diff --git a/AUTHORS.txt b/AUTHORS.txt index 70bd7af086..62329d7c1d 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -107,3 +107,4 @@ VyMajoris(W-Cephei) Winter zGuba Drill +MikeMatrix diff --git a/README.md b/README.md index a813088e96..2739ce55be 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,21 @@

- +

- ACE version + ACE3 version - - ACE download + + ACE3 download - ACE issues + ACE3 issues - BIF thread + BIF thread - ACE license + ACE3 license

Requires the latest version of CBA A3. Visit us on Facebook | YouTube | Twitter | Reddit

diff --git a/addons/advanced_ballistics/XEH_postInit.sqf b/addons/advanced_ballistics/XEH_postInit.sqf index 6416e7908a..1f9002e606 100644 --- a/addons/advanced_ballistics/XEH_postInit.sqf +++ b/addons/advanced_ballistics/XEH_postInit.sqf @@ -6,7 +6,7 @@ GVAR(currentbulletID) = -1; GVAR(Protractor) = false; GVAR(ProtractorStart) = ACE_time; - +GVAR(allBullets) = []; GVAR(currentGrid) = 0; GVAR(extensionAvailable) = true; diff --git a/addons/advanced_ballistics/XEH_preInit.sqf b/addons/advanced_ballistics/XEH_preInit.sqf index 12018ad412..f722d9c573 100644 --- a/addons/advanced_ballistics/XEH_preInit.sqf +++ b/addons/advanced_ballistics/XEH_preInit.sqf @@ -13,5 +13,5 @@ PREP(initializeTerrainExtension); PREP(initModuleSettings); PREP(readAmmoDataFromConfig); PREP(readWeaponDataFromConfig); - +PREP(handleFirePFH); ADDON = true; diff --git a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf new file mode 100644 index 0000000000..7f491a411e --- /dev/null +++ b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf @@ -0,0 +1,48 @@ +/* + * Author: Glowbal, Ruthberg, joko // Jonas + * Handle the PFH for Bullets + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +private "_deleted"; + + + +_deleted = 0; + +{ + private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"]; + _x params["_bullet","_caliber","_bulletTraceVisible","_index"]; + + _bulletVelocity = velocity _bullet; + + _bulletSpeed = vectorMagnitude _bulletVelocity; + + if (!alive _bullet || _bulletSpeed < 100) exitWith { + GVAR(allBullets) deleteAt (_forEachIndex - _deleted); + _deleted = _deleted + 1; + }; + + _bulletPosition = getPosASL _bullet; + + if (_bulletTraceVisible && _bulletSpeed > 500) then { + drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; + }; + + _aceTimeSecond = floor ACE_time; + call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]); +} forEach GVAR(allBullets); + +if (GVAR(allBullets) isEqualTo []) then { + diag_log "Remove PFH"; + [_this select 1] call CBA_fnc_removePerFrameHandler; + GVAR(BulletPFH) = nil; +}; diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index a6e4611e2f..42626f6019 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -23,7 +23,7 @@ if (!hasInterface) exitWith {}; if (!GVAR(enabled)) exitWith {}; -// parameterization +// Parameterization private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"]; params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"]; @@ -74,30 +74,26 @@ _bulletVelocity = velocity _bullet; _muzzleVelocity = vectorMagnitude _bulletVelocity; if (GVAR(barrelLengthInfluenceEnabled)) then { - _muzzleVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil]; - if (isNil "_muzzleVelocityShift") then { - _muzzleVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); + _barrelVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil]; + if (isNil "_barrelVelocityShift") then { + _barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift]; }; - if (_muzzleVelocityShift != 0) then { - _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; - }; }; if (GVAR(ammoTemperatureEnabled)) then { _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); - _muzzleVelocityShift = [_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); - if (_muzzleVelocityShift != 0) then { - _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; - }; + _temperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift)); }; if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then { if (_muzzleVelocityShift != 0) then { + _muzzleVelocity = _muzzleVelocity + (_barrelVelocityShift + _ammoTemperatureVelocityShift); _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bullet setVelocity _bulletVelocity; }; }; + _bulletTraceVisible = false; if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then { if (currentWeapon ACE_player in ["ACE_Vector", "Binocular", "Rangefinder", "Laserdesignator"]) then { @@ -125,26 +121,9 @@ GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; _aceTimeSecond = floor ACE_time; "ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond]; -[{ - private ["_args", "_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition"]; - params ["_args","_idPFH"]; - _args params["_bullet","_caliber","_bulletTraceVisible","_index"]; +GVAR(allBullets) pushBack [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]; - _bulletVelocity = velocity _bullet; - - _bulletSpeed = vectorMagnitude _bulletVelocity; - - if (!alive _bullet || _bulletSpeed < 100) exitWith { - [_idPFH] call cba_fnc_removePerFrameHandler; - }; - - _bulletPosition = getPosASL _bullet; - - if (_bulletTraceVisible && _bulletSpeed > 500) then { - drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; - }; - - _aceTimeSecond = floor ACE_time; - call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]); - -}, GVAR(simulationInterval), [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]] call CBA_fnc_addPerFrameHandler; +if (isNil QGVAR(BulletPFH)) then { + diag_log "Add PFH"; + GVAR(BulletPFH) = [FUNC(handleFirePFH), GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler; +}; diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 6738b3e8c8..bd363b1307 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -17,10 +17,10 @@ */ #include "script_component.hpp" -private ["_itemClassname", "_itemVehClass", "_onAtachText", "_selfAttachPosition", "_attachedItem", "_tempObject", "_actionID", "_model"]; - -PARAMS_3(_attachToVehicle,_unit,_args); -_itemClassname = [_args, 0, ""] call CBA_fnc_defaultParam; +private ["_itemVehClass", "_onAtachText", "_selfAttachPosition", "_attachedItem", "_tempObject", "_actionID", "_model"]; +params ["_attachToVehicle","_unit","_args"]; +_args params [["_itemClassname","", [""]]]; +TRACE_3("params",_attachToVehicle,_unit,_itemClassname); //Sanity Check (_unit has item in inventory, not over attach limit) if ((_itemClassname == "") || {!(_this call FUNC(canAttach))}) exitWith {ERROR("Tried to attach, but check failed");}; @@ -69,9 +69,8 @@ if (_unit == _attachToVehicle) then { //Self Attachment [{ private["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_lineInterection"]; - - PARAMS_2(_args,_pfID); - EXPLODE_6_PVT(_args,_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_actionID); + params ["_args","_idPFH"]; + _args params ["_unit","_attachToVehicle","_itemClassname","_itemVehClass","_onAtachText","_actionID"]; _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]); if (cameraView == "EXTERNAL") then { @@ -88,7 +87,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment {!([_unit, _attachToVehicle, []] call EFUNC(common,canInteractWith))} || {!([_attachToVehicle, _unit, _itemClassname] call FUNC(canAttach))}) then { - [_pfID] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); [] call EFUNC(interaction,hideMouseHint); [_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler); diff --git a/addons/attach/functions/fnc_canAttach.sqf b/addons/attach/functions/fnc_canAttach.sqf index 18071092d5..20a49c09be 100644 --- a/addons/attach/functions/fnc_canAttach.sqf +++ b/addons/attach/functions/fnc_canAttach.sqf @@ -17,14 +17,14 @@ */ #include "script_component.hpp" -PARAMS_3(_attachToVehicle,_player,_args); +private ["_attachLimit", "_attachedObjects","_playerPos"]; +params ["_attachToVehicle","_player","_args"]; +_args params [["_itemClassname","", [""]]]; +TRACE_3("params",_attachToVehicle,_unit,_itemClassname); -private ["_itemName", "_attachLimit", "_attachedObjects","_playerPos"]; - -_itemName = [_args, 0, ""] call CBA_fnc_defaultParam; _attachLimit = [6, 1] select (_player == _attachToVehicle); _attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; _playerPos = (ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot")); -(canStand _player) && {(_attachToVehicle distance _player) < 7} && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_itemName in ((itemsWithMagazines _player) + [""])}; +(canStand _player) && {(_attachToVehicle distance _player) < 7} && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_itemClassname in ((itemsWithMagazines _player) + [""])}; diff --git a/addons/attach/functions/fnc_canDetach.sqf b/addons/attach/functions/fnc_canDetach.sqf index dc335e6bb6..ba3182ddea 100644 --- a/addons/attach/functions/fnc_canDetach.sqf +++ b/addons/attach/functions/fnc_canDetach.sqf @@ -16,9 +16,9 @@ */ #include "script_component.hpp" -PARAMS_2(_attachToVehicle,_unit); - private ["_attachedObjects", "_inRange"]; +params ["_attachToVehicle", "_unit"]; +TRACE_2("params",_attachToVehicle,_unit); _attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; diff --git a/addons/attach/functions/fnc_detach.sqf b/addons/attach/functions/fnc_detach.sqf index 92df83b5c1..98f482f17b 100644 --- a/addons/attach/functions/fnc_detach.sqf +++ b/addons/attach/functions/fnc_detach.sqf @@ -16,15 +16,16 @@ */ #include "script_component.hpp" -PARAMS_2(_attachToVehicle,_unit); - -private ["_attachedObjects", "_attachedItems", "_itemDisplayName"]; +private ["_attachedObjects", "_attachedItems", "_itemDisplayName", + "_attachedObject", "_attachedIndex", "_itemName", "_minDistance", + "_unitPos", "_objectPos" +]; +params ["_attachToVehicle","_unit"], +TRACE_2("params",_attachToVehicle,_unit); _attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; _attachedItems = _attachToVehicle getVariable [QGVAR(ItemNames), []]; -private ["_attachedObject", "_attachedIndex", "_itemName", "_minDistance", "_unitPos", "_objectPos"]; - _attachedObject = objNull; _attachedIndex = -1; _itemName = ""; diff --git a/addons/attach/functions/fnc_getChildrenAttachActions.sqf b/addons/attach/functions/fnc_getChildrenAttachActions.sqf index fb432146be..aeb75c00d4 100644 --- a/addons/attach/functions/fnc_getChildrenAttachActions.sqf +++ b/addons/attach/functions/fnc_getChildrenAttachActions.sqf @@ -18,7 +18,8 @@ #include "script_component.hpp" private ["_listed", "_actions", "_item", "_displayName", "_picture", "_action"]; -PARAMS_2(_target,_player); +params ["_target","_player"]; +TRACE_2("params",_target,_player); _listed = []; _actions = []; @@ -30,7 +31,7 @@ _actions = []; if (getText (_item >> "ACE_Attachable") != "") then { _displayName = getText(_item >> "displayName"); _picture = getText(_item >> "picture"); - _action = [_x, _displayName, _picture, {_this call FUNC(attach)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction); + _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call EFUNC(common,execNextFrame)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction); _actions pushBack [_action, [], _target]; }; }; @@ -43,7 +44,7 @@ _actions = []; if (getText (_item >> "ACE_Attachable") != "") then { _displayName = getText(_item >> "displayName"); _picture = getText(_item >> "picture"); - _action = [_x, _displayName, _picture, {_this call FUNC(attach)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction); + _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call EFUNC(common,execNextFrame)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction); _actions pushBack [_action, [], _target]; }; }; diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf index efd85769d0..0656e7880f 100644 --- a/addons/attach/functions/fnc_placeApprove.sqf +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -27,7 +27,8 @@ private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_startASL", "_endPosShifted", "_endASL", "_attachedObject", "_currentObjects", "_currentItemNames"]; -PARAMS_6(_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_startingPosition); +params ["_unit", "_attachToVehicle", "_itemClassname", "_itemVehClass", "_onAtachText", "_startingPosition"]; +TRACE_6("params",_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_startingPosition); _startingOffset = _attachToVehicle worldToModel _startingPosition; diff --git a/addons/backpacks/XEH_postInit.sqf b/addons/backpacks/XEH_postInit.sqf index 375fcd5f89..639bf74919 100644 --- a/addons/backpacks/XEH_postInit.sqf +++ b/addons/backpacks/XEH_postInit.sqf @@ -1,3 +1,3 @@ #include "script_component.hpp" -["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler); +["backpackOpened", DFUNC(backpackOpened)] call EFUNC(common,addEventHandler); diff --git a/addons/backpacks/functions/fnc_backpackOpened.sqf b/addons/backpacks/functions/fnc_backpackOpened.sqf index 3f5cf53994..9488bf6bd9 100644 --- a/addons/backpacks/functions/fnc_backpackOpened.sqf +++ b/addons/backpacks/functions/fnc_backpackOpened.sqf @@ -2,18 +2,18 @@ * Author: commy2 * * Someone opened your backpack. Execute locally. - * + * * Argument: * 0: Who accessed your inventory? (Object) * 1: Unit that wields the backpack (Object) * 2: The backpack object (Object) - * + * * Return value: * None. */ #include "script_component.hpp" - -PARAMS_3(_unit,_target,_backpack); +private ["_sounds", "_position"]; +params ["_target", "_backpack"]; // do cam shake if the target is the player if ([_target] call EFUNC(common,isPlayer)) then { @@ -21,7 +21,6 @@ if ([_target] call EFUNC(common,isPlayer)) then { }; // play a rustling sound -private ["_sounds", "_position"]; _sounds = [ /*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss", diff --git a/addons/backpacks/functions/fnc_getBackpackAssignedUnit.sqf b/addons/backpacks/functions/fnc_getBackpackAssignedUnit.sqf index 562dc84da2..85f5966aa9 100644 --- a/addons/backpacks/functions/fnc_getBackpackAssignedUnit.sqf +++ b/addons/backpacks/functions/fnc_getBackpackAssignedUnit.sqf @@ -2,21 +2,21 @@ * Author: commy2 * * Returns the unit that has the given backpack object equipped. - * + * * Argument: - * 0: A backpack object (Object) - * + * 0: Executing Unit (Object) + * 1: A backpack object (Object) + * * Return value: * Unit that has the backpack equipped. (Object) */ #include "script_component.hpp" +scopeName "main"; -private ["_backpack", "_unit"]; - -_backpack = _this select 0; - -_unit = objNull; +params ["_unit","_backpack"]; +_target = objNull; { - if (backpackContainer _x == _backpack) exitWith {_unit = _x}; -} forEach (allUnits + allDeadMen); -_unit + if (backpackContainer _x == _backpack) then {_target = _x; breakTo "main"}; +} count nearestObjects [_unit, ["Man"], 5]; +if (isNull _target) exitWith {ACE_Player}; +_target diff --git a/addons/backpacks/functions/fnc_isBackpack.sqf b/addons/backpacks/functions/fnc_isBackpack.sqf index b1d55f9ce6..3419d2ed38 100644 --- a/addons/backpacks/functions/fnc_isBackpack.sqf +++ b/addons/backpacks/functions/fnc_isBackpack.sqf @@ -11,9 +11,8 @@ */ #include "script_component.hpp" -private ["_backpack", "_config"]; - -_backpack = _this select 0; +private ["_config"]; +params ["_backpack"]; if (typeName _backpack == "OBJECT") then { _backpack = typeOf _backpack; diff --git a/addons/backpacks/functions/fnc_onOpenInventory.sqf b/addons/backpacks/functions/fnc_onOpenInventory.sqf index 63e4aa87a3..d79f8aed9b 100644 --- a/addons/backpacks/functions/fnc_onOpenInventory.sqf +++ b/addons/backpacks/functions/fnc_onOpenInventory.sqf @@ -2,29 +2,27 @@ * Author: commy2 * * Handle the open inventory event. Display message on traget client. - * + * * Argument: * Input from "InventoryOpened" eventhandler - * + * * Return value: * false. Always open the inventory dialog. (Bool) */ #include "script_component.hpp" -private ["_unit", "_backpack"]; - -_unit = _this select 0; -_backpack = _this select 1; +private "_target"; +params ["","_backpack"]; // exit if the target is not a backpack if !([_backpack] call FUNC(isBackpack)) exitWith {}; // get the unit that wears the backpack object -private "_target"; -_target = [_backpack] call FUNC(getBackpackAssignedUnit); +_target = _this call FUNC(getBackpackAssignedUnit); +if (isNull _target) exitWith {false}; // raise event on target unit -["backpackOpened", _target, [_unit, _target, _backpack]] call EFUNC(common,targetEvent); +["backpackOpened", _target, [_target, _backpack]] call EFUNC(common,targetEvent); // return false to open inventory as usual false diff --git a/addons/ballistics/scripts/initTargetWall.sqf b/addons/ballistics/scripts/initTargetWall.sqf index 391faaa82e..d9b16eec10 100644 --- a/addons/ballistics/scripts/initTargetWall.sqf +++ b/addons/ballistics/scripts/initTargetWall.sqf @@ -1,9 +1,9 @@ // by commy2 #include "script_component.hpp" -private ["_wall", "_paper"]; +private "_paper"; -_wall = _this select 0; +params ["_wall"]; if (local _wall) then { _paper = "UserTexture_1x2_F" createVehicle position _wall; diff --git a/addons/captives/ACE_Settings.hpp b/addons/captives/ACE_Settings.hpp index 73bafbab41..1d0ebbf491 100644 --- a/addons/captives/ACE_Settings.hpp +++ b/addons/captives/ACE_Settings.hpp @@ -5,6 +5,13 @@ class ACE_Settings { typeName = "BOOL"; value = 1; }; + class GVAR(requireSurrender) { + displayName = CSTRING(ModuleSettings_requireSurrender_name); + description = CSTRING(ModuleSettings_requireSurrender_description); + typeName = "SCALAR"; + values[] = {ECSTRING(common,Disabled), CSTRING(SurrenderOnly), CSTRING(SurrenderOrNoWeapon)}; + value = 1; + }; class GVAR(allowSurrender) { displayName = CSTRING(ModuleSettings_allowSurrender_name); description = CSTRING(ModuleSettings_allowSurrender_description); diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 746a1c4b63..774ecf87e3 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -189,6 +189,26 @@ class CfgVehicles { typeName = "BOOL"; defaultValue = 1; }; + class requireSurrender { + displayName = CSTRING(ModuleSettings_requireSurrender_name); + description = CSTRING(ModuleSettings_requireSurrender_description); + typeName = "NUMBER"; + class values { + class disable { + name = ECSTRING(common,No); + value = 0; + }; + class Surrender { + name = CSTRING(SurrenderOnly); + value = 1; + default = 1; + }; + class SurrenderOrNoWeapon { + name = CSTRING(SurrenderOrNoWeapon); + value = 2; + }; + }; + }; }; class ModuleDescription: ModuleDescription { description = CSTRING(ModuleSettings_Description); diff --git a/addons/captives/functions/fnc_canApplyHandcuffs.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf index e42b5455ff..5e7eb34a76 100644 --- a/addons/captives/functions/fnc_canApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -16,11 +16,11 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_target); - +params ["_unit", "_target"]; //Check sides, Player has cableTie, target is alive and not already handcuffed (GVAR(allowHandcuffOwnSide) || {(side _unit) != (side _target)}) && ("ACE_CableTie" in (items _unit)) && {alive _target} && -{!(_target getVariable [QGVAR(isHandcuffed), false])} +{!(_target getVariable [QGVAR(isHandcuffed), false])} && +(GVAR(requireSurrender) == 0 || ((_target getVariable [QGVAR(isSurrendering), false]) || (currentWeapon _target == "" && GVAR(requireSurrender) == 2))) diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf index 1d9480fd0b..a7c799905e 100644 --- a/addons/captives/functions/fnc_canEscortCaptive.sqf +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -16,8 +16,7 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_target); - +params ["_unit", "_target"]; //Alive, handcuffed, not being escored, and not unconscious (_target getVariable [QGVAR(isHandcuffed), false]) && diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf index 5eecc453d4..d164f13ac3 100644 --- a/addons/captives/functions/fnc_canFriskPerson.sqf +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_target); +params ["_unit", "_target"]; _target getVariable [QGVAR(isHandcuffed), false] || {_target getVariable [QGVAR(isSurrendering), false]} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index 04b33ad42d..0e028ac1ec 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -18,8 +18,7 @@ #include "script_component.hpp" private ["_objects"]; - -PARAMS_3(_unit,_target,_vehicle); +params ["_unit", "_target","_vehicle"]; if (isNull _target) then { _objects = attachedObjects _unit; @@ -28,7 +27,7 @@ if (isNull _target) then { }; if (isNull _vehicle) then { - _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship_F"], 10]; + _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]; if ((count _objects) > 0) then {_vehicle = _objects select 0;}; }; diff --git a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf index 4642cd90fd..e8bbe3b50e 100644 --- a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf +++ b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_target); +params ["_unit", "_target"]; //Unit is handcuffed and not currently being escorted _target getVariable [QGVAR(isHandcuffed), false] && diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf index 56065a43fc..cfafb5a0e8 100644 --- a/addons/captives/functions/fnc_canStopEscorting.sqf +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -16,8 +16,7 @@ */ #include "script_component.hpp" -PARAMS_1(_unit); -DEFAULT_PARAM(1,_target,objNull); +params ["_unit", ["_target", objNull]]; if (isNull _target) then { _target = _unit getVariable [QGVAR(escortedUnit), objNull]; diff --git a/addons/captives/functions/fnc_canSurrender.sqf b/addons/captives/functions/fnc_canSurrender.sqf index 059fb98d03..de0a88d871 100644 --- a/addons/captives/functions/fnc_canSurrender.sqf +++ b/addons/captives/functions/fnc_canSurrender.sqf @@ -16,12 +16,12 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_newSurrenderState); - private "_returnValue"; +params ["_unit", "_newSurrenderState"]; + _returnValue = if (_newSurrenderState) then { - //no weapon equiped AND not currently surrendering and + //no weapon equiped AND not currently surrendering and GVAR(allowSurrender) && {(currentWeapon _unit) == ""} && {!(_unit getVariable [QGVAR(isSurrendering), false])} } else { //is Surrendering diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf index 59e798a24c..6bd98cf4eb 100644 --- a/addons/captives/functions/fnc_canUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -18,6 +18,6 @@ private ["_cargo"]; -PARAMS_2(_player,_unit); +params ["_player", "_unit"]; ((vehicle _unit) != _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]} diff --git a/addons/captives/functions/fnc_doApplyHandcuffs.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf index 0d15f503e8..21bfe58747 100644 --- a/addons/captives/functions/fnc_doApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -16,10 +16,11 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_target); -_unit removeItem "ACE_CableTie"; +params ["_unit", "_target"]; playSound3D [QUOTE(PATHTO_R(sounds\cable_tie_zipping.ogg)), objNull, false, (getPosASL _target), 1, 1, 10]; ["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent); + +_unit removeItem "ACE_CableTie"; diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index bc2cd97ffd..bb070b057a 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -17,7 +17,7 @@ */ #include "script_component.hpp" -PARAMS_3(_unit,_target,_state); +params ["_unit", "_target","_state"]; if (_state) then { if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {}; diff --git a/addons/captives/functions/fnc_doFriskPerson.sqf b/addons/captives/functions/fnc_doFriskPerson.sqf index d79c88a5fb..e14025b88f 100644 --- a/addons/captives/functions/fnc_doFriskPerson.sqf +++ b/addons/captives/functions/fnc_doFriskPerson.sqf @@ -19,6 +19,7 @@ private ["_weapon", "_listedItemClasses", "_actions", "_allGear"]; PARAMS_2(_player,_unit); +params ["_player", "_unit"]; _weapon = currentWeapon _player; if (_weapon == primaryWeapon _player && {_weapon != ""}) then { diff --git a/addons/captives/functions/fnc_doLoadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf index 97ecd98a0a..d7df42eb0a 100644 --- a/addons/captives/functions/fnc_doLoadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -17,9 +17,10 @@ */ #include "script_component.hpp" -PARAMS_3(_unit,_target,_vehicle); private "_objects"; +params ["_unit", "_target","_vehicle"]; + if (isNull _target) then { _objects = attachedObjects _unit; _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); @@ -28,7 +29,7 @@ if (isNull _target) then { if (isNull _target) exitWith {}; if (isNull _vehicle) then { - _objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10]; + _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]; if ((count _objects) > 0) then {_vehicle = _objects select 0;}; }; if (isNull _vehicle) exitWith {}; diff --git a/addons/captives/functions/fnc_doRemoveHandcuffs.sqf b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf index a69decf620..681b698de3 100644 --- a/addons/captives/functions/fnc_doRemoveHandcuffs.sqf +++ b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf @@ -15,6 +15,6 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_target); +params ["_unit", "_target"]; ["SetHandcuffed", [_target], [_target, false]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doUnloadCaptive.sqf b/addons/captives/functions/fnc_doUnloadCaptive.sqf index 5d95189742..46ba618010 100644 --- a/addons/captives/functions/fnc_doUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_doUnloadCaptive.sqf @@ -16,6 +16,6 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_target); +params ["_unit", "_target"]; ["MoveOutCaptive", [_target], [_target]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf index cf7d2c7271..487e7d4179 100644 --- a/addons/captives/functions/fnc_handleGetIn.sqf +++ b/addons/captives/functions/fnc_handleGetIn.sqf @@ -17,7 +17,7 @@ */ #include "script_component.hpp" -PARAMS_3(_vehicle,_dontcare,_unit); +params ["_vehicle", "_dontcare","_unit"]; if (local _unit) then { if (_unit getVariable [QGVAR(isEscorting), false]) then { diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index 4bf9a1fa19..daf88b7e34 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -17,7 +17,7 @@ */ #include "script_component.hpp" -PARAMS_3(_vehicle,_dontcare,_unit); +params ["_vehicle", "_dontcare","_unit"]; if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { private ["_cargoIndex"]; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf index 3eed932d5a..f7b15ec117 100644 --- a/addons/captives/functions/fnc_handleKilled.sqf +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_oldUnit); +params ["_oldUnit"]; if (!local _oldUnit) exitWith {}; diff --git a/addons/captives/functions/fnc_handleOnUnconscious.sqf b/addons/captives/functions/fnc_handleOnUnconscious.sqf index 9aa4856204..ca6362d3da 100644 --- a/addons/captives/functions/fnc_handleOnUnconscious.sqf +++ b/addons/captives/functions/fnc_handleOnUnconscious.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_unit,_isUnconc); +params ["_unit","_isUnconc"]; if (!local _unit) exitWith {}; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index 21fd1e1ec3..aea91b5e11 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -PARAMS_2(_newUnit,_oldUnit); +params ["_newUnit","_oldUnit"]; //set showHUD based on new unit status: if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then { diff --git a/addons/captives/functions/fnc_handleRespawn.sqf b/addons/captives/functions/fnc_handleRespawn.sqf index 02888c27a0..6f68aea2fe 100644 --- a/addons/captives/functions/fnc_handleRespawn.sqf +++ b/addons/captives/functions/fnc_handleRespawn.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_dead); +params ["_unit","_dead"]; if (!local _unit) exitWith {}; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index a8b601300a..66cbcff794 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; // prevent players from throwing grenades (added to all units) [_unit, "Throw", {((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}}, {}] call EFUNC(common,addActionEventhandler); diff --git a/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf b/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf index 84b90e78c2..7b30199caf 100644 --- a/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf +++ b/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf @@ -17,7 +17,7 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_zeusIsOpen); +params ["_unit","_zeusIsOpen"]; //set showHUD based on unit status: if (!_zeusIsOpen) then { diff --git a/addons/captives/functions/fnc_moduleSettings.sqf b/addons/captives/functions/fnc_moduleSettings.sqf index c12ac80b99..fc8c76721f 100644 --- a/addons/captives/functions/fnc_moduleSettings.sqf +++ b/addons/captives/functions/fnc_moduleSettings.sqf @@ -13,7 +13,8 @@ #include "script_component.hpp" -PARAMS_1(_logic); +params ["_logic"]; [_logic, QGVAR(allowHandcuffOwnSide), "allowHandcuffOwnSide"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(allowSurrender), "allowSurrender"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(requireSurrender), "requireSurrender"] call EFUNC(common,readSettingFromModule); diff --git a/addons/captives/functions/fnc_moduleSurrender.sqf b/addons/captives/functions/fnc_moduleSurrender.sqf index 5b40b7663e..64c80af35c 100644 --- a/addons/captives/functions/fnc_moduleSurrender.sqf +++ b/addons/captives/functions/fnc_moduleSurrender.sqf @@ -17,9 +17,10 @@ */ #include "script_component.hpp" -PARAMS_3(_logic,_units,_activated); private ["_bisMouseOver", "_mouseOverObject"]; +params ["_logic", "_units", "_activated"]; + if (!_activated) exitWith {}; if (local _logic) then { diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index bd141988bb..9bde3b399d 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -16,8 +16,7 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_state); - +params ["_unit","_state"]; if (!local _unit) exitwith { ERROR("running setHandcuffed on remote unit"); @@ -43,7 +42,7 @@ if (_state) then { // fix anim on mission start (should work on dedicated servers) [{ - PARAMS_1(_unit); + params ["_unit"]; if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { [_unit] call EFUNC(common,fixLoweredRifleAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); diff --git a/addons/captives/functions/fnc_setSurrendered.sqf b/addons/captives/functions/fnc_setSurrendered.sqf index c1a34b636c..4fad2d3853 100644 --- a/addons/captives/functions/fnc_setSurrendered.sqf +++ b/addons/captives/functions/fnc_setSurrendered.sqf @@ -16,8 +16,7 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_state); - +params ["_unit","_state"]; if (!local _unit) exitwith { ERROR("running surrender on remote unit"); diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf index 626a0b34e4..7e30fe4af4 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -16,10 +16,10 @@ */ #include "script_component.hpp" -PARAMS_2(_target,_vehicle); - private ["_cargoIndex"]; +params ["_target","_vehicle"]; + _target moveInCargo _vehicle; _target assignAsCargo _vehicle; _cargoIndex = _vehicle getCargoIndex _target; diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf index 5ef6f01406..000d5ef568 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf @@ -15,8 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_unit); - +params ["_unit"]; _unit setVariable [QGVAR(CargoIndex), -1, true]; moveOut _unit; diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 39cf65cac7..08982b7277 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -221,5 +221,21 @@ Spieler können kapitulieren, nachdem sie ihre Waffe geholstert haben Jogadores podem se render depois de guardar sua arma + + Require surrendering + Wymagaj kapitulacji + + + Require Players to surrender before they can be arrested + Wymagaj od graczy kapitulacji zanim będzie można ich zaaresztować + + + Surrendering only + Tylko kapitulacja + + + Surrendering or No weapon + Kapitulacja lub brak broni + - + \ No newline at end of file diff --git a/addons/cargo/$PBOPREFIX$ b/addons/cargo/$PBOPREFIX$ new file mode 100644 index 0000000000..74e5e4186e --- /dev/null +++ b/addons/cargo/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\cargo \ No newline at end of file diff --git a/addons/cargo/ACE_Settings.hpp b/addons/cargo/ACE_Settings.hpp new file mode 100644 index 0000000000..c8865f2097 --- /dev/null +++ b/addons/cargo/ACE_Settings.hpp @@ -0,0 +1,9 @@ +class ACE_Settings { + class GVAR(enable) { + displayName = CSTRING(ModuleSettings_enable); + description = CSTRING(ModuleSettings_enable_Description); + typeName = "BOOL"; + value = 1; + category = CSTRING(settingsCategory); + }; +}; diff --git a/addons/cargo/CfgEventHandlers.hpp b/addons/cargo/CfgEventHandlers.hpp new file mode 100644 index 0000000000..f5dd29da0e --- /dev/null +++ b/addons/cargo/CfgEventHandlers.hpp @@ -0,0 +1,80 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_Killed_EventHandlers { + class All { + init = QUOTE(call FUNC(handleDestroyed)); + }; +}; + +class Extended_Init_EventHandlers { + class StaticWeapon { + class ADDON { + init = QUOTE(_this call DFUNC(initObject)); + }; + }; + + class ReammoBox_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject)); + }; + }; + + class Cargo_base_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); + }; + }; + + class CargoNet_01_box_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); + }; + }; + + class Land_CargoBox_V1_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); + }; + }; + + class Land_PaperBox_closed_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); + }; + }; + + class Car { + class ADDON { + init = QUOTE(_this call DFUNC(initVehicle)); + }; + }; + + class Tank { + class ADDON { + init = QUOTE(_this call DFUNC(initVehicle)); + }; + }; + + class Helicopter { + class ADDON { + init = QUOTE(_this call DFUNC(initVehicle)); + }; + }; + + class Plane { + class ADDON { + init = QUOTE(_this call DFUNC(initVehicle)); + }; + }; + + class Ship_F { + class ADDON { + init = QUOTE(_this call DFUNC(initVehicle)); + }; + }; +}; diff --git a/addons/cargo/CfgVehicles.hpp b/addons/cargo/CfgVehicles.hpp new file mode 100644 index 0000000000..ecca6ee341 --- /dev/null +++ b/addons/cargo/CfgVehicles.hpp @@ -0,0 +1,301 @@ + +class CfgVehicles { + + class ACE_Module; + class ACE_moduleCargoSettings: ACE_Module { + scope = 2; + displayName = CSTRING(SettingsModule_DisplayName); + icon = QUOTE(PATHTOF(UI\Icon_Module_Cargo_ca.paa)); + category = "ACE"; + function = QUOTE(DFUNC(moduleSettings)); + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class enable { + displayName = CSTRING(ModuleSettings_enable); + description = CSTRING(ModuleSettings_enable_Description); + typeName = "BOOL"; + defaultValue = 1; + }; + }; + class ModuleDescription { + description = CSTRING(SettingsModule_Description); + sync[] = {}; + }; + }; + + + class LandVehicle; + class Car: LandVehicle { + GVAR(space) = 4; + GVAR(hasCargo) = 1; + class ACE_Cargo { + /* + class Cargo { + class ACE_medicalSupplyCrate { + type = "ACE_medicalSupplyCrate"; + amount = 1; + }; + };*/ + }; + }; + + class Tank: LandVehicle { + GVAR(space) = 4; + GVAR(hasCargo) = 1; + }; + class Car_F; + class Truck_F: Car_F { + GVAR(space) = 8; + GVAR(hasCargo) = 1; + }; + + class Air; + // Repair helicopters + class Helicopter: Air { + GVAR(space) = 8; + GVAR(hasCargo) = 1; + }; + + class Heli_Transport_02_base_F; + class I_Heli_Transport_02_F : Heli_Transport_02_base_F { + GVAR(space) = 20; + GVAR(hasCargo) = 1; + }; + + // Repair fixed wing aircraft + class Plane: Air { + GVAR(space) = 4; + GVAR(hasCargo) = 1; + }; + + // boats + class Ship; + class Ship_F: Ship { + GVAR(space) = 4; + GVAR(hasCargo) = 1; + }; + + // Static weapons + class StaticWeapon: LandVehicle { + GVAR(size) = 2; // 1 = small, 2 = large + GVAR(canLoad) = 1; + }; + + class StaticMortar; + class Mortar_01_base_F: StaticMortar { + GVAR(size) = 2; // 1 = small, 2 = large + GVAR(canLoad) = 1; + }; + + // Ammo boxes + class ThingX; + class ReammoBox_F: ThingX { + GVAR(size) = 2; // 1 = small, 2 = large + GVAR(canLoad) = 1; + }; + + class Scrapyard_base_F; + class Land_PaperBox_closed_F: Scrapyard_base_F { + GVAR(space) = 10; + GVAR(hasCargo) = 1; + GVAR(size) = 11; + GVAR(canLoad) = 1; + XEH_ENABLED; + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + distance = 5; + condition = QUOTE(true); + statement = ""; + icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; + selection = ""; + }; + }; + }; + + class Cargo_base_F: ThingX { + GVAR(space) = 4; + GVAR(hasCargo) = 1; + GVAR(size) = 4; + GVAR(canLoad) = 1; + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + distance = 5; + condition = QUOTE(true); + statement = ""; + icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; + selection = ""; + }; + }; + }; + class Cargo10_base_F: Cargo_base_F { + GVAR(space) = 14; + GVAR(size) = 15; + XEH_ENABLED; + }; + class Land_Cargo20_blue_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_brick_red_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_cyan_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_grey_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_light_blue_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_light_green_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_military_green_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Ruins_F; + class Land_Cargo20_military_ruins_F: Ruins_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_orange_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_red_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_sand_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_vr_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_white_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_yellow_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + + + class Land_Cargo40_blue_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_brick_red_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_cyan_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_grey_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_light_blue_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_light_green_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_military_green_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_military_ruins_F: Ruins_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_orange_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_red_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_sand_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_vr_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_white_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_yellow_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + // small + class Land_CargoBox_V1_F: ThingX { + GVAR(space) = 7; + GVAR(hasCargo) = 1; + GVAR(size) = 7; + XEH_ENABLED; + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + distance = 5; + condition = QUOTE(true); + statement = ""; + icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; + selection = ""; + }; + }; + }; + +}; diff --git a/addons/cargo/UI/Icon_Module_Cargo_ca.paa b/addons/cargo/UI/Icon_Module_Cargo_ca.paa new file mode 100644 index 0000000000..a292fb4227 Binary files /dev/null and b/addons/cargo/UI/Icon_Module_Cargo_ca.paa differ diff --git a/addons/cargo/UI/Icon_load.paa b/addons/cargo/UI/Icon_load.paa new file mode 100644 index 0000000000..ccd77761e4 Binary files /dev/null and b/addons/cargo/UI/Icon_load.paa differ diff --git a/addons/cargo/XEH_preInit.sqf b/addons/cargo/XEH_preInit.sqf new file mode 100644 index 0000000000..f0cf3357cd --- /dev/null +++ b/addons/cargo/XEH_preInit.sqf @@ -0,0 +1,27 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(canLoadItemIn); +PREP(canUnloadItem); +PREP(canLoad); +PREP(findNearestVehicle); +PREP(getCargoSpaceLeft); +PREP(GetSizeItem); +PREP(initObject); +PREP(initVehicle); +PREP(handleDestroyed); +PREP(moduleSettings); +PREP(loadItem); +PREP(onMenuOpen); +PREP(unloadItem); +PREP(validateCargoSpace); +PREP(startLoadIn); +PREP(startUnload); +GVAR(initializedItemClasses) = []; + +if (isServer) then { + ["cargo_hideItem", {params ["_object", "_status"]; _object hideObjectGlobal _status;}] call EFUNC(common,addEventHandler); +}; + +ADDON = true; diff --git a/addons/cargo/config.cpp b/addons/cargo/config.cpp new file mode 100644 index 0000000000..2972e8ef1b --- /dev/null +++ b/addons/cargo/config.cpp @@ -0,0 +1,18 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"commy2", "Glowbal"}; + authorUrl = "https://ace3mod.com/"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "menu.hpp" +#include "ACE_Settings.hpp" diff --git a/addons/cargo/functions/fnc_canLoad.sqf b/addons/cargo/functions/fnc_canLoad.sqf new file mode 100644 index 0000000000..88391e80da --- /dev/null +++ b/addons/cargo/functions/fnc_canLoad.sqf @@ -0,0 +1,31 @@ +/* + * Author: Glowbal + * Check if player can load item into the nearest vehicle + * + * Arguments: + * 0: Player + * 1: Object to load + * + * Return value: + * Can load + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_player", "_object"]; + +private ["_nearestVehicle"]; +_nearestVehicle = [_player] call FUNC(findNearestVehicle); + +if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then { + + { + if ([_object, _x] call FUNC(canLoadItemIn)) exitwith {_nearestVehicle = _x}; + }foreach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]); +}; + +if (isNull _nearestVehicle) exitwith {false}; + +[_object, _nearestVehicle] call FUNC(canLoadItemIn); diff --git a/addons/cargo/functions/fnc_canLoadItemIn.sqf b/addons/cargo/functions/fnc_canLoadItemIn.sqf new file mode 100644 index 0000000000..5d844cc91c --- /dev/null +++ b/addons/cargo/functions/fnc_canLoadItemIn.sqf @@ -0,0 +1,23 @@ +/* + * Author: Glowbal + * Check if item can be loaded into other Object + * + * Arguments: + * 0: Item Object + * 1: Holder Object (vehicle) + * + * Return value: + * Can load in + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_item", "_vehicle"]; + +if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitwith {false}; + +private "_itemSize"; +_itemSize = ([_item] call FUNC(getSizeItem)); +_itemSize > 0 && {alive _item && alive _vehicle} && {(_item distance _vehicle <= MAX_LOAD_DISTANCE)} && {_itemSize <= ([_vehicle] call FUNC(getCargoSpaceLeft))}; diff --git a/addons/cargo/functions/fnc_canUnloadItem.sqf b/addons/cargo/functions/fnc_canUnloadItem.sqf new file mode 100644 index 0000000000..74b4c1bb9e --- /dev/null +++ b/addons/cargo/functions/fnc_canUnloadItem.sqf @@ -0,0 +1,39 @@ +/* + * Author: Glowbal, ViperMaul + * Check if item can be unloaded + * + * Arguments: + * 0: loaded object + * 1: Object + * + * Return value: + * Can be unloaded + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_loaded", "_validVehiclestate", "_emptyPos"]; +params ["_item", "_vehicle"]; +_loaded = _vehicle getvariable [QGVAR(loaded), []]; +if !(_item in _loaded) exitwith {false}; + +_validVehiclestate = true; +_emptyPos = []; +if (_vehicle isKindOf "Ship" ) then { + if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; + _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot. +} else { + if (_vehicle isKindOf "Air" ) then { + if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false}; + _emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition); + _emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ]; + } else { + if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; + _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); + }; +}; + +if (!_validVehiclestate) exitwith { false }; +(count _emptyPos != 0); diff --git a/addons/cargo/functions/fnc_findNearestVehicle.sqf b/addons/cargo/functions/fnc_findNearestVehicle.sqf new file mode 100644 index 0000000000..40f554adc1 --- /dev/null +++ b/addons/cargo/functions/fnc_findNearestVehicle.sqf @@ -0,0 +1,34 @@ +/* + * Author: Glowbal + * Get nearest vehicle, priority car, air, tank, ship + * + * Arguments: + * 0: Object + * + * Return value: + * Vehicle that is in Distance + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_loadCar", "_loadHelicopter", "_loadTank", "_loadShip", "_loadContainer"]; +params ["_unit"]; + +_loadCar = nearestObject [_unit, "car"]; +if (_unit distance _loadCar <= MAX_LOAD_DISTANCE) exitwith {_loadCar}; + +_loadHelicopter = nearestObject [_unit, "air"]; +if (_unit distance _loadHelicopter <= MAX_LOAD_DISTANCE) exitwith {_loadHelicopter}; + +_loadTank = nearestObject [_unit, "tank"]; +if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitwith {_loadTank}; + +_loadShip = nearestObject [_unit, "ship"]; +if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitwith {_loadShip}; + +_loadContainer = nearestObject [_unit,"Cargo_base_F"]; +if (_unit distance _loadContainer <= MAX_LOAD_DISTANCE) exitwith {_loadContainer}; + +objNull; diff --git a/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf b/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf new file mode 100644 index 0000000000..3c50e24ad3 --- /dev/null +++ b/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf @@ -0,0 +1,17 @@ +/* + * Author: Glowbal + * Get the cargo space left on object + * + * Arguments: + * 0: Object + * + * Return value: + * Cargo space left + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_vehicle"]; +_vehicle getvariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space))]; diff --git a/addons/cargo/functions/fnc_getSizeItem.sqf b/addons/cargo/functions/fnc_getSizeItem.sqf new file mode 100644 index 0000000000..02e5313217 --- /dev/null +++ b/addons/cargo/functions/fnc_getSizeItem.sqf @@ -0,0 +1,22 @@ +/* + * Author: Glowbal + * Get the cargo size of an object + * + * Arguments: + * 0: Object + * + * Return value: + * Cargo size. (default: -1) + * + * Public: No + */ + +#include "script_component.hpp" + +private "_config"; +params ["_item"]; +_config = (configFile >> "CfgVehicles" >> typeof _item >> QGVAR(size)); +if (isNumber (_config)) exitwith { + _item getvariable [QGVAR(size), getNumber (_config)]; +}; +-1 diff --git a/addons/cargo/functions/fnc_handleDestroyed.sqf b/addons/cargo/functions/fnc_handleDestroyed.sqf new file mode 100644 index 0000000000..25e7a6a4e0 --- /dev/null +++ b/addons/cargo/functions/fnc_handleDestroyed.sqf @@ -0,0 +1,29 @@ +/* + * Author: Glowbal + * Handle object being destroyed + * + * Arguments: + * 0: Object + * + * Return value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_vehicle"]; + +private["_loaded"]; + +_loaded = _vehicle getvariable [QGVAR(loaded), []]; +if (count _loaded == 0) exitwith {}; + +{ + // TODO deleteVehicle or just delete vehicle? Do we want to be able to recover destroyed equipment? + deleteVehicle _x; + //_x setDamage 1; +} count _loaded; + +[_vehicle] call FUNC(validateCargoSpace); diff --git a/addons/cargo/functions/fnc_initObject.sqf b/addons/cargo/functions/fnc_initObject.sqf new file mode 100644 index 0000000000..c834bcf7b0 --- /dev/null +++ b/addons/cargo/functions/fnc_initObject.sqf @@ -0,0 +1,28 @@ +/* + * Author: Glowbal + * Initialize variables for loadable objects. Called from init EH. + * + * Arguments: + * 0: Any object + * + * Return value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_object"]; + +if (getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(canLoad)) != 1) exitwith {}; + +private ["_type", "_action"]; +_type = typeOf _object; + +// do nothing if the class is already initialized +if (_type in GVAR(initializedItemClasses)) exitWith {}; +GVAR(initializedItemClasses) pushBack _type; + +_action = [QGVAR(load), localize LSTRING(loadObject), QUOTE(PATHTOF(UI\Icon_load.paa)), {[_player, _target] call FUNC(startLoadIn)}, {GVAR(enable) && {[_player, _target] call FUNC(canLoad)}}] call EFUNC(interact_menu,createAction); +[_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/cargo/functions/fnc_initVehicle.sqf b/addons/cargo/functions/fnc_initVehicle.sqf new file mode 100644 index 0000000000..48e83c3858 --- /dev/null +++ b/addons/cargo/functions/fnc_initVehicle.sqf @@ -0,0 +1,58 @@ +/* + * Author: Glowbal + * initalize vehicle. Adds open caro menu action if available + * + * Arguments: + * 0: vehicle + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_vehicle"]; +TRACE_1("params", _vehicle); + +private ["_type", "_initializedClasses"]; +_type = typeOf _vehicle; +_initializedClasses = GETMVAR(GVAR(initializedClasses),[]); + +if (isServer) then { + { + if (isClass _x) then { + private ["_className", "_amount","_position","_object"]; + _className = getText (_x >> "type"); + _amount = getNumber (_x >> "amount"); + _position = getPos _vehicle; + _position set [1, (_position select 1) + 1]; + _position set [2, (_position select 2) + 7.5]; + for "_i" from 1 to _amount do { + _object = createVehicle [_className, _position, [], 0, "CAN_COLLIDE"]; + if !([_object, _vehicle] call FUNC(loadItem)) exitwith { + deleteVehicle _object; + }; + }; + }; + nil + } count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo")); +}; + +// do nothing if the class is already initialized +if (_type in _initializedClasses) exitWith {}; +// set class as initialized +_initializedClasses pushBack _type; +SETMVAR(GVAR(initializedClasses),_initializedClasses); + +if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) exitwith {}; + +private ["_text", "_condition", "_statement", "_icon", "_action"]; +_condition = {GVAR(enable)}; +_text = localize LSTRING(openMenu); +_statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);}; +_icon = ""; + +_action = [QGVAR(openMenu), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction); +[_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf new file mode 100644 index 0000000000..0abebdd43c --- /dev/null +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -0,0 +1,34 @@ +/* + * Author: Glowbal + * Load object into vehicle + * + * Arguments: + * 0: Object + * 1: Vehicle + * + * Return value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_loaded", "_space", "_itemSize"]; +params ["_item", "_vehicle"]; + +if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitwith {false}; + +_loaded = _vehicle getvariable [QGVAR(loaded), []]; +_loaded pushback _item; +_vehicle setvariable [QGVAR(loaded), _loaded, true]; + +_space = [_vehicle] call FUNC(getCargoSpaceLeft); +_itemSize = [_item] call FUNC(getSizeItem); +_vehicle setvariable [QGVAR(space), _space - _itemSize, true]; + +detach _item; +_item attachTo [_vehicle,[0,0,100]]; +["cargo_hideItem", [_item, true]] call EFUNC(common,serverEvent); + +true; diff --git a/addons/cargo/functions/fnc_moduleSettings.sqf b/addons/cargo/functions/fnc_moduleSettings.sqf new file mode 100644 index 0000000000..bb876c2840 --- /dev/null +++ b/addons/cargo/functions/fnc_moduleSettings.sqf @@ -0,0 +1,21 @@ +/* + * Author: Glowbal + * Module for adjusting the cargo settings + * + * Arguments: + * 0: The module logic + * 1: units + * 2: activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; +if !(_activated) exitWith {}; + +[_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule); diff --git a/addons/cargo/functions/fnc_onMenuOpen.sqf b/addons/cargo/functions/fnc_onMenuOpen.sqf new file mode 100644 index 0000000000..8c3bbfecf2 --- /dev/null +++ b/addons/cargo/functions/fnc_onMenuOpen.sqf @@ -0,0 +1,45 @@ +/* + * Author: Glowbal + * Handle the UI data display + * + * Arguments: + * 0: display + * + * Return value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +disableSerialization; +params["_display"]; + +uiNamespace setvariable [QGVAR(menuDisplay), _display]; + +[{ + private ["_display","_loaded", "_ctrl", "_label"]; + disableSerialization; + _display = uiNamespace getvariable QGVAR(menuDisplay); + if (isnil "_display") exitwith { + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + if (isNull GVAR(interactionVehicle) || ACE_player distance GVAR(interactionVehicle) >= 10) exitwith { + closeDialog 0; + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + _loaded = GVAR(interactionVehicle) getvariable [QGVAR(loaded), []]; + _ctrl = _display displayCtrl 100; + _label = _display displayCtrl 2; + + lbClear _ctrl; + { + _ctrl lbAdd (getText(configfile >> "CfgVehicles" >> typeOf _x >> "displayName")); + true + } count _loaded; + + _label ctrlSetText format[localize LSTRING(labelSpace), [GVAR(interactionVehicle)] call DFUNC(getCargoSpaceLeft)]; +}, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/cargo/functions/fnc_startLoadIn.sqf b/addons/cargo/functions/fnc_startLoadIn.sqf new file mode 100644 index 0000000000..0da44ba04c --- /dev/null +++ b/addons/cargo/functions/fnc_startLoadIn.sqf @@ -0,0 +1,29 @@ +/* + * Author: Glowbal + * Start load item + * + * Arguments: + * 0: Any object + * + * Return value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_player", "_object"]; + +private ["_nearestVehicle"]; +_nearestVehicle = [_player] call FUNC(findNearestVehicle); + +if (isNull _nearestVehicle || _nearestVehicle isKindOf "Cargo_Base_F") then { + + { + if ([_object, _x] call FUNC(canLoadItemIn)) exitwith {_nearestVehicle = _x}; + }foreach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]); +}; + +if (isNull _nearestVehicle) exitwith {false}; +[_object, _nearestVehicle] call FUNC(loadItem); diff --git a/addons/cargo/functions/fnc_startUnload.sqf b/addons/cargo/functions/fnc_startUnload.sqf new file mode 100644 index 0000000000..615c1cafbd --- /dev/null +++ b/addons/cargo/functions/fnc_startUnload.sqf @@ -0,0 +1,31 @@ +/* + * Author: Glowbal + * Start unload action + * + * Arguments: + * None + * + * Return value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_display", "_loaded", "_ctrl", "_selected", "_item"]; +disableSerialization; +_display = uiNamespace getvariable QGVAR(menuDisplay); +if (isnil "_display") exitwith {}; + +_loaded = GVAR(interactionVehicle) getvariable [QGVAR(loaded), []]; +if (count _loaded == 0) exitwith {}; + +_ctrl = _display displayCtrl 100; + +_selected = (lbCurSel _ctrl) max 0; + +if (count _loaded <= _selected) exitwith {}; +_item = _loaded select _selected; + +[_item, GVAR(interactionVehicle)] call FUNC(unloadItem); diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf new file mode 100644 index 0000000000..0209c5256e --- /dev/null +++ b/addons/cargo/functions/fnc_unloadItem.sqf @@ -0,0 +1,62 @@ +/* + * Author: Glowbal, ViperMaul + * Unload object from vehicle + * + * Arguments: + * 0: Object + * 1: Vehicle + * + * Return value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"]; +params ["_item", "_vehicle"]; + +if !([_item, _vehicle] call FUNC(canUnloadItem)) exitwith { + false +}; + +_validVehiclestate = true; +_emptyPos = []; +if (_vehicle isKindOf "Ship" ) then { + if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; + TRACE_1("SHIP Ground Check", getPosATL _vehicle ); + _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot. +} else { + if (_vehicle isKindOf "Air" ) then { + if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false}; + TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); + _emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition); + _emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ]; + } else { + if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; + TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); + _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeOf _item]); + }; +}; + +TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle); +if (!_validVehiclestate) exitwith { false }; + +if (count _emptyPos == 0) exitwith { false }; //consider displaying text saying there are no safe places to exit the vehicle + +_loaded = _vehicle getvariable [QGVAR(loaded), []]; +_loaded = _loaded - [_item]; +_vehicle setvariable [QGVAR(loaded), _loaded, true]; + +_space = [_vehicle] call FUNC(getCargoSpaceLeft); +_itemSize = [_item] call FUNC(getSizeItem); +_vehicle setvariable [QGVAR(space), (_space + _itemSize), true]; + +detach _item; +_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL)); +["cargo_hideItem", [_item, false]] call EFUNC(common,serverEvent); + +// TOOO maybe drag/carry the unloaded item? + +true; diff --git a/addons/cargo/functions/fnc_validateCargoSpace.sqf b/addons/cargo/functions/fnc_validateCargoSpace.sqf new file mode 100644 index 0000000000..6452e850bc --- /dev/null +++ b/addons/cargo/functions/fnc_validateCargoSpace.sqf @@ -0,0 +1,32 @@ +/* + * Author: Glowbal + * Validate the vehicle cargo space + * + * Arguments: + * 0: Object + * + * Return value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_loaded", "_newLoaded", "_totalSpaceOccupied"]; +params ["_vehicle"]; +_loaded = _vehicle getvariable [QGVAR(loaded), []]; +_newLoaded = []; +_totalSpaceOccupied = 0; +{ + if !(isNull _x) then { + _newLoaded pushback _x; + _totalSpaceOccupied = _totalSpaceOccupied + ([_x] call FUNC(getSizeItem)); + }; + true +} count _loaded; + +if (count _loaded != count _newLoaded) then { + _vehicle setvariable [QGVAR(loaded), _newLoaded, true]; +}; +_vehicle setvariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true]; diff --git a/addons/cargo/functions/script_component.hpp b/addons/cargo/functions/script_component.hpp new file mode 100644 index 0000000000..bd91738fd3 --- /dev/null +++ b/addons/cargo/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\cargo\script_component.hpp" \ No newline at end of file diff --git a/addons/cargo/menu.hpp b/addons/cargo/menu.hpp new file mode 100644 index 0000000000..35976d19ad --- /dev/null +++ b/addons/cargo/menu.hpp @@ -0,0 +1,104 @@ + +#include "\z\ace\addons\common\define.hpp" + +class GVAR(menu) { + idd = 314614; + movingEnable = true; + onLoad = QUOTE([_this select 0] call FUNC(onMenuOpen)); + onUnload = QUOTE(uiNamespace setvariable [ARR_2(QUOTE(QGVAR(menuDisplay)),nil)];); + class controlsBackground { + class HeaderBackground: ACE_gui_backgroundBase{ + idc = -1; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + text = "#(argb,8,8,3)color(0,0,0,0)"; + }; + class CenterBackground: HeaderBackground { + y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + h = "14 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + text = "#(argb,8,8,3)color(0,0,0,0.8)"; + colorText[] = {0, 0, 0, "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; + colorBackground[] = {0,0,0,"(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; + }; + }; + + class controls { + class HeaderName { + idc = 1; + type = CT_STATIC; + x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + style = ST_LEFT + ST_SHADOW; + font = "PuristaMedium"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + colorText[] = {0.95, 0.95, 0.95, 0.75}; + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; + text = CSTRING(cargoMenu); + }; + class SubHeader: HeaderName { + idc = 2; + x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + style = ST_CENTER; + colorText[] = {1, 1, 1.0, 0.9}; + colorBackground[] = {0,0,0,0}; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; + text = ""; + }; + class cargoList: ACE_gui_listBoxBase { + idc = 100; + x = "13.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "12.8 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; + rowHeight = 0.03; + colorBackground[] = {0, 0, 0, 0.2}; + colorText[] = {1, 1, 1, 1.0}; + colorScrollbar[] = {0.95, 0.95, 0.95, 1}; + colorSelect[] = {1, 1, 1, 1.0}; + colorSelect2[] = {1, 1, 1, 1.0}; + colorSelectBackground[] = {0.3, 0.3, 0.3, 1.0}; + colorSelectBackground2[] = {0.3, 0.3, 0.3, 1.0}; + }; + class btnUnload: ACE_gui_buttonBase { + text = "Cancel"; + idc = 11; + x = "13.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "14.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "5 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.8)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; + color[] = {1, 1, 1, 1}; + color2[] = {0,0,0, 1}; + colorBackgroundFocused[] = {1,1,1,1}; + colorBackground[] = {1,1,1,1}; + colorbackground2[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,1}; + colorFocused[] = {0,0,0,1}; + periodFocus = 1; + periodOver = 1; + action = QUOTE(closeDialog 0); + }; + class btnCancel: btnUnload { + text = CSTRING(unloadObject); + idc = 12; + x = "20.9 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + action = QUOTE([] call FUNC(startUnload);); + }; + }; +}; \ No newline at end of file diff --git a/addons/cargo/script_component.hpp b/addons/cargo/script_component.hpp new file mode 100644 index 0000000000..9716d7a536 --- /dev/null +++ b/addons/cargo/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT cargo +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_CARGO + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_ENABLED_CARGO + #define DEBUG_SETTINGS DEBUG_ENABLED_CARGO +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define MAX_LOAD_DISTANCE 10 diff --git a/addons/cargo/stringtable.xml b/addons/cargo/stringtable.xml new file mode 100644 index 0000000000..57ee916156 --- /dev/null +++ b/addons/cargo/stringtable.xml @@ -0,0 +1,35 @@ + + + + + Load + + + Unload + + + Cargo + + + Cargo Menu + + + Cargo space left: %1 + + + Cargo + + + Enable Cargo + + + Enable the load in cargo module + + + Cargo Settings + + + Configure the cargo module settings + + + diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 40d8d7334b..bf699ab83c 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -75,16 +75,6 @@ if (isServer) then { ["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler); }; -// hack to get PFH to work in briefing -[QGVAR(onBriefingPFH), "onEachFrame", { - if (ACE_time > 0) exitWith { - [QGVAR(onBriefingPFH), "onEachFrame"] call BIS_fnc_removeStackedEventHandler; - }; - - call cba_common_fnc_onFrame; -}] call BIS_fnc_addStackedEventHandler; -///// - QGVAR(remoteFnc) addPublicVariableEventHandler { (_this select 1) call FUNC(execRemoteFnc); }; @@ -118,8 +108,9 @@ if(!isServer) then { }; ["SEH", FUNC(_handleSyncedEvent)] call FUNC(addEventHandler); ["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler); -[FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler; - +if (isServer) then { + [FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler; +}; call FUNC(checkFiles); @@ -340,6 +331,14 @@ if(isMultiplayer && { ACE_time > 0 || isNull player } ) then { GVAR(deviceKeyHandlingArray) = []; GVAR(deviceKeyCurrentIndex) = -1; +// Register localizations for the Keybinding categories +["ACE3 Equipment", localize LSTRING(ACEKeybindCategoryEquipment)] call cba_fnc_registerKeybindModPrettyName; +["ACE3 Common", localize LSTRING(ACEKeybindCategoryCommon)] call cba_fnc_registerKeybindModPrettyName; +["ACE3 Weapons", localize LSTRING(ACEKeybindCategoryWeapons)] call cba_fnc_registerKeybindModPrettyName; +["ACE3 Movement", localize LSTRING(ACEKeybindCategoryMovement)] call cba_fnc_registerKeybindModPrettyName; +["ACE3 Scope Adjustment", localize LSTRING(ACEKeybindCategoryScopeAdjustment)] call cba_fnc_registerKeybindModPrettyName; +["ACE3 Vehicles", localize LSTRING(ACEKeybindCategoryVehicles)] call cba_fnc_registerKeybindModPrettyName; + ["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"), { [] call FUNC(deviceKeyFindValidIndex); diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 8285a15519..6fdf99113c 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -11,6 +11,7 @@ PREP(addCanInteractWithCondition); PREP(addLineToDebugDraw); PREP(addSetting); PREP(addToInventory); +PREP(assignObjectsInList); PREP(ambientBrightness); PREP(applyForceWalkStatus); PREP(ASLToPosition); diff --git a/addons/common/functions/fnc_assignObjectsInList.sqf b/addons/common/functions/fnc_assignObjectsInList.sqf new file mode 100644 index 0000000000..0d10066d01 --- /dev/null +++ b/addons/common/functions/fnc_assignObjectsInList.sqf @@ -0,0 +1,50 @@ +/* + * Author: Glowbal + * Loops through a string and filters out object names/variables to assign a value for given variable. + * Used by moduleAssign* within various parts of the ACE3 project. + * + * Arguments: + * 0: list + * 1: variableName + * 2: value + * 3: Global + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_splittedList", "_nilCheckPassedList"]; +params ["_list", "_variable", "_setting", "_global"]; + +if (typeName _list == "STRING") then { + _splittedList = [_list, ","] call BIS_fnc_splitString; + _nilCheckPassedList = ""; + { + _x = [_x] call FUNC(stringRemoveWhiteSpace); + if !(isnil _x) then { + if (_nilCheckPassedList == "") then { + _nilCheckPassedList = _x; + } else { + _nilCheckPassedList = _nilCheckPassedList + ","+ _x; + }; + }; + }foreach _splittedList; + + _list = [] call compile format["[%1]",_nilCheckPassedList]; +}; + +{ + if (!isnil "_x") then { + if (typeName _x == typeName objNull) then { + if (local _x) then { + _x setvariable [_variable, _setting, _global]; + }; + }; + }; +}foreach _list; + +true diff --git a/addons/common/functions/fnc_checkPBOs.sqf b/addons/common/functions/fnc_checkPBOs.sqf index ac6d8fb270..5665ee632c 100644 --- a/addons/common/functions/fnc_checkPBOs.sqf +++ b/addons/common/functions/fnc_checkPBOs.sqf @@ -27,6 +27,8 @@ _whitelist = [_whitelist, {toLower _this}] call FUNC(map); ACE_Version_CheckAll = _checkAll; ACE_Version_Whitelist = _whitelist; +if (!_checkAll) exitWith {}; //ACE is checked by FUNC(checkFiles) + if (!isServer) then { [_mode, _checkAll, _whitelist] spawn { private ["_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer", "_text", "_error", "_rscLayer", "_ctrlHint"]; diff --git a/addons/common/functions/fnc_getAllGear.sqf b/addons/common/functions/fnc_getAllGear.sqf index aa2289309e..33c23c98a3 100644 --- a/addons/common/functions/fnc_getAllGear.sqf +++ b/addons/common/functions/fnc_getAllGear.sqf @@ -18,6 +18,7 @@ * 14-16: pistol (String, Array, Array) * 17: map, compass, watch, etc. (Array) * 18: binocluar (String) + * 19: active weapon, active muzzle, active weaponMode (Array) * */ #include "script_component.hpp" @@ -34,7 +35,8 @@ if (isNull _unit) exitWith {[ "", ["","","",""], [], "", ["","","",""], [], [], - "" + "", + ["","",""] ]}; [ @@ -47,5 +49,6 @@ if (isNull _unit) exitWith {[ secondaryWeapon _unit, secondaryWeaponItems _unit, secondaryWeaponMagazine _unit, handgunWeapon _unit, handgunItems _unit, handgunMagazine _unit, assignedItems _unit, - binocular _unit + binocular _unit, + [currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit] ] diff --git a/addons/common/functions/fnc_getHitPointsWithSelections.sqf b/addons/common/functions/fnc_getHitPointsWithSelections.sqf index 2bf568ec8a..b66700881e 100644 --- a/addons/common/functions/fnc_getHitPointsWithSelections.sqf +++ b/addons/common/functions/fnc_getHitPointsWithSelections.sqf @@ -41,14 +41,15 @@ _hitpointClasses = [_config >> "HitPoints"]; while {isClass _class} do { for "_i" from 0 to (count _class - 1) do { - private ["_entry", "_selection"]; + if (isClass (_class select _i)) then { + private ["_entry", "_selection"]; + _entry = configName (_class select _i); + _selection = getText (_class select _i >> "name"); - _entry = configName (_class select _i); - _selection = getText (_class select _i >> "name"); - - if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { - _hitpoints pushBack _entry; - _selections pushBack _selection; + if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { + _hitpoints pushBack _entry; + _selections pushBack _selection; + }; }; }; diff --git a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf index 280a1e9907..4479ba04fa 100644 --- a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf +++ b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf @@ -15,16 +15,16 @@ private ["_parseConfigForDisplayNames", "_name"]; _parseConfigForDisplayNames = { - private "_optionEntry"; + private ["_optionEntry", "_values", "_text"]; _optionEntry = _this select 0; if !(isClass _optionEntry) exitwith {false}; + _values = getArray (_optionEntry >> "values"); _x set [3, getText (_optionEntry >> "displayName")]; _x set [4, getText (_optionEntry >> "description")]; + _x set [5, _values]; + _x set [8, getText (_optionEntry >> "category")]; - private "_values"; - _values = _x select 5; { - private "_text"; _text = _x; if (((typeName _text) == "STRING") && {(count _text) > 1} && {(_text select [0,1]) == "$"}) then { _text = localize (_text select [1, ((count _text) - 1)]); //chop off the leading $ @@ -41,7 +41,9 @@ _parseConfigForDisplayNames = { if !([configFile >> "ACE_Settings" >> _name] call _parseConfigForDisplayNames) then { if !([configFile >> "ACE_ServerSettings" >> _name] call _parseConfigForDisplayNames) then { - [missionConfigFile >> "ACE_Settings" >> _name] call _parseConfigForDisplayNames; + if !([missionConfigFile >> "ACE_Settings" >> _name] call _parseConfigForDisplayNames) then { + diag_log text format ["[ACE] - Setting found, but couldn't localize [%1] (server has but we don't?)", _name]; + }; }; }; diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index 9a95819996..f06436884f 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -65,17 +65,19 @@ if (isNil _name) then { localizedDescription, possibleValues, isForced, - defaultValue + defaultValue, + category ];*/ _settingData = [ _name, _typeName, (getNumber (_optionEntry >> "isClientSettable")) > 0, - getText (_optionEntry >> "displayName"), - getText (_optionEntry >> "description"), - getArray (_optionEntry >> "values"), + "", //getText (_optionEntry >> "displayName"), //No need to broadcast, handeled by fnc_loadSettingsLocalizedText + "", //getText (_optionEntry >> "description"), //No need to broadcast, handeled by fnc_loadSettingsLocalizedText + [], //getArray (_optionEntry >> "values"), //No need to broadcast, handeled by fnc_loadSettingsLocalizedText getNumber (_optionEntry >> "force") > 0, - _value + _value, + "" //getText (_optionEntry >> "category") //No need to broadcast, handeled by fnc_loadSettingsLocalizedText ]; //Strings in the values array won't be localized from the config, so just do that now: diff --git a/addons/common/functions/fnc_unloadPersonLocal.sqf b/addons/common/functions/fnc_unloadPersonLocal.sqf index 524bf6621d..da2d9ea77e 100644 --- a/addons/common/functions/fnc_unloadPersonLocal.sqf +++ b/addons/common/functions/fnc_unloadPersonLocal.sqf @@ -30,14 +30,14 @@ if (_vehicle isKindOf "Ship" ) then { _emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition); _emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ]; } else { - if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false}; + if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeof _unit]); }; }; TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle); -if (!_validVehiclestate) exitwith { diag_log format["Unable to unload patient because invalid vehicle state. Either moving or Not close enough on the ground. %1", getPos _vehicle]; false }; +if (!_validVehiclestate) exitwith { diag_log format["Unable to unload patient because invalid (%1) vehicle state. Either moving or Not close enough on the ground. position: %2 isTouchingGround: %3 Speed: %4", _vehicle, getPos _vehicle, isTouchingGround _vehicle, speed _vehicle]; false }; diag_log str _emptyPos; diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index 6ed5e10d5a..0bbe6564da 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -479,7 +479,6 @@ Verificar PBOs - Sprawdzaj spójność addonów z serwerem Este módulo verifica la integridad de los addons con los que iniciamos el simulador Dieses Modul überprüft ob jeder Spieler die richtigen PBO-Dateien hat. @@ -598,5 +597,87 @@ Następne urządzenie podręczne Procházet ruční zařízení + + Disabled + Zakázáno + Non + Deaktiviert + Disattivato + Wyłączone + Desativado + Откл. + Desactivado + + + Enabled + Zapnuto + Oui + Aktiviert + Attivato + Włączone + Ativado + Вкл. + Activado + + + Yes + Ja + Si + Tak + Ano + Oui + Да + Igen + Sim + Si + + + No + Nein + No + Nie + Ne + Non + Нет + Nem + Não + No + + + Vehicles only + Tylko pojazdy + + + Do Not Force + Nie wymuszaj + No forzar + Nicht erzwingen + Nevynucovat + Não forçar + + + ACE3 Equipment + ACE3 Wyposażenie + + + ACE3 Common + ACE3 Ogólne + + + ACE3 Weapons + ACE3 Broń + + + ACE3 Movement + ACE3 Ruch + + + ACE3 Scope Adjustment + ACE3 Regulacja optyki + + + ACE3 Vehicles + ACE3 Pojazdy + - + \ No newline at end of file diff --git a/addons/concertina_wire/CfgVehicles.hpp b/addons/concertina_wire/CfgVehicles.hpp index 2592bf5b77..cf1be40487 100644 --- a/addons/concertina_wire/CfgVehicles.hpp +++ b/addons/concertina_wire/CfgVehicles.hpp @@ -123,7 +123,8 @@ class CfgVehicles { displayName = "$STR_ACE_ROLLWIRE"; distance = 4; condition = "true"; - statement = QUOTE([ARR_2(_target,_player)] call FUNC(deploy)); + //wait a frame to handle "Do When releasing action menu key" option: + statement = QUOTE([ARR_2({_this call FUNC(deploy)}, [ARR_2(_target,_player)])] call EFUNC(common,execNextFrame)); showDisabled = 0; exceptions[] = {}; priority = 5; diff --git a/addons/concertina_wire/functions/fnc_deploy.sqf b/addons/concertina_wire/functions/fnc_deploy.sqf index c30e767266..5548cad649 100644 --- a/addons/concertina_wire/functions/fnc_deploy.sqf +++ b/addons/concertina_wire/functions/fnc_deploy.sqf @@ -37,7 +37,7 @@ deleteVehicle _wirecoil; _unit setVariable [QGVAR(wireDeployed), false]; GVAR(deployPFH) = [{ - EXPLODE_4_PVT(_this select 0,_wireNoGeo,_wireNoGeoPos,_unit,_action); + EXPLODE_3_PVT(_this select 0,_wireNoGeo,_wireNoGeoPos,_unit); private ["_range", "_posStart", "_posEnd", "_dirVect", "_dir", "_anim", "_wire"]; _posStart = (_wireNoGeo modelToWorldVisual (_wireNoGeo selectionPosition "start")) call EFUNC(common,positionToASL); @@ -73,7 +73,7 @@ GVAR(deployPFH) = [{ { _wireNoGeo animate [_x, _anim]; } foreach WIRE_FAST; -}, 0, [_wireNoGeo, _wireNoGeoPos, _unit, _action]] call CBA_fnc_addPerFrameHandler; +}, 0, [_wireNoGeo, _wireNoGeoPos, _unit]] call CBA_fnc_addPerFrameHandler; [localize "STR_ACE_ROLLWIRE", "", ""] call EFUNC(interaction,showMouseHint); diff --git a/addons/concertina_wire/stringtable.xml b/addons/concertina_wire/stringtable.xml index 812de87e6c..07c2961862 100644 --- a/addons/concertina_wire/stringtable.xml +++ b/addons/concertina_wire/stringtable.xml @@ -5,7 +5,7 @@ Concertina Wire NATO-Draht Проволочная спираль - Drut kolczasty + Koncentrina Alambre de espino Concertina wire Ostnatý drát @@ -17,7 +17,7 @@ Concertina Wire Coil NATO-Draht Rolle Проволочная спираль (моток) - Zwój drutu kolczastego + Zwój koncentriny Bobina de alambre de espino Concertina wire coil Smyčka ostnatého drátu @@ -29,7 +29,7 @@ Dismount Concertina Wire NATO-Draht abbauen Демонтировать проволочную спираль - Zwiń drut kolczasty + Zwiń koncentrinę Desmontar alambre de espino Dismount Concertina wire Svinout ostnatý drát @@ -41,7 +41,7 @@ Deploy Concertina Wire NATO-Draht verlegen Монтировать проволочную спираль - Rozwiń drut kolczasty + Rozwiń koncentrinę Desplegar alambre de espino Deploy Concertina wire Rozvinout ostnatý drát @@ -50,4 +50,4 @@ Colocar arame farpado - \ No newline at end of file + diff --git a/addons/disarming/XEH_postInit.sqf b/addons/disarming/XEH_postInit.sqf index 7315ef1785..ef17e6e96a 100644 --- a/addons/disarming/XEH_postInit.sqf +++ b/addons/disarming/XEH_postInit.sqf @@ -1,4 +1,4 @@ #include "script_component.hpp" -["DisarmDropItems", {_this call FUNC(eventTargetStart)}] call EFUNC(common,addEventHandler); -["DisarmDebugCallback", {_this call FUNC(eventCallerFinish)}] call EFUNC(common,addEventHandler); +["DisarmDropItems", FUNC(eventTargetStart)] call EFUNC(common,addEventHandler); +["DisarmDebugCallback", FUNC(eventCallerFinish)] call EFUNC(common,addEventHandler); diff --git a/addons/disarming/functions/fnc_canBeDisarmed.sqf b/addons/disarming/functions/fnc_canBeDisarmed.sqf index 25ec884919..9be20db7f4 100644 --- a/addons/disarming/functions/fnc_canBeDisarmed.sqf +++ b/addons/disarming/functions/fnc_canBeDisarmed.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Checks the conditions for being able to disarm a unit * * Arguments: @@ -15,17 +16,17 @@ */ #include "script_component.hpp" -PARAMS_1(_target); - private ["_animationStateCfgMoves", "_putDownAnim"]; +params ["_target"]; + //Check animationState for putDown anim //This ensures the unit doesn't have to actualy do any animation to drop something //This should always be true for the 3 possible status effects that allow disarming _animationStateCfgMoves = getText (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _target) >> "actions"); -if (_animationStateCfgMoves == "") exitWith {false}; +if (_animationStateCfgMoves == "") exitWith { false }; _putDownAnim = getText (configFile >> "CfgMovesBasic" >> "Actions" >> _animationStateCfgMoves >> "PutDown"); -if (_putDownAnim != "") exitWith {false}; +if (_putDownAnim != "") exitWith { false }; (alive _target) && diff --git a/addons/disarming/functions/fnc_canPlayerDisarmUnit.sqf b/addons/disarming/functions/fnc_canPlayerDisarmUnit.sqf index ec9e975ec2..34f1a10d32 100644 --- a/addons/disarming/functions/fnc_canPlayerDisarmUnit.sqf +++ b/addons/disarming/functions/fnc_canPlayerDisarmUnit.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Checks the conditions for being able to disarm a unit * * Arguments: @@ -16,7 +17,7 @@ */ #include "script_component.hpp" -PARAMS_2(_player,_target); +params ["_player", "_target"]; -([_target] call FUNC(canBeDisarmed)) && +([_target] call FUNC(canBeDisarmed)) && {([_player, _target, []] call EFUNC(common,canInteractWith))} diff --git a/addons/disarming/functions/fnc_disarmDropItems.sqf b/addons/disarming/functions/fnc_disarmDropItems.sqf index 5422fd00a6..91eff1c99d 100644 --- a/addons/disarming/functions/fnc_disarmDropItems.sqf +++ b/addons/disarming/functions/fnc_disarmDropItems.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Makes a unit drop items * * Arguments: @@ -22,13 +23,11 @@ private ["_fncSumArray", "_return", "_holder", "_dropPos", "_targetMagazinesStart", "_holderMagazinesStart", "_xClassname", "_xAmmo", "_targetMagazinesEnd", "_holderMagazinesEnd", "_holderItemsStart", "_targetItemsStart", "_addToCrateClassnames", "_addToCrateCount", "_index", "_holderItemsEnd", "_targetItemsEnd", "_holderIsEmpty"]; - -PARAMS_3(_caller,_target,_listOfItemsToRemove); -DEFAULT_PARAM(3,_doNotDropAmmo,false); //By default units drop all weapon mags when dropping a weapon +params ["_caller", "_target", "_listOfItemsToRemove", ["_doNotDropAmmo", false, [false]]]; //By default units drop all weapon mags when dropping a weapon _fncSumArray = { _return = 0; - {_return = _return + _x;} forEach (_this select 0); + {_return = _return + _x;} count (_this select 0); _return }; @@ -48,7 +47,7 @@ if (!_doNotDropAmmo) then { if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith { _holder = _x; }; - } forEach ((getpos _target) nearObjects [DISARM_CONTAINER, 3]); + } count ((getpos _target) nearObjects [DISARM_CONTAINER, 3]); }; //Create a new weapon holder diff --git a/addons/disarming/functions/fnc_eventCallerFinish.sqf b/addons/disarming/functions/fnc_eventCallerFinish.sqf index d95be98d5f..bc48a26b70 100644 --- a/addons/disarming/functions/fnc_eventCallerFinish.sqf +++ b/addons/disarming/functions/fnc_eventCallerFinish.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Recieves a possible error code from FUNC(eventTargetFinish) * * Arguments: @@ -17,7 +18,7 @@ */ #include "script_component.hpp" -PARAMS_3(_caller,_target,_errorMsg); +params ["_caller", "_target", "_errorMsg"]; if (_caller != ACE_player) exitWith {}; diff --git a/addons/disarming/functions/fnc_eventTargetFinish.sqf b/addons/disarming/functions/fnc_eventTargetFinish.sqf index d702a554a5..b9fb461356 100644 --- a/addons/disarming/functions/fnc_eventTargetFinish.sqf +++ b/addons/disarming/functions/fnc_eventTargetFinish.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * After FUNC(disarmDropItems) has completed, passing a possible error code. * Passes that error back to orginal caller. * @@ -18,7 +19,7 @@ */ #include "script_component.hpp" -PARAMS_3(_caller,_target,_errorMsg); +params ["_caller", "_target", "_errorMsg"]; if (_errorMsg != "") then { diag_log text format ["[ACE_Disarming] %1 - eventTargetFinish: %2", ACE_time, _this]; diff --git a/addons/disarming/functions/fnc_eventTargetStart.sqf b/addons/disarming/functions/fnc_eventTargetStart.sqf index 316ec2b656..29c370f2b5 100644 --- a/addons/disarming/functions/fnc_eventTargetStart.sqf +++ b/addons/disarming/functions/fnc_eventTargetStart.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Disarm Event Handler, Starting func, called on the target. * If target has to remove uniform/vest, this will add all uniform/vest items to the drop list. * @@ -18,7 +19,7 @@ */ #include "script_component.hpp" -PARAMS_3(_caller,_target,_listOfObjectsToRemove); +params ["_caller", "_target", "_listOfObjectsToRemove"]; private "_itemsToAdd"; diff --git a/addons/disarming/functions/fnc_getAllGearContainer.sqf b/addons/disarming/functions/fnc_getAllGearContainer.sqf index c5b2c445ab..0394761197 100644 --- a/addons/disarming/functions/fnc_getAllGearContainer.sqf +++ b/addons/disarming/functions/fnc_getAllGearContainer.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Helper function to get all gear of a container * * Arguments: @@ -15,15 +16,16 @@ */ #include "script_component.hpp" -PARAMS_1(_target); +params ["_target"]; -private ["_allGear"]; - -_allGear = [[],[]]; +private ["_items", "_counts"]; +_items = []; +_counts = []; { - (_allGear select 0) append (_x select 0); - (_allGear select 1) append (_x select 1); + _x params ["_item", "_count"]; + _items append _item; + _counts append _count; } forEach [(getWeaponCargo _target), (getItemCargo _target), (getMagazineCargo _target), (getBackpackCargo _target)]; -_allGear +[_items,_counts] // Return diff --git a/addons/disarming/functions/fnc_getAllGearUnit.sqf b/addons/disarming/functions/fnc_getAllGearUnit.sqf index 99d4b2d7f2..bdd1ff0bf9 100644 --- a/addons/disarming/functions/fnc_getAllGearUnit.sqf +++ b/addons/disarming/functions/fnc_getAllGearUnit.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Helper function to get all gear of a unit. * * Arguments: @@ -15,7 +16,7 @@ */ #include "script_component.hpp" -PARAMS_1(_target); +params ["_target"]; private ["_allItems", "_classnamesCount", "_index", "_uniqueClassnames"]; diff --git a/addons/disarming/functions/fnc_openDisarmDialog.sqf b/addons/disarming/functions/fnc_openDisarmDialog.sqf index 88e0e81be8..c2a3a6396e 100644 --- a/addons/disarming/functions/fnc_openDisarmDialog.sqf +++ b/addons/disarming/functions/fnc_openDisarmDialog.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Opens the disarm dialog (allowing a person to remove items) * * Arguments: @@ -15,21 +16,9 @@ * Public: No */ #include "script_component.hpp" - -#define TEXTURES_RANKS [ \ - "", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\private_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\corporal_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\lieutenant_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\captain_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\major_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa" \ - ] - -PARAMS_2(_caller,_target); +params ["_caller", "_target"]; private "_display"; - +#define DEFUALTPATH "\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa" //Sanity Checks if (_caller != ACE_player) exitwith {ERROR("Player isn't caller?");}; if (!([_player, _target] call FUNC(canPlayerDisarmUnit))) exitWith {ERROR("Can't Disarm Unit");}; @@ -47,8 +36,8 @@ GVAR(disarmTarget) = _target; //Setup Drop Event (on right pannel) (_display displayCtrl 632) ctrlAddEventHandler ["LBDrop", { if (isNull GVAR(disarmTarget)) exitWith {}; - PARAMS_5(_ctrl,_xPos,_yPos,_idc,_itemInfo); - EXPLODE_3_PVT((_itemInfo select 0),_displayText,_value,_data); + params ["_ctrl", "_xPos", "_yPos", "_idc", "_itemInfo"]; + (_itemInfo select 0) params ["_displayText", "_value", "_data"]; if (isNull GVAR(disarmTarget)) exitWith {ERROR("disarmTarget is null");}; @@ -60,18 +49,18 @@ GVAR(disarmTarget) = _target; //Setup PFEH [{ - private ["_groundContainer", "_targetContainer", "_playerName", "_rankPicture", "_rankIndex", "_targetUniqueItems", "_holderUniqueItems", "_holder"]; + private ["_groundContainer", "_targetContainer", "_playerName", "_icon", "_rankPicture", "_targetUniqueItems", "_holderUniqueItems", "_holder"]; disableSerialization; - EXPLODE_2_PVT(_this,_args,_pfID); - EXPLODE_3_PVT(_args,_player,_target,_display); + params ["_args", "_idPFH"]; + _args params ["_player", "_target", "_display"]; if ((!([_player, _target] call FUNC(canPlayerDisarmUnit))) || {isNull _display} || {_player != ACE_player}) then { - [_pfID] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; GVAR(disarmTarget) = objNull; - if (!isNull _display) then {closeDialog 0;}; //close dialog if still open + if (!isNull _display) then { closeDialog 0; }; //close dialog if still open } else { _groundContainer = _display displayCtrl 632; @@ -80,8 +69,9 @@ GVAR(disarmTarget) = _target; _rankPicture = _display displayCtrl 1203; //Show rank and name (just like BIS's inventory) - _rankIndex = ((["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"] find (rank _target)) + 1); - _rankPicture ctrlSetText (TEXTURES_RANKS select _rankIndex); + _icon = format [DEFUALTPATH, toLower (rank _target)]; + if (_icon isEqualTo DEFUALTPATH) then {_icon = ""}; + _rankPicture ctrlSetText _icon; _playerName ctrlSetText ([GVAR(disarmTarget)] call EFUNC(common,getName)); //Clear both inventory lists: @@ -98,7 +88,7 @@ GVAR(disarmTarget) = _target; if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith { _holder = _x; }; - } forEach ((getpos _target) nearObjects [DISARM_CONTAINER, 3]); + } count ((getpos _target) nearObjects [DISARM_CONTAINER, 3]); //If a holder exists, show it's inventory if (!isNull _holder) then { diff --git a/addons/disarming/functions/fnc_showItemsInListbox.sqf b/addons/disarming/functions/fnc_showItemsInListbox.sqf index b36e53e820..f675012ee3 100644 --- a/addons/disarming/functions/fnc_showItemsInListbox.sqf +++ b/addons/disarming/functions/fnc_showItemsInListbox.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Shows a list of inventory items in a listBox control. * * Arguments: @@ -17,11 +18,12 @@ #include "script_component.hpp" disableSerialization; -PARAMS_2(_listBoxCtrl,_itemsCountArray); - private ["_classname", "_count", "_displayName", "_picture"]; +params ["_listBoxCtrl", "_itemsCountArray"]; + { + private "_configPath"; _displayName = ""; _picture = ""; @@ -31,21 +33,25 @@ private ["_classname", "_count", "_displayName", "_picture"]; if ((_classname != DUMMY_ITEM) && {_classname != "ACE_FakePrimaryWeapon"}) then { //Don't show the dummy potato or fake weapon switch (true) do { - case (isClass (configFile >> "CfgWeapons" >> _classname)): { - _displayName = getText (configFile >> "CfgWeapons" >> _classname >> "displayName"); - _picture = getText (configFile >> "CfgWeapons" >> _classname >> "picture"); + case (isClass (configFile >> "CfgWeapons" >> _classname)): { + _configPath = (configFile >> "CfgWeapons"); + _displayName = getText (_configPath >> _classname >> "displayName"); + _picture = getText (_configPath >> _classname >> "picture"); }; - case (isClass (configFile >> "CfgMagazines" >> _classname)): { - _displayName = getText (configFile >> "CfgMagazines" >> _classname >> "displayName"); - _picture = getText (configFile >> "CfgMagazines" >> _classname >> "picture"); + case (isClass (configFile >> "CfgMagazines" >> _classname)): { + _configPath = (configFile >> "CfgMagazines"); + _displayName = getText (_configPath >> _classname >> "displayName"); + _picture = getText (_configPath >> _classname >> "picture"); }; - case (isClass (configFile >> "CfgVehicles" >> _classname)): { - _displayName = getText (configFile >> "CfgVehicles" >> _classname >> "displayName"); - _picture = getText (configFile >> "CfgVehicles" >> _classname >> "picture"); + case (isClass (configFile >> "CfgVehicles" >> _classname)): { + _configPath = (configFile >> "CfgVehicles"); + _displayName = getText (_configPath >> _classname >> "displayName"); + _picture = getText (_configPath >> _classname >> "picture"); }; - case (isClass (configFile >> "CfgGlasses" >> _classname)): { - _displayName = getText (configFile >> "CfgGlasses" >> _classname >> "displayName"); - _picture = getText (configFile >> "CfgGlasses" >> _classname >> "picture"); + case (isClass (configFile >> "CfgGlasses" >> _classname)): { + _configPath = (configFile >> "CfgGlasses"); + _displayName = getText (_configPath >> _classname >> "displayName"); + _picture = getText (_configPath >> _classname >> "picture"); }; default { ERROR(format ["[%1] - bad classname", _classname]); diff --git a/addons/disarming/functions/fnc_verifyMagazinesMoved.sqf b/addons/disarming/functions/fnc_verifyMagazinesMoved.sqf index e1753f390a..efe5aae72a 100644 --- a/addons/disarming/functions/fnc_verifyMagazinesMoved.sqf +++ b/addons/disarming/functions/fnc_verifyMagazinesMoved.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Verifies magazines moved with exact ammo counts preserved. * Arrays will be in format from magazinesAmmo/magazinesAmmoCargo * e.g.: [["30Rnd_65x39_caseless_mag",15], ["30Rnd_65x39_caseless_mag",30]] diff --git a/addons/disposable/CfgEventHandlers.hpp b/addons/disposable/CfgEventHandlers.hpp index e4e4abffd8..98fec255c2 100644 --- a/addons/disposable/CfgEventHandlers.hpp +++ b/addons/disposable/CfgEventHandlers.hpp @@ -22,7 +22,7 @@ class Extended_FiredBIS_EventHandlers { class Extended_InitPost_EventHandlers { class CAManBase { class ADDON { - init = QUOTE([ARR_2(_this select 0, secondaryWeapon (_this select 0))] call FUNC(takeLoadedATWeapon)); + init = QUOTE([_this select 0] call FUNC(takeLoadedATWeapon)); }; }; }; diff --git a/addons/disposable/CfgMagazines.hpp b/addons/disposable/CfgMagazines.hpp index 484fa36238..d26d5ecea2 100644 --- a/addons/disposable/CfgMagazines.hpp +++ b/addons/disposable/CfgMagazines.hpp @@ -1,6 +1,6 @@ class CfgMagazines { class NLAW_F; - class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine + class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine author = ECSTRING(common,ACETeam); scope = 1; scopeArsenal = 1; @@ -12,14 +12,4 @@ class CfgMagazines { class ACE_FiredMissileDummy: ACE_PreloadedMissileDummy { count = 0; }; - class ACE_UsedTube_F: NLAW_F { - author = ECSTRING(common,ACETeam); - displayName = CSTRING(UsedTube); - descriptionShort = CSTRING(UsedTubeDescription); - displayNameShort = "-"; - count = 0; - weaponPoolAvailable = 0; - modelSpecial = ""; - mass = 0; - }; }; diff --git a/addons/disposable/XEH_postInit.sqf b/addons/disposable/XEH_postInit.sqf index bc51974bc6..800d749d06 100644 --- a/addons/disposable/XEH_postInit.sqf +++ b/addons/disposable/XEH_postInit.sqf @@ -3,8 +3,12 @@ if (!hasInterface) exitWith {}; -["inventoryDisplayLoaded", {[ACE_player, _this select 0] call FUNC(updateInventoryDisplay)}] call EFUNC(common,addEventHandler); -["playerInventoryChanged", { - [_this select 0, _this select 1 select 11] call FUNC(takeLoadedATWeapon); - [_this select 0] call FUNC(updateInventoryDisplay); +["inventoryDisplayLoaded", { + [ACE_player, _this select 0] call FUNC(updateInventoryDisplay) +}] call EFUNC(common,addEventHandler); + +["playerInventoryChanged", { + params ["_unit"]; + [_unit] call FUNC(takeLoadedATWeapon); + [_unit] call FUNC(updateInventoryDisplay); }] call EFUNC(common,addEventHandler); diff --git a/addons/disposable/XEH_postInitClient.sqf b/addons/disposable/XEH_postInitClient.sqf deleted file mode 100644 index c20dfa886b..0000000000 --- a/addons/disposable/XEH_postInitClient.sqf +++ /dev/null @@ -1,10 +0,0 @@ -// by commy2 - -// The Arma InventoryOpened EH fires actually before the inventory dialog is opened (findDisplay 602 => displayNull). - -#include "script_component.hpp" - -["inventoryDisplayLoaded",{ - [ACE_player] call FUNC(takeLoadedATWeapon); - [ACE_player, (_this select 0)] call FUNC(updateInventoryDisplay); -}] call EFUNC(common,addEventHandler); \ No newline at end of file diff --git a/addons/disposable/functions/fnc_replaceATWeapon.sqf b/addons/disposable/functions/fnc_replaceATWeapon.sqf index 8c55209123..ec56f42ff4 100644 --- a/addons/disposable/functions/fnc_replaceATWeapon.sqf +++ b/addons/disposable/functions/fnc_replaceATWeapon.sqf @@ -21,17 +21,14 @@ */ #include "script_component.hpp" -private ["_unit", "_weapon", "_projectile", "_replacementTube", "_items"]; +params ["_unit", "_weapon", "", "", "", "", "_projectile"]; +TRACE_3("params",_unit,_weapon,_projectile); -_unit = _this select 0; -_weapon = _this select 1; -_projectile = _this select 6; - -if (!local _unit) exitWith {}; +if ((!local _unit) || {_weapon != (secondaryWeapon _unit)}) exitWith {}; +private ["_replacementTube", "_items"]; _replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube"); if (_replacementTube == "") exitWith {}; //If no replacement defined just exit -if (_weapon != (secondaryWeapon _unit)) exitWith {}; //just to be sure //Save array of items attached to launcher @@ -43,19 +40,19 @@ _unit selectWeapon _replacementTube; //Re-add all attachments to the used tube { if (_x != "") then {_unit addSecondaryWeaponItem _x}; -} forEach _items; +} count _items; // AI - Remove the ai's missle launcher tube after the missle has exploded if !([_unit] call EFUNC(common,isPlayer)) then { [{ - EXPLODE_2_PVT(_this,_params,_pfhId); - EXPLODE_3_PVT(_params,_unit,_tube,_projectile); + params ["_args","_idPFH"]; + _args params ["_unit", "_tube", "_projectile"]; //don't do anything until projectile is null (exploded/max range) if (isNull _projectile) then { //Remove PFEH: - [_pfhId] call cba_fnc_removePerFrameHandler; + [_idPFH] call cba_fnc_removePerFrameHandler; //If (tube is dropped) OR (is dead) OR (is player) just exit if (((secondaryWeapon _unit) != _tube) || {!alive _unit} || {([_unit] call EFUNC(common,isPlayer))}) exitWith {}; @@ -66,13 +63,13 @@ if !([_unit] call EFUNC(common,isPlayer)) then { _container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"]; _container setPosAsl (getPosAsl _unit); _container addWeaponCargoGlobal [_tube, 1]; - + //This will duplicate attachements, because we will be adding a weapon that may already have attachments on it //We either need a way to add a clean weapon, or a way to add a fully configured weapon to a container: // { // if (_x != "") then {_container addItemCargoGlobal [_x, 1];}; // } forEach _items; - + _unit removeWeaponGlobal _tube; }; }, 1, [_unit, _replacementTube, _projectile]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf b/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf index de3875dfa0..b379584b68 100644 --- a/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf +++ b/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf @@ -15,16 +15,18 @@ */ #include "script_component.hpp" -private ["_unit", "_launcher", "_config"]; +params ["_unit"]; +TRACE_1("params",_unit); -PARAMS_1(_unit); if (!local _unit) exitWith {}; +private ["_launcher", "_config"]; + _launcher = secondaryWeapon _unit; _config = configFile >> "CfgWeapons" >> _launcher; if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then { - private ["_magazine", "_isLauncherSelected"]; + private ["_magazine", "_isLauncherSelected", "_didAdd"]; _magazine = getArray (_config >> "magazines") select 0; @@ -34,14 +36,22 @@ if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber if (backpack _unit == "") then { _unit addBackpack "Bag_Base"; - _unit addMagazine _magazine; + _didAdd = _magazine in (magazines _unit); _unit addWeapon _launcher; - + if (!_didAdd) then { + TRACE_1("Failed To Add Disposable Magazine Normally, doing backup method (no backpack)",_unit); + _unit addSecondaryWeaponItem _magazine; + }; removeBackpack _unit; } else { _unit addMagazine _magazine; + _didAdd = _magazine in (magazines _unit); _unit addWeapon _launcher; + if (!_didAdd) then { + TRACE_2("Failed To Add Disposable Magazine Normally, doing backup method",_unit,(backpack _unit)); + _unit addSecondaryWeaponItem _magazine; + }; }; if (_isLauncherSelected) then { diff --git a/addons/disposable/functions/fnc_updateInventoryDisplay.sqf b/addons/disposable/functions/fnc_updateInventoryDisplay.sqf index 3f9d6f9802..7f50e45089 100644 --- a/addons/disposable/functions/fnc_updateInventoryDisplay.sqf +++ b/addons/disposable/functions/fnc_updateInventoryDisplay.sqf @@ -16,9 +16,8 @@ #include "script_component.hpp" disableSerialization; - -PARAMS_1(_player); -DEFAULT_PARAM(1,_display,(findDisplay 602)); +params ["_player", ["_display",(findDisplay 602),[displayNull]]]; +TRACE_2("params",_player,_display); _player removeMagazines "ACE_PreloadedMissileDummy"; _player removeMagazines "ACE_FiredMissileDummy"; diff --git a/addons/disposable/script_component.hpp b/addons/disposable/script_component.hpp index af1f17bd86..12a05ea60d 100644 --- a/addons/disposable/script_component.hpp +++ b/addons/disposable/script_component.hpp @@ -1,6 +1,8 @@ #define COMPONENT disposable #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL + #ifdef DEBUG_ENABLED_ATTACH #define DEBUG_MODE_FULL #endif diff --git a/addons/dragging/CfgEventHandlers.hpp b/addons/dragging/CfgEventHandlers.hpp index e5c454e969..2ff7d07c0d 100644 --- a/addons/dragging/CfgEventHandlers.hpp +++ b/addons/dragging/CfgEventHandlers.hpp @@ -28,6 +28,11 @@ class Extended_Init_EventHandlers { init = QUOTE(_this call DFUNC(initObject)); }; }; + class ACE_RepairItem_Base { + class ADDON { + init = QUOTE(_this call DFUNC(initObject)); + }; + }; }; class Extended_Killed_EventHandlers { diff --git a/addons/dragging/CfgVehicles.hpp b/addons/dragging/CfgVehicles.hpp index 5ac84b7038..d4d791724b 100644 --- a/addons/dragging/CfgVehicles.hpp +++ b/addons/dragging/CfgVehicles.hpp @@ -83,4 +83,18 @@ class CfgVehicles { GVAR(canCarry) = 0; GVAR(canDrag) = 0; }; + + class ACE_RepairItem_Base: ThingX {}; + + class ACE_Track: ACE_RepairItem_Base { + GVAR(canCarry) = 1; + GVAR(carryPosition[]) = {0,1,1}; + GVAR(carryDirection) = 0; + }; + + class ACE_Wheel: ACE_RepairItem_Base { + GVAR(canCarry) = 1; + GVAR(carryPosition[]) = {0,1,1}; + GVAR(carryDirection) = 0; + }; }; diff --git a/addons/finger/functions/fnc_incomingFinger.sqf b/addons/finger/functions/fnc_incomingFinger.sqf index 83e2916e4f..5a1e23a278 100644 --- a/addons/finger/functions/fnc_incomingFinger.sqf +++ b/addons/finger/functions/fnc_incomingFinger.sqf @@ -16,10 +16,10 @@ */ #include "script_component.hpp" -PARAMS_2(_sourceUnit,_fingerPosPrecise); - private ["_data", "_fingerPos"]; +params ["_sourceUnit", "_fingerPosPrecise"]; + //add some random float to location if it's not our own finger: _fingerPos = if (_sourceUnit == ACE_player) then { _fingerPosPrecise diff --git a/addons/finger/functions/fnc_keyPress.sqf b/addons/finger/functions/fnc_keyPress.sqf index 8462eb7170..1ce83d62dc 100644 --- a/addons/finger/functions/fnc_keyPress.sqf +++ b/addons/finger/functions/fnc_keyPress.sqf @@ -38,7 +38,7 @@ _sendFingerToPlayers = []; _nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]); { _nearbyMen append (crew _x); -} forEach (ACE_player nearObjects ["StaticWeapon", (GVAR(maxRange) + 2)]); +} count (ACE_player nearObjects ["StaticWeapon", (GVAR(maxRange) + 2)]); { if ((((eyePos _x) vectorDistance _playerEyePos) < GVAR(maxRange)) && @@ -50,7 +50,8 @@ _nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]); _sendFingerToPlayers pushBack _x; }; -} forEach _nearbyMen; + true +} count _nearbyMen; TRACE_1("sending finger to",_sendFingerToPlayers); diff --git a/addons/finger/functions/fnc_moduleSettings.sqf b/addons/finger/functions/fnc_moduleSettings.sqf index aa623ed58c..c5189f4562 100644 --- a/addons/finger/functions/fnc_moduleSettings.sqf +++ b/addons/finger/functions/fnc_moduleSettings.sqf @@ -13,8 +13,7 @@ #include "script_component.hpp" -PARAMS_1(_logic); - +params ["_logic"]; if !(isServer) exitWith {}; [_logic, QGVAR(enabled), "enabled"] call EFUNC(common,readSettingFromModule); diff --git a/addons/finger/functions/fnc_perFrameEH.sqf b/addons/finger/functions/fnc_perFrameEH.sqf index a35550db76..d6297a4095 100644 --- a/addons/finger/functions/fnc_perFrameEH.sqf +++ b/addons/finger/functions/fnc_perFrameEH.sqf @@ -30,7 +30,7 @@ _iconSize = BASE_SIZE * _fovCorrection; { _data = HASH_GET(GVAR(fingersHash), _x); - EXPLODE_3_PVT(_data,_lastTime,_pos,_name); + _data params ["_lastTime", "_pos", "_name"]; _timeLeftToShow = _lastTime + FP_TIMEOUT - ACE_diagTime; if (_timeLeftToShow <= 0) then { HASH_REM(GVAR(fingersHash), _x); @@ -43,7 +43,7 @@ _iconSize = BASE_SIZE * _fovCorrection; drawIcon3D [QUOTE(PATHTOF(UI\fp_icon.paa)), _drawColor, _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "PuristaMedium"]; }; -} forEach (GVAR(fingersHash) select 0); +} count (GVAR(fingersHash) select 0); if ((count (GVAR(fingersHash) select 0)) == 0) then { [GVAR(pfeh_id)] call CBA_fnc_removePerFrameHandler; diff --git a/addons/grenades/XEH_postInit.sqf b/addons/grenades/XEH_postInit.sqf index b1559c6cfe..e78f1d52de 100644 --- a/addons/grenades/XEH_postInit.sqf +++ b/addons/grenades/XEH_postInit.sqf @@ -2,7 +2,7 @@ #include "script_component.hpp" -["flashbangExplosion", {_this call FUNC(flashbangExplosionEH)}] call EFUNC(common,addEventHandler); +["flashbangExplosion", DFUNC(flashbangExplosionEH)] call EFUNC(common,addEventHandler); if !(hasInterface) exitWith {}; diff --git a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf index a98fbc2350..cd85c3fe36 100644 --- a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf +++ b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf @@ -6,7 +6,7 @@ * 0: The grenade * * Return Value: - * Nothing + * None * * Example: * [theGrenade] call ace_grenades_fnc_flashbangExplosionEH @@ -15,9 +15,8 @@ */ #include "script_component.hpp" -private ["_affected", "_strength", "_posGrenade", "_posUnit", "_angleGrenade", "_angleView", "_angleDiff", "_light", "_losCount", "_dirToUnitVector", "_eyeDir", "_eyePos"]; - -PARAMS_1(_grenade); +private ["_affected", "_strength", "_posGrenade", "_angleDiff", "_light", "_losCount", "_dirToUnitVector", "_eyeDir", "_eyePos"]; +params ["_grenade"]; _affected = _grenade nearEntities ["CAManBase", 20]; @@ -34,7 +33,7 @@ _affected = _grenade nearEntities ["CAManBase", 20]; _x setSkill ((skill _x) / 50); [{ - PARAMS_1(_unit); + params ["_unit"]; //Make sure we don't enable AI for unconscious units if (!(_unit getVariable ["ace_isunconscious", false])) then { [_unit, false] call EFUNC(common,disableAI); @@ -48,13 +47,11 @@ _affected = _grenade nearEntities ["CAManBase", 20]; _eyePos = eyePos ACE_player; //PositionASL _posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground - _losCount = 0; //Check for line of sight (check 4 points in case grenade is stuck in an object or underground) - { - if (!lineIntersects [(_posGrenade vectorAdd _x), _eyePos, _grenade, ACE_player]) then { - _losCount = _losCount + 1; - }; - } forEach [[0,0,0], [0,0,0.2], [0.1, 0.1, 0.1], [-0.1, -0.1, 0.1]]; + _losCount = { + (!lineIntersects [(_posGrenade vectorAdd _x), _eyePos, _grenade, ACE_player]) + } count [[0,0,0], [0,0,0.2], [0.1, 0.1, 0.1], [-0.1, -0.1, 0.1]]; + TRACE_1("Line of sight count (out of 4)",_losCount); if (_losCount <= 1) then { _strength = _strength / 10; @@ -78,7 +75,6 @@ _affected = _grenade nearEntities ["CAManBase", 20]; TRACE_1("Final strength for player",_strength); - //Add ace_medical pain effect: if ((isClass (configFile >> "CfgPatches" >> "ACE_Medical")) && {_strength > 0.1}) then { [ACE_player, (_strength / 2)] call EFUNC(medical,adjustPainLevel); @@ -93,7 +89,7 @@ _affected = _grenade nearEntities ["CAManBase", 20]; //Delete the light after 0.1 seconds [{ - PARAMS_1(_light); + params ["_light"]; deleteVehicle _light; }, [_light], 0.1] call EFUNC(common,waitAndExecute); @@ -105,7 +101,7 @@ _affected = _grenade nearEntities ["CAManBase", 20]; //PARTIALRECOVERY - start decreasing effect over ACE_time [{ - PARAMS_1(_strength); + params ["_strength"]; GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength); }, [_strength], (7 * _strength), 0] call EFUNC(common,waitAndExecute); @@ -117,4 +113,5 @@ _affected = _grenade nearEntities ["CAManBase", 20]; }; }; }; -} forEach _affected; + true +} count _affected; diff --git a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf index 377793ca7b..f0e2406b53 100644 --- a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf +++ b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf @@ -6,7 +6,7 @@ * 0: projectile - Flashbang Grenade * * Return Value: - * Nothing + * None * * Example: * [theFlashbang] call ace_grenades_fnc_flashbangThrownFuze @@ -14,12 +14,11 @@ * Public: No */ #include "script_component.hpp" - -PARAMS_1(_projectile); +params ["_projectile"]; if (alive _projectile) then { playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; - + private "_affected"; _affected = _projectile nearEntities ["CAManBase", 50]; ["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent); diff --git a/addons/grenades/functions/fnc_nextMode.sqf b/addons/grenades/functions/fnc_nextMode.sqf index 913906b8f8..7789e12ac4 100644 --- a/addons/grenades/functions/fnc_nextMode.sqf +++ b/addons/grenades/functions/fnc_nextMode.sqf @@ -3,7 +3,7 @@ * Select the next throwing mode and display message. * * Arguments: - * Nothing + * None * * Return Value: * Handeled diff --git a/addons/grenades/functions/fnc_throwGrenade.sqf b/addons/grenades/functions/fnc_throwGrenade.sqf index c7bc09a261..03e67a152a 100644 --- a/addons/grenades/functions/fnc_throwGrenade.sqf +++ b/addons/grenades/functions/fnc_throwGrenade.sqf @@ -12,7 +12,7 @@ * 6: projectile - Object of the projectile that was shot * * Return Value: - * Nothing + * None * * Example: * [clientFiredBIS-XEH] call ace_grenades_fnc_throwGrenade @@ -21,11 +21,8 @@ */ #include "script_component.hpp" -private ["_unit", "_weapon", "_projectile", "_mode", "_fuzeTime"]; - -_unit = _this select 0; -_weapon = _this select 1; -_projectile = _this select 6; +private ["_mode", "_fuzeTime"]; +params ["_unit", "_weapon", "", "", "", "", "_projectile"]; if (_unit != ACE_player) exitWith {}; if (_weapon != "Throw") exitWith {}; diff --git a/addons/grenades/textures/ace_m84.rvmat b/addons/grenades/textures/ace_m84.rvmat index e668125e70..1bfb6ffc0f 100644 --- a/addons/grenades/textures/ace_m84.rvmat +++ b/addons/grenades/textures/ace_m84.rvmat @@ -8,85 +8,85 @@ PixelShaderID = "Super"; VertexShaderID = "Super"; class Stage1 { - texture = "z\ace\addons\grenades\textures\ace_m84_nohq.paa"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; + texture = "z\ace\addons\grenades\textures\ace_m84_nohq.paa"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; }; class Stage2 { - texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; - uvSource = "tex"; - class uvTransform - { - aside[] = {0,9,0}; - up[] = {4.5,0,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; + texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {0,9,0}; + up[] = {4.5,0,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; }; class Stage3 { - texture = "#(argb,8,8,3)color(0.5,0.5,0.5,0,MC)"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; + texture = "#(argb,8,8,3)color(0.5,0.5,0.5,0,MC)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; }; class Stage4 { - texture = "#(argb,8,8,3)color(1,1,1,1,AS)"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; + texture = "#(argb,8,8,3)color(1,1,1,1,AS)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; }; class Stage5 { - texture = "z\ace\addons\grenades\textures\ace_m84_smdi.paa"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; + texture = "z\ace\addons\grenades\textures\ace_m84_smdi.paa"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; }; class Stage6 { - texture = "#(ai,16,2,2)fresnel(10.4,8.3)"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,1}; - pos[] = {0,0,0}; - }; + texture = "#(ai,16,2,2)fresnel(10.4,8.3)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; }; class Stage7 { - texture = "a3\data_f\env_land_co.paa"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; -}; \ No newline at end of file + texture = "a3\data_f\env_land_co.paa"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; +}; diff --git a/addons/hearing/ACE_Settings.hpp b/addons/hearing/ACE_Settings.hpp index c0f69dda65..867914b857 100644 --- a/addons/hearing/ACE_Settings.hpp +++ b/addons/hearing/ACE_Settings.hpp @@ -2,6 +2,8 @@ class ACE_Settings { class GVAR(EnableCombatDeafness) { value = 1; typeName = "BOOL"; + displayName = CSTRING(CombatDeafness_DisplayName); + description = CSTRING(CombatDeafness_Description); }; class GVAR(EarplugsVolume) { value = 0.5; diff --git a/addons/hearing/CfgVehicles.hpp b/addons/hearing/CfgVehicles.hpp index 1cf06910b0..44ea8f734f 100644 --- a/addons/hearing/CfgVehicles.hpp +++ b/addons/hearing/CfgVehicles.hpp @@ -109,6 +109,27 @@ class CfgVehicles { typeName = "BOOL"; defaultValue = 1; }; + class DisableEarRinging { + displayName = CSTRING(DisableEarRinging); + typeName = "NUMBER"; + class values { + class DoNotForce { + default = 1; + name = ECSTRING(common,DoNotForce); + value = -1; + }; + /* Probably don't want to allow forcing ear ringing for people who have serious problems with the effect + class NotDisabled { + name = ECSTRING(common,No); + value = 0; + }; + */ + class IsDisabled { + name = ECSTRING(common,Yes); + value = 1; + }; + }; + }; }; class ModuleDescription { description = CSTRING(Module_Description); diff --git a/addons/hearing/functions/fnc_moduleHearing.sqf b/addons/hearing/functions/fnc_moduleHearing.sqf index 7b78ac581b..6ec0af0231 100644 --- a/addons/hearing/functions/fnc_moduleHearing.sqf +++ b/addons/hearing/functions/fnc_moduleHearing.sqf @@ -16,4 +16,9 @@ if !(_activated) exitWith {}; [_logic, QGVAR(enableCombatDeafness), "EnableCombatDeafness"] call EFUNC(common,readSettingFromModule); +// Do Not Force - read module setting only non-default is set due to using SCALAR +if ((_logic getVariable "DisableEarRinging") != -1) then { + [_logic, QGVAR(DisableEarRinging), "DisableEarRinging"] call EFUNC(common,readSettingFromModule); +}; + diag_log text "[ACE]: Hearing Module Initialized."; diff --git a/addons/hearing/stringtable.xml b/addons/hearing/stringtable.xml index dbd063b752..a3af102580 100644 --- a/addons/hearing/stringtable.xml +++ b/addons/hearing/stringtable.xml @@ -126,7 +126,7 @@ Ativar surdez em combate? - Enable combat deafness? + Reduces the hearing ability as the player takes hearing damage Możliwość chwilowej utraty słuchu przy głośnych wystrzałach i jednoczesnym braku włożonych stoperów Habilita la sordera de combate Aktiviere Taubheit im Gefecht? @@ -134,7 +134,7 @@ Ativar surdez em combate? - + Controls combat deafness and ear ringing. When activated, players can be deafened when a gun is fired in their vicinity or an explosion takes place without hearing protection Głuchota bojowa pojawia się w momentach, kiedy stoimy w pobliżu broni wielkokalibrowej bez ochrony słuchu, lub np. podczas ostrzału artyleryjskiego. Moduł ten pozwala na włączenie lub wyłączenie tego efektu. Dieses Modul aktiviert/deaktiviert die Taubheit im Gefecht. Wenn aktiviert, können Spieler ohne Gehörschutz taub werden, wenn eine Waffe in ihrer Nähe abgefeuert wird oder eine Explosion stattfindet. Ztráta sluchu je možná ve chvíly, kdy se v bezprostřední blízkosti střílí z velkorážní zbraně nebo při bombardování a osoba je bez ochrany sluchu (např. špunty). Tento modul umožňuje tuto věc povolit nebo zakázat. diff --git a/addons/hitreactions/functions/fnc_fallDown.sqf b/addons/hitreactions/functions/fnc_fallDown.sqf index b979d09a4f..7fa6453fe2 100644 --- a/addons/hitreactions/functions/fnc_fallDown.sqf +++ b/addons/hitreactions/functions/fnc_fallDown.sqf @@ -1,11 +1,7 @@ // by commy2 #include "script_component.hpp" -private ["_unit", "_firer", "_damage"]; - -_unit = _this select 0; -_firer = _this select 1; -_damage = _this select 2; +params ["_unit", "_firer", "_damage"]; // don't fall on collision damage if (_unit == _firer) exitWith {}; diff --git a/addons/interact_menu/ACE_Settings.hpp b/addons/interact_menu/ACE_Settings.hpp index ea4d4699ed..381405987c 100644 --- a/addons/interact_menu/ACE_Settings.hpp +++ b/addons/interact_menu/ACE_Settings.hpp @@ -3,12 +3,14 @@ class ACE_Settings { value = 0; typeName = "BOOL"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(AlwaysUseCursorSelfInteraction); }; class GVAR(cursorKeepCentered) { value = 0; typeName = "BOOL"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(cursorKeepCentered); description = CSTRING(cursorKeepCenteredDescription); }; @@ -16,42 +18,49 @@ class ACE_Settings { value = 0; typeName = "BOOL"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(AlwaysUseCursorInteraction); }; class GVAR(UseListMenu) { value = 0; typeName = "BOOL"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(UseListMenu); }; class GVAR(colorTextMax) { value[] = {1, 1, 1, 1}; typeName = "COLOR"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(ColorTextMax); }; class GVAR(colorTextMin) { value[] = {1, 1, 1, 0.25}; typeName = "COLOR"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(ColorTextMin); }; class GVAR(colorShadowMax) { value[] = {0, 0, 0, 1}; typeName = "COLOR"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(ColorShadowMax); }; class GVAR(colorShadowMin) { value[] = {0, 0, 0, 0.25}; typeName = "COLOR"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(ColorShadowMin); }; class GVAR(textSize) { value = 2; typeName = "SCALAR"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(textSize); values[] = {"$str_very_small", "$str_small", "$str_medium", "$str_large", "$str_very_large"}; }; @@ -59,6 +68,7 @@ class ACE_Settings { value = 2; typeName = "SCALAR"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(shadowSetting); description = CSTRING(shadowSettingDescription); values[] = {"$STR_A3_OPTIONS_DISABLED", "$STR_A3_OPTIONS_ENABLED", CSTRING(shadowOutline)}; @@ -67,12 +77,14 @@ class ACE_Settings { value = 1; typeName = "BOOL"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(ActionOnKeyRelease); }; class GVAR(menuBackground) { value = 0; typeName = "SCALAR"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(background); values[] = {"$STR_A3_OPTIONS_DISABLED", CSTRING(backgroundBlur), CSTRING(backgroundBlack)}; }; @@ -80,6 +92,7 @@ class ACE_Settings { value = 0; typeName = "BOOL"; isClientSettable = 1; + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(addBuildingActions); description = CSTRING(addBuildingActionsDescription); }; diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index c656ab9056..73b543250e 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -4,6 +4,7 @@ ADDON = false; PREP(addActionToClass); PREP(addActionToObject); +PREP(addMainAction); PREP(compileMenu); PREP(compileMenuSelfAction); PREP(compileMenuZeus); diff --git a/addons/interact_menu/functions/fnc_addActionToClass.sqf b/addons/interact_menu/functions/fnc_addActionToClass.sqf index 7a8278c72d..4d300d35a2 100644 --- a/addons/interact_menu/functions/fnc_addActionToClass.sqf +++ b/addons/interact_menu/functions/fnc_addActionToClass.sqf @@ -19,7 +19,9 @@ */ #include "script_component.hpp" -EXPLODE_4_PVT(_this,_objectType,_typeNum,_parentPath,_action); +if (!params [["_objectType", "", [""]], ["_typeNum", 0, [0]], ["_parentPath", [], [[]]], ["_action", [], [[]], 11]]) exitWith { + ERROR("Bad Params"); +}; // Ensure the config menu was compiled first if (_typeNum == 0) then { @@ -35,8 +37,15 @@ if((count _actionTrees) == 0) then { missionNamespace setVariable [_varName, _actionTrees]; }; +if (_parentPath isEqualTo ["ACE_MainActions"]) then { + [_objectType, _typeNum] call FUNC(addMainAction); +}; + _parentNode = [_actionTrees, _parentPath] call FUNC(findActionNode); -if (isNil {_parentNode}) exitWith {}; +if (isNil {_parentNode}) exitWith { + ERROR("Failed to add action"); + diag_log text format ["action (%1) to parent %2 on object %3 [%4]", (_action select 0), _parentPath, _objectType, _typeNum]; +}; // Add action node as children of the correct node of action tree (_parentNode select 1) pushBack [_action,[]]; diff --git a/addons/interact_menu/functions/fnc_addActionToObject.sqf b/addons/interact_menu/functions/fnc_addActionToObject.sqf index 5c736a2da6..8cd2270d48 100644 --- a/addons/interact_menu/functions/fnc_addActionToObject.sqf +++ b/addons/interact_menu/functions/fnc_addActionToObject.sqf @@ -19,7 +19,9 @@ */ #include "script_component.hpp" -EXPLODE_4_PVT(_this,_object,_typeNum,_parentPath,_action); +if (!params [["_object", objNull, [objNull]], ["_typeNum", 0, [0]], ["_parentPath", [], [[]]], ["_action", [], [[]], 11]]) exitWith { + ERROR("Bad Params"); +}; private ["_varName","_actionList"]; _varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum; @@ -28,6 +30,10 @@ if((count _actionList) == 0) then { _object setVariable [_varName, _actionList]; }; +if (_parentPath isEqualTo ["ACE_MainActions"]) then { + [(typeOf _object), _typeNum] call FUNC(addMainAction); +}; + // Add action and parent path to the list of object actions _actionList pushBack [_action, +_parentPath]; diff --git a/addons/interact_menu/functions/fnc_addMainAction.sqf b/addons/interact_menu/functions/fnc_addMainAction.sqf new file mode 100644 index 0000000000..cf2a3f51d4 --- /dev/null +++ b/addons/interact_menu/functions/fnc_addMainAction.sqf @@ -0,0 +1,31 @@ +/* + * Author: Jonpas, PabstMirror + * Makes sure there is a ACE_MainActions on the object type + * + * Argument: + * 0: Object classname + * 1: Type of action, 0 for actions, 1 for self-actions + * + * Return value: + * None + * + * Example: + * ["Table", 0] call ace_interact_menu_fnc_addMainAction; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_objectType", "_typeNum"]; + +private["_actionTrees", "_mainAction", "_parentNode", "_varName"]; + +_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType]; +_actionTrees = missionNamespace getVariable [_varName, []]; +_parentNode = [_actionTrees, ["ACE_MainActions"]] call FUNC(findActionNode); + +if (isNil {_parentNode}) then { + TRACE_2("No Main Action on object", _objectType, _typeNum); + _mainAction = ["ACE_MainActions", localize ELSTRING(interaction,MainAction), "", {}, {true}] call FUNC(createAction); + [_objectType, _typeNum, [], _mainAction] call EFUNC(interact_menu,addActionToClass); +}; diff --git a/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf index 62d9ca1094..4da303f618 100644 --- a/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf +++ b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf @@ -14,8 +14,8 @@ */ #include "script_component.hpp" -EXPLODE_3_PVT(_this,_object,_origAction,_parentPath); -EXPLODE_2_PVT(_origAction,_origActionData,_origActionChildren); +params ["_object", "_origAction", "_parentPath"]; +_origAction params ["_origActionData", "_origActionChildren"]; private ["_target","_player","_fullPath","_activeChildren","_dynamicChildren","_action","_actionData","_x"]; diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index cf4db7aab1..6dd4c5ee74 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp"; -EXPLODE_1_PVT(_this,_target); +params ["_target"]; private ["_objectType","_actionsVarName","_isMan"]; _objectType = _target; @@ -29,7 +29,7 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {}; private "_recurseFnc"; _recurseFnc = { private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_position", "_condition", "_showDisabled", "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"]; - EXPLODE_1_PVT(_this,_actionsCfg); + params ["_actionsCfg"]; _actions = []; { diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf index a34c45f504..910b8893c6 100644 --- a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp"; -EXPLODE_1_PVT(_this,_target); +params ["_target"]; private ["_objectType","_actionsVarName","_isMan"]; _objectType = _target; @@ -30,7 +30,7 @@ private "_recurseFnc"; _recurseFnc = { private ["_actions", "_displayName", "_icon", "_statement", "_condition", "_showDisabled", "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"]; - EXPLODE_1_PVT(_this,_actionsCfg); + params ["_actionsCfg"]; _actions = []; { diff --git a/addons/interact_menu/functions/fnc_compileMenuZeus.sqf b/addons/interact_menu/functions/fnc_compileMenuZeus.sqf index 9dc212ac40..ef7c36abc9 100644 --- a/addons/interact_menu/functions/fnc_compileMenuZeus.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuZeus.sqf @@ -19,7 +19,7 @@ private "_recurseFnc"; _recurseFnc = { private ["_actions", "_displayName", "_icon", "_statement", "_condition", "_showDisabled", "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"]; - EXPLODE_1_PVT(_this,_actionsCfg); + params ["_actionsCfg"]; _actions = []; { diff --git a/addons/interact_menu/functions/fnc_createAction.sqf b/addons/interact_menu/functions/fnc_createAction.sqf index 6845683044..256984c104 100644 --- a/addons/interact_menu/functions/fnc_createAction.sqf +++ b/addons/interact_menu/functions/fnc_createAction.sqf @@ -26,56 +26,31 @@ */ #include "script_component.hpp" -EXPLODE_5_PVT(_this,_actionName,_displayName,_icon,_statement,_condition); +params [ + "_actionName", + "_displayName", + "_icon", + "_statement", + "_condition", + ["_insertChildren", {}], + ["_customParams", []], + ["_position", {[0, 0, 0]}], + ["_distance", 2], + ["_params", [false, false, false, false, false]], + ["_modifierFunction", {}] +]; -// IGNORE_PRIVATE_WARNING(_target); -private ["_insertChildren","_customParams","_position","_distance","_params", "_modifierFunction"]; - -_insertChildren = if (count _this > 5) then { - _this select 5 -} else { - {} -}; - -_customParams = if (count _this > 6) then { - _this select 6 -} else { - [] -}; - -_position = if (count _this > 7) then { - if (typeName (_this select 7) == "STRING") then { +_position = if (typeName (_position) == "STRING") then { // If the action is set to a selection, create the suitable code - compile format ["_target selectionPosition '%1'", _this select 7]; + compile format ["_target selectionPosition '%1'", _position]; } else { - if (typeName (_this select 7) == "ARRAY") then { + if (typeName (_position) == "ARRAY") then { // If the action is set to a array position, create the suitable code - compile format ["%1", _this select 7]; + compile format ["%1", _position]; } else { - _this select 7 + _position; }; - } -} else { - {[0,0,0]} -}; - -_distance = if (count _this > 8) then { - _this select 8 -} else { - 2 -}; - -_params = if (count _this > 9) then { - _this select 9 -} else { - [false,false,false,false,false] -}; - -_modifierFunction = if (count _this > 10) then { - _this select 10 -} else { - {} -}; + }; [ _actionName, diff --git a/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf b/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf index b5d6a4e967..13b241e1d1 100644 --- a/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf +++ b/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf @@ -1,11 +1,7 @@ // by commy2 #include "script_component.hpp" -private ["_ctrl", "_index", "_text"]; - -_ctrl = _this select 0; -_index = _this select 1; -_text = _this select 2; +params ["_ctrl", "_index", "_text"]; //systemChat str (_text != ARR_SELECT(GVAR(ParsedTextCached),_index,"-1")); diff --git a/addons/interact_menu/functions/fnc_findActionNode.sqf b/addons/interact_menu/functions/fnc_findActionNode.sqf index b8639754d2..41ab658a62 100644 --- a/addons/interact_menu/functions/fnc_findActionNode.sqf +++ b/addons/interact_menu/functions/fnc_findActionNode.sqf @@ -8,7 +8,7 @@ * 1: Path * * Return value: - * Action node . + * Action node or if not found * * Example: * [_actionTree, ["ACE_TapShoulderRight","VulcanPinchAction"]] call ace_interact_menu_fnc_findActionNode; @@ -17,7 +17,7 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_actionTreeList,_parentPath); +params ["_actionTreeList", "_parentPath"]; private ["_parentNode", "_foundParentNode", "_fnc_findFolder", "_actionTree"]; @@ -31,10 +31,10 @@ _parentNode = [[],_actionTreeList]; _foundParentNode = false; _fnc_findFolder = { - EXPLODE_3_PVT(_this,_parentPath,_level,_actionNode); + params ["_parentPath", "_level", "_actionNode"]; { - EXPLODE_2_PVT(_x,_actionData,_actionChildren); + _x params ["_actionData", "_actionChildren"]; if ((_actionData select 0) isEqualTo (_parentPath select _level)) exitWith { if (count _parentPath == _level + 1) exitWith { diff --git a/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf index cb21d218db..a0962d7883 100644 --- a/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf +++ b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf @@ -11,7 +11,7 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_newUnit,_oldUnit); +params ["_newUnit", "_oldUnit"]; // add to new unit private "_ehid"; diff --git a/addons/interact_menu/functions/fnc_isSubPath.sqf b/addons/interact_menu/functions/fnc_isSubPath.sqf index ec22b0aa9e..0a02fe2ea7 100644 --- a/addons/interact_menu/functions/fnc_isSubPath.sqf +++ b/addons/interact_menu/functions/fnc_isSubPath.sqf @@ -13,7 +13,7 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_longPath,_shortPath); +params ["_longPath", "_shortPath"]; private ["_isSubPath","_i"]; _isSubPath = true; diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index 5bf156b69e..ca06e25eb6 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" -EXPLODE_1_PVT(_this,_menuType); +params ["_menuType"]; if (GVAR(openedMenuType) == _menuType) exitWith {true}; diff --git a/addons/interact_menu/functions/fnc_keyUp.sqf b/addons/interact_menu/functions/fnc_keyUp.sqf index 02e2d4db01..86580afa67 100644 --- a/addons/interact_menu/functions/fnc_keyUp.sqf +++ b/addons/interact_menu/functions/fnc_keyUp.sqf @@ -12,8 +12,7 @@ */ #include "script_component.hpp" -private "_calledByClicking"; -_calledByClicking = _this select 1; +params ["_menuType", "_calledByClicking"]; // Exit if there's no menu opened if (GVAR(openedMenuType) < 0) exitWith {true}; diff --git a/addons/interact_menu/functions/fnc_removeActionFromClass.sqf b/addons/interact_menu/functions/fnc_removeActionFromClass.sqf index 3959d7d0b1..c95f53f152 100644 --- a/addons/interact_menu/functions/fnc_removeActionFromClass.sqf +++ b/addons/interact_menu/functions/fnc_removeActionFromClass.sqf @@ -17,11 +17,11 @@ */ #include "script_component.hpp" -EXPLODE_3_PVT(_this,_objectType,_typeNum,_fullPath); +params ["_objectType", "_typeNum", "_fullPath"]; private ["_res","_varName","_actionTrees", "_parentNode", "_found"]; _res = _fullPath call FUNC(splitPath); -EXPLODE_2_PVT(_res,_parentPath,_actionName); +_res params ["_parentPath", "_actionName"]; _varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType]; _actionTrees = missionNamespace getVariable [_varName, []]; diff --git a/addons/interact_menu/functions/fnc_removeActionFromObject.sqf b/addons/interact_menu/functions/fnc_removeActionFromObject.sqf index bab740c578..e630bf4ad1 100644 --- a/addons/interact_menu/functions/fnc_removeActionFromObject.sqf +++ b/addons/interact_menu/functions/fnc_removeActionFromObject.sqf @@ -17,11 +17,11 @@ */ #include "script_component.hpp" -EXPLODE_3_PVT(_this,_object,_typeNum,_fullPath); +params ["_object", "_typeNum", "_fullPath"]; private ["_res","_varName","_actionList"]; _res = _fullPath call FUNC(splitPath); -EXPLODE_2_PVT(_res,_parentPath,_actionName); +_res params ["_parentPath", "_actionName"]; _varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum; _actionList = _object getVariable [_varName, []]; diff --git a/addons/interact_menu/functions/fnc_renderActionPoints.sqf b/addons/interact_menu/functions/fnc_renderActionPoints.sqf index 80bff14793..81a6887f97 100644 --- a/addons/interact_menu/functions/fnc_renderActionPoints.sqf +++ b/addons/interact_menu/functions/fnc_renderActionPoints.sqf @@ -78,7 +78,7 @@ _fnc_renderNearbyActions = { _fnc_renderLastFrameActions = { { - EXPLODE_3_PVT(_x,_target,_action,_objectActionList); + _x params ["_target", "_action", "_objectActionList"]; GVAR(objectActionList) = _objectActionList; [_target, _action] call FUNC(renderBaseMenu); @@ -176,6 +176,6 @@ if (count GVAR(collectedActionPoints) > 1) then { // Render the non-ocluded points { - EXPLODE_3_PVT(_x,_z,_sPos,_activeActionTree); + _x params ["_z", "_sPos", "_activeActionTree"]; [[], _activeActionTree, _sPos, [180,360]] call FUNC(renderMenu); } forEach GVAR(collectedActionPoints); diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf index 5330bbebd2..a5ccabf3bf 100644 --- a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -18,8 +18,8 @@ BEGIN_COUNTER(fnc_renderBaseMenu) private ["_distance","_pos","_weaponDir","_ref","_sPos","_activeActionTree", "_line"]; -EXPLODE_2_PVT(_this,_object,_baseActionNode); -EXPLODE_1_PVT(_baseActionNode,_actionData); +params ["_object", "_baseActionNode"]; +_baseActionNode params ["_actionData"]; _distance = _actionData select 8; diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index 44a280a52e..ab909964de 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -16,7 +16,8 @@ #include "script_component.hpp" #define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa) private ["_ctrl", "_pos", "_displayNum"]; -PARAMS_4(_text,_icon,_sPos,_textSettings); + +params ["_text", "_icon", "_sPos", "_textSettings"]; //systemChat format ["Icon %1 - %2,%3", _text, _sPos select 0, _sPos select 1]; diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index a82b82dcb7..21c434fe03 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -17,9 +17,9 @@ private ["_menuInSelectedPath", "_path", "_menuDepth", "_x", "_offset", "_newPos", "_forEachIndex", "_player", "_pos", "_target", "_textSettings"]; -EXPLODE_4_PVT(_this,_parentPath,_action,_sPos,_angles); -EXPLODE_3_PVT(_action,_actionData,_activeChildren,_actionObject); -EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan); +params ["_parentPath", "_action", "_sPos", "_angles"]; +_action params ["_actionData", "_activeChildren", "_actionObject"]; +_angles params ["_centerAngle", "_maxAngleSpan"]; _menuDepth = (count GVAR(menuDepthPath)); diff --git a/addons/interact_menu/functions/fnc_renderSelector.sqf b/addons/interact_menu/functions/fnc_renderSelector.sqf index 96a495c715..17ded20903 100644 --- a/addons/interact_menu/functions/fnc_renderSelector.sqf +++ b/addons/interact_menu/functions/fnc_renderSelector.sqf @@ -13,7 +13,7 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_sPos,_icon); +params ["_sPos", "_icon"]; private ["_displayNum", "_ctrl", "_pos"]; diff --git a/addons/interact_menu/functions/fnc_setupTextColors.sqf b/addons/interact_menu/functions/fnc_setupTextColors.sqf index e54d529668..c23d68cfd3 100644 --- a/addons/interact_menu/functions/fnc_setupTextColors.sqf +++ b/addons/interact_menu/functions/fnc_setupTextColors.sqf @@ -16,7 +16,7 @@ private ["_menuDepth", "_mixColor", "_pathCount", "_row", "_shadowColor", "_text //Mixes 2 colors (number arrays) and makes a color string "#AARRGGBB" for structured text _mixColor = { - PARAMS_3(_color1,_color2,_ratio); + params ["_color1", "_color2", "_ratio"]; private ["_return", "_mix", "_index"]; _return = ""; for "_index" from 0 to 3 do { diff --git a/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf b/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf index 9143db0d4d..fdd7d14573 100644 --- a/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf +++ b/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -PARAMS_1(_interactionType); +params ["_interactionType"]; //Ignore if not enabled: if (!GVAR(addBuildingActions)) exitWith {}; @@ -27,8 +27,8 @@ if ((vehicle ACE_player) != ACE_player) exitWith {}; [{ private ["_nearBuidlings", "_typeOfHouse", "_houseBeingScaned", "_actionSet", "_memPoints", "_memPointsActions", "_helperPos", "_helperObject"]; - PARAMS_2(_args,_pfID); - EXPLODE_4_PVT(_args,_setPosition,_addedHelpers,_housesScaned,_housesToScanForActions); + params ["_args", "_pfID"]; + _args params ["_setPosition", "_addedHelpers", "_housesScaned", "_housesToScanForActions"]; if (!EGVAR(interact_menu,keyDown)) then { {deleteVehicle _x;} forEach _addedHelpers; @@ -75,7 +75,7 @@ if ((vehicle ACE_player) != ACE_player) exitWith {}; _housesScaned pushBack _houseBeingScaned; _actionSet = [_typeOfHouse] call FUNC(userActions_getHouseActions); - EXPLODE_2_PVT(_actionSet,_memPoints,_memPointsActions); + _actionSet params ["_memPoints", "_memPointsActions"]; // systemChat format ["Add Actions for [%1] (count %2) @ %3", _typeOfHouse, (count _memPoints), diag_tickTime]; { diff --git a/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf b/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf index 0b3d4347c7..dee82fd939 100644 --- a/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf +++ b/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" -PARAMS_1(_typeOfBuilding); +params ["_typeOfBuilding"]; private["_action", "_actionDisplayName", "_actionDisplayNameDefault", "_actionMaxDistance", "_actionOffset", "_actionPath", "_actionPosition", "_building", "_configPath", "_endIndex", "_iconImage", "_index", "_ladders", "_memPointIndex", "_memPoints", "_memPointsActions", "_startIndex"]; @@ -24,7 +24,7 @@ _memPointsActions = []; //Get the offset for a memory point: _fnc_getMemPointOffset = { - PARAMS_1(_memoryPoint); + params ["_memoryPoint"]; _memPointIndex = _memPoints find _memoryPoint; _actionOffset = [0,0,0]; if (_memPointIndex == -1) then { @@ -38,14 +38,14 @@ _fnc_getMemPointOffset = { // Add UserActions for the building: _fnc_userAction_Statement = { - PARAMS_3(_target,_player,_variable); - EXPLODE_2_PVT(_variable,_actionStatement,_actionCondition); + params ["_target", "_player", "_variable"]; + _variable params ["_actionStatement", "_actionCondition"]; this = _target getVariable [QGVAR(building), objNull]; call _actionStatement; }; _fnc_userAction_Condition = { - PARAMS_3(_target,_player,_variable); - EXPLODE_2_PVT(_variable,_actionStatement,_actionCondition); + params ["_target", "_player", "_variable"]; + _variable params ["_actionStatement", "_actionCondition"]; this = _target getVariable [QGVAR(building), objNull]; if (isNull this) exitWith {false}; call _actionCondition; @@ -84,29 +84,29 @@ for "_index" from 0 to ((count _configPath) - 1) do { // Add Ladder Actions for the building: _fnc_ladder_ladderUp = { - PARAMS_3(_target,_player,_variable); - EXPLODE_1_PVT(_variable,_ladderIndex); + params ["_target", "_player", "_variable"]; + _variable params ["_ladderIndex"]; _building = _target getVariable [QGVAR(building), objNull]; TRACE_3("Ladder Action - UP",_player,_building,_ladderIndex); _player action ["LadderUp", _building, _ladderIndex, 0]; }; _fnc_ladder_ladderDown = { - PARAMS_3(_target,_player,_variable); - EXPLODE_1_PVT(_variable,_ladderIndex); + params ["_target", "_player", "_variable"]; + _variable params ["_ladderIndex"]; _building = _target getVariable [QGVAR(building), objNull]; TRACE_3("Ladder Action - Down",_player,_building,_ladderIndex); _player action ["LadderDown", _building, _ladderIndex, 1]; }; _fnc_ladder_conditional = { - PARAMS_2(_target,_player); + params ["_target", "_player"]; //(Check distance < 2) and (Don't show actions if on a ladder) ((_target distance _player) < 2) && {((getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _player) >> "onLadder")) == 0)} }; _ladders = getArray (configFile >> "CfgVehicles" >> _typeOfBuilding >> "ladders"); { - EXPLODE_2_PVT(_x,_ladderBottomMemPoint,_ladderTopMemPoint); + _x params ["_ladderBottomMemPoint", "_ladderTopMemPoint"]; _actionMaxDistance = 3; //interact_menu will check head -> target's offset; leave this high and do a precice distance check in condition diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml index b55e8483a1..5bd8aefe21 100644 --- a/addons/interact_menu/stringtable.xml +++ b/addons/interact_menu/stringtable.xml @@ -267,5 +267,9 @@ Přidá možnost interakce pro otevření dvěří a umistňovat žebříky na budovy. (Poznámka: Použití této možnosti snižuje výkon při otevírání pomocí interakčního menu, zejména ve velkých městech.) Añade las acciones de interacción para la apertura de puertas y montaje de escaleras en los edificios. (Nota: Hay un coste de rendimiento al abrir el menú de interacción, especialmente en las ciudades) + + Interaction Menu + Menu interakcji + - + \ No newline at end of file diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 17c271f372..997974d2e3 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -91,7 +91,7 @@ class CfgVehicles { class ACE_JoinGroup { displayName = CSTRING(JoinGroup); - condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinGroup)); + condition = QUOTE(GVAR(EnableTeamManagement) && {[ARR_2(_player,_target)] call DFUNC(canJoinGroup)}); statement = QUOTE([_player] joinSilent group _target); showDisabled = 0; priority = 2.6; @@ -351,7 +351,7 @@ class CfgVehicles { hotkey = "7"; }; class ACE_Gesture_Yes { - displayName = CSTRING(Gestures_Yes); + displayName = ECSTRING(common,Yes); condition = QUOTE(canStand _target); statement = QUOTE(_target playActionNow ([ARR_2('gestureYes','gestureNod')] select floor random 2);); showDisabled = 1; @@ -359,7 +359,7 @@ class CfgVehicles { hotkey = "8"; }; class ACE_Gesture_No { - displayName = CSTRING(Gestures_No); + displayName = ECSTRING(common,No); condition = QUOTE(canStand _target); statement = QUOTE(_target playActionNow 'gestureNo';); showDisabled = 1; @@ -548,7 +548,7 @@ class CfgVehicles { }; }; }; - + class StaticMGWeapon: StaticWeapon {}; class HMG_01_base_F: StaticMGWeapon {}; class HMG_01_high_base_F: HMG_01_base_F { @@ -557,14 +557,14 @@ class CfgVehicles { position = "[-0.172852,0.164063,-0.476091]"; }; }; - }; + }; class AA_01_base_F: StaticMGWeapon { class ACE_Actions: ACE_Actions { class ACE_MainActions: ACE_MainActions { position = "[0,0.515869,-0.200671]"; }; }; - }; + }; class AT_01_base_F: StaticMGWeapon { class ACE_Actions: ACE_Actions { class ACE_MainActions: ACE_MainActions { @@ -592,4 +592,16 @@ class CfgVehicles { }; class ACE_SelfActions {}; }; + + class ACE_RepairItem_Base: thingX { + class ACE_Actions { + class ACE_MainActions { + displayName = CSTRING(MainAction); + selection = ""; + distance = 2; + condition = "true"; + }; + }; + class ACE_SelfActions {}; + }; }; diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 5bd3282872..4f1df733b7 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -385,30 +385,6 @@ Olá Ciao - - Yes - Ja - Si - Tak - Ano - Oui - Да - Igen - Sim - Si - - - No - Nein - No - Nie - Ne - Non - Нет - Nem - Não - No - Put weapon on back Waffe wegstecken diff --git a/addons/laser/initKeybinds.sqf b/addons/laser/initKeybinds.sqf index 5e3d017103..25fdd2ddcc 100644 --- a/addons/laser/initKeybinds.sqf +++ b/addons/laser/initKeybinds.sqf @@ -1,9 +1,9 @@ ["ACE3 Equipment", QGVAR(LaserCodeUp), localize LSTRING(laserCodeUp), { - if( EGVAR(laser_selfdesignate,active) - || + if( EGVAR(laser_selfdesignate,active) + || { (currentWeapon ACE_player) == "Laserdesignator" && (call CBA_fnc_getFoV) select 1 > 5 } // If laserdesignator & FOV, we are in scope. - || + || { [ACE_player] call FUNC(unitTurretCanLockLaser) } ) then { [] call FUNC(keyLaserCodeUp); @@ -14,14 +14,14 @@ ["ACE3 Equipment", QGVAR(LaserCodeDown), localize LSTRING(laserCodeDown), { - if( EGVAR(laser_selfdesignate,active) - || + if( EGVAR(laser_selfdesignate,active) + || { (currentWeapon ACE_player) == "Laserdesignator" && (call CBA_fnc_getFoV) select 1 > 5 } // If laserdesignator & FOV, we are in scope. - || + || { [ACE_player] call FUNC(unitTurretCanLockLaser) } ) then { [] call FUNC(keyLaserCodeDown); }; }, {false}, -[18, [true, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+E) +[18, [false, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+E) diff --git a/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf index aaaac3077d..451753a9e2 100644 --- a/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf @@ -16,6 +16,6 @@ */ #include "script_component.hpp" -PARAMS_2(_caller,_target); +params ["_caller", "_target"]; ("ACE_UAVBattery" in (items _caller)) && {(fuel _target) < 1} && {(speed _target) < 1} && {!(isEngineOn _target)} && {(_target distance _caller) <= 4} diff --git a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf index e51f17777e..25f452882c 100644 --- a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf @@ -15,23 +15,21 @@ * Public: No */ #include "script_component.hpp" - -PARAMS_2(_caller,_target); - private ["_onFinish", "_onFailure"]; +params ["_caller", "_target"]; if (!(_this call FUNC(canRefuelUAV))) exitWith {}; _onFinish = { - EXPLODE_2_PVT((_this select 0),_caller,_target); - _caller removeItem "ACE_UAVBattery"; - playSound3D [QUOTE(PATHTO_R(sounds\exchange_battery.ogg)), objNull, false, getPosASL _caller, 1, 1, 10]; - ["setFuel", [_target], [_target, 1]] call EFUNC(common,targetEvent); //setFuel is local + (_this select 0) params ["_caller", "_target"]; + _caller removeItem "ACE_UAVBattery"; + playSound3D [QUOTE(PATHTO_R(sounds\exchange_battery.ogg)), objNull, false, getPosASL _caller, 1, 1, 10]; + ["setFuel", [_target], [_target, 1]] call EFUNC(common,targetEvent); //setFuel is local }; _onFailure = { - EXPLODE_2_PVT((_this select 0),_caller,_target); - [_caller, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); + (_this select 0) params ["_caller", "_target"]; + [_caller, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); }; [_caller, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp index 8b752ae67a..e38e71ac4b 100644 --- a/addons/main/script_mod.hpp +++ b/addons/main/script_mod.hpp @@ -5,7 +5,7 @@ #define MAJOR 3 #define MINOR 2 -#define PATCHLVL 1 +#define PATCHLVL 2 #define BUILD 0 #define VERSION MAJOR.MINOR.PATCHLVL.BUILD diff --git a/addons/map/config.cpp b/addons/map/config.cpp index 078c06b41d..16cfd2bc31 100644 --- a/addons/map/config.cpp +++ b/addons/map/config.cpp @@ -125,13 +125,6 @@ class RscDisplayDiary { }; }; }; - // scale up the compass - class objects { - class Compass: RscObject { - scale = 0.7; - zoomDuration = 0; - }; - }; }; // BRIEFING SCREEN @@ -149,13 +142,6 @@ class RscDisplayGetReady: RscDisplayMainMap { #include "MapControls.hpp" }; }; - // scale up the compass - class objects { - class Compass: RscObject { - scale = 0.7; - zoomDuration = 0; - }; - }; }; class RscDisplayClientGetReady: RscDisplayGetReady { // get rid of the "center to player position" - button (as it works even on elite) @@ -164,13 +150,6 @@ class RscDisplayClientGetReady: RscDisplayGetReady { #include "MapControls.hpp" }; }; - // scale up the compass - class objects { - class Compass: RscObject { - scale = 0.7; - zoomDuration = 0; - }; - }; }; class RscDisplayServerGetReady: RscDisplayGetReady { // get rid of the "center to player position" - button (as it works even on elite) @@ -179,11 +158,4 @@ class RscDisplayServerGetReady: RscDisplayGetReady { #include "MapControls.hpp" }; }; - // scale up the compass - class objects { - class Compass: RscObject { - scale = 0.7; - zoomDuration = 0; - }; - }; }; diff --git a/addons/maptools/functions/fnc_canUseMapTools.sqf b/addons/maptools/functions/fnc_canUseMapTools.sqf index 30d86160ab..7658c2c1d2 100644 --- a/addons/maptools/functions/fnc_canUseMapTools.sqf +++ b/addons/maptools/functions/fnc_canUseMapTools.sqf @@ -14,7 +14,13 @@ visibleMap && {alive ACE_player} && -{"ItemMap" in (assignedItems ACE_player)} && +{ + scopeName "hasMap"; + { + if (_x isKindOf ["ItemMap", configFile >> "CfgWeapons"]) exitWith {true breakOut "hasMap"}; + } forEach (assignedItems ACE_player); + false +} && {"ACE_MapTools" in (items ACE_player)} && {!GVAR(mapTool_isDragging)} && {!GVAR(mapTool_isRotating)} diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 079ae40506..d94ba333d2 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -4,8 +4,9 @@ class ACE_Medical_Actions { class Bandage { displayName = CSTRING(Bandage); displayNameProgress = CSTRING(Bandaging); - + category = "bandage"; treatmentLocations[] = {"All"}; + allowedSelections[] = {"All"}; requiredMedic = 0; treatmentTime = 5; treatmentTimeSelfCoef = 1; @@ -25,11 +26,13 @@ class ACE_Medical_Actions { animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic"; animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; - litter[] = { {"All", "", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}} }; + litter[] = { {"All", "_previousDamage > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, {"All", "_previousDamage <= 0", {"ACE_MedicalLitter_clean"}} }; }; class Morphine: Bandage { displayName = CSTRING(Inject_Morphine); displayNameProgress = CSTRING(Injecting_Morphine); + allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + category = "medication"; treatmentTime = 2; items[] = {"ACE_morphine"}; callbackSuccess = QUOTE(DFUNC(treatmentBasic_morphine)); @@ -39,6 +42,8 @@ class ACE_Medical_Actions { class Epinephrine: Bandage { displayName = CSTRING(Inject_Epinephrine); displayNameProgress = CSTRING(Injecting_Epinephrine); + allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + category = "medication"; requiredMedic = 1; treatmentTime = 3; items[] = {"ACE_epinephrine"}; @@ -49,6 +54,8 @@ class ACE_Medical_Actions { class BloodIV: Bandage { displayName = CSTRING(Transfuse_Blood); displayNameProgress = CSTRING(Transfusing_Blood); + allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + category = "advanced"; requiredMedic = 1; treatmentTime = 20; items[] = {"ACE_bloodIV"}; @@ -57,14 +64,17 @@ class ACE_Medical_Actions { litter[] = {}; }; class BloodIV_500: BloodIV { + category = "advanced"; items[] = {"ACE_bloodIV_500"}; }; class BloodIV_250: BloodIV { + category = "advanced"; items[] = {"ACE_bloodIV_250"}; }; class BodyBag: Bandage { displayName = CSTRING(PlaceInBodyBag); displayNameProgress = CSTRING(PlacingInBodyBag); + category = "advanced"; treatmentLocations[] = {"All"}; requiredMedic = 0; treatmentTime = 4; @@ -81,7 +91,9 @@ class ACE_Medical_Actions { class Diagnose: Bandage { displayName = CSTRING(Actions_Diagnose); displayNameProgress = CSTRING(Actions_Diagnosing); + category = "examine"; treatmentLocations[] = {"All"}; + allowedSelections[] = {"head"}; requiredMedic = 0; treatmentTime = 1; items[] = {}; @@ -97,10 +109,12 @@ class ACE_Medical_Actions { class Advanced { class FieldDressing { - displayName = CSTRING(Bandage); + displayName = CSTRING(Actions_FieldDressing); displayNameProgress = CSTRING(Bandaging); + category = "bandage"; // Which locations can this treatment action be used? Available: Field, MedicalFacility, MedicalVehicle, All. treatmentLocations[] = {"All"}; + allowedSelections[] = {"All"}; // What is the level of medical skill required for this treatment action? 0 = all soldiers, 1 = medic, 2 = doctor requiredMedic = 0; // The time it takes for a treatment action to complete. Time is in seconds. @@ -121,20 +135,26 @@ class ACE_Medical_Actions { animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic"; animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; - litter[] = { {"All", "", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}} }; + litter[] = { {"All", "_previousDamage > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, {"All", "_previousDamage <= 0", {"ACE_MedicalLitter_clean"}} }; }; class PackingBandage: fieldDressing { + displayName = CSTRING(Actions_PackingBandage); items[] = {"ACE_packingBandage"}; + litter[] = { {"All", "", {"ACE_MedicalLitter_packingBandage"}}}; }; class ElasticBandage: fieldDressing { + displayName = CSTRING(Actions_ElasticBandage); items[] = {"ACE_elasticBandage"}; }; class QuikClot: fieldDressing { + displayName = CSTRING(Actions_QuikClot); items[] = {"ACE_quikclot"}; + litter[] = { {"All", "", {"ACE_MedicalLitter_QuickClot"}}}; }; class Tourniquet: fieldDressing { displayName = CSTRING(Apply_Tourniquet); displayNameProgress = CSTRING(Applying_Tourniquet); + allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r", "body"}; items[] = {"ACE_tourniquet"}; treatmentTime = 6; callbackSuccess = QUOTE(DFUNC(treatmentTourniquet)); @@ -144,6 +164,8 @@ class ACE_Medical_Actions { class Morphine: fieldDressing { displayName = CSTRING(Inject_Morphine); displayNameProgress = CSTRING(Injecting_Morphine); + allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + category = "medication"; items[] = {"ACE_morphine"}; treatmentTime = 3; callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_medication)); @@ -163,8 +185,10 @@ class ACE_Medical_Actions { litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} }; }; class BloodIV: fieldDressing { - displayName = CSTRING(Transfuse_Blood); + displayName = CSTRING(Actions_Blood4_1000); displayNameProgress = CSTRING(Transfusing_Blood); + allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + category = "advanced"; items[] = {"ACE_bloodIV"}; requiredMedic = 1; treatmentTime = 7; @@ -173,38 +197,45 @@ class ACE_Medical_Actions { litter[] = {}; }; class BloodIV_500: BloodIV { + displayName = CSTRING(Actions_Blood4_500); items[] = {"ACE_bloodIV_500"}; }; class BloodIV_250: BloodIV { + displayName = CSTRING(Actions_Blood4_250); items[] = {"ACE_bloodIV_250"}; }; class PlasmaIV: BloodIV { - displayName = CSTRING(Transfuse_Plasma); + displayName = CSTRING(Actions_Plasma4_1000); displayNameProgress = CSTRING(Transfusing_Plasma); items[] = {"ACE_plasmaIV"}; animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; }; class PlasmaIV_500: PlasmaIV { + displayName = CSTRING(Actions_Plasma4_500); items[] = {"ACE_plasmaIV_500"}; }; class PlasmaIV_250: PlasmaIV { + displayName = CSTRING(Actions_Plasma4_250); items[] = {"ACE_plasmaIV_250"}; }; class SalineIV: BloodIV { - displayName = CSTRING(Transfuse_Saline); + displayName = CSTRING(Actions_Saline4_1000); displayNameProgress = CSTRING(Transfusing_Saline); items[] = {"ACE_salineIV"}; animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; }; class SalineIV_500: SalineIV { + displayName = CSTRING(Actions_Saline4_500); items[] = {"ACE_salineIV_500"}; }; class SalineIV_250: SalineIV { + displayName = CSTRING(Actions_Saline4_250); items[] = {"ACE_salineIV_250"}; }; class SurgicalKit: fieldDressing { - displayName = ""; + displayName = CSTRING(Use_SurgicalKit); displayNameProgress = CSTRING(TreatmentAction); + category = "advanced"; items[] = {"ACE_surgicalKit"}; treatmentLocations[] = {QGVAR(useLocation_SurgicalKit)}; requiredMedic = QGVAR(medicSetting_SurgicalKit); @@ -217,8 +248,9 @@ class ACE_Medical_Actions { litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"} }}; }; class PersonalAidKit: fieldDressing { - displayName = ""; + displayName = CSTRING(Use_Aid_Kit); displayNameProgress = CSTRING(TreatmentAction); + category = "advanced"; items[] = {"ACE_personalAidKit"}; treatmentLocations[] = {QGVAR(useLocation_PAK)}; requiredMedic = QGVAR(medicSetting_PAK); @@ -232,11 +264,16 @@ class ACE_Medical_Actions { animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; animationCallerSelf = ""; animationCallerSelfProne = ""; - litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"}}, {"All", "", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}} }, {"All", "", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}} }; + litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"}}, + {"All", "_previousDamage > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}} }, + {"All", "_previousDamage > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, + {"All", "_previousDamage <= 0", {"ACE_MedicalLitter_clean"}} + }; }; class CheckPulse: fieldDressing { - displayName = ""; + displayName = CSTRING(Actions_CheckPulse); displayNameProgress = CSTRING(Check_Pulse_Content); + category = "examine"; treatmentLocations[] = {"All"}; requiredMedic = 0; treatmentTime = 2; @@ -246,27 +283,36 @@ class ACE_Medical_Actions { callbackProgress = ""; animationPatient = ""; animationCaller = ""; // TODO + animationCallerProne = ""; + animationCallerSelfProne = ""; itemConsumed = 0; litter[] = {}; }; class CheckBloodPressure: CheckPulse { + displayName = CSTRING(Actions_CheckBloodPressure); callbackSuccess = QUOTE(DFUNC(actionCheckBloodPressure)); displayNameProgress = CSTRING(Check_Bloodpressure_Content); }; class CheckResponse: CheckPulse { + displayName = CSTRING(Check_Response); callbackSuccess = QUOTE(DFUNC(actionCheckResponse)); displayNameProgress = CSTRING(Check_Response_Content); }; - class RemoveTourniquet: CheckPulse { + class RemoveTourniquet: Tourniquet { + displayName = CSTRING(Actions_RemoveTourniquet); + items[] = {}; treatmentTime = 2.5; callbackSuccess = QUOTE(DFUNC(actionRemoveTourniquet)); condition = QUOTE([ARR_2(_this select 1, _this select 2)] call FUNC(hasTourniquetAppliedTo)); displayNameProgress = CSTRING(RemovingTourniquet); + litter[] = {}; }; class CPR: fieldDressing { displayName = CSTRING(Actions_CPR); displayNameProgress = CSTRING(Actions_PerformingCPR); + category = "advanced"; treatmentLocations[] = {"All"}; + allowedSelections[] = {"body"}; requiredMedic = 0; treatmentTime = 15; items[] = {}; @@ -286,6 +332,7 @@ class ACE_Medical_Actions { class BodyBag: fieldDressing { displayName = CSTRING(PlaceInBodyBag); displayNameProgress = CSTRING(PlacingInBodyBag); + category = "advanced"; treatmentLocations[] = {"All"}; requiredMedic = 0; treatmentTime = 2; @@ -817,9 +864,9 @@ class ACE_Medical_Advanced { // specific details for the ACE_Morphine treatment action class Morphine { painReduce = 15; - hrIncreaseLow[] = {-10, -30, 35}; - hrIncreaseNormal[] = {-10, -50, 40}; - hrIncreaseHigh[] = {-10, -40, 50}; + hrIncreaseLow[] = {-10, -20, 35}; + hrIncreaseNormal[] = {-10, -30, 35}; + hrIncreaseHigh[] = {-10, -35, 50}; timeInSystem = 900; maxDose = 4; inCompatableMedication[] = {}; diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index fcaba03aa0..910f152292 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -1,94 +1,116 @@ class ACE_Settings { class GVAR(level) { + category = CSTRING(Category_Medical); value = 1; typeName = "SCALAR"; values[] = {"Disabled", "Basic", "Advanced"}; }; class GVAR(medicSetting) { + category = CSTRING(Category_Medical); value = 1; typeName = "SCALAR"; values[] = {"Disabled", "Normal", "Advanced"}; }; class GVAR(enableFor) { + category = CSTRING(Category_Medical); value = 0; typeName = "SCALAR"; values[] = {"Players only", "Players and AI"}; }; class GVAR(enableOverdosing) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(bleedingCoefficient) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; }; class GVAR(painCoefficient) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; }; class GVAR(enableAirway) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = false; }; class GVAR(enableFractures) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = false; }; class GVAR(enableAdvancedWounds) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = false; }; class GVAR(enableVehicleCrashes) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(enableScreams) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(playerDamageThreshold) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; }; class GVAR(AIDamageThreshold) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; }; class GVAR(enableUnconsciousnessAI) { + category = CSTRING(Category_Medical); value = 1; typeName = "SCALAR"; values[] = {"Disabled", "50/50", "Enabled"}; }; class GVAR(remoteControlledAI) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(preventInstaDeath) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 0; }; class GVAR(enableRevive) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 0; values[] = {"Disabled", "Players only", "Players and AI"}; }; class GVAR(maxReviveTime) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 120; }; class GVAR(amountOfReviveLives) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = -1; }; class GVAR(allowDeadBodyMovement) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 0; }; class GVAR(allowLitterCreation) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(litterSimulationDetail) { + category = CSTRING(Category_Medical); displayName = CSTRING(litterSimulationDetail); description = CSTRING(litterSimulationDetail_Desc); typeName = "SCALAR"; @@ -100,40 +122,48 @@ class ACE_Settings { isClientSettable = 1; }; class GVAR(litterCleanUpDelay) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 0; }; class GVAR(medicSetting_PAK) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; values[] = {"Anyone", "Medics only", "Doctors only"}; }; class GVAR(medicSetting_SurgicalKit) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; values[] = {"Anyone", "Medics only", "Doctors only"}; }; class GVAR(consumeItem_PAK) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 0; values[] = {"No", "Yes"}; }; class GVAR(consumeItem_SurgicalKit) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 0; values[] = {"No", "Yes"}; }; class GVAR(useLocation_PAK) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 3; values[] = {"Anywhere", "Medical vehicles", "Medical facility", "vehicle & facility", "Disabled"}; }; class GVAR(useLocation_SurgicalKit) { + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 2; values[] = {"Anywhere", "Medical vehicles", "Medical facility", "vehicle & facility", "Disabled"}; }; class GVAR(useCondition_PAK) { + category = CSTRING(Category_Medical); displayName = CSTRING(AdvancedMedicalSettings_useCondition_PAK_DisplayName); description = CSTRING(AdvancedMedicalSettings_useCondition_PAK_Description); typeName = "SCALAR"; @@ -141,6 +171,7 @@ class ACE_Settings { values[] = {"Anytime", "Stable"}; }; class GVAR(useCondition_SurgicalKit) { + category = CSTRING(Category_Medical); displayName = CSTRING(AdvancedMedicalSettings_useCondition_SurgicalKit_DisplayName); description = CSTRING(AdvancedMedicalSettings_useCondition_SurgicalKit_Description); typeName = "SCALAR"; @@ -148,20 +179,24 @@ class ACE_Settings { values[] = {"Anytime", "Stable"}; }; class GVAR(keepLocalSettingsSynced) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(healHitPointAfterAdvBandage) { + category = CSTRING(Category_Medical); displayName = CSTRING(healHitPointAfterAdvBandage); typeName = "BOOL"; value = 0; }; class GVAR(painIsOnlySuppressed) { + category = CSTRING(Category_Medical); displayName = CSTRING(painIsOnlySuppressed); typeName = "BOOL"; value = 1; }; class GVAR(painEffectType) { + category = CSTRING(Category_Medical); displayName = CSTRING(painEffectType); typeName = "SCALAR"; value = 0; @@ -169,15 +204,18 @@ class ACE_Settings { isClientSettable = 1; }; class GVAR(allowUnconsciousAnimationOnTreatment) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 0; }; class GVAR(moveUnitsFromGroupOnUnconscious) { + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 0; }; class GVAR(menuTypeStyle) { + category = CSTRING(Category_Medical); displayName = CSTRING(menuTypeDisplay); description = CSTRING(menuTypeDescription); typeName = "SCALAR"; diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index aab193c098..aef45b115d 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -92,7 +92,7 @@ class CfgVehicles { typeName = "NUMBER"; class values { class disable { - name = CSTRING(disabled); + name = ECSTRING(common,Disabled); value = 0; }; class normal { @@ -101,7 +101,7 @@ class CfgVehicles { default = 1; }; class full { - name = CSTRING(enabled); + name = ECSTRING(common,Enabled); value = 2; }; }; @@ -198,8 +198,8 @@ class CfgVehicles { description = CSTRING(AdvancedMedicalSettings_consumeItem_PAK_Description); typeName = "NUMBER"; class values { - class keep { name = CSTRING(No); value = 0; }; - class remove { name = CSTRING(Yes); value = 1; default = 1; }; + class keep { name = ECSTRING(common,No); value = 0; }; + class remove { name = ECSTRING(common,Yes); value = 1; default = 1; }; }; }; class useCondition_PAK { @@ -220,7 +220,7 @@ class CfgVehicles { class vehicle { name = CSTRING(AdvancedMedicalSettings_vehicle); value = 1; }; class facility { name = CSTRING(AdvancedMedicalSettings_facility); value = 2; }; class vehicleAndFacility { name = CSTRING(AdvancedMedicalSettings_vehicleAndFacility); value = 3; default = 1; }; - class disabled { name = CSTRING(AdvancedMedicalSettings_disabled); value = 4;}; + class disabled { name = ECSTRING(common,Disabled); value = 4;}; }; }; class medicSetting_SurgicalKit: medicSetting_PAK { @@ -280,7 +280,7 @@ class CfgVehicles { typeName = "NUMBER"; defaultValue = 0; class values { - class disable { name = CSTRING(disabled); value = 0; default = 1;}; + class disable { name = ECSTRING(common,Disabled); value = 0; default = 1;}; class playerOnly { name = CSTRING(playeronly); value = 1; }; class playerAndAI { name = CSTRING(playersandai); value = 2; }; }; @@ -373,11 +373,11 @@ class CfgVehicles { typeName = "NUMBER"; class values { class none { - name = CSTRING(No); + name = ECSTRING(common,No); value = 0; }; class medic { - name = CSTRING(Yes); + name = ECSTRING(common,Yes); value = 1; default = 1; }; @@ -717,6 +717,9 @@ class CfgVehicles { destrType = "DestructNo"; model = QUOTE(PATHTOF(data\littergeneric.p3d)); }; + class ACE_MedicalLitter_clean: ACE_MedicalLitterBase { + model = QUOTE(PATHTOF(data\littergeneric_clean.p3d)); + }; class ACE_MedicalLitter_bandage1: ACE_MedicalLitterBase { model = QUOTE(PATHTOF(data\littergeneric_bandages1.p3d)); }; diff --git a/addons/medical/data/ace_litterclean_co.paa b/addons/medical/data/ace_litterclean_co.paa new file mode 100644 index 0000000000..68fb2a2b22 Binary files /dev/null and b/addons/medical/data/ace_litterclean_co.paa differ diff --git a/addons/medical/data/littergeneric_clean.p3d b/addons/medical/data/littergeneric_clean.p3d new file mode 100644 index 0000000000..7fa6fb3e91 Binary files /dev/null and b/addons/medical/data/littergeneric_clean.p3d differ diff --git a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf index 19bd75caad..82edd1749f 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf @@ -58,4 +58,5 @@ if ([_caller] call FUNC(isMedic)) then { if (_logOutPut != "") then { [_target,"activity", LSTRING(Check_Bloodpressure_Log), [[_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); + [_target,"quick_view", LSTRING(Check_Bloodpressure_Log), [[_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); }; diff --git a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf index 9af18d0a6d..d759bf1bc8 100644 --- a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf @@ -50,4 +50,5 @@ if (_heartRate > 1.0) then { if (_logOutPut != "") then { [_unit,"activity", LSTRING(Check_Pulse_Log),[[_caller] call EFUNC(common,getName),_logOutPut]] call FUNC(addToLog); + [_unit,"quick_view", LSTRING(Check_Pulse_Log),[[_caller] call EFUNC(common,getName),_logOutPut]] call FUNC(addToLog); }; diff --git a/addons/medical/functions/fnc_actionCheckResponse.sqf b/addons/medical/functions/fnc_actionCheckResponse.sqf index 2d62df12f6..b5df63047e 100644 --- a/addons/medical/functions/fnc_actionCheckResponse.sqf +++ b/addons/medical/functions/fnc_actionCheckResponse.sqf @@ -28,3 +28,4 @@ if ([_target] call EFUNC(common,isAwake)) then { ["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName)], 2, _caller]] call EFUNC(common,targetEvent); [_target,"activity",_output, [[_target] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target,"quick_view",_output, [[_target] call EFUNC(common,getName)]] call FUNC(addToLog); diff --git a/addons/medical/functions/fnc_canTreat.sqf b/addons/medical/functions/fnc_canTreat.sqf index 4795ccc561..e0cab95420 100644 --- a/addons/medical/functions/fnc_canTreat.sqf +++ b/addons/medical/functions/fnc_canTreat.sqf @@ -16,7 +16,7 @@ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_condition", "_patientStateCondition"]; +private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_condition", "_patientStateCondition", "_allowedSelections"]; _caller = _this select 0; _target = _this select 1; _selectionName = _this select 2; @@ -44,6 +44,8 @@ if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false}; _items = getArray (_config >> "items"); if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false}; +_allowedSelections = getArray (_config >> "allowedSelections"); +if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith {false}; _return = true; if (getText (_config >> "condition") != "") then { diff --git a/addons/medical/functions/fnc_createLitter.sqf b/addons/medical/functions/fnc_createLitter.sqf index 6797785763..a3b71b7f9c 100644 --- a/addons/medical/functions/fnc_createLitter.sqf +++ b/addons/medical/functions/fnc_createLitter.sqf @@ -16,12 +16,13 @@ #define MIN_ENTRIES_LITTER_CONFIG 3 -private ["_target", "_className", "_config", "_litter", "_createLitter", "_position", "_createdLitter", "_caller", "_selectionName", "_usersOfItems"]; +private ["_target", "_className", "_config", "_litter", "_createLitter", "_position", "_createdLitter", "_caller", "_selectionName", "_usersOfItems", "_previousDamage"]; _caller = _this select 0; _target = _this select 1; _selectionName = _this select 2; _className = _this select 3; _usersOfItems = _this select 5; +_previousDamage = _this select 6; if !(GVAR(allowLitterCreation)) exitwith {}; if (vehicle _caller != _caller || vehicle _target != _target) exitwith {}; @@ -76,7 +77,7 @@ _createdLitter = []; _litterCondition = missionNamespace getvariable _litterCondition; if (typeName _litterCondition != "CODE") then {_litterCondition = {false}}; }; - if !([_caller, _target, _selectionName, _className, _usersOfItems] call _litterCondition) exitwith {}; + if !([_caller, _target, _selectionName, _className, _usersOfItems, _previousDamage] call _litterCondition) exitwith {}; if (typeName _litterOptions == "ARRAY") then { // Loop through through the litter options and place the litter diff --git a/addons/medical/functions/fnc_handleCreateLitter.sqf b/addons/medical/functions/fnc_handleCreateLitter.sqf index cf8acd0969..d7595ec439 100644 --- a/addons/medical/functions/fnc_handleCreateLitter.sqf +++ b/addons/medical/functions/fnc_handleCreateLitter.sqf @@ -31,6 +31,7 @@ if((count GVAR(allCreatedLitter)) > _maxLitterCount ) then { GVAR(allCreatedLitter) pushBack [ACE_time, [_litterObject]]; if(!GVAR(litterPFHRunning) && {GVAR(litterCleanUpDelay) > 0}) then { + GVAR(litterPFHRunning) = true; [{ { if (ACE_time - (_x select 0) >= GVAR(litterCleanUpDelay)) then { diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index 18f3406df2..9c218de540 100644 --- a/addons/medical/functions/fnc_treatment.sqf +++ b/addons/medical/functions/fnc_treatment.sqf @@ -16,7 +16,7 @@ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTimeConfig", "_patientStateCondition"]; +private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTimeConfig", "_patientStateCondition", "_allowedSelections"]; _caller = _this select 0; _target = _this select 1; _selectionName = _this select 2; @@ -49,6 +49,9 @@ _medicRequired = if (isNumber (_config >> "requiredMedic")) then { if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false}; +_allowedSelections = getArray (_config >> "allowedSelections"); +if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith {false}; + // Check item _items = getArray (_config >> "items"); if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false}; @@ -156,7 +159,7 @@ if (_caller == _target) then { _callerAnim = [getText (_config >> "animationCallerSelf"), getText (_config >> "animationCallerSelfProne")] select (stance _caller == "PRONE"); }; -_caller setvariable [QGVAR(selectedWeaponOnTreatment), currentWeapon _caller]; +_caller setvariable [QGVAR(selectedWeaponOnTreatment), (weaponState _caller)]; // Cannot use secondairy weapon for animation if (currentWeapon _caller == secondaryWeapon _caller) then { diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf index 61723319a5..c3151f2c90 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf @@ -31,4 +31,7 @@ if (random(1)>= 0.6) exitwith { _target setvariable [QGVAR(bloodPressure), [50,70]]; }; +[_target, "activity", LSTRING(Activity_fullHeal), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target, "activity_view", LSTRING(Activity_fullHeal), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message + true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf index 6b6b7adb81..1278994a11 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf @@ -38,5 +38,6 @@ if !([_target] call FUNC(hasMedicalEnabled)) exitwith { }foreach _items;*/ [_target, "activity", LSTRING(Activity_bandagedPatient), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target, "activity_view", LSTRING(Activity_bandagedPatient), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf index 544ef6ae55..df7594921d 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf @@ -68,4 +68,7 @@ if (alive _target) exitwith { // Resetting damage _target setDamage 0; + + [_target, "activity", LSTRING(Activity_fullHeal), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); + [_target, "activity_view", LSTRING(Activity_fullHeal), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message }; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf index e3d07616f3..0b401a73cc 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf @@ -29,9 +29,10 @@ _items = _this select 4; { if (_x != "") then { [_target, _x] call FUNC(addToTriageCard); + [_target, "activity", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); + [_target, "activity_view", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); }; }foreach _items; -[_target, "activity", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), _className]] call FUNC(addToLog); true; diff --git a/addons/medical/functions/fnc_treatmentIV.sqf b/addons/medical/functions/fnc_treatmentIV.sqf index fc6b91b057..e0c4d20ed6 100644 --- a/addons/medical/functions/fnc_treatmentIV.sqf +++ b/addons/medical/functions/fnc_treatmentIV.sqf @@ -30,3 +30,4 @@ _removeItem = _items select 0; [[_target, _className], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [_target, _removeItem] call FUNC(addToTriageCard); [_target, "activity", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target, "activity_view", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message diff --git a/addons/medical/functions/fnc_treatmentTourniquet.sqf b/addons/medical/functions/fnc_treatmentTourniquet.sqf index cab44d3295..148ed06252 100644 --- a/addons/medical/functions/fnc_treatmentTourniquet.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquet.sqf @@ -44,6 +44,7 @@ _removeItem = _items select 0; [_target, _removeItem] call FUNC(addToTriageCard); [_target, "activity", LSTRING(Activity_appliedTourniquet), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target, "activity_view", LSTRING(Activity_appliedTourniquet), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message true; diff --git a/addons/medical/functions/fnc_treatment_failure.sqf b/addons/medical/functions/fnc_treatment_failure.sqf index dd49729686..8a5d784301 100644 --- a/addons/medical/functions/fnc_treatment_failure.sqf +++ b/addons/medical/functions/fnc_treatment_failure.sqf @@ -44,9 +44,14 @@ if (vehicle _caller == _caller) then { }; _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; -_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), ""]); -if (_weaponSelect != "") then { - _caller selectWeapon _weaponSelect; +_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), []]); +if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then { + for "_index" from 0 to 99 do { + _caller action ["SwitchWeapon", _caller, _caller, _index]; + //Just check weapon, muzzle and mode (ignore ammo in case they were reloading) + if (((weaponState _caller) select [0,3]) isEqualTo (_weaponSelect select [0,3])) exitWith {TRACE_1("Restoring", (weaponState _caller));}; + if ((weaponState _caller) isEqualTo ["","","","",0]) exitWith {ERROR("weaponState not found");}; + }; } else { _caller action ["SwitchWeapon", _caller, _caller, 99]; }; diff --git a/addons/medical/functions/fnc_treatment_success.sqf b/addons/medical/functions/fnc_treatment_success.sqf index 19c12d9299..f5cb9baf71 100644 --- a/addons/medical/functions/fnc_treatment_success.sqf +++ b/addons/medical/functions/fnc_treatment_success.sqf @@ -42,9 +42,14 @@ if (vehicle _caller == _caller) then { }; _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; -_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), ""]); -if (_weaponSelect != "") then { - _caller selectWeapon _weaponSelect; +_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnTreatment), []]); +if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then { + for "_index" from 0 to 99 do { + _caller action ["SwitchWeapon", _caller, _caller, _index]; + //Just check weapon, muzzle and mode (ignore ammo in case they were reloading) + if (((weaponState _caller) select [0,3]) isEqualTo (_weaponSelect select [0,3])) exitWith {TRACE_1("Restoring", (weaponState _caller));}; + if ((weaponState _caller) isEqualTo ["","","","",0]) exitWith {ERROR("weaponState not found");}; + }; } else { _caller action ["SwitchWeapon", _caller, _caller, 99]; }; @@ -62,11 +67,24 @@ if (isNil _callback) then { _callback = missionNamespace getvariable _callback; }; -_args call _callback; +//Get current damage before treatment (for litter) +_previousDamage = switch (toLower _selectionName) do { + case ("head"): {_target getHitPointDamage "HitHead"}; + case ("body"): {_target getHitPointDamage "HitBody"}; + case ("hand_l"): {_target getHitPointDamage "HitLeftArm"}; + case ("hand_r"): {_target getHitPointDamage "HitRightArm"}; + case ("leg_l"): {_target getHitPointDamage "HitLeftLeg"}; + case ("leg_r"): {_target getHitPointDamage "HitRightLeg"}; + default {damage _target}; +}; +_args call _callback; +_args pushBack _previousDamage; _args call FUNC(createLitter); //If we're not already tracking vitals, start: if (!(_target getvariable [QGVAR(addedToUnitLoop),false])) then { [_target] call FUNC(addToInjuredCollection); }; + +["medical_treatmentSuccess", [_caller, _target, _selectionName, _className]] call EFUNC(common,localEvent); diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 9f161d032d..290690d442 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -950,7 +950,7 @@ Analgetikum slouží k tlumení středně těžkých a těžkých bolestí - Atropin autoinjector + Atropine autoinjector Атропин в пневмошприце Atropina auto-inyectable Auto-injecteur d'Atropine @@ -2928,24 +2928,6 @@ Traktuj jednostki zdalnie sterowane (przez Zeusa) jako AI, nie jako graczy? Ošetřit vzdáleně ovládané jednotky jako AI, ne jako hráče? - - Disabled - Отключено - Wyłączone - Desactivado - Deaktiviert - Zakázáno - Desativado - - - Enabled - Включено - Włączone - Activado - Aktiviert - Povoleno - Ativado - Prevent instant death Отключить мгновенную смерть @@ -3237,15 +3219,6 @@ Vozidla a zařízení Veículos e instalações - - Disabled - Отключено - Wyłączone - Desactivado - Deaktiviert - Zakázáno - Desativado - Allow Surgical kit (Adv) Разрешить хирургический набор (усл.) @@ -3612,30 +3585,6 @@ [ACE] Zdravotnické zásoby (pokročilé) [ACE] Caixa com suprimentos médicos (Avançados) - - Yes - Ja - Si - Tak - Ano - Oui - Да - Igen - Sim - Si - - - No - Nein - No - Nie - Ne - Non - Нет - Nem - Não - No - Anytime Kdykoli @@ -3648,5 +3597,17 @@ Estable Po stabilizacji + + Medical + Zdravotní + Médical + Sanitäter + Medico + Medyczne + Médico + Медик + Médico + Orvosi + diff --git a/addons/medical/ui/body_background.png b/addons/medical/ui/body_background.png deleted file mode 100644 index 65791a01c0..0000000000 Binary files a/addons/medical/ui/body_background.png and /dev/null differ diff --git a/addons/medical_menu/$PBOPREFIX$ b/addons/medical_menu/$PBOPREFIX$ new file mode 100644 index 0000000000..6ca7434932 --- /dev/null +++ b/addons/medical_menu/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\medical_menu \ No newline at end of file diff --git a/addons/medical_menu/ACE_Settings.hpp b/addons/medical_menu/ACE_Settings.hpp new file mode 100644 index 0000000000..1f2b9cc3ea --- /dev/null +++ b/addons/medical_menu/ACE_Settings.hpp @@ -0,0 +1,25 @@ + +class ACE_Settings { + class GVAR(allow) { + displayName = CSTRING(allow); + description = CSTRING(allow_Descr); + value = 1; + typeName = "SCALAR"; + values[] = {ECSTRING(common,Disabled), ECSTRING(common,Enabled), ECSTRING(common,VehiclesOnly)}; + }; + class GVAR(useMenu) { + displayName = CSTRING(useMenu); + description = CSTRING(useMenu_Descr); + value = 0; + typeName = "SCALAR"; + values[] = {ECSTRING(common,Disabled), ECSTRING(common,Enabled), ECSTRING(common,VehiclesOnly)}; + isClientSettable = 1; + }; + class GVAR(openAfterTreatment) { + displayName = CSTRING(openAfterTreatment); + description = CSTRING(openAfterTreatment_Descr); + typeName = "BOOL"; + value = 1; + isClientSettable = 1; + }; +}; diff --git a/addons/medical_menu/CfgEventHandlers.hpp b/addons/medical_menu/CfgEventHandlers.hpp new file mode 100644 index 0000000000..7392999c9a --- /dev/null +++ b/addons/medical_menu/CfgEventHandlers.hpp @@ -0,0 +1,11 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/addons/medical_menu/CfgVehicles.hpp b/addons/medical_menu/CfgVehicles.hpp new file mode 100644 index 0000000000..7bbe7db2ad --- /dev/null +++ b/addons/medical_menu/CfgVehicles.hpp @@ -0,0 +1,70 @@ + +class CfgVehicles { + + class ACE_Module; + class ACE_moduleMedicalMenuSettings: ACE_Module { + scope = 2; + displayName = CSTRING(module_DisplayName); + icon = QUOTE(PATHTOEF(medical,UI\Icon_Module_Medical_ca.paa)); + category = "ACE_medical"; + function = QUOTE(DFUNC(module)); + functionPriority = 1; + isGlobal = 0; + isTriggerActivated = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class allow { + displayName = CSTRING(allow); + description = CSTRING(allow_Descr); + typeName = "NUMBER"; + class values { + class disable { + name = ECSTRING(common,Disabled); + value = 0; + }; + class enable { + name = ECSTRING(common,Enabled); + value = 1; + default = 1; + }; + class VehiclesOnly { + name = ECSTRING(common,VehiclesOnly); + value = 2; + }; + }; + }; + }; + class ModuleDescription { + description = CSTRING(module_Desc); + sync[] = {}; + }; + }; + + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class Medical_Menu { + displayName = CSTRING(OpenMenu); + runOnHover = 0; + exceptions[] = {"isNotInside"}; + condition = QUOTE([ARR_2(ACE_player,_target)] call FUNC(canOpenMenu)); + statement = QUOTE([_target] call DFUNC(openMenu)); + icon = PATHTOEF(medical,UI\icons\medical_cross.paa); + }; + }; + + class ACE_Actions { + // Create a consolidates medical menu for treatment while boarded + class ACE_MainActions { + class Medical_Menu { + displayName = CSTRING(OpenMenu); + runOnHover = 0; + exceptions[] = {"isNotInside"}; + condition = QUOTE([ARR_2(ACE_player,_target)] call FUNC(canOpenMenu)); + statement = QUOTE([_target] call DFUNC(openMenu)); + icon = PATHTOEF(medical,UI\icons\medical_cross.paa); + }; + }; + }; + }; +}; diff --git a/addons/medical_menu/README.md b/addons/medical_menu/README.md new file mode 100644 index 0000000000..0755083712 --- /dev/null +++ b/addons/medical_menu/README.md @@ -0,0 +1,10 @@ +ace_medical_menu +=============== + +Provides the CSE medical menu for the advanced medical system. + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Glowbal](https://github.com/Glowbal) diff --git a/addons/medical_menu/XEH_postInit.sqf b/addons/medical_menu/XEH_postInit.sqf new file mode 100644 index 0000000000..a72c1a8887 --- /dev/null +++ b/addons/medical_menu/XEH_postInit.sqf @@ -0,0 +1,34 @@ +#include "script_component.hpp" + +if (!hasInterface) exitwith {}; + +["medical_treatmentSuccess", { + + if (GVAR(openAfterTreatment) && {GVAR(pendingReopen)}) then { + GVAR(pendingReopen) = false; + [{ + [GVAR(INTERACTION_TARGET)] call FUNC(openMenu); + }, []] call EFUNC(common,execNextFrame); + }; +}] call EFUNC(common,addEventhandler); + + +["ACE3 Common", QGVAR(displayMenuKeyPressed), localize LSTRING(DisplayMenuKey), +{ + _target = cursorTarget; + if (!(_target isKindOf "CAManBase") || ACE_player distance _target > 10) then {_target = ACE_player}; + // Conditions: canInteract + if !([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, _target] call FUNC(canOpenMenu)) exitwith {false}; + + // Statement + [_target] call FUNC(openMenu); + false +}, +{ + if (ACE_time - GVAR(lastOpenedOn) > 0.5) then { + [ObjNull] call FUNC(openMenu); + }; +}, +[35, [false, false, false]], false, 0] call CBA_fnc_addKeybind; + diff --git a/addons/medical_menu/XEH_preInit.sqf b/addons/medical_menu/XEH_preInit.sqf new file mode 100644 index 0000000000..c231c7df6e --- /dev/null +++ b/addons/medical_menu/XEH_preInit.sqf @@ -0,0 +1,29 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(onMenuOpen); +PREP(openMenu); + +PREP(canOpenMenu); +PREP(updateIcons); +PREP(updateUIInfo); +PREP(handleUI_DisplayOptions); +PREP(handleUI_dropDownTriageCard); +PREP(getTreatmentOptions); +PREP(updateActivityLog); +PREP(updateQuickViewLog); +PREP(updateBodyImage); +PREP(updateInformationLists); +PREP(setTriageStatus); +PREP(collectActions); +PREP(module); + +GVAR(INTERACTION_TARGET) = objNull; +GVAR(actionsOther) = []; +GVAR(actionsSelf) = []; +GVAR(selectedBodyPart) = 0; + +call FUNC(collectActions); + +ADDON = true; diff --git a/addons/medical_menu/config.cpp b/addons/medical_menu/config.cpp new file mode 100644 index 0000000000..27e0db03b9 --- /dev/null +++ b/addons/medical_menu/config.cpp @@ -0,0 +1,18 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_medical"}; + author[] = {$STR_ACE_Common_ACETeam, "Glowbal"}; + authorUrl = "http://ace3mod.com"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "ui\menu.hpp" +#include "ACE_Settings.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/medical_menu/data/background_img.paa b/addons/medical_menu/data/background_img.paa new file mode 100644 index 0000000000..de59065e3b Binary files /dev/null and b/addons/medical_menu/data/background_img.paa differ diff --git a/addons/medical_menu/data/icons/advanced_treatment_small.paa b/addons/medical_menu/data/icons/advanced_treatment_small.paa new file mode 100644 index 0000000000..8becb9d2df Binary files /dev/null and b/addons/medical_menu/data/icons/advanced_treatment_small.paa differ diff --git a/addons/medical_menu/data/icons/airway_management_small.paa b/addons/medical_menu/data/icons/airway_management_small.paa new file mode 100644 index 0000000000..ab4da47958 Binary files /dev/null and b/addons/medical_menu/data/icons/airway_management_small.paa differ diff --git a/addons/medical_menu/data/icons/bandage_fracture_small.paa b/addons/medical_menu/data/icons/bandage_fracture_small.paa new file mode 100644 index 0000000000..a869f260ec Binary files /dev/null and b/addons/medical_menu/data/icons/bandage_fracture_small.paa differ diff --git a/addons/medical_menu/data/icons/examine_patient_small.paa b/addons/medical_menu/data/icons/examine_patient_small.paa new file mode 100644 index 0000000000..2e9fc9831d Binary files /dev/null and b/addons/medical_menu/data/icons/examine_patient_small.paa differ diff --git a/addons/medical_menu/data/icons/icon_advanced_treatment.paa b/addons/medical_menu/data/icons/icon_advanced_treatment.paa new file mode 100644 index 0000000000..d6bf6effd9 Binary files /dev/null and b/addons/medical_menu/data/icons/icon_advanced_treatment.paa differ diff --git a/addons/medical_menu/data/icons/icon_airway_management.paa b/addons/medical_menu/data/icons/icon_airway_management.paa new file mode 100644 index 0000000000..f444f5f385 Binary files /dev/null and b/addons/medical_menu/data/icons/icon_airway_management.paa differ diff --git a/addons/medical_menu/data/icons/icon_bandage_fracture.paa b/addons/medical_menu/data/icons/icon_bandage_fracture.paa new file mode 100644 index 0000000000..df8d1de571 Binary files /dev/null and b/addons/medical_menu/data/icons/icon_bandage_fracture.paa differ diff --git a/addons/medical_menu/data/icons/icon_bleeding.paa b/addons/medical_menu/data/icons/icon_bleeding.paa new file mode 100644 index 0000000000..d11c2ed496 Binary files /dev/null and b/addons/medical_menu/data/icons/icon_bleeding.paa differ diff --git a/addons/medical_menu/data/icons/icon_carry.paa b/addons/medical_menu/data/icons/icon_carry.paa new file mode 100644 index 0000000000..7ebb830b03 Binary files /dev/null and b/addons/medical_menu/data/icons/icon_carry.paa differ diff --git a/addons/medical_menu/data/icons/icon_examine_patient.paa b/addons/medical_menu/data/icons/icon_examine_patient.paa new file mode 100644 index 0000000000..12eb06c890 Binary files /dev/null and b/addons/medical_menu/data/icons/icon_examine_patient.paa differ diff --git a/addons/medical_menu/data/icons/icon_medication.paa b/addons/medical_menu/data/icons/icon_medication.paa new file mode 100644 index 0000000000..98893ad863 Binary files /dev/null and b/addons/medical_menu/data/icons/icon_medication.paa differ diff --git a/addons/medical_menu/data/icons/icon_toggle_self.paa b/addons/medical_menu/data/icons/icon_toggle_self.paa new file mode 100644 index 0000000000..3078eb5dd5 Binary files /dev/null and b/addons/medical_menu/data/icons/icon_toggle_self.paa differ diff --git a/addons/medical_menu/data/icons/icon_tourniquet.paa b/addons/medical_menu/data/icons/icon_tourniquet.paa new file mode 100644 index 0000000000..8b34a7bfbb Binary files /dev/null and b/addons/medical_menu/data/icons/icon_tourniquet.paa differ diff --git a/addons/medical_menu/data/icons/icon_tourniquet_small.paa b/addons/medical_menu/data/icons/icon_tourniquet_small.paa new file mode 100644 index 0000000000..a457e2c0d5 Binary files /dev/null and b/addons/medical_menu/data/icons/icon_tourniquet_small.paa differ diff --git a/addons/medical_menu/data/icons/icon_triage_card.paa b/addons/medical_menu/data/icons/icon_triage_card.paa new file mode 100644 index 0000000000..850ab0f4ce Binary files /dev/null and b/addons/medical_menu/data/icons/icon_triage_card.paa differ diff --git a/addons/medical_menu/data/icons/medication_small.paa b/addons/medical_menu/data/icons/medication_small.paa new file mode 100644 index 0000000000..b6acd670c8 Binary files /dev/null and b/addons/medical_menu/data/icons/medication_small.paa differ diff --git a/addons/medical_menu/data/icons/toggle_self_small.paa b/addons/medical_menu/data/icons/toggle_self_small.paa new file mode 100644 index 0000000000..73108e5a98 Binary files /dev/null and b/addons/medical_menu/data/icons/toggle_self_small.paa differ diff --git a/addons/medical_menu/data/icons/triage_card_small.paa b/addons/medical_menu/data/icons/triage_card_small.paa new file mode 100644 index 0000000000..92eb0f0d20 Binary files /dev/null and b/addons/medical_menu/data/icons/triage_card_small.paa differ diff --git a/addons/medical_menu/data/ui_background.paa b/addons/medical_menu/data/ui_background.paa new file mode 100644 index 0000000000..f1c42c7d7d Binary files /dev/null and b/addons/medical_menu/data/ui_background.paa differ diff --git a/addons/medical_menu/functions/fnc_canOpenMenu.sqf b/addons/medical_menu/functions/fnc_canOpenMenu.sqf new file mode 100644 index 0000000000..2cfe7072ef --- /dev/null +++ b/addons/medical_menu/functions/fnc_canOpenMenu.sqf @@ -0,0 +1,24 @@ +/* + * Author: Glowbal + * Check if ACE_player can Open the medical menu + * + * Arguments: + * 0: Caller + * 1: Target + * + * Return Value: + * Can open + * + * Example: + * [] call ace_medical_menu_canOpenMenu + * + * Public: No + */ +#include "script_component.hpp" + +params ["_caller", "_target"]; + +if !(GVAR(allow) == 1 || (GVAR(allow) == 2 && {vehicle _caller != _caller || vehicle _target != _target} && {alive ACE_player})) exitwith {false}; +if !(GVAR(useMenu) == 1 || (GVAR(useMenu) == 2 && {vehicle _caller != _caller || vehicle _target != _target} && {alive ACE_player})) exitwith {false}; + +true; diff --git a/addons/medical_menu/functions/fnc_collectActions.sqf b/addons/medical_menu/functions/fnc_collectActions.sqf new file mode 100644 index 0000000000..211de76202 --- /dev/null +++ b/addons/medical_menu/functions/fnc_collectActions.sqf @@ -0,0 +1,42 @@ +/* + * Author: Glowbal + * Collect treatment actions from medical config + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_medical_menu_fnc_collectActions + * + * Public: No + */ +#include "script_component.hpp" + +private ["_configBasic", "_configAdvanced", "_fnc_compileActionsLevel"]; +_configBasic = (configFile >> "ACE_Medical_Actions" >> "Basic"); +_configAdvanced = (configFile >> "ACE_Medical_Actions" >> "Advanced"); + +_fnc_compileActionsLevel = { + private ["_entryCount", "_actions", "_displayName", "_condition", "_category", "_statement"]; + params ["_config"]; + _actions = []; + + { + if (isClass _x) then { + _displayName = getText (_x >> "displayName"); + _category = getText (_x >> "category"); + _condition = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,canTreatCached)), configName _x]; + _statement = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,treatment)), configName _x]; + _actions pushBack [_displayName, _category, compile _condition, compile _statement]; + }; + nil + }count ("true" configClasses _config); + + _actions // return +}; + +GVAR(actionsBasic) = [_configBasic] call _fnc_compileActionsLevel; +GVAR(actionsAdvanced) = [_configAdvanced] call _fnc_compileActionsLevel; diff --git a/addons/medical_menu/functions/fnc_getTreatmentOptions.sqf b/addons/medical_menu/functions/fnc_getTreatmentOptions.sqf new file mode 100644 index 0000000000..4b03d27970 --- /dev/null +++ b/addons/medical_menu/functions/fnc_getTreatmentOptions.sqf @@ -0,0 +1,42 @@ +/* + * Author: Glowbal + * Grab available treatment options for given category + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: Category name + * + * Return Value: + * Available actions + * + * Exmaple: + * [ACE_player, poor_dude, "some category"] call ace_medical_menu_fnc_getTreatmentOptions + * + * Public: No + */ +#include "script_component.hpp" + +private "_actions"; +params ["_player", "_target", "_name"]; + +if (!([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith))) exitwith {[]}; + +_actions = if (EGVAR(medical,level) == 2) then { + GVAR(actionsAdvanced); +} else { + GVAR(actionsBasic); +}; + +_collectedActions = []; + +_bodyPart = EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart); +{ + _x params ["", "_currentCategory", "_currentCondition"]; + if (_name == _currentCategory && {call _currentCondition}) then { + _collectedActions pushBack _x; + }; + nil +} count _actions; + +_collectedActions // return diff --git a/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf b/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf new file mode 100644 index 0000000000..d795b0128c --- /dev/null +++ b/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf @@ -0,0 +1,110 @@ +/* + * Author: Glowbal + * Display the available treatment options in category + * + * Arguments: + * 0: Category name + * + * Return Value: + * None + * + * Example: + * ["some category"] call ace_medical_menu_handleUI_DisplayOptions + * + * Public: No + */ +#include "script_component.hpp" + +#define START_IDC 20 +#define END_IDC 27 +#define AMOUNT_OF_ENTRIES (count _entries) + +if (!hasInterface) exitwith{}; + +private ["_entries", "_display", "_newTarget", "_card", "_ctrl", "_code"]; + +params ["_name"]; + +disableSerialization; + +_display = uiNamespace getVariable QGVAR(medicalMenu); +if (isNil "_display") exitwith {}; // no valid dialog present + +if (_name isEqualTo "toggle") exitwith { + if (GVAR(INTERACTION_TARGET) != ACE_player) then { + _newTarget = ACE_player; + } else { + _newTarget = GVAR(INTERACTION_TARGET_PREVIOUS); + }; + + GVAR(INTERACTION_TARGET_PREVIOUS) = GVAR(INTERACTION_TARGET); + [_newTarget] spawn { + closeDialog 0; + sleep 0.1; + [_this select 0] call FUNC(openMenu); + }; +}; + +// Clean the dropdown options list from all actions +for [{_x = START_IDC}, {_x <= END_IDC}, {_x = _x + 1}] do { + _ctrl = (_display displayCtrl (_x)); + _ctrl ctrlSetText ""; + _ctrl ctrlShow false; + _ctrl ctrlSetEventHandler ["ButtonClick",""]; + _ctrl ctrlSetTooltip ""; + _ctrl ctrlCommit 0; +}; + +GVAR(LatestDisplayOptionMenu) = _name; + +// The triage card has no options available +lbClear 212; +if (_name isEqualTo "triage") exitwith { + + ctrlEnable [212, true]; + private ["_log", "_triageCardTexts", "_message"]; + _log = GVAR(INTERACTION_TARGET) getvariable [QEGVAR(medical,triageCard), []]; + _triageCardTexts = []; + { + _x params ["_item", "_amount", "_time"]; + _message = _item; + if (isClass(configFile >> "CfgWeapons" >> _item)) then { + _message = getText(configFile >> "CfgWeapons" >> _item >> "DisplayName"); + } else { + if (isLocalized _message) then { + _message = localize _message; + }; + }; + _triageCardTexts pushback format["%1x - %2 (%3m)", _amount, _message, round((ACE_time - _time) / 60)]; + nil; + }count _log; + + if (count _triageCardTexts == 0) exitwith { + lbAdd [212,(localize ELSTRING(medical,TriageCard_NoEntry))]; + }; + { + lbAdd [212,_x]; + nil; + }count _triageCardTexts; +}; + +ctrlEnable [212, false]; + +_entries = [ACE_player, GVAR(INTERACTION_TARGET), _name] call FUNC(getTreatmentOptions); + +{ + //player sidechat format["TRIGGERED: %1",_x]; + if (_forEachIndex > END_IDC) exitwith {}; + _ctrl = (_display displayCtrl (START_IDC + _forEachIndex)); + if (!(_forEachIndex > AMOUNT_OF_ENTRIES)) then { + _ctrl ctrlSetText (_x select 0); + _code = format ["ace_medical_menu_pendingReopen = true; call %1;", (_x select 3)]; + _ctrl ctrlSetEventHandler ["ButtonClick", _code]; + _ctrl ctrlSetTooltip (_x select 0); // TODO implement + _ctrl ctrlShow true; + } else { + _ctrl ctrlSetText ""; + _ctrl ctrlSetEventHandler ["ButtonClick", ""]; + }; + _ctrl ctrlCommit 0; +} forEach _entries; diff --git a/addons/medical_menu/functions/fnc_handleUI_dropDownTriageCard.sqf b/addons/medical_menu/functions/fnc_handleUI_dropDownTriageCard.sqf new file mode 100644 index 0000000000..fb924fc40b --- /dev/null +++ b/addons/medical_menu/functions/fnc_handleUI_dropDownTriageCard.sqf @@ -0,0 +1,35 @@ +/* + * Author: Glowbal + * Handle the triage card display + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_medical_menu_handleUI_dropDownTriageCard + * + * Public: No + */ +#include "script_component.hpp" + +private ["_display", "_pos", "_ctrl", "_currentPos", "_idc"]; + +disableSerialization; + +_display = uiNamespace getVariable QGVAR(medicalMenu); +_pos = [0, 0, 0, 0]; +_currentPos = ctrlPosition (_display displayCtrl 2002); +_currentPos params ["_currentPosX", "_currentPosY"]; +if (_currentPosX == 0 && _currentPosY == 0) then { + _pos = ctrlPosition (_display displayCtrl 2001); +}; + +for "_idc" from 2002 to 2006 step 1 do { + _pos set [1, (_pos select 1) + (_pos select 3)]; + _ctrl = _display displayCtrl _idc; + _ctrl ctrlSetPosition _pos; + _ctrl ctrlCommit 0; +}; diff --git a/addons/medical_menu/functions/fnc_module.sqf b/addons/medical_menu/functions/fnc_module.sqf new file mode 100644 index 0000000000..d95110c200 --- /dev/null +++ b/addons/medical_menu/functions/fnc_module.sqf @@ -0,0 +1,22 @@ +/* + * Author: Glowbal + * Module for adjusting the medical menu settings + * + * Arguments: + * 0: The module logic + * 1: units + * 2: activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; + +if !(_activated) exitWith {}; + +[_logic, QGVAR(allow), "allow"] call EFUNC(common,readSettingFromModule); diff --git a/addons/medical_menu/functions/fnc_onMenuOpen.sqf b/addons/medical_menu/functions/fnc_onMenuOpen.sqf new file mode 100644 index 0000000000..52a957ae93 --- /dev/null +++ b/addons/medical_menu/functions/fnc_onMenuOpen.sqf @@ -0,0 +1,77 @@ +/* + * Author: Glowbal + * Handle medical menu opened + * + * Arguments: + * 0: Medical Menu display + * + * Return Value: + * None + * + * Example: + * [medical_menu] call ace_medical_menu_onMenuOpen + * + * Public: No + */ +#include "script_component.hpp" + +private "_target"; + +params ["_display"]; + +if (isNil "_display") exitwith {}; + +if (isNil QGVAR(LatestDisplayOptionMenu)) then { + GVAR(LatestDisplayOptionMenu) = "triage"; +} else { + if (GVAR(LatestDisplayOptionMenu) == "toggle") then { + GVAR(LatestDisplayOptionMenu) = "triage"; + GVAR(INTERACTION_TARGET) = GVAR(INTERACTION_TARGET_PREVIOUS); + }; +}; + +_target = GVAR(INTERACTION_TARGET); +if (isNil QGVAR(INTERACTION_TARGET_PREVIOUS)) then { + GVAR(INTERACTION_TARGET_PREVIOUS) = _target; +}; +[GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions); + +disableSerialization; + +[_target, _display] call FUNC(updateUIInfo); + +(_display displayCtrl 11) ctrlSetTooltip localize LSTRING(VIEW_TRIAGE_CARD); +(_display displayCtrl 12) ctrlSetTooltip localize LSTRING(EXAMINE_PATIENT); +(_display displayCtrl 13) ctrlSetTooltip localize LSTRING(BANDAGE_FRACTURES); +(_display displayCtrl 14) ctrlSetTooltip localize LSTRING(MEDICATION); +(_display displayCtrl 15) ctrlSetTooltip localize LSTRING(AIRWAY_MANAGEMENT); +(_display displayCtrl 16) ctrlSetTooltip localize LSTRING(ADVANCED_TREATMENT); +(_display displayCtrl 17) ctrlSetTooltip localize LSTRING(DRAG_CARRY); +(_display displayCtrl 18) ctrlSetTooltip localize LSTRING(TOGGLE_SELF); + +(_display displayCtrl 301) ctrlSetTooltip localize LSTRING(SELECT_HEAD); +(_display displayCtrl 302) ctrlSetTooltip localize LSTRING(SELECT_TORSO); +(_display displayCtrl 303) ctrlSetTooltip localize LSTRING(SELECT_ARM_R); +(_display displayCtrl 304) ctrlSetTooltip localize LSTRING(SELECT_ARM_L); +(_display displayCtrl 305) ctrlSetTooltip localize LSTRING(SELECT_LEG_R); +(_display displayCtrl 306) ctrlSetTooltip localize LSTRING(SELECT_LEG_L); +(_display displayCtrl 2001) ctrlSetTooltip localize LSTRING(SELECT_TRIAGE_STATUS); + +(_display displayCtrl 1) ctrlSetText format ["%1", [_target] call EFUNC(common,getName)]; +setMousePosition [0.4, 0.4]; + +[QGVAR(onMenuOpen), "onEachFrame", { + params ["_display"]; + if (isNull GVAR(INTERACTION_TARGET)) then { + GVAR(INTERACTION_TARGET) = ACE_player; + }; + [GVAR(INTERACTION_TARGET), _display] call FUNC(updateUIInfo); + [GVAR(INTERACTION_TARGET)] call FUNC(updateIcons); + [GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions); + + _status = [GVAR(INTERACTION_TARGET)] call FUNC(getTriageStatus); + (_display displayCtrl 2000) ctrlSetText (_status select 0); + (_display displayCtrl 2000) ctrlSetBackgroundColor (_status select 2); + }, [_display]] call BIS_fnc_addStackedEventHandler; + + ["Medical_onMenuOpen", [ACE_player, _interactionTarget]] call EFUNC(common,localEvent); diff --git a/addons/medical_menu/functions/fnc_openMenu.sqf b/addons/medical_menu/functions/fnc_openMenu.sqf new file mode 100644 index 0000000000..3bc67f0028 --- /dev/null +++ b/addons/medical_menu/functions/fnc_openMenu.sqf @@ -0,0 +1,33 @@ +/* + * Author: Glowbal + * Open the medical menu for target + * + * Arguments: + * 0: Target + * + * Return Value: + * None + * + * Example: + * [some_player] call ace_medical_menu_openMenu + * + * Public: No + */ +#include "script_component.hpp" + +params ["_interactionTarget"]; + +if (dialog || isNull _interactionTarget) exitwith { + disableSerialization; + + private "_display"; + _display = uiNamespace getVariable QGVAR(medicalMenu); + if (!isNil "_display") then { + closeDialog 314412; + }; +}; + +GVAR(INTERACTION_TARGET) = _interactionTarget; + +createDialog QGVAR(medicalMenu); +GVAR(lastOpenedOn) = ACE_time; diff --git a/addons/medical_menu/functions/fnc_setTriageStatus.sqf b/addons/medical_menu/functions/fnc_setTriageStatus.sqf new file mode 100644 index 0000000000..7e7c764aee --- /dev/null +++ b/addons/medical_menu/functions/fnc_setTriageStatus.sqf @@ -0,0 +1,18 @@ +/* + * Author: Glowbal + * Set the triage status of object + * + * Arguments: + * 0: Target + * 1: Status + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params ["_target", "_status"]; + +_target setvariable [QEGVAR(medical,triageLevel), _status, true]; diff --git a/addons/medical_menu/functions/fnc_updateActivityLog.sqf b/addons/medical_menu/functions/fnc_updateActivityLog.sqf new file mode 100644 index 0000000000..335aea0c58 --- /dev/null +++ b/addons/medical_menu/functions/fnc_updateActivityLog.sqf @@ -0,0 +1,42 @@ +/* + * Author: Glowbal + * Update the activity log + * + * Arguments: + * 0: display + * 1: log collection + * + * Return Value: + * None + * + * Example: + * [some_display, log] call ace_medical_menu_updateActivityLog + * + * Public: No + */ +#include "script_component.hpp" + +private "_logCtrl"; + +params ["_display", "_logs"]; + +_logCtrl = _display displayCtrl 214; +lbClear _logCtrl; + +{ + _x params ["_message", "_moment", "_dummy", "_arguments"]; + + if (isLocalized _message) then { + _message = localize _message; + }; + + { + if (typeName _x == "STRING" && {isLocalized _x}) then { + _arguments set [_foreachIndex, localize _x]; + }; + } forEach _arguments; + + _message = format ([_message] + _arguments); + _logCtrl lbAdd format ["%1 %2", _moment, _message]; + nil +} count _logs; diff --git a/addons/medical_menu/functions/fnc_updateBodyImage.sqf b/addons/medical_menu/functions/fnc_updateBodyImage.sqf new file mode 100644 index 0000000000..34b2f450c8 --- /dev/null +++ b/addons/medical_menu/functions/fnc_updateBodyImage.sqf @@ -0,0 +1,42 @@ +/* + * Author: Glowbal + * Update the body image on the menu + * + * Arguments: + * 0: selection bloodloss + * 1: display + * + * Return Value: + * None + * + * Example: + * [0.3, some_display] call ace_medical_menu_updateBodyImage + * + * Public: No + */ +#include "script_component.hpp" + +params ["_selectionBloodLoss", "_display"]; + +// Handle the body image coloring +_availableSelections = [50, 51, 52, 53, 54, 55]; +{ + private ["_red", "_green", "_blue"]; + + _red = 1; + _green = 1; + _blue = 1; + + if (_x > 0) then { + if (_damaged select _forEachIndex) then { + _green = (0.9 - _x) max 0; + _blue = _green; + } else { + _green = (0.9 - _x) max 0; + _red = _green; + //_blue = _green; + }; + }; + + (_display displayCtrl (_availableSelections select _forEachIndex)) ctrlSetTextColor [_red, _green, _blue, 1.0]; +} forEach _selectionBloodLoss; diff --git a/addons/medical_menu/functions/fnc_updateIcons.sqf b/addons/medical_menu/functions/fnc_updateIcons.sqf new file mode 100644 index 0000000000..f9d3fc5ab4 --- /dev/null +++ b/addons/medical_menu/functions/fnc_updateIcons.sqf @@ -0,0 +1,35 @@ +/* + * Author: Glowbal + * Update the category icons + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_medical_menu_updateIcons + * + * Public: No + */ +#include "script_component.hpp" + +#define START_IDC 111 +#define END_IDC 118 + +private ["_display", "_idc", "_options", "_name", "_amount"]; + +disableSerialization; + +_display = uiNamespace getVariable QGVAR(medicalMenu); + +_options = ["triage" , "examine", "bandage", "medication", "airway", "advanced", "drag", "toggle"]; +for "_idc" from START_IDC to END_IDC step 1 do { + _amount = [ACE_player, GVAR(INTERACTION_TARGET), _options select (_idc - START_IDC)] call FUNC(getTreatmentOptions); + if ((count _amount) > 0 || _idc == START_IDC || _idc == END_IDC) then { + (_display displayCtrl _idc) ctrlSettextColor [1, 1, 1, 1]; + } else { + (_display displayCtrl _idc) ctrlSettextColor [0.4, 0.4, 0.4, 1]; + }; +}; diff --git a/addons/medical_menu/functions/fnc_updateInformationLists.sqf b/addons/medical_menu/functions/fnc_updateInformationLists.sqf new file mode 100644 index 0000000000..db7220065c --- /dev/null +++ b/addons/medical_menu/functions/fnc_updateInformationLists.sqf @@ -0,0 +1,36 @@ +/* + * Author: Glowbal + * Update the treatment information list + * + * Arguments: + * 0: display + * 1: message collection + * 2: injury collection + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +private "_lbCtrl"; + +params ["_display", "_genericMessages", "_allInjuryTexts"]; + +_lbCtrl = _display displayCtrl 213; +lbClear _lbCtrl; +{ + _lbCtrl lbAdd (_x select 0); + _lbCtrl lbSetColor [_forEachIndex, _x select 1]; +} forEach _genericMessages; + +_amountOfGeneric = count _genericMessages; +{ + _lbCtrl lbAdd (_x select 0); + _lbCtrl lbSetColor [_forEachIndex + _amountOfGeneric, _x select 1]; +} forEach _allInjuryTexts; + +if (count _allInjuryTexts == 0) then { + _lbCtrl lbAdd localize ELSTRING(medical,NoInjuriesBodypart); +}; diff --git a/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf b/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf new file mode 100644 index 0000000000..8ca81f28ed --- /dev/null +++ b/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf @@ -0,0 +1,42 @@ +/* + * Author: Glowbal + * Update the quick view log + * + * Arguments: + * 0: display + * 1: log collection + * + * Return Value: + * None + * + * Example: + * [some_display, log] call ace_medical_menu_updateQuickViewLog + * + * Public: No + */ +#include "script_component.hpp" + +private "_logCtrl"; + +params ["_display", "_logs"]; + +_logCtrl = _display displayCtrl 215; +lbClear _logCtrl; + +{ + _x params ["_message", "_moment", "_dummy", "_arguments"]; + + if (isLocalized _message) then { + _message = localize _message; + }; + + { + if (typeName _x == "STRING" && {isLocalized _x}) then { + _arguments set [_foreachIndex, localize _x]; + }; + } forEach _arguments; + + _message = format ([_message] + _arguments); + _logCtrl lbAdd format ["%1 %2", _moment, _message]; + nil +} count _logs; diff --git a/addons/medical_menu/functions/fnc_updateUIInfo.sqf b/addons/medical_menu/functions/fnc_updateUIInfo.sqf new file mode 100644 index 0000000000..7dee2d5123 --- /dev/null +++ b/addons/medical_menu/functions/fnc_updateUIInfo.sqf @@ -0,0 +1,142 @@ +/* + * Author: Glowbal + * Update all UI information in the medical menu + * + * Arguments: + * 0: target + * 1: display + * + * Return Value: + * None + * + * Example: + * [some_player, some_display] call ace_medical_menu_updateUIInfo + * + * Public: No + */ +#include "script_component.hpp" + +private ["_genericMessages", "_totalIvVolume", "_damaged", "_selectionBloodLoss", "_allInjuryTexts"]; + +params ["_target", "_display"]; + +_selectionN = GVAR(selectedBodyPart); +if (_selectionN < 0 || _selectionN > 5) exitwith {}; + +_genericMessages = []; +_partText = [ELSTRING(medical,Head), ELSTRING(medical,Torso), ELSTRING(medical,LeftArm) ,ELSTRING(medical,RightArm) ,ELSTRING(medical,LeftLeg), ELSTRING(medical,RightLeg)] select _selectionN; +_genericMessages pushBack [localize _partText, [1, 1, 1, 1]]; + +if (_target getVariable [QEGVAR(medical,isBleeding), false]) then { + _genericMessages pushBack [localize ELSTRING(medical,Status_Bleeding), [1, 0.1, 0.1, 1]]; +}; + +if (_target getVariable [QEGVAR(medical,hasLostBlood), 0] > 1) then { + _genericMessages pushBack [localize ELSTRING(medical,Status_Lost_Blood), [1, 0.1, 0.1, 1]]; +}; + +if (((_target getVariable [QEGVAR(medical,tourniquets), [0, 0, 0, 0, 0, 0]]) select _selectionN) > 0) then { + _genericMessages pushBack [localize ELSTRING(medical,Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]]; +}; + +if (_target getVariable [QEGVAR(medical,hasPain), false]) then { + _genericMessages pushBack [localize ELSTRING(medical,Status_Pain), [1, 1, 1, 1]]; +}; + +_totalIvVolume = 0; +{ + private "_value"; + _value = _target getVariable _x; + if (!isNil "_value") then { + _totalIvVolume = _totalIvVolume + (_target getVariable [_x, 0]); + }; +} count EGVAR(medical,IVBags); + +if (_totalIvVolume >= 1) then { + _genericMessages pushBack [format [localize ELSTRING(medical,receivingIvVolume), floor _totalIvVolume], [1, 1, 1, 1]]; +}; + +_damaged = [false, false, false, false, false, false]; +_selectionBloodLoss = [0, 0, 0, 0, 0, 0]; + +_allInjuryTexts = []; +if (EGVAR(medical,level) >= 2) then { + _openWounds = _target getVariable [QEGVAR(medical,openWounds), []]; + private "_amountOf"; + { + _amountOf = _x select 3; + // Find how much this bodypart is bleeding + if (_amountOf > 0) then { + _damaged set [_x select 2, true]; + _selectionBloodLoss set [_x select 2, (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))]; + + if (_selectionN == (_x select 2)) then { + // Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this] + if (_amountOf >= 1) then { + // TODO localization + _allInjuryTexts pushBack [format["%2x %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,1,1,1]]; + } else { + // TODO localization + _allInjuryTexts pushBack [format["Partial %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6], [1,1,1,1]]; + }; + }; + }; + } forEach _openWounds; + + _bandagedwounds = _target getVariable [QEGVAR(medical,bandagedWounds), []]; + { + _amountOf = _x select 3; + // Find how much this bodypart is bleeding + if !(_damaged select (_x select 2)) then { + _selectionBloodLoss set [_x select 2, (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))]; + }; + if (_selectionN == (_x select 2)) then { + // Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this] + if (_amountOf > 0) then { + if (_amountOf >= 1) then { + // TODO localization + _allInjuryTexts pushBack [format ["[B] %2x %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [0.88,0.7,0.65,1]]; + } else { + // TODO localization + _allInjuryTexts pushBack [format ["[B] Partial %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6], [0.88,0.7,0.65,1]]; + }; + }; + }; + } forEach _bandagedwounds; +} else { + _damaged = [true, true, true, true, true, true]; + { + _selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _x]; + + if (_target getHitPointDamage _x > 0 && _forEachIndex == _selectionN) then { + _pointDamage = _target getHitPointDamage _x; + _severity = switch (true) do { + case (_pointDamage > 0.5): {localize ELSTRING(medical,HeavilyWounded)}; + case (_pointDamage > 0.1): {localize ELSTRING(medical,LightlyWounded)}; + default {localize ELSTRING(medical,VeryLightlyWounded)}; + }; + _part = localize ([ + ELSTRING(medical,Head), + ELSTRING(medical,Torso), + ELSTRING(medical,LeftArm), + ELSTRING(medical,RightArm), + ELSTRING(medical,LeftLeg), + ELSTRING(medical,RightLeg) + ] select _forEachIndex); + _allInjuryTexts pushBack [format ["%1 %2", _severity, toLower _part], [1,1,1,1]]; + }; + } forEach ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; +}; + +[_selectionBloodLoss, _display] call FUNC(updateBodyImage); +[_display, _genericMessages, _allInjuryTexts] call FUNC(updateInformationLists); + +_logs = _target getVariable [QEGVAR(medical,logFile_activity_view), []]; +[_display, _logs] call FUNC(updateActivityLog); + +_logs = _target getVariable [QEGVAR(medical,logFile_quick_view), []]; +[_display, _logs] call FUNC(updateQuickViewLog); + +_triageStatus = [_target] call EFUNC(medical,getTriageStatus); +(_display displayCtrl 2000) ctrlSetText (_triageStatus select 0); +(_display displayCtrl 2000) ctrlSetBackgroundColor (_triageStatus select 2); diff --git a/addons/medical_menu/functions/script_component.hpp b/addons/medical_menu/functions/script_component.hpp new file mode 100644 index 0000000000..8c2e419166 --- /dev/null +++ b/addons/medical_menu/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\medical_menu\script_component.hpp" diff --git a/addons/medical_menu/script_component.hpp b/addons/medical_menu/script_component.hpp new file mode 100644 index 0000000000..3119d48e19 --- /dev/null +++ b/addons/medical_menu/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT medical_menu +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_MEDICAL_MENU + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MEDICAL_MENU + #define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL_MENU +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/medical_menu/stringtable.xml b/addons/medical_menu/stringtable.xml new file mode 100644 index 0000000000..f4cc40521a --- /dev/null +++ b/addons/medical_menu/stringtable.xml @@ -0,0 +1,396 @@ + + + + + Medical Menu + Menu medyczne + + + Allow Medical Menu + Akt. menu medyczne + + + Allow clients to use the medical menu + Zezwalaj graczom korzystać z menu medycznego + + + Use Medical menu + Użyj menu medycznego + + + If allowed by server, enable the option to use the Medical Menu through keybinding and interaction menu + Jeżeli zezwolone przez serwer, aktywuj menu medyczne poprzez skrót klawiszowy i menu interakcji. + + + Re-open Medical menu + Otwieraj ponownie menu medyczne + + + Re-open the medical menu after succesful treatment + Otwórz ponownie menu medyczne po udanym zakończeniu leczenia + + + Open Medical Menu + Otwórz menu medyczne + + + Medical Menu Settings + Ustawienia menu medycznego + + + Configure the usage of the Medical Menu + Skonfiguruj opcje menu medycznego + + + EXAMINE & TREATMENT + ОСМОТР И ЛЕЧЕНИЕ + EXAMINAR & TRATAMIENTO + EXAMINER & TRAITEMENTS + BADANIE & LECZENIE + + + STATUS + СОСТОЯНИЕ + ESTADO + ÉTATS + STATUS + + + OVERVIEW + ОБЩАЯ ИНФОРМАЦИЯ + DESCRIPCIÓN + DESCRIPTION + OPIS + + + ACTIVITY LOG + ПРОВЕДЕННЫЕ МАНИПУЛЯЦИИ + REGISTRO DE ACTIVIDAD + REGISTRE DES SOINS + LOGI AKTYWNOŚCI + + + QUICK VIEW + БЫСТРЫЙ ОСМОТР + VISTA RÁPIDA + VUE RAPIDE + SZYBKI PODGLĄD + + + None + Не ранен + Ninguno + Aucun + Brak + + + Minor + Несрочная помощь + Menor + Mineur + Normalny + + + Delayed + Срочная помощь + Diferido + Urgent + Opóźniony + + + Immediate + Неотложная помощь + Inmediato + Immédiat + Natychmiastowy + + + Deceased + Морг + Fallecido + Décédé + Nie żyje + + + View triage Card + Смотреть первичную карточку + Ver Triage + Voir Carte de Triage + Pokaż kartę segregacyjną + + + Examine Patient + Осмотреть пациента + Examinar Paciente + Examiner Patient + Zbadaj pacjenta + + + Bandage / Fractures + Раны / переломы + Vendajes/Fracturas + Bandages / Fractures + Bandaże / Złamania + + + Medication + Медикаменты + Medicación + Médications + Leki + + + Airway Management + Дыхательные пути + Vías Aéreas + Gestion Des Voie REspiratoire + Drogi oddechowe + + + Advanced Treatments + Специальная медпомощь + Tratamientos Avanzados + Traitement Avancé + Zaawansowane zabiegi + + + Drag/Carry + Тащить/нести + Arrastrar/Cargar + Glisser/Porter + Ciągnij/Nieś + + + Toggle (Self) + Лечить себя/другого раненого + Activer (sois) + Przełącz (na siebie) + Alternar + + + Select triage status + Сортировка + Seleccionar estado de Triage + Selectioner l'état de Triage + Wybierz priorytet + + + + Select Head + Выбрать голову + Seleccionar Cabeza + Selectioner Tête + Wybierz głowę + + + Select Torso + Выбрать торс + Seleccionar Torso + Selectioner Torse + Wybierz tors + + + Select Left Arm + Выбрать левую руку + Seleccionar Brazo Izquierdo + Selectioner Bras Gauche + Wybierz lewą rękę + + + Select Right Arm + Выбрать правую руку + Seleccionar Brazo Derecho + Selectioner Bras Droit + Wybierz prawą rękę + + + Select Left Leg + Выбрать левую ногу + Seleccionar Pierna Izquierda + Selectioner Jambe Gauche + Wybierz lewą nogę + + + Select Right Leg + Выбрать правую ногу + Seleccionar Pierna Derecha + Selectioner Jambe Droite + Wybierz prawą nogę + + + Head + Голова + Cabeza + Tête + Głowa + + + Torso + Торс + Torse + Tors + + + Left Arm + Левая рука + Brazo Izquierdo + Bras Gauche + Lewa ręka + + + Right Arm + Правая рука + Brazo Derecho + Bras Droit + Prawa ręka + + + Left Leg + Левая нога + Pierna Izquierda + Jambe Gauche + Lewa noga + + + Right Leg + Правая нога + Pierna Derecha + Jambe Droite + Prawa noga + + + Body Part: %1 + Часть тела: %1 + Parte del cuerpo: %1 + Partie du corps: %1 + Część ciała: %1 + + + Small + малого размера + Pequeña + Petite + małym + + + Medium + среднего размера + Mediana + moyenne + średnim + + + Large + большого размера + Grande + Grande + dużym + + + There are %2 %1 Open Wounds + %2 открытые раны %1 + Hay %2 Heridas Abiertas %1 + Il y a %2 %1 Blessure Ouverte + Widzisz otwarte rany w ilości %2 o %1 rozmiarze + + + There is 1 %1 Open Wound + Открытая рана %1 + Hay 1 Herida Abierta %1 + Il y a 1 blessure ouverte %1 + Widzisz 1 otwartą ranę o %1 rozmiarze + + + There is a partial %1 Open wound + Частично открытая рана %1 + Hay una herida parcial abierta %1 + Il y a une Blessure Patiellement Ouverte %1 + Widzisz częściowo otwartą ranę o %1 rozmiarze + + + There are %2 %1 Bandaged Wounds + %2 перевязанные раны %1 + Hay %2 Heridas %1 Vendadas + Il y a %2 %1 Blessure Bandée + Widzisz %2 zabandażowanych ran o %1 rozmiarze + + + There is 1 %1 Bandaged Wound + 1 перевязанная рана %1 + Hay 1 Herida Vendada %1 + Il y a 1 %1 Blessure Bandée + Widzisz 1 zabandażowaną ranę o %1 rozmiarze + + + There is a partial %1 Bandaged wound + Частично перевязанная рана %1 + Hay una Herida parcial %1 Vendada + Il y a %1 Blessure Partielment Bandée + Widzisz 1 częściowo zabandażowaną ranę o %1 rozmiarze + + + Normal breathing + Дыхание в норме + Respiración normal + Respiration Normale + Normalny oddech + + + No breathing + Дыхания нет + No respira + Apnée + Brak oddechu + + + Difficult breathing + Дыхание затруднено + Dificultad para respirar + Difficultée Respiratoire + Trudności z oddychaniem + + + Almost no breathing + Дыхания почти нет + Casi sin respirar + Respiration Faible + Prawie brak oddechu + + + Bleeding + Кровотечение + Sangrando + Seignement + Krwawienie zewnętrzne + + + in Pain + Испытывает боль + Con Dolor + A De La Douleur + W bólu + + + Lost a lot of Blood + Большая кровопотеря + Mucha Sangre perdida + A Perdu Bcp de Sang + Stracił dużo krwi + + + Tourniquet [CAT] + Жгут + Torniquete [CAT] + Garot [CAT] + Opaska uciskowa [CAT] + + + Nasopharyngeal Tube [NPA] + Назотрахеальная трубка + Torniquete [CAT] + Canule Naseaupharyngée [NPA] + Rurka nosowo-gardłowa [NPA] + Nasopharyngeal Tube [NPA] + + + diff --git a/addons/medical_menu/ui/menu.hpp b/addons/medical_menu/ui/menu.hpp new file mode 100644 index 0000000000..c0c32cac8b --- /dev/null +++ b/addons/medical_menu/ui/menu.hpp @@ -0,0 +1,570 @@ +#include "\z\ace\addons\common\define.hpp" + +class GVAR(medicalMenu) { + idd = 314412; + movingEnable = true; + onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(medicalMenu)), _this select 0)]; [ARR_2(QUOTE(QGVAR(id)), true)] call EFUNC(common,blurScreen); [_this select 0] call FUNC(onMenuOpen);); + onUnload = QUOTE([ARR_2(QUOTE(QGVAR(id)), false)] call EFUNC(common,blurScreen); [ARR_2(QUOTE(QGVAR(onMenuOpen)), 'onEachFrame')] call BIS_fnc_removeStackedEventHandler;); + class controlsBackground { + class HeaderBackground: ACE_gui_backgroundBase{ + idc = -1; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + text = "#(argb,8,8,3)color(0,0,0,0)"; + }; + class CenterBackground: HeaderBackground { + y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + h = "16 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + text = "#(argb,8,8,3)color(0,0,0,0.8)"; + colorText[] = {0, 0, 0, "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; + colorBackground[] = {0,0,0,"(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; + }; + class BottomBackground: CenterBackground { + y = "(18.6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2))"; + h = "9 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + }; + }; + + class controls { + class HeaderName { + idc = 1; + type = CT_STATIC; + x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + style = ST_LEFT + ST_SHADOW; + font = "PuristaMedium"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + colorText[] = {0.95, 0.95, 0.95, 0.75}; + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; + text = ""; + }; + + class IconsBackGroundBar: ACE_gui_backgroundBase{ + idc = -1; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "3.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + text = QUOTE(PATHTOF(data\background_img.paa)); + colorText[] = {1, 1, 1, 0.0}; + }; + class CatagoryLeft: HeaderName { + x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + style = ST_CENTER; + colorText[] = {1, 1, 1.0, 0.9}; + colorBackground[] = {0,0,0,0}; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; + text = $STR_ACE_Medical_Menu_EXAMINE_TREATMENT; + }; + class CatagoryCenter: CatagoryLeft { + x = "13.33 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + text = $STR_ACE_Medical_Menu_STATUS; + }; + class CatagoryRight: CatagoryCenter{ + x = "25.66 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + text = $STR_ACE_Medical_Menu_OVERVIEW; + }; + class Line: ACE_gui_backgroundBase { + idc = -1; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "3.7 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "37 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "0.03 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + text = "#(argb,8,8,3)color(1,1,1,0.5)"; + }; + + class iconImg1: ACE_gui_backgroundBase { + idc = 111; + x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "3.73 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.1)"; + colorBackground[] = {0,0,0,1}; + colorPicture[] = {1,1,1,1}; + colorText[] = {1,1,1,1}; + text = QUOTE(PATHTOF(data\icons\triage_card_small.paa)); + }; + class iconImg2: iconImg1 { + idc = 112; + x = "3 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + text = QUOTE(PATHTOF(data\icons\examine_patient_small.paa)); + }; + class iconImg3: iconImg1 { + idc = 113; + x = "4.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + text = QUOTE(PATHTOF(data\icons\bandage_fracture_small.paa)); + }; + class iconImg4: iconImg1 { + idc = 114; + x = "6 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + text = QUOTE(PATHTOF(data\icons\medication_small.paa)); + }; + class iconImg5: iconImg1 { + idc = 115; + x = "7.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + text = QUOTE(PATHTOF(data\icons\airway_management_small.paa)); + }; + class iconImg6: iconImg1 { + idc = 116; + x = "9 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + text = QUOTE(PATHTOF(data\icons\advanced_treatment_small.paa)); + }; + class iconImg7: iconImg1 { + idc = 117; + x = "10.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + text = QUOTE(PATHTOF(data\icons\icon_carry.paa)); + }; + class iconImg8: iconImg1 { + idc = 118; + x = "12 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + text = QUOTE(PATHTOF(data\icons\toggle_self_small.paa)); + }; + + + class BtnIconLeft1: ACE_gui_buttonBase { + idc = 11; + x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "3.73 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.1)"; + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureOver = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.0)"; + action = QUOTE(['triage'] call FUNC(handleUI_DisplayOptions);); + }; + class BtnIconLeft2: BtnIconLeft1 { + idc = 12; + x = "3 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + action = QUOTE(['examine'] call FUNC(handleUI_DisplayOptions);); + }; + class BtnIconLeft3: BtnIconLeft1 { + idc = 13; + x = "4.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + action = QUOTE(['bandage'] call FUNC(handleUI_DisplayOptions);); + }; + class BtnIconLeft4: BtnIconLeft1 { + idc = 14; + x = "6 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + action = QUOTE(['medication'] call FUNC(handleUI_DisplayOptions);); + }; + class BtnIconLeft5: BtnIconLeft1 { + idc = 15; + x = "7.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + action = QUOTE(['airway'] call FUNC(handleUI_DisplayOptions);); + }; + class BtnIconLeft6: BtnIconLeft1 { + idc = 16; + x = "9 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + action = QUOTE(['advanced'] call FUNC(handleUI_DisplayOptions);); + }; + class BtnIconLeft7: BtnIconLeft1 { + idc = 17; + x = "10.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + action = QUOTE(['drag'] call FUNC(handleUI_DisplayOptions);); + }; + class BtnIconLeft8: BtnIconLeft1 { + idc = 18; + x = "12 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + action = QUOTE(['toggle'] call FUNC(handleUI_DisplayOptions);); + }; + + class TriageCardList: ACE_gui_listBoxBase { + idc = 212; + x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "5.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "12 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; + rowHeight = 0.03; + colorBackground[] = {0, 0, 0, 0.2}; + colorText[] = {1,1, 1, 1.0}; + colorScrollbar[] = {0.95, 0.95, 0.95, 1}; + colorSelect[] = {0.95, 0.95, 0.95, 1}; + colorSelect2[] = {0.95, 0.95, 0.95, 1}; + colorSelectBackground[] = {0, 0, 0, 0.0}; + colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.0}; + }; + + // Left side + class BtnMenu1: BtnIconLeft1 { + idc = 20; + y = "5.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "12 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + text = ""; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.9)"; + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.8)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.5)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; + color[] = {1, 1, 1, 1}; + color2[] = {0,0,0, 1}; + colorBackgroundFocused[] = {1,1,1,1}; + colorBackground[] = {1,1,1,1}; + colorbackground2[] = {1,1,1,1}; + colorDisabled[] = {0.5,0.5,0.5,0.8}; + colorFocused[] = {0,0,0,1}; + periodFocus = 1; + periodOver = 1; + action = ""; + }; + class BtnMenu2: BtnMenu1 { + idc = 21; + y = "6.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + text = ""; + }; + class BtnMenu3: BtnMenu1 { + idc = 22; + y = "7.6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + text = ""; + }; + class BtnMenu4: BtnMenu1 { + idc = 23; + y = "8.7 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + text =""; + }; + class BtnMenu5: BtnMenu1 { + idc = 24; + y = "9.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + text = ""; + }; + class BtnMenu6: BtnMenu1 { + idc = 25; + y = "10.9 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + text = ""; + }; + class BtnMenu7: BtnMenu1 { + idc = 26; + y = "12 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + text = ""; + }; + class BtnMenu8: BtnMenu1 { + idc = 27; + y = "13.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + text = ""; + }; + // center + + class bodyImgBackground: ACE_gui_backgroundBase { + idc = -1; + x = "13.33 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "3.73 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "12.33 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; + colorBackground[] = {1,1,1,1}; + colorPicture[] = {1,1,1,1}; + colorText[] = {1,1,1,1}; + text = QUOTE(PATHTOEF(medical,ui\body_background.paa)); + }; + class bodyImgHead: bodyImgBackground { + idc = 50; + x = "13.33 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "3.73 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "12.33 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; + colorBackground[] = {1,1,1,1}; + colorPicture[] = {1,1,1,0.75}; + colorText[] = {1,1,1,0.75}; + text = QUOTE(PATHTOEF(medical,ui\body_head.paa)); + }; + + class bodyImgTorso: bodyImgHead { + idc = 51; + text = QUOTE(PATHTOEF(medical,ui\body_torso.paa)); + }; + class bodyImgArms_l: bodyImgHead { + idc = 52; + text = QUOTE(PATHTOEF(medical,ui\body_arm_left.paa)); + }; + class bodyImgArms_r: bodyImgHead { + idc = 53; + text = QUOTE(PATHTOEF(medical,ui\body_arm_right.paa)); + }; + class bodyImgLegs_l: bodyImgHead { + idc = 54; + text = QUOTE(PATHTOEF(medical,ui\body_leg_left.paa)); + }; + class bodyImgLegs_r: bodyImgHead { + idc = 55; + text = QUOTE(PATHTOEF(medical,ui\body_leg_right.paa)); + }; + + + class selectHead: ACE_gui_buttonBase { + idc = 301; + x = "18.8 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "3.9 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "1.4 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.1)"; + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureOver = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.0)"; + action = QUOTE(GVAR(selectedBodyPart) = 0; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); + }; + class selectTorso : selectHead { + idc = 302; + x = "18.4 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "5.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "2.2 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "4.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + action = QUOTE(GVAR(selectedBodyPart) = 1; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); + }; + class selectLeftArm: selectHead{ + idc = 303; + x = "17.4 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "5.9 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "1.1 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "4.3 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + action = QUOTE(GVAR(selectedBodyPart) = 3; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); + }; + class selectRightArm: selectLeftArm{ + idc = 304; + x = "20.6 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + action = QUOTE(GVAR(selectedBodyPart) = 2; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); + }; + class selectLeftLeg :selectHead { + idc = 305; + x = "18.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "9.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "1.1 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + action = QUOTE(GVAR(selectedBodyPart) = 5; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); + }; + class selectRightLeg :selectLeftLeg { + idc = 306; + x = "19.6 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + action = QUOTE(GVAR(selectedBodyPart) = 4; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); + }; + + + class TriageTextBottom: HeaderName { + idc = 2000; + x = "13.33 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "16.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + style = ST_CENTER; + colorText[] = {1, 1, 1.0, 1}; + colorBackground[] = {0,0.0,0.0,0.7}; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + text = ""; + }; + + // Right side + class InjuryList: ACE_gui_listBoxBase { + idc = 213; + x = "25.66 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "5.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; + rowHeight = 0.03; + colorBackground[] = {0, 0, 0, 0.2}; + colorText[] = {1,1, 1, 1.0}; + colorScrollbar[] = {0.95, 0.95, 0.95, 1}; + colorSelect[] = {0.95, 0.95, 0.95, 1}; + colorSelect2[] = {0.95, 0.95, 0.95, 1}; + colorSelectBackground[] = {0, 0, 0, 0.0}; + colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.5}; + }; + // bottom + + class ActivityLogHeader: CatagoryLeft { + x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "18.6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "18.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + style = ST_CENTER; + colorText[] = {0.6, 0.7, 1.0, 1}; + colorBackground[] = {0,0,0,0}; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + text = $STR_ACE_Medical_Menu_ACTIVITY_LOG; + }; + class QuickViewHeader: ActivityLogHeader { + x = "19.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + text = $STR_ACE_Medical_Menu_QUICK_VIEW; + }; + class LineBottomHeaders: Line { + y = "19.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + }; + class ActivityLog: InjuryList { + idc = 214; + //style = 16; + //type = 102; + //rows=1; + colorBackground[] = {0, 0, 0, 0}; + x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "(19.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2))"; + w = "18.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "6.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; + //colorSelectBackground[] = {0, 0, 0, 0.0}; + //colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.0}; + //columns[] = {0.0, 0.08}; + //canDrag=true; + //arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; + // arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; + drawSideArrows = 0; + //idcLeft = -1; + //idcRight = -1; + }; + + class QuikViewLog: InjuryList { + idc = 215; + //style = 16; + //type = 102; + //rows=1; + colorBackground[] = {0, 0, 0, 0}; + x = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "(19.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2))"; + w = "18.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "6.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; + colorSelectBackground[] = {0, 0, 0, 0.0}; + colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.0}; + + //columns[] = {0.0, 0.08}; + //canDrag=true; + //arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; + // arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; + drawSideArrows = 0; + //idcLeft = -1; + //idcRight = -1; + }; + + class selectTriageStatus: ACE_gui_buttonBase { + idc = 2001; + x = "13.33 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "16.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + style = ST_CENTER; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureOver = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.0)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.0)"; + action = QUOTE([] call FUNC(handleUI_dropDownTriageCard);); + }; + class selectTriageStatusNone: selectTriageStatus { + idc = 2002; + x = 0; + y = 0; + w = 0; + h = 0; + text = $STR_ACE_Medical_Menu_TRIAGE_NONE; + style = ST_CENTER; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureOver = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.9)"; + action = QUOTE([] call FUNC(handleUI_dropDownTriageCard); [ARR_2(GVAR(INTERACTION_TARGET),0)] call FUNC(setTriageStatus);); + }; + + class selectTriageStatusMinor: selectTriageStatus { + idc = 2003; + x = 0; + y = 0; + w = 0; + h = 0; + text = $STR_ACE_Medical_Menu_TRIAGE_MINOR; + style = ST_CENTER; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + animTextureNormal = "#(argb,8,8,3)color(0,0.5,0,0.9)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0.5,0,0.9)"; + animTextureOver = "#(argb,8,8,3)color(0,0.5,0,0.9)"; + animTextureFocused = "#(argb,8,8,3)color(0,0.5,0,0.9)"; + animTexturePressed = "#(argb,8,8,3)color(0,0.5,0,0.9)"; + animTextureDefault = "#(argb,8,8,3)color(0,0.5,0,0.9)"; + action = QUOTE([] call FUNC(handleUI_dropDownTriageCard); [ARR_2(GVAR(INTERACTION_TARGET),1)] call FUNC(setTriageStatus);); + }; + class selectTriageStatusDelayed: selectTriageStatus { + idc = 2004; + x = 0; + y = 0; + w = 0; + h = 0; + text = $STR_ACE_Medical_Menu_TRIAGE_DELAYED; + style = ST_CENTER; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + animTextureNormal = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; + animTextureDisabled = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; + animTextureOver = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; + animTextureFocused = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; + animTexturePressed = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; + animTextureDefault = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; + action = QUOTE([] call FUNC(handleUI_dropDownTriageCard); [ARR_2(GVAR(INTERACTION_TARGET),2)] call FUNC(setTriageStatus);); + }; + class selectTriageStatusImmediate: selectTriageStatus { + idc = 2005; + x = 0; + y = 0; + w = 0; + h = 0; + text = $STR_ACE_Medical_Menu_TRIAGE_IMMEDIATE; + style = ST_CENTER; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + animTextureNormal = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; + animTextureDisabled = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; + animTextureOver = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; + animTextureFocused = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; + animTexturePressed = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; + animTextureDefault = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; + action = QUOTE([] call FUNC(handleUI_dropDownTriageCard); [ARR_2(GVAR(INTERACTION_TARGET),3)] call FUNC(setTriageStatus);); + }; + class selectTriageStatusDeceased: selectTriageStatus { + idc = 2006; + x = 0; + y = 0; + w = 0; + h = 0; + text = $STR_ACE_Medical_Menu_TRIAGE_DECEASED; + style = ST_CENTER; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureOver = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.9)"; + action = QUOTE([] call FUNC(handleUI_dropDownTriageCard); [ARR_2(GVAR(INTERACTION_TARGET),4)] call FUNC(setTriageStatus);); + }; + }; +}; \ No newline at end of file diff --git a/addons/nametags/ACE_Settings.hpp b/addons/nametags/ACE_Settings.hpp index e976c4adc8..354d5748bf 100644 --- a/addons/nametags/ACE_Settings.hpp +++ b/addons/nametags/ACE_Settings.hpp @@ -4,6 +4,7 @@ class ACE_Settings { typeName = "COLOR"; isClientSettable = 1; displayName = CSTRING(DefaultNametagColor); + category = CSTRING(Module_DisplayName); }; class GVAR(showPlayerNames) { value = 1; @@ -11,30 +12,35 @@ class ACE_Settings { isClientSettable = 1; displayName = CSTRING(ShowPlayerNames); description = CSTRING(ShowPlayerNames_Desc); - values[] = {CSTRING(Disabled), CSTRING(Enabled), CSTRING(OnlyCursor), CSTRING(OnlyKeypress), CSTRING(OnlyCursorAndKeypress)}; + values[] = {ECSTRING(common,Disabled), ECSTRING(common,Enabled), CSTRING(OnlyCursor), CSTRING(OnlyKeypress), CSTRING(OnlyCursorAndKeypress)}; + category = CSTRING(Module_DisplayName); }; class GVAR(showPlayerRanks) { value = 1; typeName = "BOOL"; isClientSettable = 1; displayName = CSTRING(ShowPlayerRanks); + category = CSTRING(Module_DisplayName); }; class GVAR(showVehicleCrewInfo) { value = 1; typeName = "BOOL"; isClientSettable = 1; displayName = CSTRING(ShowVehicleCrewInfo); + category = CSTRING(Module_DisplayName); }; class GVAR(showNamesForAI) { value = 0; typeName = "BOOL"; isClientSettable = 1; displayName = CSTRING(ShowNamesForAI); + category = CSTRING(Module_DisplayName); }; class GVAR(showCursorTagForVehicles) { value = 0; typeName = "BOOL"; isClientSettable = 0; + category = CSTRING(Module_DisplayName); }; class GVAR(showSoundWaves) { value = 1; @@ -42,17 +48,20 @@ class ACE_Settings { isClientSettable = 1; displayName = CSTRING(ShowSoundWaves); description = CSTRING(ShowSoundWaves_Desc); - values[] = {CSTRING(Disabled), CSTRING(NameTagSettings), CSTRING(AlwaysShowAll)}; + values[] = {ECSTRING(common,Disabled), CSTRING(NameTagSettings), CSTRING(AlwaysShowAll)}; + category = CSTRING(Module_DisplayName); }; class GVAR(playerNamesViewDistance) { value = 5; typeName = "SCALAR"; isClientSettable = 0; + category = CSTRING(Module_DisplayName); }; class GVAR(playerNamesMaxAlpha) { value = 0.8; typeName = "SCALAR"; isClientSettable = 0; + category = CSTRING(Module_DisplayName); }; class GVAR(tagSize) { value = 2; @@ -61,5 +70,6 @@ class ACE_Settings { displayName = CSTRING(TagSize_Name); description = CSTRING(TagSize_Description); values[] = {"$str_very_small", "$str_small", "$str_medium", "$str_large", "$str_very_large"}; + category = CSTRING(Module_DisplayName); }; }; diff --git a/addons/nametags/CfgVehicles.hpp b/addons/nametags/CfgVehicles.hpp index 6c0c148e47..f6e28095b4 100644 --- a/addons/nametags/CfgVehicles.hpp +++ b/addons/nametags/CfgVehicles.hpp @@ -16,7 +16,7 @@ class CfgVehicles { class values { class DoNotForce { default = 1; - name = CSTRING(DoNotForce); + name = ECSTRING(common,DoNotForce); value = -1; }; class ForceHide { @@ -54,7 +54,7 @@ class CfgVehicles { class values { class DoNotForce { default = 1; - name = CSTRING(DoNotForce); + name = ECSTRING(common,DoNotForce); value = -1; }; class ForceHide { @@ -74,7 +74,7 @@ class CfgVehicles { class values { class DoNotForce { default = 1; - name = CSTRING(DoNotForce); + name = ECSTRING(common,DoNotForce); value = -1; }; class ForceHide { diff --git a/addons/nametags/XEH_postInit.sqf b/addons/nametags/XEH_postInit.sqf index efc634be6c..b828d70005 100644 --- a/addons/nametags/XEH_postInit.sqf +++ b/addons/nametags/XEH_postInit.sqf @@ -66,8 +66,8 @@ GVAR(showNamesTime) = -10; // Change settings accordingly when they are changed ["SettingChanged", { - PARAMS_1(_name); - if (_name == QGVAR(showPlayerNames)) then { + params ["_name"]; + if (_name == QGVAR(showPlayerNames)) then { call FUNC(updateSettings); }; }] call EFUNC(common,addEventHandler); diff --git a/addons/nametags/functions/fnc_canShow.sqf b/addons/nametags/functions/fnc_canShow.sqf index b53f50c93e..5bccc8f91d 100644 --- a/addons/nametags/functions/fnc_canShow.sqf +++ b/addons/nametags/functions/fnc_canShow.sqf @@ -10,16 +10,12 @@ * Can show Crew Info * * Example: - * call ace_nametags_fnc_doShow + * call ace_nametags_fnc_canShow * * Public: No */ #include "script_component.hpp" -private ["_player"]; - -_player = ACE_player; - -vehicle _player != _player && +((vehicle ACE_player) != ACE_player) && {GVAR(ShowCrewInfo)} && -{!(vehicle _player isKindOf "ParachuteBase")}; +{!(vehicle ACE_player isKindOf "ParachuteBase")}; diff --git a/addons/nametags/functions/fnc_drawNameTagIcon.sqf b/addons/nametags/functions/fnc_drawNameTagIcon.sqf index 021a4e2a0b..7c98be16ed 100644 --- a/addons/nametags/functions/fnc_drawNameTagIcon.sqf +++ b/addons/nametags/functions/fnc_drawNameTagIcon.sqf @@ -13,26 +13,26 @@ * None * * Example: - * [ACE_player, _target, _alpha, _distance * 0.026, _icon] call ace_nametags_fnc_drawNameTagIcon + * [ACE_player, bob, 0.5, height, ICON_NAME_SPEAK] call ace_nametags_fnc_drawNameTagIcon * * Public: No */ #include "script_component.hpp" -PARAMS_5(_player,_target,_alpha,_heightOffset,_iconType); - -private ["_position", "_color", "_name", "_rank", "_size", "_icon", "_scale"]; +params ["_player", "_target", "_alpha", "_heightOffset", "_iconType"]; if (_iconType == ICON_NONE) exitWith {}; //Don't waste time if not visable +private ["_position", "_color", "_name", "_size", "_icon", "_scale"]; + //Set Icon: _icon = ""; _size = 0; -if ((_iconType == ICON_NAME_SPEAK) || (_iconType == ICON_SPEAK)) then { +if (_iconType in [ICON_NAME_SPEAK, ICON_SPEAK]) then { _icon = QUOTE(PATHTOF(UI\soundwave)) + str (floor (random 10)) + ".paa"; _size = 1; - _alpha = _alpha max 0.6;//Boost alpha when speaking + _alpha = (_alpha max 0.2) + 0.2;//Boost alpha when speaking } else { if (_iconType == ICON_NAME_RANK) then { _icon = format["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa",(toLower(rank _target))]; @@ -50,7 +50,7 @@ _name = if (_iconType in [ICON_NAME, ICON_NAME_RANK, ICON_NAME_SPEAK]) then { }; //Set Color: -if !(group _target == group _player) then { +if ((group _target) != (group _player)) then { _color = +GVAR(defaultNametagColor); //Make a copy, then multiply both alpha values (allows client to decrease alpha in settings) _color set [3, (_color select 3) * _alpha]; } else { @@ -58,7 +58,7 @@ if !(group _target == group _player) then { }; // Convert position to ASLW (expected by drawIcon3D) and add height offsets -_position = _target modelToWorldVisual ((_target selectionPosition "pilot") vectorAdd [0,0,(_heightOffset + .35)]); +_position = _target modelToWorldVisual ((_target selectionPosition "pilot") vectorAdd [0,0,(_heightOffset + .3)]); _scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize); diff --git a/addons/nametags/functions/fnc_getVehicleData.sqf b/addons/nametags/functions/fnc_getVehicleData.sqf index 6d83b0f573..b0e0b1ff34 100644 --- a/addons/nametags/functions/fnc_getVehicleData.sqf +++ b/addons/nametags/functions/fnc_getVehicleData.sqf @@ -22,7 +22,7 @@ private ["_type", "_varName", "_data", "_isAir", "_config", "_fnc_addTurret", "_fnc_addTurretUnit"]; -PARAMS_1(_type); +params ["_type"]; _varName = format ["ACE_CrewInfo_Cache_%1", _type]; _data = + (uiNamespace getVariable _varName); diff --git a/addons/nametags/functions/fnc_initIsSpeaking.sqf b/addons/nametags/functions/fnc_initIsSpeaking.sqf index 897d223930..9299611d3b 100644 --- a/addons/nametags/functions/fnc_initIsSpeaking.sqf +++ b/addons/nametags/functions/fnc_initIsSpeaking.sqf @@ -19,7 +19,7 @@ if (isServer) then { //If someone disconnects while speaking, reset their variable addMissionEventHandler ["HandleDisconnect", { - PARAMS_1(_disconnectedPlayer); + params ["_disconnectedPlayer"]; if (_disconnectedPlayer getVariable [QGVAR(isSpeakingInGame), false]) then { _disconnectedPlayer setVariable [QGVAR(isSpeakingInGame), false, true]; }; @@ -30,7 +30,7 @@ if (!hasInterface) exitWith {}; ["playerChanged", { //When player changes, make sure to reset old unit's variable - PARAMS_2(_newUnit,_oldUnit); + params ["", "_oldUnit"]; if ((!isNull _oldUnit) && {_oldUnit getVariable [QGVAR(isSpeakingInGame), false]}) then { _oldUnit setVariable [QGVAR(isSpeakingInGame), false, true]; }; @@ -40,14 +40,14 @@ if (!hasInterface) exitWith {}; if (isClass (configFile >> "cfgPatches" >> "acre_api")) then { diag_log text format ["[ACE_nametags] - ACRE Detected"]; DFUNC(isSpeaking) = { - PARAMS_1(_unit); - (([_unit] call acre_api_fnc_isSpeaking) || ([ACE_player] call acre_api_fnc_isBroadcasting)) && {!(_unit getVariable ["ACE_isUnconscious", false])} + params ["_unit"]; + (([_unit] call acre_api_fnc_isSpeaking) || {[ACE_player] call acre_api_fnc_isBroadcasting}) && {!(_unit getVariable ["ACE_isUnconscious", false])} }; } else { if (isClass (configFile >> "cfgPatches" >> "task_force_radio")) then { diag_log text format ["[ACE_nametags] - TFR Detected"]; DFUNC(isSpeaking) = { - PARAMS_1(_unit); + params ["_unit"]; (_unit getVariable ["tf_isSpeaking", false]) && {!(_unit getVariable ["ACE_isUnconscious", false])} }; } else { @@ -64,7 +64,7 @@ if (isClass (configFile >> "cfgPatches" >> "acre_api")) then { } , 0.1, []] call CBA_fnc_addPerFrameHandler; DFUNC(isSpeaking) = { - PARAMS_1(_unit); + params ["_unit"]; (_unit getVariable [QGVAR(isSpeakingInGame), false]) && {!(_unit getVariable ["ACE_isUnconscious", false])} }; }; diff --git a/addons/nametags/functions/fnc_moduleNameTags.sqf b/addons/nametags/functions/fnc_moduleNameTags.sqf index 7a6d2fa3c8..1b209cb32a 100644 --- a/addons/nametags/functions/fnc_moduleNameTags.sqf +++ b/addons/nametags/functions/fnc_moduleNameTags.sqf @@ -1,6 +1,5 @@ /* * Author: esteldunedain - * * Initializes the name tags module. * * Arguments: @@ -14,7 +13,7 @@ if !(isServer) exitWith {}; -PARAMS_3(_logic,_units,_activated); +params ["_logic", "", "_activated"]; if !(_activated) exitWith {}; diff --git a/addons/nametags/functions/fnc_onDraw3d.sqf b/addons/nametags/functions/fnc_onDraw3d.sqf index 43996e17b2..bbf608b75a 100644 --- a/addons/nametags/functions/fnc_onDraw3d.sqf +++ b/addons/nametags/functions/fnc_onDraw3d.sqf @@ -17,8 +17,8 @@ private ["_onKeyPressAlphaMax", "_defaultIcon", "_distance", "_alpha", "_icon", "_targets", "_pos2", "_vecy", "_relPos", "_projDist", "_pos", "_target", "_targetEyePosASL", "_ambientBrightness", "_maxDistance"]; -//don't show nametags in spectator -if ((isNull ACE_player) || {!alive ACE_player}) exitWith {}; +//don't show nametags in spectator or if RscDisplayMPInterrupt is open +if ((isNull ACE_player) || {!alive ACE_player} || {!isNull (findDisplay 49)}) exitWith {}; _ambientBrightness = ((([] call EFUNC(common,ambientBrightness)) + ([0, 0.4] select ((currentVisionMode ace_player) != 0))) min 1) max 0; _maxDistance = _ambientBrightness * GVAR(PlayerNamesViewDistance); @@ -63,6 +63,7 @@ if ((GVAR(showPlayerNames) in [2,4]) && {_onKeyPressAlphaMax > 0}) then { {GVAR(showNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} && {!(_target getVariable ["ACE_hideName", false])}) then { _distance = ACE_player distance _target; + if (_distance > (_maxDistance + 5)) exitWith {}; _alpha = (((1 - 0.2 * (_distance - _maxDistance)) min 1) * GVAR(playerNamesMaxAlpha)) min _onKeyPressAlphaMax; _icon = ICON_NONE; if (GVAR(showSoundWaves) == 2) then { //icon will be drawn below, so only show name here @@ -116,5 +117,6 @@ if (((GVAR(showPlayerNames) in [1,3]) && {_onKeyPressAlphaMax > 0}) || {GVAR(sho [ACE_player, _target, _alpha, _distance * 0.026, _icon] call FUNC(drawNameTagIcon); }; - } forEach _targets; + nil + } count _targets; }; diff --git a/addons/nametags/functions/fnc_setText.sqf b/addons/nametags/functions/fnc_setText.sqf index 33112c31d0..842c765de1 100644 --- a/addons/nametags/functions/fnc_setText.sqf +++ b/addons/nametags/functions/fnc_setText.sqf @@ -17,7 +17,7 @@ #define TextIDC 11123 -PARAMS_1(_text); +params ["_text"]; private["_ctrl"]; diff --git a/addons/nametags/stringtable.xml b/addons/nametags/stringtable.xml index e811b3447c..a0048c4076 100644 --- a/addons/nametags/stringtable.xml +++ b/addons/nametags/stringtable.xml @@ -149,14 +149,6 @@ Zobrazit jména a hodnosti pro spřátelené AI jednotky? Výchozí: Nevynucovat Mostra o nome e patente para unidades IA aliadas? Padrão: Não forçar - - Do Not Force - Nie wymuszaj - No forzar - Nicht erzwingen - Nevynucovat - Não forçar - Force Hide Wymuś ukrycie @@ -213,22 +205,6 @@ Tento modul umožňuje si přizpůsobit nastavení a vzdálenost jmenovky. Este módulo permite que você personalize as configurações e distâncias de etiquetas de nome. - - Disabled - Wyłączone - Desactivado - Deaktiviert - Zakázáno - Desativado - - - Enabled - Włączone - Activado - Aktiviert - Povoleno - Ativado - Only on Cursor Tylko pod kursorem diff --git a/addons/optionsmenu/CfgEventHandlers.hpp b/addons/optionsmenu/CfgEventHandlers.hpp index b97829836e..917a0acbd7 100644 --- a/addons/optionsmenu/CfgEventHandlers.hpp +++ b/addons/optionsmenu/CfgEventHandlers.hpp @@ -1,5 +1,10 @@ class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); - }; + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; }; diff --git a/addons/optionsmenu/XEH_postInit.sqf b/addons/optionsmenu/XEH_postInit.sqf new file mode 100644 index 0000000000..a981c34e0b --- /dev/null +++ b/addons/optionsmenu/XEH_postInit.sqf @@ -0,0 +1,11 @@ + +#include "script_component.hpp" + +["SettingsInitialized", { + GVAR(categories) pushback ""; //Ensure All Catagories is at top + { + if !(_x select 8 in GVAR(categories)) then { + GVAR(categories) pushback (_x select 8); + }; + }foreach EGVAR(common,settings); +}] call EFUNC(common,addEventHandler); diff --git a/addons/optionsmenu/XEH_preInit.sqf b/addons/optionsmenu/XEH_preInit.sqf index e35784560a..21f64c4f46 100644 --- a/addons/optionsmenu/XEH_preInit.sqf +++ b/addons/optionsmenu/XEH_preInit.sqf @@ -10,16 +10,19 @@ PREP(onSliderPosChanged); PREP(onServerSaveInputField); PREP(onServerSettingsMenuOpen); PREP(onServerListBoxShowSelectionChanged); +PREP(onCategorySelectChanged); PREP(resetSettings); PREP(serverResetSettings); PREP(settingsMenuUpdateKeyView); PREP(settingsMenuUpdateList); PREP(serverSettingsMenuUpdateKeyView); PREP(serverSettingsMenuUpdateList); +PREP(onServerCategorySelectChanged); PREP(updateSetting); PREP(exportSettings); PREP(toggleIncludeClientSettings); PREP(moduleAllowConfigExport); +PREP(stringEscape); GVAR(clientSideOptions) = []; GVAR(clientSideColors) = []; @@ -29,5 +32,7 @@ GVAR(ClientSettingsExportIncluded) = false; GVAR(serverSideOptions) = []; GVAR(serverSideColors) = []; GVAR(serverSideValues) = []; +GVAR(categories) = []; +GVAR(currentCategorySelection) = 0; ADDON = true; diff --git a/addons/optionsmenu/functions/fnc_exportSettings.sqf b/addons/optionsmenu/functions/fnc_exportSettings.sqf index fa76b8752a..9d6437495d 100644 --- a/addons/optionsmenu/functions/fnc_exportSettings.sqf +++ b/addons/optionsmenu/functions/fnc_exportSettings.sqf @@ -40,7 +40,7 @@ private ["_compiledConfig", "_name", "_typeName", "_isClientSetable", "_localize if (GVAR(ClientSettingsExportIncluded) || !_isClientSetable) then { _value = missionNamespace getvariable [_name, _defaultValue]; - if (_typeName == "STRING") then { // I dont think we have string values, but just in case + if (_typeName == "STRING") then { _value = format['"%1"', _value]; }; if (_typeName == "BOOL") then { diff --git a/addons/optionsmenu/functions/fnc_onCategorySelectChanged.sqf b/addons/optionsmenu/functions/fnc_onCategorySelectChanged.sqf new file mode 100644 index 0000000000..3129e32bef --- /dev/null +++ b/addons/optionsmenu/functions/fnc_onCategorySelectChanged.sqf @@ -0,0 +1,27 @@ +/* + * Author: Glowbal + * Changes which category is selected + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ACE_optionsmenu_fnc_onCategorySelectChanged + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_settingsMenu", "_ctrlComboBox"]; + +disableSerialization; +_settingsMenu = uiNamespace getVariable 'ACE_settingsMenu'; + +_ctrlComboBox = (_settingsMenu displayCtrl 14); +GVAR(currentCategorySelection) = lbCurSel _ctrlComboBox; + +[true] call FUNC(settingsMenuUpdateList); diff --git a/addons/optionsmenu/functions/fnc_onListBoxSettingsChanged.sqf b/addons/optionsmenu/functions/fnc_onListBoxSettingsChanged.sqf index 1543a2c8d5..b122d0da0e 100644 --- a/addons/optionsmenu/functions/fnc_onListBoxSettingsChanged.sqf +++ b/addons/optionsmenu/functions/fnc_onListBoxSettingsChanged.sqf @@ -18,24 +18,28 @@ private ["_settingIndex", "_rightDropDownIndex"]; -_settingIndex = lbCurSel 200; //Index of left list _rightDropDownIndex = lbCurSel 400; //Index of right drop down - if (_rightDropDownIndex < 0) then {_rightDropDownIndex = 0;}; +_settingIndex = -1; +if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then { + _settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]]; +}; +if (_settingIndex == -1) exitWith {}; + switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(clientSideOptions)))) then { - _settingIndex = (GVAR(clientSideOptions) select _settingIndex) select 0; - [MENU_TAB_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting); + _settingIndex = (GVAR(clientSideOptions) select _settingIndex) select 0; + [MENU_TAB_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting); }; [false] call FUNC(settingsMenuUpdateList); - }; + }; case (MENU_TAB_SERVER_OPTIONS): { if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(serverSideOptions)))) then { - _settingIndex = (GVAR(serverSideOptions) select _settingIndex) select 0; - [MENU_TAB_SERVER_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting); + _settingIndex = (GVAR(serverSideOptions) select _settingIndex) select 0; + [MENU_TAB_SERVER_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting); }; [false] call FUNC(serverSettingsMenuUpdateList); - }; + }; }; diff --git a/addons/optionsmenu/functions/fnc_onServerCategorySelectChanged.sqf b/addons/optionsmenu/functions/fnc_onServerCategorySelectChanged.sqf new file mode 100644 index 0000000000..d134cda993 --- /dev/null +++ b/addons/optionsmenu/functions/fnc_onServerCategorySelectChanged.sqf @@ -0,0 +1,26 @@ +/* + * Author: Glowbal + * Changes which category is selected + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ACE_optionsmenu_fnc_onCategorySelectChanged + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_settingsMenu", "_ctrlComboBox"]; +disableSerialization; +_settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu'; + +_ctrlComboBox = (_settingsMenu displayCtrl 14); +GVAR(currentCategorySelection) = lbCurSel _ctrlComboBox; + +[true] call FUNC(serverSettingsMenuUpdateList); diff --git a/addons/optionsmenu/functions/fnc_onServerSaveInputField.sqf b/addons/optionsmenu/functions/fnc_onServerSaveInputField.sqf index b8eb630f85..fde370426f 100644 --- a/addons/optionsmenu/functions/fnc_onServerSaveInputField.sqf +++ b/addons/optionsmenu/functions/fnc_onServerSaveInputField.sqf @@ -18,9 +18,13 @@ private ["_settingIndex", "_inputText", "_setting", "_settingName", "_convertedValue"]; -_settingIndex = lbCurSel 200; //Index of left list _inputText = ctrlText 414; //Index of right drop down +_settingIndex = -1; +if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then { + _settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]]; +}; + switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_SERVER_VALUES): { if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(serverSideValues)))) then { @@ -29,7 +33,10 @@ switch (GVAR(optionMenu_openTab)) do { _settingName = _setting select 0; _convertedValue = switch (toUpper (_setting select 1)) do { - case "STRING": {format ['"%1"', _inputText]}; + case "STRING": { + ctrlSetText [414, _inputText call FUNC(stringEscape)]; + format ['%1', _inputText call FUNC(stringEscape)]; + }; case "ARRAY": {format [call compile "[%1]", _inputText]}; case "SCALAR": {parseNumber _inputText;}; default {throw "Error"}; diff --git a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf index 4f96438042..6c0cb56519 100644 --- a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf @@ -65,3 +65,14 @@ if (GVAR(ClientSettingsExportIncluded)) then { } else { (_settingsMenu displayCtrl 1102) ctrlSetText localize (LSTRING(inClientSettings)); }; + + +lbClear (_menu displayCtrl 14); +{ + if (_x == "") then { + _x = localize (LSTRING(category_all)); + }; + (_menu displayCtrl 14) lbAdd _x; +} forEach GVAR(categories); + +(_menu displayCtrl 14) lbSetCurSel GVAR(currentCategorySelection); //All Catagoies diff --git a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf index 050abcf295..c71a26a6e7 100644 --- a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf @@ -52,3 +52,15 @@ if (GVAR(serverConfigGeneration) == 0) then { (_menu displayCtrl 1102) ctrlEnable false; (_menu displayCtrl 1102) ctrlShow false; }; + +lbClear (_menu displayCtrl 14); +{ + if (_x == "") then { + _x = localize LSTRING(category_all); + }; + (_menu displayCtrl 14) lbAdd _x; +} forEach GVAR(categories); + +(_menu displayCtrl 14) lbSetCurSel GVAR(currentCategorySelection); //All Catagoies + + diff --git a/addons/optionsmenu/functions/fnc_onSliderPosChanged.sqf b/addons/optionsmenu/functions/fnc_onSliderPosChanged.sqf index b69d8bd734..7df198cc5f 100644 --- a/addons/optionsmenu/functions/fnc_onSliderPosChanged.sqf +++ b/addons/optionsmenu/functions/fnc_onSliderPosChanged.sqf @@ -18,7 +18,11 @@ private ["_newColor", "_settingIndex"]; -_settingIndex = lbCurSel 200; +_settingIndex = -1; +if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then { + _settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]]; +}; +if (_settingIndex == -1) exitWith {}; switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_COLORS): { diff --git a/addons/optionsmenu/functions/fnc_resetSettings.sqf b/addons/optionsmenu/functions/fnc_resetSettings.sqf index 07fc43cdfc..8d6c3958c6 100644 --- a/addons/optionsmenu/functions/fnc_resetSettings.sqf +++ b/addons/optionsmenu/functions/fnc_resetSettings.sqf @@ -30,8 +30,8 @@ private ["_name", "_default", "_lastSelected"]; [MENU_TAB_COLORS, _name, _default] call FUNC(updateSetting); } forEach GVAR(clientSideColors); -_lastSelected = lbCurSel 200; +_lastSelected = lnbCurSelRow 200; [GVAR(optionMenu_openTab)] call FUNC(onListBoxShowSelectionChanged); if (_lastSelected != -1) then { - lbSetCurSel [200, _lastSelected]; + lnbSetCurSelRow [200, _lastSelected]; }; diff --git a/addons/optionsmenu/functions/fnc_serverResetSettings.sqf b/addons/optionsmenu/functions/fnc_serverResetSettings.sqf index 434e622818..d9f6a4ad96 100644 --- a/addons/optionsmenu/functions/fnc_serverResetSettings.sqf +++ b/addons/optionsmenu/functions/fnc_serverResetSettings.sqf @@ -36,7 +36,7 @@ private ["_name", "_default", "_lastSelected"]; [MENU_TAB_SERVER_VALUES, _name, _default] call FUNC(updateSetting); } forEach GVAR(serverSideVakyes); -_lastSelected = lbCurSel 200; +_lastSelected = lnbCurSelRow 200; [GVAR(optionMenu_openTab)] call FUNC(onserverListBoxShowSelectionChanged); if (_lastSelected != -1) then { lbSetCurSel [200, _lastSelected]; diff --git a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf index 9daee053bb..87532aaf86 100644 --- a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf +++ b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf @@ -16,11 +16,10 @@ #include "script_component.hpp" -private ["_settingsMenu", "_ctrlList", "_collection", "_settingIndex", "_setting", "_entryName", "_localizedName", "_localizedDescription", "_possibleValues", "_settingsValue", "_currentColor", "_expectedType"]; +private ["_settingsMenu", "_collection", "_settingIndex", "_setting", "_entryName", "_localizedName", "_localizedDescription", "_possibleValues", "_settingsValue", "_currentColor", "_expectedType"]; disableSerialization; _settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu'; -_ctrlList = _settingsMenu displayCtrl 200; _collection = switch (GVAR(optionMenu_openTab)) do { case MENU_TAB_SERVER_OPTIONS: {GVAR(serverSideOptions)}; @@ -29,15 +28,12 @@ _collection = switch (GVAR(optionMenu_openTab)) do { default {[]}; }; -if (count _collection > 0) then { - _settingIndex = (lbCurSel _ctrlList); - if (_settingIndex > (count _collection)) then { - _settingIndex = count _collection - 1; - }; +_settingIndex = -1; +if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then { + _settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]]; +}; - if (_settingIndex < 0) then { - _settingIndex = 0; - }; +if ((_settingIndex >= 0) && {_settingIndex <= (count _collection)}) then { _setting = _collection select _settingIndex; _entryName = _setting select 0; @@ -52,12 +48,12 @@ if (count _collection > 0) then { switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_SERVER_OPTIONS): { _possibleValues = _setting select 5; - _settingsValue = _setting select 8; + _settingsValue = _setting select 9; // Created disable/enable options for bools if ((_setting select 1) == "BOOL") then { lbClear 400; - lbAdd [400, (localize LSTRING(Disabled))]; - lbAdd [400, (localize LSTRING(Enabled))]; + lbAdd [400, (localize ELSTRING(common,No))]; + lbAdd [400, (localize ELSTRING(common,Yes))]; _settingsValue = [0, 1] select _settingsValue; } else { lbClear 400; @@ -66,14 +62,14 @@ if (count _collection > 0) then { (_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue; }; case (MENU_TAB_SERVER_COLORS): { - _currentColor = _setting select 8; + _currentColor = _setting select 9; { sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))]; } forEach [410, 411, 412, 413]; }; case (MENU_TAB_SERVER_VALUES): { // TODO implement - _settingsValue = _setting select 8; + _settingsValue = _setting select 9; // Created disable/enable options for bools _expectedType = switch (_setting select 1) do { diff --git a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf index f3e393bbfd..fc745c37be 100644 --- a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf @@ -16,63 +16,77 @@ #include "script_component.hpp" -private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue"]; +private ["_settingName", "_added", "_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"]; DEFAULT_PARAM(0,_updateKeyView,true); disableSerialization; _settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu'; _ctrlList = _settingsMenu displayCtrl 200; -lbclear _ctrlList; +lnbClear _ctrlList; + +_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection); + +_added = 0; switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_SERVER_OPTIONS): { { - if ((_x select 3) != "") then { - _ctrlList lbadd (_x select 3); - } else { - _ctrlList lbadd (_x select 0); + if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { + _settingName = if ((_x select 3) != "") then { + (_x select 3); + } else { + (_x select 0); + }; + + _settingsValue = _x select 9; + + // Created disable/enable options for bools + _settingsText = if ((_x select 1) == "BOOL") then { + [(localize ELSTRING(common,No)), (localize ELSTRING(common,Yes))] select _settingsValue; + } else { + (_x select 5) select _settingsValue; + }; + + _added = _ctrlList lnbAddRow [_settingName, _settingsText]; + _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; - - _settingsValue = _x select 8; - - // Created disable/enable options for bools - _settingsText = if ((_x select 1) == "BOOL") then { - [(localize LSTRING(Disabled)), (localize LSTRING(Enabled))] select _settingsValue; - } else { - (_x select 5) select _settingsValue; - }; - - _ctrlList lbadd (_settingsText); }foreach GVAR(serverSideOptions); }; case (MENU_TAB_SERVER_COLORS): { { - _color = +(_x select 8); - { - _color set [_forEachIndex, ((round (_x * 100))/100)]; - } forEach _color; - _settingsColor = str _color; - if ((_x select 3) != "") then { - _ctrlList lbadd (_x select 3); - } else { - _ctrlList lbadd (_x select 0); + if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { + _color = +(_x select 9); + { + _color set [_forEachIndex, ((round (_x * 100))/100)]; + } forEach _color; + _settingsColor = str _color; + _settingName = if ((_x select 3) != "") then { + (_x select 3); + } else { + (_x select 0); + }; + + _added = _ctrlList lnbAddRow [_settingName, _settingsColor]; + _ctrlList lnbSetColor [[_added, 1], (_x select 9)]; + _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; - _ctrlList lbadd (_settingsColor); - _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 8)]; }foreach GVAR(serverSideColors); }; case (MENU_TAB_SERVER_VALUES): { { - if ((_x select 3) != "") then { - _ctrlList lbadd (_x select 3); - } else { - _ctrlList lbadd (_x select 0); + if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { + _settingName = if ((_x select 3) != "") then { + (_x select 3); + } else { + (_x select 0); + }; + _settingsValue = _x select 9; + if (typeName _settingsValue != "STRING") then { + _settingsValue = format["%1", _settingsValue]; + }; + _added = _ctrlList lnbAddRow [_settingName, _settingsValue]; + _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; - _settingsValue = _x select 8; - if (typeName _settingsValue != "STRINg") then { - _settingsValue = format["%1", _settingsValue]; - }; - _ctrlList lbadd (_settingsValue); }foreach GVAR(serverSideValues); }; }; diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf index 3777093ccd..64f45121e5 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf @@ -28,15 +28,12 @@ _collection = switch (GVAR(optionMenu_openTab)) do { default {[]}; }; -if (count _collection > 0) then { - _settingIndex = (lbCurSel _ctrlList); - if (_settingIndex > (count _collection)) then { - _settingIndex = count _collection - 1; - }; +_settingIndex = -1; +if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then { + _settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]]; +}; - if (_settingIndex < 0) then { - _settingIndex = 0; - }; +if ((_settingIndex >= 0) && {_settingIndex <= (count _collection)}) then { _setting = _collection select _settingIndex; _entryName = _setting select 0; @@ -51,13 +48,13 @@ if (count _collection > 0) then { switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { _possibleValues = _setting select 5; - _settingsValue = _setting select 8; + _settingsValue = _setting select 9; // Created disable/enable options for bools if ((_setting select 1) == "BOOL") then { lbClear 400; - lbAdd [400, (localize LSTRING(Disabled))]; - lbAdd [400, (localize LSTRING(Enabled))]; + lbAdd [400, (localize ELSTRING(common,No))]; + lbAdd [400, (localize ELSTRING(common,Yes))]; _settingsValue = [0, 1] select _settingsValue; } else { lbClear 400; @@ -66,7 +63,7 @@ if (count _collection > 0) then { (_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue; }; case (MENU_TAB_COLORS): { - _currentColor = _setting select 8; + _currentColor = _setting select 9; { sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))]; } forEach [410, 411, 412, 413]; diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf index fdd9128ca3..96a45a1b83 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf @@ -16,42 +16,49 @@ #include "script_component.hpp" -private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue"]; +private ["_settingName", "_added", "_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"]; DEFAULT_PARAM(0,_updateKeyView,true); disableSerialization; _settingsMenu = uiNamespace getVariable 'ACE_settingsMenu'; _ctrlList = _settingsMenu displayCtrl 200; -lbclear _ctrlList; +lnbClear _ctrlList; + +_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection); switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { { - _ctrlList lbadd (_x select 3); + if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { + _settingName = (_x select 3); + _settingsValue = _x select 9; - _settingsValue = _x select 8; - - // Created disable/enable options for bools - _settingsText = if ((_x select 1) == "BOOL") then { - [(localize LSTRING(Disabled)), (localize LSTRING(Enabled))] select _settingsValue; - } else { - (_x select 5) select _settingsValue; + // Created disable/enable options for bools + _settingsText = if ((_x select 1) == "BOOL") then { + [(localize ELSTRING(common,No)), (localize ELSTRING(common,Yes))] select _settingsValue; + } else { + (_x select 5) select _settingsValue; + }; + _added = _ctrlList lnbAddRow [_settingName, _settingsText]; + _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; - - _ctrlList lbadd (_settingsText); - }foreach GVAR(clientSideOptions); + } foreach GVAR(clientSideOptions); }; case (MENU_TAB_COLORS): { - { - _color = +(_x select 8); - { - _color set [_forEachIndex, ((round (_x * 100))/100)]; - } forEach _color; - _settingsColor = str _color; - _ctrlList lbadd (_x select 3); - _ctrlList lbadd (_settingsColor); - _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 8)]; + { + if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { + _color = +(_x select 9); + { + _color set [_forEachIndex, ((round (_x * 100))/100)]; + } forEach _color; + _settingsColor = str _color; + _settingName = (_x select 3); + + _added = _ctrlList lnbAddRow [_settingName, _settingsColor]; + _ctrlList lnbSetColor [[_added, 1], (_x select 9)]; + _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; + }; }foreach GVAR(clientSideColors); }; }; diff --git a/addons/optionsmenu/functions/fnc_stringEscape.sqf b/addons/optionsmenu/functions/fnc_stringEscape.sqf new file mode 100644 index 0000000000..1493f76445 --- /dev/null +++ b/addons/optionsmenu/functions/fnc_stringEscape.sqf @@ -0,0 +1,59 @@ +/* + * Author: Glowbal + * Parse the string for quotation marks, so it can be used for config export. + * + * Arguments: + * 0: string + * + * Return Value: + * parsed string + * + * Example: + * [] call ACE_optionsmenu_fnc_stringEscape + * + * Public: No + */ + +private ["_str", "_array", "_maxIndex", "_isEven"]; +_str = _this; + +_isEven = { + params ["_array", "_index"]; + private [ "_count"]; + _count = 0; + { + if (_forEachIndex <= _index && {_x == 39}) then { + _count = _count + 1; + }; + }foreach _array; + + _count %2 == 0; +}; + +// reg: 34 +// single: 39 +_array = toArray _str; +{ + if (_x == 34) then { + _array set [_foreachIndex, 39]; + }; +}foreach _array; + +_maxIndex = count _array; +for "_i" from 0 to _maxIndex /* step +1 */ do { + if (((_i + 1) < _maxIndex - 1) && {_array select _i == 39 && (_array select (_i + 1)) == 39}) then { + if ([_array, _i] call _isEven) then { + _array deleteAt _i; + _i = _i - 1; + _maxIndex = _maxIndex - 1; + }; + }; +}; + +{ + if (_x == 34) then { + _array set [_foreachIndex, 39]; + }; +}foreach _array; + +toString _array; diff --git a/addons/optionsmenu/functions/fnc_updateSetting.sqf b/addons/optionsmenu/functions/fnc_updateSetting.sqf index 3fe1682614..25fa06c604 100644 --- a/addons/optionsmenu/functions/fnc_updateSetting.sqf +++ b/addons/optionsmenu/functions/fnc_updateSetting.sqf @@ -32,9 +32,9 @@ switch (_type) do { _newValue = [false, true] select _newValue; }; - if !((_x select 8) isEqualTo _newValue) then { + if !((_x select 9) isEqualTo _newValue) then { _changed = true; - _x set [8, _newValue]; + _x set [9, _newValue]; } ; }; @@ -42,9 +42,9 @@ switch (_type) do { }; case (MENU_TAB_COLORS): { { - if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then { + if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then { _changed = true; - _x set [8, _newValue]; + _x set [9, _newValue]; }; } foreach GVAR(clientSideColors); }; @@ -56,9 +56,9 @@ switch (_type) do { _newValue = [false, true] select _newValue; }; - if !((_x select 8) isEqualTo _newValue) then { + if !((_x select 9) isEqualTo _newValue) then { _changed = true; - _x set [8, _newValue]; + _x set [9, _newValue]; } ; }; @@ -66,17 +66,17 @@ switch (_type) do { }; case (MENU_TAB_SERVER_COLORS): { { - if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then { + if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then { _changed = true; - _x set [8, _newValue]; + _x set [9, _newValue]; }; } foreach GVAR(serverSideColors); }; case (MENU_TAB_SERVER_VALUES): { { - if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then { + if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then { _changed = true; - _x set [8, _newValue]; + _x set [9, _newValue]; }; } foreach GVAR(serverSideValues); }; diff --git a/addons/optionsmenu/gui/settingsMenu.hpp b/addons/optionsmenu/gui/settingsMenu.hpp index 665db1f17a..cd65eb966d 100644 --- a/addons/optionsmenu/gui/settingsMenu.hpp +++ b/addons/optionsmenu/gui/settingsMenu.hpp @@ -1,9 +1,3 @@ -class ACE_settingsMenu { - idd = 145246; - movingEnable = false; - onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_settingsMenu', _this select 0)]; [] call FUNC(onSettingsMenuOpen);); - onUnload = QUOTE(uiNamespace setVariable [ARR_2('ACE_settingsMenu', nil)]; saveProfileNamespace;); - #define SIZEX (((safezoneW / safezoneH) min 1.2)) #define SIZEY (SIZEX / 1.2) #define X_ORIGINAL(num) (num * (SIZEX / 40) + (safezoneX + (safezoneW - SIZEX)/2)) @@ -21,6 +15,12 @@ class ACE_settingsMenu { #define W_PART(num) QUOTE(linearConversion [ARR_5(0, 2, (missionNamespace getVariable [ARR_2(QUOTE(QGVAR(optionMenuDisplaySize)), 0)]), W_ORIGINAL(num), W_MAKEITBIGGA(num))]) #define H_PART(num) QUOTE(linearConversion [ARR_5(0, 2, (missionNamespace getVariable [ARR_2(QUOTE(QGVAR(optionMenuDisplaySize)), 0)]), H_ORIGINAL(num), H_MAKEITBIGGA(num))]) +class ACE_settingsMenu { + idd = 145246; + movingEnable = false; + onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_settingsMenu', _this select 0)]; [] call FUNC(onSettingsMenuOpen);); + onUnload = QUOTE(uiNamespace setVariable [ARR_2('ACE_settingsMenu', nil)]; saveProfileNamespace;); + class controlsBackground { class HeaderBackground: ACE_gui_backgroundBase { idc = -1; @@ -77,10 +77,20 @@ class ACE_settingsMenu { idc = 13; x = X_PART(2); y = Y_PART(3.4); - w = W_PART(30); + w = W_PART(15); h = H_PART(1); text = ""; }; + class categorySelection: ACE_gui_comboBoxBase { + idc = 14; + x = X_PART(14); + y = Y_PART(3.4); + w = W_PART(9); + h = H_PART(1); + text = ""; + onLBSelChanged = QUOTE( call FUNC(onCategorySelectChanged)); + SizeEx = H_PART(0.9); + }; class selectionAction_1: ACE_gui_buttonBase { idc = 1000; text = CSTRING(TabOptions); @@ -246,7 +256,7 @@ class ACE_settingsMenu { idc = 1102; text = CSTRING(OpenExport); x = X_PART(18); - action = QUOTE(if (GVAR(serverConfigGeneration) > 0) then {createDialog 'ACE_serverSettingsMenu'; }); + action = QUOTE(if (GVAR(serverConfigGeneration) > 0) then {closeDialog 0; createDialog 'ACE_serverSettingsMenu';}); }; class action_debug: actionClose { idc = 1102; @@ -291,6 +301,16 @@ class ACE_serverSettingsMenu: ACE_settingsMenu { h = H_PART(1); text = ""; }; + class categorySelection: ACE_gui_comboBoxBase { + idc = 14; + x = X_PART(14); + y = Y_PART(3.4); + w = W_PART(9); + h = H_PART(1); + text = ""; + onLBSelChanged = QUOTE( call FUNC(onServerCategorySelectChanged)); + SizeEx = H_PART(0.9); + }; class selectionAction_1: ACE_gui_buttonBase { idc = 1000; text = CSTRING(TabOptions); diff --git a/addons/optionsmenu/stringtable.xml b/addons/optionsmenu/stringtable.xml index 376935297e..77cbc0961c 100644 --- a/addons/optionsmenu/stringtable.xml +++ b/addons/optionsmenu/stringtable.xml @@ -73,30 +73,6 @@ Valori Valores - - Yes - Ja - Si - Tak - Ano - Oui - Да - Igen - Sim - Si - - - No - Nein - No - Nie - Ne - Non - Нет - Nem - Não - No - Setting: Nastavení: @@ -345,11 +321,13 @@ Protokolliert Debug-Informationen im RPT und speichert sie in der Zwischenablage. Envia informação de depuração para RPT e área de transferência. - + Headbug Fix + Fix Headbug - + Resets your animation state. + Resetuje aktualną animację. ACE News @@ -367,5 +345,9 @@ Pokazuj wiadomości ACE w menu głównym Zobrazit novinky v hlavním menu + + All Categories + Wszystkie kategorie + - + \ No newline at end of file diff --git a/addons/parachute/CfgVehicles.hpp b/addons/parachute/CfgVehicles.hpp index 3de7bf66b6..aefadf2e63 100644 --- a/addons/parachute/CfgVehicles.hpp +++ b/addons/parachute/CfgVehicles.hpp @@ -6,7 +6,6 @@ class CfgVehicles { }; class TransportBackpacks { MACRO_ADDBACKPACK(ACE_NonSteerableParachute,4); - MACRO_ADDBACKPACK(ACE_ReserveParachute,4); }; }; @@ -93,7 +92,7 @@ class CfgVehicles { class ACE_ReserveParachute: ACE_NonSteerableParachute { author = ECSTRING(common,ACETeam); displayName = CSTRING(ReserveParachute); - scope = 2; + scope = 1; mass = 70; ParachuteClass = "NonSteerable_Parachute_F"; ace_reserveParachute = ""; diff --git a/addons/repair/$PBOPREFIX$ b/addons/repair/$PBOPREFIX$ new file mode 100644 index 0000000000..d8fbd51195 --- /dev/null +++ b/addons/repair/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\repair \ No newline at end of file diff --git a/addons/repair/ACE_Settings.hpp b/addons/repair/ACE_Settings.hpp new file mode 100644 index 0000000000..0762b51ec9 --- /dev/null +++ b/addons/repair/ACE_Settings.hpp @@ -0,0 +1,65 @@ +class ACE_Settings { + class GVAR(DisplayTextOnRepair) { + displayName = CSTRING(SettingDisplayTextName); + description = CSTRING(SettingDisplayTextDesc); + typeName = "BOOL"; + isClientSettable = 1; + value = 1; + category = CSTRING(categoryName); + }; + class GVAR(engineerSetting_Repair) { + displayName = CSTRING(enginerSetting_Repair_name); + description = CSTRING(enginerSetting_Repair_description); + typeName = "SCALAR"; + value = 1; + values[] = {CSTRING(engineerSetting_anyone), CSTRING(engineerSetting_EngineerOnly), CSTRING(engineerSetting_RepairSpecialistOnly)}; + category = CSTRING(categoryName); + }; + class GVAR(engineerSetting_Wheel) { + displayName = CSTRING(enginerSetting_Wheel_name); + description = CSTRING(enginerSetting_Wheel_description); + typeName = "SCALAR"; + value = 0; + values[] = {CSTRING(engineerSetting_anyone), CSTRING(engineerSetting_EngineerOnly), CSTRING(engineerSetting_RepairSpecialistOnly)}; + category = CSTRING(categoryName); + }; + class GVAR(repairDamageThreshold) { + displayName = CSTRING(repairDamageThreshold_name); + description = CSTRING(repairDamageThreshold_description); + typeName = "SCALAR"; + value = 0.6; + category = CSTRING(categoryName); + }; + class GVAR(repairDamageThreshold_Engineer) { + displayName = CSTRING(repairDamageThreshold_Engineer_name); + description = CSTRING(repairDamageThreshold_Engineer_description); + typeName = "SCALAR"; + value = 0.4; + category = CSTRING(categoryName); + }; + class GVAR(consumeItem_ToolKit) { + displayName = CSTRING(consumeItem_ToolKit_name); + description = CSTRING(consumeItem_ToolKit_description); + typeName = "SCALAR"; + value = 1; + values[] = {ECSTRING(common,No), ECSTRING(common,Yes)}; + category = CSTRING(categoryName); + }; + + class GVAR(fullRepairLocation) { + displayName = CSTRING(fullRepairLocation); + description = CSTRING(fullRepairLocation_description); + typeName = "SCALAR"; + value = 2; + values[] = {CSTRING(useAnywhere), CSTRING(repairVehicleOnly), CSTRING(repairFacilityOnly), CSTRING(vehicleAndFacility), ECSTRING(common,Disabled)}; + category = CSTRING(categoryName); + }; + class GVAR(engineerSetting_fullRepair) { + displayName = CSTRING(engineerSetting_fullRepair_name); + description = CSTRING(engineerSetting_fullRepair_description); + typeName = "SCALAR"; + value = 3; + values[] = {CSTRING(engineerSetting_anyone), CSTRING(engineerSetting_EngineerOnly), CSTRING(engineerSetting_RepairSpecialistOnly)}; + category = CSTRING(categoryName); + }; +}; diff --git a/addons/repair/ACE_repair.hpp b/addons/repair/ACE_repair.hpp new file mode 100644 index 0000000000..01ad3aee23 --- /dev/null +++ b/addons/repair/ACE_repair.hpp @@ -0,0 +1,70 @@ +class ACE_Repair { + class Actions { + class ReplaceWheel { + displayName = CSTRING(ReplaceWheel); + displayNameProgress = CSTRING(ReplacingWheel); + + locations[] = {"All"}; + requiredEngineer = QGVAR(engineerSetting_Wheel); + repairingTime = 10; + repairingTimeSelfCoef = 1; + items[] = {"ToolKit"}; + condition = QUOTE(call FUNC(canReplaceWheel)); + itemConsumed = 0; + + callbackSuccess = QUOTE(call FUNC(doReplaceWheel)); + callbackFailure = ""; + callbackProgress = ""; + + animationCaller = "Acts_carFixingWheel"; + animationCallerProne = "Acts_carFixingWheel"; + animationCallerSelf = "Acts_carFixingWheel"; + animationCallerSelfProne = "Acts_carFixingWheel"; + litter[] = {}; + }; + class RemoveWheel: ReplaceWheel { + displayName = CSTRING(RemoveWheel); + displayNameProgress = CSTRING(RemovingWheel); + condition = QUOTE(call FUNC(canRemoveWheel)); + callbackSuccess = QUOTE(call FUNC(doRemoveWheel)); + }; + class MiscRepair: ReplaceWheel { + displayName = CSTRING(Repairing); // let's make empty string an auto generated string + displayNameProgress = CSTRING(RepairingHitPoint); + condition = QUOTE((_target getHitPointDamage _hitPoint) > ([_caller] call FUNC(getPostRepairDamage))); + requiredEngineer = 0; + repairingTime = 15; + callbackSuccess = QUOTE(call FUNC(doRepair)); + }; + class RepairTrack: MiscRepair { + displayName = CSTRING(Repairing); + displayNameProgress = CSTRING(RepairingHitPoint); + condition = QUOTE(call FUNC(canRepairTrack)); + callbackSuccess = QUOTE(call FUNC(doRepairTrack)); + requiredEngineer = QGVAR(engineerSetting_Wheel); + }; + class RemoveTrack: MiscRepair { + displayName = CSTRING(RemoveTrack); + displayNameProgress = CSTRING(RemovingTrack); + condition = QUOTE(call FUNC(canRemoveTrack)); + callbackSuccess = QUOTE(call FUNC(doRemoveTrack)); + requiredEngineer = QGVAR(engineerSetting_Wheel); + }; + class ReplaceTrack: RemoveTrack { + displayName = CSTRING(ReplaceTrack); + displayNameProgress = CSTRING(ReplacingTrack); + condition = QUOTE(call FUNC(canReplaceTrack)); + callbackSuccess = QUOTE(call FUNC(doReplaceTrack)); + requiredEngineer = QGVAR(engineerSetting_Wheel); + }; + class FullRepair: MiscRepair { + displayName = CSTRING(fullRepair); + displayNameProgress = CSTRING(fullyRepairing); + requiredEngineer = QGVAR(engineerSetting_fullRepair); + repairLocations[] = {QGVAR(fullRepairLocation)}; + repairingTime = 30; + condition = "damage (_this select 1) > 0"; + callbackSuccess = QUOTE(call FUNC(doFullRepair)); + }; + }; +}; diff --git a/addons/repair/CfgEventHandlers.hpp b/addons/repair/CfgEventHandlers.hpp new file mode 100644 index 0000000000..d03936c59b --- /dev/null +++ b/addons/repair/CfgEventHandlers.hpp @@ -0,0 +1,49 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; + +class Extended_Init_EventHandlers { + class Car { + class ADDON { + init = QUOTE(_this call DFUNC(addRepairActions)); + }; + }; + + class Tank { + class ADDON { + init = QUOTE(_this call DFUNC(addRepairActions)); + }; + }; + + class Helicopter { + class ADDON { + init = QUOTE(_this call DFUNC(addRepairActions)); + }; + }; + + class Plane { + class ADDON { + init = QUOTE(_this call DFUNC(addRepairActions)); + }; + }; + + class Ship_F { + class ADDON { + init = QUOTE(_this call DFUNC(addRepairActions)); + }; + }; + class ACE_RepairItem_Base { + class ADDON { + init = QUOTE(if (!isnil QUOTE(QEFUNC(cargo,initObject))) then {_this call EFUNC(cargo,initObject)}); + }; + }; +}; diff --git a/addons/repair/CfgVehicleClasses.hpp b/addons/repair/CfgVehicleClasses.hpp new file mode 100644 index 0000000000..0cd2e70942 --- /dev/null +++ b/addons/repair/CfgVehicleClasses.hpp @@ -0,0 +1,6 @@ + +class CfgVehicleClasses { + class GVAR(items) { + displayName = "ACE"; + }; +}; diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp new file mode 100644 index 0000000000..b70e415b53 --- /dev/null +++ b/addons/repair/CfgVehicles.hpp @@ -0,0 +1,340 @@ + +#define MACRO_REPAIRVEHICLE \ + class ACE_Actions { \ + class ACE_MainActions { \ + class GVAR(Repair) { \ + displayName = CSTRING(Repair); \ + condition = "true"; \ + statement = ""; \ + runOnHover = 1; \ + showDisabled = 0; \ + priority = 2; \ + icon = "\A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; \ + distance = 4; \ + }; \ + }; \ + }; + +class CfgVehicles { + class ACE_Module; + // @todo localization for all the modules + class ACE_moduleRepairSettings: ACE_Module { + scope = 2; + displayName = CSTRING(moduleName); + icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); //@todo + category = "ACE"; + function = QUOTE(DFUNC(moduleRepairSettings)); + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = ECSTRING(Common,ACETeam); + class Arguments { + class engineerSetting_Repair { + displayName = CSTRING(enginerSetting_Repair_name); + description = CSTRING(enginerSetting_Repair_description); + typeName = "NUMBER"; + class values { + class anyone { name = CSTRING(engineerSetting_anyone); value = 0; }; + class Engineer { name = CSTRING(engineerSetting_EngineerOnly); value = 1; default = 1; }; + class Special { name = CSTRING(engineerSetting_RepairSpecialistOnly); value = 2; }; + }; + }; + class engineerSetting_Wheel { + displayName = CSTRING(enginerSetting_Wheel_name); + description = CSTRING(enginerSetting_Wheel_description); + typeName = "NUMBER"; + class values { + class anyone { name = CSTRING(engineerSetting_anyone); value = 0; default = 1; }; + class Engineer { name = CSTRING(engineerSetting_EngineerOnly); value = 1; }; + class Special { name = CSTRING(engineerSetting_RepairSpecialistOnly); value = 2; }; + }; + }; + class repairDamageThreshold { + displayName = CSTRING(repairDamageThreshold_name); + description = CSTRING(repairDamageThreshold_description); + typeName = "NUMBER"; + defaultValue = 0.6; + }; + class repairDamageThreshold_Engineer { + displayName = CSTRING(repairDamageThreshold_Engineer_name); + description = CSTRING(repairDamageThreshold_Engineer_description); + typeName = "NUMBER"; + defaultValue = 0.4; + }; + class consumeItem_ToolKit { + displayName = CSTRING(consumeItem_ToolKit_name); + description = CSTRING(consumeItem_ToolKit_description); + typeName = "NUMBER"; + class values { + class keep { name = ECSTRING(common,No); value = 0; default = 1; }; + class remove { name = ECSTRING(common,Yes); value = 1; }; + }; + }; + class fullRepairLocation { + displayName = CSTRING(fullRepairLocation); + description = CSTRING(fullRepairLocation_description); + typeName = "NUMBER"; + class values { + class anywhere { name = CSTRING(useAnywhere); value = 0; }; + class vehicle { name = CSTRING(repairVehicleOnly); value = 1; }; + class facility { name = CSTRING(repairFacilityOnly); value = 2; default = 1; }; + class vehicleAndFacility { name = CSTRING(vehicleAndFacility); value = 3; }; + class disabled { name = ECSTRING(common,Disabled); value = 4;}; + }; + }; + class engineerSetting_fullRepair { + displayName = CSTRING(engineerSetting_fullRepair_name); + description = CSTRING(engineerSetting_fullRepair_description); + typeName = "NUMBER"; + class values { + class anyone { name = CSTRING(engineerSetting_anyone); value = 0; }; + class Engineer { name = CSTRING(engineerSetting_EngineerOnly); value = 1; }; + class Special { name = CSTRING(engineerSetting_RepairSpecialistOnly); value = 2; default = 1;}; + }; + }; + }; + class ModuleDescription { + description = CSTRING(moduleDescription); + sync[] = {}; + }; + }; + + class Module_F; + class ACE_moduleAssignEngineerRoles: Module_F { + scope = 2; + displayName = CSTRING(AssignEngineerRole_Module_DisplayName); + icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); + category = "ACE"; + function = QUOTE(DFUNC(moduleAssignEngineer)); + functionPriority = 10; + isGlobal = 2; + isTriggerActivated = 0; + isDisposable = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class EnableList { + displayName = CSTRING(AssignEngineerRole_EnableList_DisplayName); + description = CSTRING(AssignEngineerRole_EnableList_Description); + defaultValue = ""; + typeName = "STRING"; + }; + class role { + displayName = CSTRING(AssignEngineerRole_role_DisplayName); + description = CSTRING(AssignEngineerRole_role_Description); + typeName = "NUMBER"; + class values { + class none { + name = CSTRING(AssignEngineerRole_role_none); + value = 0; + }; + class medic { + name = CSTRING(AssignEngineerRole_role_engineer); + value = 1; + default = 1; + }; + class doctor { + name = CSTRING(AssignEngineerRole_role_specialist); + value = 2; + }; + }; + }; + }; + class ModuleDescription { + description = CSTRING(AssignEngineerRole_Module_Description); + sync[] = {}; + }; + }; + class ACE_moduleAssignRepairVehicle: Module_F { + scope = 2; + displayName = CSTRING(AssignRepairVehicle_Module_DisplayName); + icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); + category = "ACE"; + function = QUOTE(DFUNC(moduleAssignRepairVehicle)); + functionPriority = 10; + isGlobal = 2; + isTriggerActivated = 0; + isDisposable = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class EnableList { + displayName = CSTRING(AssignRepairVehicle_EnableList_DisplayName); + description = CSTRING(AssignRepairVehicle_EnableList_Description); + defaultValue = ""; + typeName = "STRING"; + }; + class role { + displayName = CSTRING(AssignRepairVehicle_role_DisplayName); + description = CSTRING(AssignRepairVehicle_role_Description); + typeName = "NUMBER"; + class values { + class none { + name = ECSTRING(common,No); + value = 0; + }; + class isVehicle { + name = ECSTRING(common,Yes); + value = 1; + default = 1; + }; + }; + }; + }; + class ModuleDescription { + description = CSTRING(AssignRepairVehicle_Module_Description); + sync[] = {}; + }; + }; + class ACE_moduleAssignRepairFacility: ACE_moduleAssignRepairVehicle { + displayName = CSTRING(AssignRepairFacility_Module_DisplayName); + function = QUOTE(DFUNC(moduleAssignRepairFacility)); + class Arguments { + class EnableList { + displayName = CSTRING(AssignRepairFacility_EnableList_DisplayName); + description = CSTRING(AssignRepairFacility_EnableList_Description); + defaultValue = ""; + typeName = "STRING"; + }; + class role { + displayName = CSTRING(AssignRepairFacility_role_DisplayName); + description = CSTRING(AssignRepairFacility_role_Description); + typeName = "NUMBER"; + class values { + class none { + name = ECSTRING(common,No); + value = 0; + }; + class isFacility { + name = ECSTRING(common,Yes); + value = 1; + default = 1; + }; + }; + }; + }; + class ModuleDescription { + description = CSTRING(AssignRepairFacility_Module_Description); + sync[] = {}; + }; + }; + + + class LandVehicle; + class Car: LandVehicle { + MACRO_REPAIRVEHICLE + + class ACE_Cargo { + class Cargo { + class ACE_Wheel { + type = "ACE_Wheel"; + amount = 1; + }; + }; + }; + }; + + class Tank: LandVehicle { + MACRO_REPAIRVEHICLE + }; + + class Air; + class Helicopter: Air { + MACRO_REPAIRVEHICLE + }; + + class Plane: Air { + MACRO_REPAIRVEHICLE + }; + + class Ship; + class Ship_F: Ship { + MACRO_REPAIRVEHICLE + }; + + class thingX; + class ACE_RepairItem_Base: thingX { + XEH_ENABLED; + icon = "iconObject_circle"; + mapSize = 0.7; + accuracy = 0.2; + vehicleClass = QGVAR(items); + destrType = "DesturctNo"; + }; + + class ACE_Track: ACE_RepairItem_Base { + ace_cargo_size = 2; + ace_cargo_canLoad = 1; + author = "Hawkins"; + scope = 2; + model = QUOTE(PATHTOF(data\ace_track.p3d)); + displayName = "$STR_ACE_Repair_SpareTrack"; + }; + + class ACE_Wheel: ACE_RepairItem_Base { + ace_cargo_size = 1; + ace_cargo_canLoad = 1; + author = "Hawkins"; + scope = 2; + model = QUOTE(PATHTOF(data\ace_wheel.p3d)); + displayName = "$STR_ACE_Repair_SpareWheel"; + picture = QUOTE(PATHTOF(ui\tire_ca.paa)); + }; + + // disable vanilla repair + // "getNumber (_x >> ""transportRepair"") > 0" configClasses (configFile >> "CfgVehicles") + + class Slingload_01_Base_F; + class B_Slingload_01_Repair_F: Slingload_01_Base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class Heli_Transport_04_base_F; + class O_Heli_Transport_04_repair_F: Heli_Transport_04_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class Pod_Heli_Transport_04_base_F; + class Land_Pod_Heli_Transport_04_repair_F: Pod_Heli_Transport_04_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class B_APC_Tracked_01_base_F; + class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class Offroad_01_base_F; + class Offroad_01_repair_base_F: Offroad_01_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class B_Truck_01_mover_F; + class B_Truck_01_Repair_F: B_Truck_01_mover_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class B_Truck_01_fuel_F: B_Truck_01_mover_F { // the fuel hemet apparently can repair. GJ BI + transportRepair = 0; + }; + + class Truck_02_base_F; + class Truck_02_box_base_F: Truck_02_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class Truck_02_engineeral_base_F: Truck_02_box_base_F { + GVAR(canRepair) = 0; + }; + + class Truck_03_base_F; + class O_Truck_03_repair_F: Truck_03_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; +}; diff --git a/addons/repair/XEH_postInit.sqf b/addons/repair/XEH_postInit.sqf new file mode 100644 index 0000000000..44ca157b0c --- /dev/null +++ b/addons/repair/XEH_postInit.sqf @@ -0,0 +1,7 @@ +#include "script_component.hpp" + +["setVehicleDamage", {_this call FUNC(setDamage)}] call EFUNC(common,addEventHandler); +["setVehicleHitPointDamage", {_this call FUNC(setHitPointDamage)}] call EFUNC(common,addEventHandler); + +// wheels +["setWheelHitPointDamage", {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call EFUNC(common,addEventHandler); diff --git a/addons/repair/XEH_preInit.sqf b/addons/repair/XEH_preInit.sqf new file mode 100644 index 0000000000..38de84a452 --- /dev/null +++ b/addons/repair/XEH_preInit.sqf @@ -0,0 +1,40 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(addRepairActions); +PREP(canRemoveWheel); +PREP(canRemoveTrack); +PREP(canRepair); +PREP(canRepairTrack); +PREP(canReplaceWheel); +PREP(canReplaceTrack); +PREP(doRemoveWheel); +PREP(doRemoveTrack); +PREP(doRepair); +PREP(doFullRepair); +PREP(doRepairTrack); +PREP(doReplaceWheel); +PREP(doReplaceTrack); +PREP(getPostRepairDamage); +PREP(getWheelHitPointsWithSelections); +PREP(hasItems); +PREP(isEngineer); +PREP(isInRepairFacility); +PREP(isNearRepairVehicle); +PREP(isRepairVehicle); +PREP(moduleRepairSettings); +PREP(moduleAssignEngineer); +PREP(moduleAssignRepairVehicle); +PREP(moduleAssignRepairFacility); +PREP(normalizeHitPoints); +PREP(repair); +PREP(repair_failure); +PREP(repair_success); +PREP(setDamage); +PREP(setHitPointDamage); +PREP(spawnObject); +PREP(useItem); +PREP(useItems); + +ADDON = true; diff --git a/addons/repair/config.cpp b/addons/repair/config.cpp new file mode 100644 index 0000000000..9d447ffe5f --- /dev/null +++ b/addons/repair/config.cpp @@ -0,0 +1,31 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"ACE_Wheel", "ACE_Track"}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common","ace_interact_menu"}; + author[] = {"commy2", "Glowbal"}; + authorUrl = "https://ace3mod.com"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" + +#include "CfgVehicleClasses.hpp" +#include "CfgVehicles.hpp" + +#include "ACE_Settings.hpp" +#include "ACE_repair.hpp" + +class CfgActions { + class None; + class Repair: None { + show = 0; + }; + class RepairVehicle: None { + show = 0; + }; +}; \ No newline at end of file diff --git a/addons/repair/data/ace_track.p3d b/addons/repair/data/ace_track.p3d new file mode 100644 index 0000000000..86b07f0ef8 Binary files /dev/null and b/addons/repair/data/ace_track.p3d differ diff --git a/addons/repair/data/ace_wheel.p3d b/addons/repair/data/ace_wheel.p3d new file mode 100644 index 0000000000..f2b07b066f Binary files /dev/null and b/addons/repair/data/ace_wheel.p3d differ diff --git a/addons/repair/data/trailObjects.rvmat b/addons/repair/data/trailObjects.rvmat new file mode 100644 index 0000000000..4fa521f376 --- /dev/null +++ b/addons/repair/data/trailObjects.rvmat @@ -0,0 +1,99 @@ +#define _ARMA_ + +class StageTI +{ + texture = "a3\data_f\default_ti_ca.paa"; +}; +ambient[] = {1,1,1,1}; +diffuse[] = {1,1,1,1}; +forcedDiffuse[] = {0,0,0,0}; +emmisive[] = {0,0,0,0}; +specular[] = {0.0099999998,0.0099999998,0.0099999998,0.0099999998}; +specularPower = 500; +PixelShaderID = "Super"; +VertexShaderID = "Super"; +class Stage1 +{ + texture = "z\ace\addons\repair\data\trailObjects_nohq.paa"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage2 +{ + texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage3 +{ + texture = "#(argb,8,8,3)color(0,0,0,0,MC)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage4 +{ + texture = "#(argb,8,8,3)color(1,1,1,1,AS)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage5 +{ + texture = "#(argb,8,8,3)color(0,0.6,1,1,SMDI)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage6 +{ + texture = "#(ai,64,64,1)fresnelGlass(2)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage7 +{ + useWorldEnvMap = "true"; + texture = "a3\data_f\env_land_ca.paa"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; diff --git a/addons/repair/data/trailObjects_co.paa b/addons/repair/data/trailObjects_co.paa new file mode 100644 index 0000000000..25f2c4c1c0 Binary files /dev/null and b/addons/repair/data/trailObjects_co.paa differ diff --git a/addons/repair/data/trailObjects_nohq.paa b/addons/repair/data/trailObjects_nohq.paa new file mode 100644 index 0000000000..fc10e94aea Binary files /dev/null and b/addons/repair/data/trailObjects_nohq.paa differ diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf new file mode 100644 index 0000000000..c267832298 --- /dev/null +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -0,0 +1,124 @@ +/* + * Author: commy2 + * Called from init eventhandler. Checks if the vehicles class already has the actions initialized. Otherwise add all available repair options. + * + * Arguments: + * 0: vehicle + * + * Return Value: + * NONE + */ +#include "script_component.hpp" +#define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"] + +params ["_vehicle"]; +TRACE_1("params", _vehicle); + +private ["_type", "_initializedClasses"]; + +_type = typeOf _vehicle; + +_initializedClasses = GETMVAR(GVAR(initializedClasses),[]); + +// do nothing if the class is already initialized +if (_type in _initializedClasses) exitWith {}; +// get all hitpoints +private "_hitPoints"; +_hitPoints = [_vehicle] call EFUNC(common,getHitPointsWithSelections) select 0; + +// get hitpoints of wheels with their selections +private ["_wheelHitPointsWithSelections", "_wheelHitPoints", "_wheelHitPointSelections"]; + +_wheelHitPointsWithSelections = [_vehicle] call FUNC(getWheelHitPointsWithSelections); + +_wheelHitPoints = _wheelHitPointsWithSelections select 0; +_wheelHitPointSelections = _wheelHitPointsWithSelections select 1; + +// add repair events to this vehicle class +{ + if (_x in _wheelHitPoints) then { + // add wheel repair action + + private ["_icon", "_selection"]; + + _icon = QUOTE(PATHTOF(ui\tire_ca.paa)); + _icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; + // textDefault = ""; + _selection = _wheelHitPointSelections select (_wheelHitPoints find _x); + + private ["_name", "_text", "_condition", "_statement"]; + + // remove wheel action + _name = format ["Remove_%1", _x]; + _text = localize "STR_ACE_Repair_RemoveWheel"; + + _condition = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(canRepair)}; + _statement = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(repair)}; + + private "_action"; + _action = [_name, _text, _icon, _statement, _condition, {}, [_x], _selection, 2] call EFUNC(interact_menu,createAction); + [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); + + // replace wheel action + _name = format ["Replace_%1", _x]; + _text = localize LSTRING(ReplaceWheel); + + _condition = {[_this select 1, _this select 0, _this select 2 select 0, "ReplaceWheel"] call DFUNC(canRepair)}; + _statement = {[_this select 1, _this select 0, _this select 2 select 0, "ReplaceWheel"] call DFUNC(repair)}; + + _action = [_name, _text, _icon, _statement, _condition, {}, [_x], _selection, 2] call EFUNC(interact_menu,createAction); + [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); + + } else { + // exit if the hitpoint is in the blacklist, e.g. glasses + if (_x in IGNORED_HITPOINTS) exitWith {}; + + // exit if the hitpoint is virtual + if (isText (configFile >> "CfgVehicles" >> _type >> "HitPoints" >> _x >> "depends")) exitWith {}; + + // add misc repair action + + private ["_name", "_text", "_icon", "_selection", "_condition", "_statement"]; + + _name = format ["Repair_%1", _x]; + + _text = format ["STR_ACE_Repair_%1", _x]; + + if (isLocalized _text) then { + _text = format [localize LSTRING(RepairHitpoint), localize _text]; + } else { + _text = format [localize LSTRING(RepairHitpoint), _x]; + }; + + _icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; + _selection = ""; + _condition = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(canRepair)}; + _statement = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(repair)}; + + if (_x in TRACK_HITPOINTS) then { + if (_x == "HitLTrack") then { + _selection = [-1.75, 0, -1.75]; + } else { + _selection = [1.75, 0, -1.75]; + }; + private "_action"; + _action = [_name, _text, _icon, _statement, _condition, {}, [_x, "RepairTrack"], _selection, 4] call EFUNC(interact_menu,createAction); + [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); + } else { + private "_action"; + _action = [_name, _text, _icon, _statement, _condition, {}, [_x, "MiscRepair"], _selection, 4] call EFUNC(interact_menu,createAction); + [_type, 0, ["ACE_MainActions", QGVAR(Repair)], _action] call EFUNC(interact_menu,addActionToClass); + }; + }; +} forEach _hitPoints; + +private ["_action", "_condition", "_statement"]; + +_condition = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(canRepair)}; +_statement = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(repair)}; +_action = [QGVAR(fullRepair), localize LSTRING(fullRepair), "A3\ui_f\data\igui\cfg\actions\repair_ca.paa", _statement, _condition, {}, ["", "fullRepair"], "", 4] call EFUNC(interact_menu,createAction); +[_type, 0, ["ACE_MainActions", QGVAR(Repair)], _action] call EFUNC(interact_menu,addActionToClass); +// set class as initialized +_initializedClasses pushBack _type; + +SETMVAR(GVAR(initializedClasses),_initializedClasses); diff --git a/addons/repair/functions/fnc_canRemoveTrack.sqf b/addons/repair/functions/fnc_canRemoveTrack.sqf new file mode 100644 index 0000000000..e428ac00a8 --- /dev/null +++ b/addons/repair/functions/fnc_canRemoveTrack.sqf @@ -0,0 +1,18 @@ +/* + * Author: commy2 + * Check if the unit can remove given wheel of the vehicle. + * + * Arguments: + * 0: Unit that does the repairing + * 1: vehicle to repair + * 2: Selected hitpoint + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_target", "_hitPoint"]; +TRACE_3("params",_unit,_target,_hitPoint); + +alive _target && {_target getHitPointDamage _hitPoint < 1} diff --git a/addons/repair/functions/fnc_canRemoveWheel.sqf b/addons/repair/functions/fnc_canRemoveWheel.sqf new file mode 100644 index 0000000000..e428ac00a8 --- /dev/null +++ b/addons/repair/functions/fnc_canRemoveWheel.sqf @@ -0,0 +1,18 @@ +/* + * Author: commy2 + * Check if the unit can remove given wheel of the vehicle. + * + * Arguments: + * 0: Unit that does the repairing + * 1: vehicle to repair + * 2: Selected hitpoint + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_target", "_hitPoint"]; +TRACE_3("params",_unit,_target,_hitPoint); + +alive _target && {_target getHitPointDamage _hitPoint < 1} diff --git a/addons/repair/functions/fnc_canRepair.sqf b/addons/repair/functions/fnc_canRepair.sqf new file mode 100644 index 0000000000..4a8524e518 --- /dev/null +++ b/addons/repair/functions/fnc_canRepair.sqf @@ -0,0 +1,92 @@ +/* + * Author: Glowbal + * Check if the repair action can be performed. + * + * Arguments: + * 0: The caller + * 1: The target + * 2: Selection name + * 3: ACE_Engineeral_Treatments Classname + * + * ReturnValue: + * Can Treat + * + * Public: Yes + */ + +#include "script_component.hpp" + +params ["_caller", "_target", "_hitPoint", "_className"]; +TRACE_4("params",_caller,_target,_hitPoint,_className); + +private ["_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition"]; + +_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); +if !(isClass _config) exitwith {false}; // or go for a default? +if(isEngineOn _target) exitwith {false}; + +_engineerRequired = if (isNumber (_config >> "requiredEngineer")) then { + getNumber (_config >> "requiredEngineer"); +} else { + // Check for required class + if (isText (_config >> "requiredEngineer")) exitwith { + missionNamespace getvariable [(getText (_config >> "requiredEngineer")), 0]; + }; + 0; +}; +if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitwith {false}; + +_items = getArray (_config >> "items"); +if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitwith {false}; + +_return = true; +if (getText (_config >> "condition") != "") then { + _condition = getText (_config >> "condition"); + if (isnil _condition) then { + _condition = compile _condition; + } else { + _condition = missionNamespace getvariable _condition; + }; + if (typeName _condition == "BOOL") then { + _return = _condition; + } else { + _return = [_caller, _target, _hitPoint, _className] call _condition; + }; +}; + +if (!_return) exitwith {false}; + +_vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { + missionNamespace getvariable [getText(_config >> "vehicleStateCondition"), 0] +} else { + getNumber(_config >> "vehicleStateCondition") +}; +// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; + +_locations = getArray (_config >> "repairLocations"); +if ("All" in _locations) exitwith {true}; + +private ["_repairFacility", "_repairVeh"]; +_repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; +_repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; + +{ + if (_x == "field") exitwith {_return = true;}; + if (_x == "RepairFacility" && _repairFacility) exitwith {_return = true;}; + if (_x == "RepairVehicle" && _repairVeh) exitwith {_return = true;}; + if !(isnil _x) exitwith { + private "_val"; + _val = missionNamespace getvariable _x; + if (typeName _val == "SCALAR") then { + _return = switch (_val) do { + case 0: {true}; //useAnywhere + case 1: {call _repairVeh}; //repairVehicleOnly + case 2: {call _repairFacility}; //repairFacilityOnly + case 3: {(call _repairFacility) || {call _repairVeh}}; //vehicleAndFacility + default {false}; //Disabled + }; + }; + }; +} forEach _locations; + +_return && alive _target; diff --git a/addons/repair/functions/fnc_canRepairTrack.sqf b/addons/repair/functions/fnc_canRepairTrack.sqf new file mode 100644 index 0000000000..847715c5cb --- /dev/null +++ b/addons/repair/functions/fnc_canRepairTrack.sqf @@ -0,0 +1,37 @@ +/* + * Author: commy2 + * Check if the unit can replace given wheel of the vehicle. + * + * Arguments: + * 0: Unit that does the repairing (Object) + * 1: vehicle to repair (Object) + * 2: Selected hitpoint (String) + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_target", "_hitPoint", ["_wheel",false]]; +TRACE_4("params",_unit,_target,_hitPoint,_wheel); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + +if (typeName _wheel == "OBJECT") then { + // not near interpret as objNull + if !(_wheel in nearestObjects [_unit, ["ACE_Track"], 5]) then { + _wheel = objNull; + }; +} else { + _wheel = objNull; + + { + if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith { + _wheel = _x; + }; + } forEach nearestObjects [_unit, ["ACE_Track"], 5]; +}; + +if (isNull _wheel || damage _wheel >= 1) exitWith {false}; + +alive _target && {_target getHitPointDamage _hitPoint > 0} + diff --git a/addons/repair/functions/fnc_canReplaceTrack.sqf b/addons/repair/functions/fnc_canReplaceTrack.sqf new file mode 100644 index 0000000000..8ced60d63e --- /dev/null +++ b/addons/repair/functions/fnc_canReplaceTrack.sqf @@ -0,0 +1,37 @@ +/* + * Author: commy2 + * Check if the unit can replace given wheel of the vehicle. + * + * Arguments: + * 0: Unit that does the repairing (Object) + * 1: vehicle to repair (Object) + * 2: Selected hitpoint (String) + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_target", "_hitPoint", ["_wheel",false]]; +TRACE_4("params",_unit,_target,_hitPoint,_wheel); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + +if (typeName _wheel == "OBJECT") then { + // not near interpret as objNull + if !(_wheel in nearestObjects [_unit, ["ACE_Track"], 5]) then { + _wheel = objNull; + }; +} else { + _wheel = objNull; + + { + if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith { + _wheel = _x; + }; + } forEach nearestObjects [_unit, ["ACE_Track"], 5]; +}; + +if (isNull _wheel) exitWith {false}; + +alive _target && {_target getHitPointDamage _hitPoint >= 1} + diff --git a/addons/repair/functions/fnc_canReplaceWheel.sqf b/addons/repair/functions/fnc_canReplaceWheel.sqf new file mode 100644 index 0000000000..9251650e7f --- /dev/null +++ b/addons/repair/functions/fnc_canReplaceWheel.sqf @@ -0,0 +1,43 @@ +/* + * Author: commy2 + * Check if the unit can replace given wheel of the vehicle. + * + * Arguments: + * 0: Unit that does the repairing (Object) + * 1: vehicle to repair (Object) + * 2: Selected hitpoint (String) + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_target", "_hitPoint", ["_wheel",false]]; +TRACE_4("params",_unit,_target,_hitPoint,_wheel); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action +//if !([_unit, _target, _hitpoint, "ReplaceWheel"] call FUNC(canRepair)) exitwith {false}; + +//if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; + +//if !([_unit, GVAR(engineerSetting_Wheel)] call FUNC(isEngineer)) exitWith {false}; + +// check for a near wheel +if (typeName _wheel == "OBJECT") then { + // not near interpret as objNull + if !(_wheel in nearestObjects [_unit, ["ACE_Wheel"], 5]) then { + _wheel = objNull; + }; +} else { + _wheel = objNull; + + { + if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith { + _wheel = _x; + }; + } forEach nearestObjects [_unit, ["ACE_Wheel"], 5]; +}; + +if (isNull _wheel) exitWith {false}; + +alive _target && {_target getHitPointDamage _hitPoint >= 1} + diff --git a/addons/repair/functions/fnc_doFullRepair.sqf b/addons/repair/functions/fnc_doFullRepair.sqf new file mode 100644 index 0000000000..24454bbd62 --- /dev/null +++ b/addons/repair/functions/fnc_doFullRepair.sqf @@ -0,0 +1,17 @@ +/* + * Author: Glowbal + * + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * Stuff from progress bar. + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); + +_vehicle setDamage 0; diff --git a/addons/repair/functions/fnc_doRemoveTrack.sqf b/addons/repair/functions/fnc_doRemoveTrack.sqf new file mode 100644 index 0000000000..740edabf09 --- /dev/null +++ b/addons/repair/functions/fnc_doRemoveTrack.sqf @@ -0,0 +1,38 @@ +/* + * Author: commy2 + * + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * Stuff from progress bar. + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action +// get current hitpoint damage +private "_hitPointDamage"; +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; + +// can't remove destroyed or already removed wheel +if (_hitPointDamage >= 1) exitWith {}; + +// don't die by spawning / moving the wheel +["fixCollision", _unit] call EFUNC(common,localEvent); + +// spawn wheel +private "_wheel"; +_wheel = ["ACE_Track", getPosASL _unit] call FUNC(spawnObject); +_wheel setdamage _hitPointDamage; + +// raise event to set the new hitpoint damage +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, 1]] call EFUNC(common,targetEvent); + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + [localize LSTRING(RemovedTrack)] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_doRemoveWheel.sqf b/addons/repair/functions/fnc_doRemoveWheel.sqf new file mode 100644 index 0000000000..89fc76a341 --- /dev/null +++ b/addons/repair/functions/fnc_doRemoveWheel.sqf @@ -0,0 +1,38 @@ +/* + * Author: commy2 + * + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * Stuff from progress bar. + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action +// get current hitpoint damage +private "_hitPointDamage"; +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; + +// can't remove destroyed or already removed wheel +if (_hitPointDamage >= 1) exitWith {}; + +// don't die by spawning / moving the wheel +["fixCollision", _unit] call EFUNC(common,localEvent); + +// spawn wheel +private "_wheel"; +_wheel = ["ACE_Wheel", getPosASL _unit] call FUNC(spawnObject); +_wheel setdamage _hitPointDamage; + +// raise event to set the new hitpoint damage +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, 1]] call EFUNC(common,targetEvent); + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + [localize LSTRING(RemovedWheel)] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf new file mode 100644 index 0000000000..8059003845 --- /dev/null +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -0,0 +1,39 @@ +/* + * Author: commy2 + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * 0: Stuff from progress bar. + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); + +// get current hitpoint damage +private "_hitPointDamage"; +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; + +_hitPointDamage = _hitPointDamage - 0.5; +// don't use negative values for damage +_hitPointDamage = _hitPointDamage max ([_unit] call FUNC(getPostRepairDamage)); + +// raise event to set the new hitpoint damage +["setVehicleHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + private "_text"; + _text = format ["STR_ACE_Repair_%1", _hitPoint]; + + if (isLocalized _text) then { + _text = format [localize ([LSTRING(RepairedHitPointFully), LSTRING(RepairedHitPointPartially)] select (_hitPointDamage > 0)), localize _text]; + } else { + _text = localize ([LSTRING(RepairedFully), LSTRING(RepairedPartially)] select (_hitPointDamage > 0)); + }; + + [_text] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_doRepairTrack.sqf b/addons/repair/functions/fnc_doRepairTrack.sqf new file mode 100644 index 0000000000..621d933d64 --- /dev/null +++ b/addons/repair/functions/fnc_doRepairTrack.sqf @@ -0,0 +1,45 @@ +/* + * Author: commy2 + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * 0: Stuff from progress bar. + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint", "_classname"]; +TRACE_4("params",_unit,_vehicle,_hitPoint,_classname); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + +private ["_hitPointDamage", "_newDamage", "_wheel"]; + +_wheel = objNull; + +{ + if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith { + _wheel = _x; + }; +} forEach nearestObjects [_unit, ["ACE_Track"], 5]; +if (isNull _wheel) exitwith {}; + +// get current hitpoint damage + +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; +_newDamage = (1 - (damage _wheel)) / 4; // require 4 tracks to fully replace one side + +// can't replace a destroyed wheel +if ((damage _wheel) >= 1) exitWith {}; +// don't die by spawning / moving the wheel +_hitPointDamage = (_hitPointDamage - _newDamage) min 0; +deleteVehicle _wheel; + +// raise event to set the new hitpoint damage +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + [LSTRING(ReplacedTrack)] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_doReplaceTrack.sqf b/addons/repair/functions/fnc_doReplaceTrack.sqf new file mode 100644 index 0000000000..224508684b --- /dev/null +++ b/addons/repair/functions/fnc_doReplaceTrack.sqf @@ -0,0 +1,48 @@ +/* + * Author: commy2 + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * 0: Stuff from progress bar. + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint", "_classname"]; +TRACE_4("params",_unit,_vehicle,_hitPoint,_classname); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + +private["_hitPointDamage", "_wheel"]; + +_wheel = objNull; + +{ + if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith { + _wheel = _x; + }; +} forEach nearestObjects [_unit, ["ACE_Track"], 5]; +if (isNull _wheel) exitwith {}; + +// get current hitpoint damage +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; + +// can't replace not destroyed wheel +if (_hitPointDamage < 1) exitWith {}; + +// don't die by spawning / moving the wheel +_hitPointDamage = damage _wheel; + +// can't replace a destroyed wheel +if (_hitPointDamage >= 1) exitWith {}; + +deleteVehicle _wheel; + +// raise event to set the new hitpoint damage +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + [LSTRING(ReplacedTrack)] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_doReplaceWheel.sqf b/addons/repair/functions/fnc_doReplaceWheel.sqf new file mode 100644 index 0000000000..5051699497 --- /dev/null +++ b/addons/repair/functions/fnc_doReplaceWheel.sqf @@ -0,0 +1,48 @@ +/* + * Author: commy2 + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * 0: Stuff from progress bar. + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint", "_classname"]; +TRACE_4("params",_unit,_vehicle,_hitPoint,_classname); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + +private ["_hitPointDamage", "_wheel"]; + +_wheel = objNull; + +{ + if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith { + _wheel = _x; + }; +} forEach nearestObjects [_unit, ["ACE_Wheel"], 5]; +if (isNull _wheel) exitwith {}; + +// get current hitpoint damage +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; + +// can't replace not destroyed wheel +if (_hitPointDamage < 1) exitWith {}; + +// don't die by spawning / moving the wheel +_hitPointDamage = damage _wheel; + +// can't replace a destroyed wheel +if (_hitPointDamage >= 1) exitWith {}; + +deleteVehicle _wheel; + +// raise event to set the new hitpoint damage +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + [LSTRING(ReplacedWheel)] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_getPostRepairDamage.sqf b/addons/repair/functions/fnc_getPostRepairDamage.sqf new file mode 100644 index 0000000000..c425f6569e --- /dev/null +++ b/addons/repair/functions/fnc_getPostRepairDamage.sqf @@ -0,0 +1,12 @@ +// by comm2 +#include "script_component.hpp" + +params ["_unit"]; +TRACE_1("params",_unit); +// TODO when near repair station, full repair? + +if (([_unit] call FUNC(isInRepairFacility) || {[_unit] call FUNC(isNearRepairVehicle)})) exitwith {0}; + +if ([_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold_Engineer)}; +if ([_unit, GVAR(engineerSetting_Repair)] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold)}; +0.3; diff --git a/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf new file mode 100644 index 0000000000..6719047737 --- /dev/null +++ b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf @@ -0,0 +1,76 @@ +/* + * Author: commy2 + * Returns the wheel hitpoints and their selections. + * + * Arguments: + * 0: A vehicle + * + * Return Value: + * Wheel positions in model coordinates. + */ +#include "script_component.hpp" + +params ["_vehicle"]; +TRACE_1("params",_vehicle); + +// get the vehicles wheel config +private "_wheels"; +_wheels = configfile >> "CfgVehicles" >> typeOf _vehicle >> "Wheels"; + +// exit with nothing if the vehicle has no wheels class +if !(isClass _wheels) exitWith {[[],[]]}; + +// get all wheels and read selections from config +private ["_selections", "_bones"]; + +_wheels = "true" configClasses _wheels; + +_selections = []; +_bones = []; +{ + _selections pushBack getText (_x >> "center"); + + private "_bone"; + _bone = getText (_x >> "boneName"); + + _bone = toArray _bone; + _bone resize count "wheel_X_Y"; // this is a requirement for physx. Should work for all addon vehicles. + _bone = toString _bone; + + _bones pushBack _bone; +} forEach _wheels; + +// get hitpoints with their fire geometry selections +private ["_hitPointsWithSelections", "_hitPoints", "_hitPointSelections"]; + +_hitPointsWithSelections = [_vehicle] call EFUNC(common,getHitPointsWithSelections); + +_hitPoints = _hitPointsWithSelections select 0; +_hitPointSelections = _hitPointsWithSelections select 1; + +// assign hitpoints to correct wheel selection by comparing bone name and fire geometry selection +private ["_wheelHitPoints", "_wheelHitPointSelections"]; + +_wheelHitPoints = []; +_wheelHitPointSelections = []; +{ + private "_bone"; + _bone = _x; + + private "_index"; + + _index = -1; + { + if (_bone != "" && {_x find _bone == 0}) exitWith { // same as above. Requirement for physx. + _index = _forEachIndex; + }; + } forEach _hitPointSelections; + + if (_index != -1) then { + _wheelHitPoints pushBack (_hitPoints select _index); + _wheelHitPointSelections pushBack (_selections select _forEachIndex); + }; + +} forEach _bones; + +[_wheelHitPoints, _wheelHitPointSelections] diff --git a/addons/repair/functions/fnc_hasItems.sqf b/addons/repair/functions/fnc_hasItems.sqf new file mode 100644 index 0000000000..6167689faf --- /dev/null +++ b/addons/repair/functions/fnc_hasItems.sqf @@ -0,0 +1,32 @@ +/* + * Author: Glowbal + * Check if the engineer has all items. + * + * Arguments: + * 0: Engineer + * 1: Patient + * 2: Items > + * + * ReturnValue: + * Has the items + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_engineer", "_items"]; +TRACE_2("params",_engineer,_items); + +private ["_return"]; + +_return = true; +{ + if (typeName _x == "ARRAY" && {({[_engineer, _x] call EFUNC(common,hasItem)} count _x == 0)}) exitwith { + _return = false; + }; + if (typeName _x == "STRING" && {!([_engineer, _x] call EFUNC(common,hasItem))}) exitwith { + _return = false; + }; +} forEach _items; + +_return; diff --git a/addons/repair/functions/fnc_isEngineer.sqf b/addons/repair/functions/fnc_isEngineer.sqf new file mode 100644 index 0000000000..aa2368184a --- /dev/null +++ b/addons/repair/functions/fnc_isEngineer.sqf @@ -0,0 +1,26 @@ +/* + * Author: Glowbal, KoffeinFlummi, commy2 + * Check if a unit is any engineer class + * + * Arguments: + * 0: The Unit + * 1: Class + * + * ReturnValue: + * Is in of engineer class + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", ["_engineerN", 1]]; +TRACE_2("params",_unit,_engineerN); + +private ["_class"]; +_class = _unit getVariable ["ACE_IsEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer")]; + +// This if statement is here for copmatability with the common variant of isEngineer, which requires a bool. +// We cannot move this function to common because we require the GVAR(engineerSetting_Repair), which only makes sense to include in the repair module. +if (typeName _class == "BOOL") then {_class = 1}; + +_class >= (_engineerN min GVAR(engineerSetting_Repair)); \ No newline at end of file diff --git a/addons/repair/functions/fnc_isInRepairFacility.sqf b/addons/repair/functions/fnc_isInRepairFacility.sqf new file mode 100644 index 0000000000..725cddd4c2 --- /dev/null +++ b/addons/repair/functions/fnc_isInRepairFacility.sqf @@ -0,0 +1,40 @@ +/* + * Author: Glowbal + * Checks if a unit is in a repair facility + * + * Arguments: + * 0: The Unit + * + * ReturnValue: + * Is inside a repair facility + * + * Public: Yes + */ + +#include "script_component.hpp" + +params ["_object"]; +TRACE_1("params",_object); + +private ["_position","_objects","_isInBuilding","_repairFacility"]; + +_position = getPosASL _object; +_isInBuilding = false; +_repairFacility = []; + +_objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position select 2)], _object modelToWorldVisual [0, 0, (_position select 2) +10], _object]); +{ + if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitwith { + _isInBuilding = true; + }; +} forEach _objects; + +if (!_isInBuilding) then { + _objects = position _object nearObjects 7.5; + { + if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitwith { + _isInBuilding = true; + }; + } forEach _objects; +}; +_isInBuilding; diff --git a/addons/repair/functions/fnc_isNearRepairVehicle.sqf b/addons/repair/functions/fnc_isNearRepairVehicle.sqf new file mode 100644 index 0000000000..126a0c40cb --- /dev/null +++ b/addons/repair/functions/fnc_isNearRepairVehicle.sqf @@ -0,0 +1,28 @@ +/* + * Author: KoffeinFlummi + * Checks if a unit is in a engineeral vehicle. + * + * Arguments: + * 0: unit to be checked + * + * Return Value: + * Is unit in engineeral vehicle? + * + * Public: Yes + */ + +#include "script_component.hpp" + +params ["_unit"]; +TRACE_1("params",_unit); + +private ["_nearObjects", "_return"]; + +_nearObjects = nearestObjects [_unit, ["Air","LandVehicle"], 20]; + +_return = false; +{ + if ([_x] call FUNC(isRepairVehicle)) exitwith {_return = true;}; +} forEach _nearObjects; + +_return; diff --git a/addons/repair/functions/fnc_isRepairVehicle.sqf b/addons/repair/functions/fnc_isRepairVehicle.sqf new file mode 100644 index 0000000000..72da9783d1 --- /dev/null +++ b/addons/repair/functions/fnc_isRepairVehicle.sqf @@ -0,0 +1,20 @@ +/* + * Author: Glowbal + * Check if vehicle is a engineeral vehicle + * + * Arguments: + * 0: The Vehicle + * + * ReturnValue: + * Is in of engineer class + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_vehicle"]; +TRACE_1("params",_vehicle); + +if (_vehicle isKindOf "CAManBase") exitwith {false}; + +((_vehicle getVariable ["ACE_isRepairVehicle", getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(canRepair))]) > 0); diff --git a/addons/repair/functions/fnc_moduleAssignEngineer.sqf b/addons/repair/functions/fnc_moduleAssignEngineer.sqf new file mode 100644 index 0000000000..e5310bfa5a --- /dev/null +++ b/addons/repair/functions/fnc_moduleAssignEngineer.sqf @@ -0,0 +1,29 @@ +/* + * Author: Glowbal + * Assign an engineer role to a unit + * + * Arguments: + * 0: The module logic + * 1: units + * 2: activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic"]; + +if (!isNull _logic) then { + private ["_list", "_setting"]; + _list = _logic getvariable ["EnableList",""]; + _setting = _logic getvariable ["role",0]; + + [_list, "ACE_IsEngineer", _setting, true] call EFUNC(common,assignObjectsInList); + [synchronizedObjects _logic, "ACE_IsEngineer", _setting, true] call EFUNC(common,assignObjectsInList); + }; + +true diff --git a/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf b/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf new file mode 100644 index 0000000000..e9e60f4190 --- /dev/null +++ b/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf @@ -0,0 +1,29 @@ +/* + * Author: Glowbal + * Assign an repair facility + * + * Arguments: + * 0: The module logic + * 1: units + * 2: activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic"]; + +if (!isNull _logic) then { + private ["_list", "_setting"]; + _list = _logic getvariable ["EnableList",""]; + _setting = _logic getvariable ["role",0]; + + [_list, "ACE_isRepairFacility", _setting, true] call EFUNC(common,assignObjectsInList); + [synchronizedObjects _logic, "ACE_isRepairFacility", _setting, true] call EFUNC(common,assignObjectsInList); + }; + +true diff --git a/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf b/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf new file mode 100644 index 0000000000..991de2d8d6 --- /dev/null +++ b/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf @@ -0,0 +1,29 @@ +/* + * Author: Glowbal + * Assign an repair vehicle + * + * Arguments: + * 0: The module logic + * 1: units + * 2: activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic"]; + +if (!isNull _logic) then { + private ["_list", "_setting"]; + _list = _logic getvariable ["EnableList",""]; + _setting = _logic getvariable ["role",0]; + + [_list, "ACE_isRepairVehicle", _setting, true] call EFUNC(common,assignObjectsInList); + [synchronizedObjects _logic, "ACE_isRepairVehicle", _setting, true] call EFUNC(common,assignObjectsInList); + }; + +true diff --git a/addons/repair/functions/fnc_moduleRepairSettings.sqf b/addons/repair/functions/fnc_moduleRepairSettings.sqf new file mode 100644 index 0000000000..7517d819c5 --- /dev/null +++ b/addons/repair/functions/fnc_moduleRepairSettings.sqf @@ -0,0 +1,29 @@ +/* + * Author: commy2 + * Module for adjusting the repair damage settings + * + * Arguments: + * 0: The module logic + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic"]; + +if (!isServer) exitWith {}; + +[_logic, QGVAR(engineerSetting_Repair), "engineerSetting_Repair"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(engineerSetting_Wheel), "engineerSetting_Wheel"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(consumeItem_ToolKit), "consumeItem_ToolKit"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(repairDamageThreshold), "repairDamageThreshold"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(repairDamageThreshold_Engineer), "repairDamageThreshold_Engineer"] call EFUNC(common,readSettingFromModule); + + +[_logic, QGVAR(fullRepairLocation), "fullRepairLocation"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(engineerSetting_fullRepair), "engineerSetting_fullRepair"] call EFUNC(common,readSettingFromModule); + +diag_log text "[ACE]: Repair Module Initialized."; diff --git a/addons/repair/functions/fnc_normalizeHitPoints.sqf b/addons/repair/functions/fnc_normalizeHitPoints.sqf new file mode 100644 index 0000000000..7a39940794 --- /dev/null +++ b/addons/repair/functions/fnc_normalizeHitPoints.sqf @@ -0,0 +1,53 @@ +/* + * Author: commy2 + * Used to normalize dependant hitpoints. May overwrite some global variables that are named like hitpoints or "Total" though... + * + * Arguments: + * 0: A local vehicle with hitpoints. + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_vehicle"]; +TRACE_1("params",_vehicle); + +// can't execute all commands if the vehicle isn't local. exit here. +if !(local _vehicle) exitWith {}; + +private ["_hitPoints", "_config"]; + +_hitPoints = [_vehicle] call EFUNC(common,getHitPoints); + +_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints"; + +// define global variables. Needed to parse the depends config entries. Also find dependent hitpoints. + +private ["_dependentHitPoints", "_dependentHitPointScripts"]; + +_dependentHitPoints = []; +_dependentHitPointScripts = []; + +Total = damage _vehicle; + +{ + missionNamespace setVariable [_x, _vehicle getHitPointDamage _x]; + + if (isText (_config >> _x >> "depends")) then { + _dependentHitPoints pushBack _x; + _dependentHitPointScripts pushBack compile getText (_config >> _x >> "depends"); + }; + +} forEach _hitPoints; + +// apply normalized damage to all dependand hitpoints + +{ + private "_damage"; + + _damage = call (_dependentHitPointScripts select _forEachIndex); + + _vehicle setHitPointDamage [_x, _damage]; + +} forEach _dependentHitPoints; diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf new file mode 100644 index 0000000000..3eb8f77ca6 --- /dev/null +++ b/addons/repair/functions/fnc_repair.sqf @@ -0,0 +1,203 @@ +/* + * Author: Glowbal, KoffeinFlummi + * Starts the repair process + * + * Arguments: + * 0: The engineer + * 1: The patient + * 2: SelectionName + * 3: repair classname + * + * Return Value: + * Succesful repair started + * + * Public: Yes + */ + +#include "script_component.hpp" + +params ["_caller", "_target", "_hitPoint", "_className"]; +TRACE_4("params",_calller,_target,_hitPoint,_className); + +private["_callbackProgress", "_callerAnim", "_calller", "_condition", "_config", "_consumeItems", "_displayText", "_engineerRequired", "_iconDisplayed", "_items", "_locations", "_repairTime", "_repairTimeConfig", "_return", "_usersOfItems", "_vehicleStateCondition", "_wpn"]; + +_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); +if !(isClass _config) exitwith {false}; // or go for a default? + +_engineerRequired = if (isNumber (_config >> "requiredEngineer")) then { + getNumber (_config >> "requiredEngineer"); +} else { + // Check for required class + if (isText (_config >> "requiredEngineer")) exitwith { + missionNamespace getvariable [(getText (_config >> "requiredEngineer")), 0]; + }; + 0; +}; +if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitwith {false}; +if (isEngineOn _target) exitwith {false}; +_items = getArray (_config >> "items"); +if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitwith {false}; + +_return = true; +if (getText (_config >> "condition") != "") then { + _condition = getText (_config >> "condition"); + if (isnil _condition) then { + _condition = compile _condition; + } else { + _condition = missionNamespace getvariable _condition; + }; + if (typeName _condition == "BOOL") then { + _return = _condition; + } else { + _return = [_caller, _target, _hitPoint, _className] call _condition; + }; +}; +if (!_return) exitwith {false}; + +_vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { + missionNamespace getvariable [getText(_config >> "vehicleStateCondition"), 0] +} else { + getNumber(_config >> "vehicleStateCondition") +}; +// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; + +_locations = getArray (_config >> "repairLocations"); +if ("All" in _locations) exitwith {true}; + +private ["_repairFacility", "_repairVeh"]; +_repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; +_repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; + +{ + if (_x == "field") exitwith {_return = true;}; + if (_x == "RepairFacility" && _repairFacility) exitwith {_return = true;}; + if (_x == "RepairVehicle" && _repairVeh) exitwith {_return = true;}; + if !(isnil _x) exitwith { + private "_val"; + _val = missionNamespace getvariable _x; + if (typeName _val == "SCALAR") then { + _return = switch (_val) do { + case 0: {true}; //useAnywhere + case 1: {call _repairVeh}; //repairVehicleOnly + case 2: {call _repairFacility}; //repairFacilityOnly + case 3: {(call _repairFacility) || {call _repairVeh}}; //vehicleAndFacility + default {false}; //Disabled + }; + }; + }; +} forEach _locations; + +if !(_return && alive _target) exitwith {false}; + +_consumeItems = if (isNumber (_config >> "itemConsumed")) then { + getNumber (_config >> "itemConsumed"); +} else { + // Check for required class + if (isText (_config >> "itemConsumed")) exitwith { + missionNamespace getvariable [(getText (_config >> "itemConsumed")), 0]; + }; + 0; +}; + +_usersOfItems = []; +if (_consumeItems > 0) then { + _usersOfItems = ([_caller, _target, _items] call FUNC(useItems)) select 1; +}; + +// Parse the config for the progress callback +_callbackProgress = getText (_config >> "callbackProgress"); +if (_callbackProgress == "") then { + _callbackProgress = "true"; +}; +if (isNil _callbackProgress) then { + _callbackProgress = compile _callbackProgress; +} else { + _callbackProgress = missionNamespace getvariable _callbackProgress; +}; + + +// Player Animation +_callerAnim = [getText (_config >> "animationCaller"), getText (_config >> "animationCallerProne")] select (stance _caller == "PRONE"); +_caller setvariable [QGVAR(selectedWeaponOnrepair), currentWeapon _caller]; + +// Cannot use secondairy weapon for animation +if (currentWeapon _caller == secondaryWeapon _caller) then { + _caller selectWeapon (primaryWeapon _caller); +}; + +_wpn = ["non", "rfl", "pst"] select (1 + ([primaryWeapon _caller, handgunWeapon _caller] find (currentWeapon _caller))); +_callerAnim = [_callerAnim, "[wpn]", _wpn] call CBA_fnc_replace; +if (vehicle _caller == _caller && {_callerAnim != ""}) then { + if (primaryWeapon _caller == "") then { + _caller addWeapon "ACE_FakePrimaryWeapon"; + }; + if (currentWeapon _caller == "") then { + _caller selectWeapon (primaryWeapon _caller); // unit always has a primary weapon here + }; + + if (stance _caller == "STAND") then { + _caller setvariable [QGVAR(repairPrevAnimCaller), "amovpknlmstpsraswrfldnon"]; + } else { + _caller setvariable [QGVAR(repairPrevAnimCaller), animationState _caller]; + }; + [_caller, _callerAnim] call EFUNC(common,doAnimation); +}; + +//Get repair time +_repairTime = if (isNumber (_config >> "repairingTime")) then { + getNumber (_config >> "repairingTime"); +} else { + if (isText (_config >> "repairingTime")) exitwith { + _repairTimeConfig = getText(_config >> "repairingTime"); + if (isnil _repairTimeConfig) then { + _repairTimeConfig = compile _repairTimeConfig; + } else { + _repairTimeConfig = missionNamespace getvariable _repairTimeConfig; + }; + if (typeName _repairTimeConfig == "SCALAR") exitwith { + _repairTimeConfig; + }; + [_caller, _target, _hitPoint, _className] call _repairTimeConfig; + }; + 0; +}; + +private ["_text", "_processText"]; +_processText = getText (_config >> "displayNameProgress"); +_text = format ["STR_ACE_Repair_%1", _hitPoint]; +if (isLocalized _text) then { + _text = format [_processText, localize _text]; +} else { + _text = _processText; +}; + +// Start repair +[ + _repairTime, + [_caller, _target, _hitPoint, _className, _items, _usersOfItems], + DFUNC(repair_success), + DFUNC(repair_failure), + _text, + _callbackProgress, + [] +] call EFUNC(common,progressBar); + +// Display Icon +_iconDisplayed = getText (_config >> "actionIconPath"); +if (_iconDisplayed != "") then { + [QGVAR(repairActionIcon), true, _iconDisplayed, [1,1,1,1], getNumber(_config >> "actionIconDisplayTime")] call EFUNC(common,displayIcon); +}; + +// handle display of text/hints +_displayText = ""; +if (_target != _caller) then { + _displayText = getText(_config >> "displayTextOther"); +} else { + _displayText = getText(_config >> "displayTextSelf"); +}; + +if (_displayText != "") then { + ["displayTextStructured", [_caller], [[_displayText, [_caller] call EFUNC(common,getName), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); +}; + +true; diff --git a/addons/repair/functions/fnc_repairVehicle.sqf b/addons/repair/functions/fnc_repairVehicle.sqf new file mode 100644 index 0000000000..becdcb366d --- /dev/null +++ b/addons/repair/functions/fnc_repairVehicle.sqf @@ -0,0 +1,45 @@ +/* + * Author: commy2 + * + * Start a repair action and open progress bar. + * + * Arguments: + * 0: Unit that does the repairing (Object) + * 1: vehicle to repair (Object) + * 2: Selected hitpoint (String) + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); + +// exit if not a valid hitpoint +if !(_hitPoint in ([_vehicle] call EFUNC(common,getHitPoints))) exitWith {}; + +// calculate time to fully repair the hitpoint +private ["_damage", "_time"]; + +_damage = _vehicle getHitPointDamage _hitPoint; + +_time = (5 + 10 * _damage) * ([1.5, 1] select ([_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer))); + +// get string of the hitpoint +private "_text"; +_text = format ["STR_ACE_Repair_%1", _hitPoint]; + +if (isLocalized _text) then { + _text = format [localize LSTRING(RepairingHitPoint), localize _text]; +} else { + _text = localize LSTRING(Repairing); +}; + +// open the loading bar +[_time, [_unit, _vehicle, _hitPoint], {_this call DFUNC(doRepair)}, {_this call DFUNC(doRepair)}, _text, {(_this select 0) call DFUNC(canRepair)}, []] call EFUNC(common,progressBar); + +// do animation +[_unit] call EFUNC(common,goKneeling); + +// @todo play sound diff --git a/addons/repair/functions/fnc_repair_failure.sqf b/addons/repair/functions/fnc_repair_failure.sqf new file mode 100644 index 0000000000..b1f62cecb9 --- /dev/null +++ b/addons/repair/functions/fnc_repair_failure.sqf @@ -0,0 +1,56 @@ +/* + * Author: KoffeinFlummi, Glowbal + * Callback when the repair fails + * + * Arguments: + * 0: The engineer + * 1: The patient + * 2: SelectionName + * 3: Treatment classname + * 4: Items available > + * + * Return Value: + * nil + * + * Public: No + */ +#include "script_component.hpp" + +params ["_args"]; +_args params ["_caller", "_target","_selectionName","_className","","_usersOfItems"]; +TRACE_5("params",_caller,_target,_selectionName,_className,_usersOfItems); + +private ["_config","_callback", "_usersOfItems", "_weaponSelect"]; + +if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { + _caller removeWeapon "ACE_FakePrimaryWeapon"; +}; +if (vehicle _caller == _caller) then { + [_caller, _caller getvariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation); +}; +_caller setvariable [QGVAR(repairPrevAnimCaller), nil]; + +_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnrepair), ""]); +if (_weaponSelect != "") then { + _caller selectWeapon _weaponSelect; +} else { + _caller action ["SwitchWeapon", _caller, _caller, 99]; +}; + +{ + (_x select 0) addItem (_x select 1); +} forEach _usersOfItems; + +// Record specific callback +_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); + +_callback = getText (_config >> "callbackFailure"); +if (isNil _callback) then { + _callback = compile _callback; +} else { + _callback = missionNamespace getvariable _callback; +}; + +_args call _callback; + +// _args call FUNC(createLitter); diff --git a/addons/repair/functions/fnc_repair_success.sqf b/addons/repair/functions/fnc_repair_success.sqf new file mode 100644 index 0000000000..7b19ef64de --- /dev/null +++ b/addons/repair/functions/fnc_repair_success.sqf @@ -0,0 +1,52 @@ +/* + * Author: KoffeinFlummi, Glowbal + * Callback when the repair is completed + * + * Arguments: + * 0: The engineer + * 1: The patient + * 2: SelectionName + * 3: Treatment classname + * 4: Items available > + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_args"]; +_args params ["_caller", "_target","_selectionName","_className"]; +TRACE_4("params",_caller,_target,_selectionName,_className); + +private ["_config","_callback", "_weaponSelect"]; + +if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { + _caller removeWeapon "ACE_FakePrimaryWeapon"; +}; +if (vehicle _caller == _caller) then { + [_caller, _caller getvariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation); +}; +_caller setvariable [QGVAR(repairPrevAnimCaller), nil]; + +_weaponSelect = (_caller getvariable [QGVAR(selectedWeaponOnrepair), ""]); +if (_weaponSelect != "") then { + _caller selectWeapon _weaponSelect; +} else { + _caller action ["SwitchWeapon", _caller, _caller, 99]; +}; + +// Record specific callback +_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); + +_callback = getText (_config >> "callbackSuccess"); +if (isNil _callback) then { + _callback = compile _callback; +} else { + _callback = missionNamespace getvariable _callback; +}; +_args call _callback; + +// _args call FUNC(createLitter); diff --git a/addons/repair/functions/fnc_setDamage.sqf b/addons/repair/functions/fnc_setDamage.sqf new file mode 100644 index 0000000000..c739a2c9fc --- /dev/null +++ b/addons/repair/functions/fnc_setDamage.sqf @@ -0,0 +1,40 @@ +/* + * Author: commy2 + * Sets the structural damage of a vehicle without altering the hitPoints. Requires local vehicle. + * + * Arguments: + * 0: vehicle to damage + * 1: Total damage + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_vehicle", "_damage"]; +TRACE_2("params",_vehicle,_damage); + +// can't execute all commands if the vehicle isn't local. exit here. +if !(local _vehicle) exitWith {}; + +// save array with damage values of all hitpoints +private ["_hitPoints", "_hitPointDamages"]; + +_hitPoints = [_vehicle] call EFUNC(common,getHitpoints); + +_hitPointDamages = []; + +{ + _hitPointDamages set [_forEachIndex, _vehicle getHitPointDamage _x]; +} forEach _hitPoints; + +// set damage of the vehicle +_vehicle setDamage _damage; + +// restore original hitpoint damage values +{ + _vehicle setHitPointDamage [_x, _hitPointDamages select _forEachIndex]; +} forEach _hitPoints; + +// normalize hitpoints +[_vehicle] call FUNC(normalizeHitPoints); diff --git a/addons/repair/functions/fnc_setHitPointDamage.sqf b/addons/repair/functions/fnc_setHitPointDamage.sqf new file mode 100644 index 0000000000..d4595960e4 --- /dev/null +++ b/addons/repair/functions/fnc_setHitPointDamage.sqf @@ -0,0 +1,81 @@ +/* + * Author: commy2 + * Set the hitpoint damage and change the structural damage acordingly. Requires local vehicle. + * + * Arguments: + * 0: vehicle + * 1: hitpoint + * 2: damage + * + * Return Value: + * NONE + */ +#include "script_component.hpp" + +params ["_vehicle", "_hitPoint", "_hitPointDamage"]; +TRACE_3("params",_vehicle,_hitPoint,_hitPointDamage); + +// can't execute all commands if the vehicle isn't local. exit here. +if !(local _vehicle) exitWith {}; + +// get all valid hitpoints +private ["_hitPoints", "_hitPointsWithSelections"]; + +_hitPoints = [_vehicle] call EFUNC(common,getHitpoints); +_hitPointsWithSelections = [_vehicle] call EFUNC(common,getHitpointsWithSelections) select 0; + +// exit if the hitpoint is not valid +if !(_hitPoint in _hitPoints) exitWith {systemChat format["NOT A VALID HITPOINT: %1",_hitpoint]}; + +// save array with damage values of all hitpoints +private "_hitPointDamages"; +_hitPointDamages = []; + +{ + _hitPointDamages set [_forEachIndex, (_vehicle getHitPointDamage _x)]; +} forEach _hitPoints; + +// save structural damage and sum of hitpoint damages +private ["_damageOld", "_hitPointDamageSumOld"]; + +_damageOld = damage _vehicle; + +_hitPointDamageSumOld = 0; +{ + if (!(_x in IGNORED_HITPOINTS) && {!isText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints" >> _x >> "depends")}) then { + _hitPointDamageSumOld = _hitPointDamageSumOld + (_hitPointDamages select (_hitPoints find _x)); + }; +} forEach _hitPointsWithSelections; + +// set new damage in array +_hitPointDamages set [_hitPoints find _hitPoint, _hitPointDamage]; + +// save sum of new hitpoint damages +private "_hitPointDamageSumNew"; + +_hitPointDamageSumNew = 0; +{ + if (!(_x in IGNORED_HITPOINTS) && {!isText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints" >> _x >> "depends")}) then { + _hitPointDamageSumNew = _hitPointDamageSumNew + (_hitPointDamages select (_hitPoints find _x)); + }; +} forEach _hitPointsWithSelections; + +// calculate new strctural damage +private "_damageNew"; +_damageNew = _hitPointDamageSumNew / count _hitPoints; + +if (_hitPointDamageSumOld > 0) then { + _damageNew = _damageOld * (_hitPointDamageSumNew / _hitPointDamageSumOld); +}; + +// set new structural damage value +_vehicle setDamage _damageNew; + +// set the new damage for that hit point + +{ + _vehicle setHitPointDamage [_x, _hitPointDamages select _forEachIndex]; +} forEach _hitPoints; + +// normalize hitpoints +// [_vehicle] call FUNC(normalizeHitPoints); diff --git a/addons/repair/functions/fnc_spawnObject.sqf b/addons/repair/functions/fnc_spawnObject.sqf new file mode 100644 index 0000000000..efe64ec9d5 --- /dev/null +++ b/addons/repair/functions/fnc_spawnObject.sqf @@ -0,0 +1,16 @@ +// by commy2 +#include "script_component.hpp" + +params ["_item", "_position", ["_damage", 0]]; +TRACE_3("params",_item,_position,_damage); + +// randomized end position +_position = _position vectorAdd [1 - random 2, 1 - random 2, 0]; + +_item = createVehicle [_item, _position, [], 0, "NONE"]; +_item setPosASL _position; + +["fixCollision", _item] call EFUNC(common,localEvent); +["fixPosition", _item] call EFUNC(common,localEvent); + +_item setDamage _damage; diff --git a/addons/repair/functions/fnc_useItem.sqf b/addons/repair/functions/fnc_useItem.sqf new file mode 100644 index 0000000000..2309c25bd8 --- /dev/null +++ b/addons/repair/functions/fnc_useItem.sqf @@ -0,0 +1,24 @@ +/* + * Author: Glowbal + * Use Equipment if any is available. + * + * Arguments: + * 0: Engineer + * 2: Item + * + * ReturnValue: + * + * + * Public: Yes + */ + +#include "script_component.hpp" + +params ["_engineer", "_item"]; +TRACE_2("params",_engineer,_item); + +if ([_engineer, _item] call EFUNC(common,hasItem)) exitwith { + [[_engineer, _item], QUOTE(EFUNC(common,useItem)), _engineer] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + [true, _engineer]; +}; +[false, objNull]; diff --git a/addons/repair/functions/fnc_useItems.sqf b/addons/repair/functions/fnc_useItems.sqf new file mode 100644 index 0000000000..cf27105190 --- /dev/null +++ b/addons/repair/functions/fnc_useItems.sqf @@ -0,0 +1,39 @@ +/* + * Author: Glowbal + * Use Equipment items if any is available. + * + * Arguments: + * 0: Engineer + * 1: Items > + * + * ReturnValue: + * + * + * Public: Yes + */ + +#include "script_component.hpp" + +params ["_engineer", "_items"]; +TRACE_2("params",_engineer,_items); + +private ["_itemUsedInfo", "_itemsUsedBy"]; + +_itemsUsedBy = []; +{ + // handle a one of type use item + if (typeName _x == "ARRAY") then { + { + _itemUsedInfo = [_engineer, _x] call FUNC(useItem); + if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; + } forEach _x; + }; + + // handle required item + if (typeName _x == "STRING") then { + _itemUsedInfo = [_engineer, _x] call FUNC(useItem); + if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; + }; +} forEach _items; + +[count _items == count _itemsUsedBy, _itemsUsedBy]; diff --git a/addons/repair/functions/script_component.hpp b/addons/repair/functions/script_component.hpp new file mode 100644 index 0000000000..ea8f8ef9f9 --- /dev/null +++ b/addons/repair/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\repair\script_component.hpp" \ No newline at end of file diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp new file mode 100644 index 0000000000..23c52bdec8 --- /dev/null +++ b/addons/repair/script_component.hpp @@ -0,0 +1,16 @@ +#define COMPONENT repair +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_REPAIR + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_REPAIR + #define DEBUG_SETTINGS DEBUG_SETTINGS_REPAIR +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + + +#define IGNORED_HITPOINTS ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitGlass7","HitGlass8","HitGlass9","HitGlass10","HitGlass11","HitGlass12","HitGlass13","HitGlass14","HitGlass15","HitRGlass","HitLGlass"] +// #define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"]; diff --git a/addons/repair/stringtable.xml b/addons/repair/stringtable.xml new file mode 100644 index 0000000000..ffafc56683 --- /dev/null +++ b/addons/repair/stringtable.xml @@ -0,0 +1,642 @@ + + + + + + Spare Track + Ersatzkette + Cadena de repuesto + Chenille de réserve + Zapasowa gąsienica + Náhradní pásy + Lagarta Reserva + Cingolo di scorta + Pót lánctalp + Запасная гусеница + + + Spare Wheel + Ersatzreifen + Rueda de repuesto + Roue de secours + Zapasowe koło + Náhradní Kolo + Roda Reserva + Ruota di scorta + Pótkerék + Запасное колесо + + + Change Wheel + Reifen wechseln + Cambiar rueda + Changer Roue + Wymień koło + Vyměňit kolo + Trocar Roda + Sostituisci la ruota + Kerék cseréje + Поменять колесо + + + Replacing Wheel ... + Ersetze Reifen ... + + + Wheel replaced + Reifen ersetzt + + + Remove Wheel + Reifen entfernen + Quitar rueda + Démonter Roue + Zdejmij koło + Odstranit Kolo + Remover Roda + Rimuovi la ruota + Kerék leszerelése + Снять колесо + + + Removing Wheel ... + Entferne Reifen ... + + + Wheel removed + Reifen entfernt + + + Change Track + + + Replacing Track ... + + + Track replaced + + + Remove Track + + + Removing Track ... + + + Track removed + + + + Full Repair + + + Repairing Vehicle ... + + + + Full Repair Locations + + + At what locations can a vehicle be fully repaired? + + + Allow Full Repair + + + Who can perform a full repair on a vehicle? + + + Repair %1 + Reparieren %1 + Reparación %1 + Réparer %1 + Napraw %1 + Opravit %1 + Reparar %1 + Ripara %1 + Szerelés %1 + Ремонт %1 + + + Repair >> + Reparieren >> + Reparación >> + Réparer >> + Napraw >> + Opravit >> + Reparar >> + Ripara >> + Szerelés >> + Ремонт >> + + + Display text on repair + + + Display a notification whenever you repair a vehicle + + + Repairing ... + Reparieren ... + Reparando ... + Réparation ... + Naprawianie... + Opravuji ... + Reparando ... + Sto riparando ... + javítása ... + Ремонтируем ... + + + Repairing %1 ... + Reparieren %1 ... + Reparando %1 ... + Réparation %1 ... + Naprawianie %1... + Opravuji %1 ... + Reparando %1 ... + Sto riparando %1 ... + %1 javítása ... + Ремонтируем %1 ... + + + Repaired %1 + %1 repariert + Reparado %1 + %1 réparé(e) + Naprawiono %1 + Opraveno - %1 + Reparado %1 + %1 Riparata/o + %1 megjavítva + %1 отремонтирован + + + Fully repaired part + Bauteil vollständig repariert + + + Partially repaired %1 + Bauteil teilweise repariert + + + Fully repaired %1 + %1 vollständig repariert + + + Partially repaired %1 + %1 teilweise repariert + + + Body + Karosserie + Carrocería + Blindage + Karoseria + Karoserie + Carroceria + Carrozzeria + Test + Кузов + + + Hull + Wanne + Casco + Caisse + Kadłub + Trup + Chassi + Scafo + Test + Корпус + + + Engine + Motor + Motor + Moteur + Silnik + Motor + Motor + Motore + Motor + Двигатель + + + Fuel Tank + Tank + Depósito + Réservoir + Zbiornik paliwa + Palivová nádrž + Tanque de Combustível + Serbatoio + Üzemanyagtank + Топливный бак + + + Main Turret + Turm + Torreta príncipal + Tourelle + Wieżyczka + Hlavní Věž + Torre principal + Torretta principale + Lövegtorony + Башню + + + Gun + Kanone + Cañón + Canon + Działo + Kanón + Canhão + Cannone + Ágyú + Пушку + + + Left Track + Linke Kette + Cadena izquierda + Chenille gauche + Lewa gąsienica + Levý Pás + Lagarta Esquerda + Cingolo sinistro + Bal lánctalp + Левую гусеницу + + + Right Track + Rechte Kette + Cadena derecha + Chenille droite + Prawa gąsienica + Pravý Pás + Lagarta Direita + Cingolo destro + Jobb lánctalp + Правую гусеницу + + + Left Front Wheel + Linkes Vorderrad + Rueda frontal izquierda + Roue avant-gauche + Przednie lewe koło + Levé přední Kolo + Roda Dianteira Esquerda + Ruota frontale sinistra + Bal első kerék + Левое переднее колесо + + + Right Front Wheel + Rechtes Vorderrad + Rueda frontal derecha + Roue avant-droite + Przednie prawe koło + Pravé přední Kolo + Roda Dianteira Direita + Ruota frontale destra + Jobb első kerék + Правое переднее колесо + + + Second Left Front Wheel + Zweites linkes Vorderrad + Segunda rueda frontal izquierda + Deuxième roue avant-gauche + Drugie przednie lewe koło + Druhé Levé přední Kolo + Segunda Roda Dianteira Esquerda + Seconda ruota frontale sinistra + Második bal első kerék + Второе переднее левое колесо + + + Second Right Front Wheel + Zweites rechtes Vorderrad + Segunda rueda frontal derecha + Deuxième roue avant-droite + Drugie przednie prawe koło + Druhé Pravé přední Kolo + Segunda Roda Dianteira Direita + Seconda ruota frontale destra + Második jobb hátsó kerék + Второе правое переднее колесо + + + Left Middle Wheel + Linkes mittleres Rad + Rueda central izquierda + Roue centre-gauche + Środkowe lewe koło + Levé prostřední Kolo + Roda Intermediária Esquerda + Ruota centrale sinistra + Bal középső kerék + Левое среднее колесо + + + Right Middle Wheel + Rechtes mittleres Rad + Rueda central derecha + Roue centre-droite + Środkowe prawe koło + Pravé prostřední Kolo + Roda Intermediária Direita + Ruota centrale destra + Jobb középső kerék + Правое среднее колесо + + + Left Rear Wheel + Linkes Hinterrad + Rueda trasera izquierda + Roue arrière-gauche + Tylnie lewe koło + Levé zadní Kolo + Roda Traseira Esquerda + Ruota posteriore sinistra + Bal hátsó kerék + Левое заднее колесо + + + Right Rear Wheel + Rechtes Hinterrad + Rueda trasera derecha + Roue arrière-droite + Tylnie prawe koło + Pravé zadní Kolo + Roda Traseira Direita + Ruota posteriore destra + Jobb hátsó kerék + Правое заднее колесо + + + Avionics + Avionik + Aviónica + Avionique + Awionika + Elektronika + Aviônica + Avionica + Avionika + Авионику + + + Main Rotor + Hauptrotor + Rotor principal + Rotor principal + Główny rotor + Hlavní Rotor + Rotor Principal + Rotore principale + Főrotor + Несущий винт + + + Tail Rotor + Heckrotor + Rotor de cola + Rotor anticouple + Tylni rotor + Zadní Rotor + Rotor de Cauda + Rotore di coda + Farokrotor + Рулевой винт + + + Winch + Seilwinde + + + Glass (right) + Scheibe (rechts) + Ventana (derecha) + Vitre (droite) + Szyba (prawa) + Sklo (pravé) + Vidro (à direita) + Vetro destro + Jobb szélvédő + Стекло (справа) + + + Glass (left) + Scheibe (links) + Ventana (izquierda) + Vitre (gauche) + Szyba (lewa) + Sklo (pravé) + Vidro (à esquerda) + Vetro sinistro + Bal szélvédő + Стекло (слава) + + + Glass 1 + Scheibe 1 + Ventana 1 + Vitre 1 + Szyba 1 + Sklo 1 + Vidro 1 + Vetro 1 + Üveg 1 + Стекло 1 + + + Glass 2 + Scheibe 2 + Ventana 2 + Vitre 2 + Szyba 2 + Sklo 2 + Vidro 2 + Vetro 2 + Üveg 2 + Стекло 2 + + + Glass 3 + Scheibe 3 + Ventana 3 + Vitre 3 + Szyba 3 + Sklo 3 + Vidro 3 + Vetro 3 + Üveg 3 + Стекло 3 + + + Glass 4 + Scheibe 4 + Ventana 4 + Vitre 4 + Szyba 4 + Sklo 4 + Vidro 4 + Vetro 4 + Üveg 4 + Стекло 4 + + + Glass 5 + Scheibe 5 + Ventana 5 + Vitre 5 + Szyba 5 + Sklo 5 + Vidro 5 + Vetro 5 + Üveg 5 + Стекло 5 + + + Glass 6 + Scheibe 6 + Ventana 6 + Vitre 6 + Szyba 6 + Sklo 6 + Vidro 6 + Vetro 6 + Üveg 6 + Стекло 6 + + + Repair Settings + + + Provides a repair system for all types of vehicles. + + + Anyone + + + Engineer only + + + Repair Specialist only + + + Allow Wheel + + + Who can remove and replace wheels? + + + Allow Repair + + + Who can perform repair actions? + + + Repair Threshold + + + What is the maximum damage that can be repaired with a toolkit? + + + Repair Threshold (Engineer) + + + What is the maximum damage that can be repaired by an engineer? + + + Remove toolkit on use + + + Should the toolkit be removed on usage? + + + Anywhere + + + Repair Vehicle only + + + Repair Facility only + + + Repair Facility or Vehicle + + + Assign Engineer + + + List + + + List of unit names that will be classified as engineer, separated by commas. + + + Is Engineer + + + Select the engineering skill level of the unit + + + None + + + Engineer + + + Specialist + + + Assign one or multiple units as an engineer + + + Assign Repair Vehicle + + + List + + + List of vehicles that will be classified as repair vehicle, separated by commas. + + + Is Repair Vehicle + + + Is the vehicle classified as a repair vehicle? + + + Assign one or multiple vehicles as a repair vehicle + + + + Assign Repair Facility + + + List + + + List of objects that will be classified as repair Facility, separated by commas. + + + Is Repair Facility + + + Is the object classified as a repair Facility? + + + Assign one or multiple objects as a repair Facility + + + Vehicle Repair + + + diff --git a/addons/repair/ui/Icon_Module_Repair_ca.paa b/addons/repair/ui/Icon_Module_Repair_ca.paa new file mode 100644 index 0000000000..11b0f896d6 Binary files /dev/null and b/addons/repair/ui/Icon_Module_Repair_ca.paa differ diff --git a/addons/repair/ui/tire_ca.paa b/addons/repair/ui/tire_ca.paa new file mode 100644 index 0000000000..93ceb6bb6c Binary files /dev/null and b/addons/repair/ui/tire_ca.paa differ diff --git a/addons/respawn/functions/fnc_restoreGear.sqf b/addons/respawn/functions/fnc_restoreGear.sqf index 285c560a6c..7e55c1d8e2 100644 --- a/addons/respawn/functions/fnc_restoreGear.sqf +++ b/addons/respawn/functions/fnc_restoreGear.sqf @@ -1,16 +1,16 @@ /* - Name: ACE_Respawn_fnc_removeBody - + Name: ACE_Respawn_fnc_restoreGear + Author(s): bux578 - + Description: Restores previously saved gear - + Parameters: 0: OBJECT - unit - 1: ARRAY - Array containing all gear - + 1: ARRAY - Array containing all gear (result of ACE_common_fnc_getAllGear) + Returns: VOID */ @@ -19,7 +19,15 @@ PARAMS_2(_unit,_allGear); -private ["_unit", "_allGear", "_headgear", "_goggles", "_uniform", "_uniformitems", "_vest", "_vestitems", "_backpack", "_backpackitems", "_primaryweapon", "_primaryweaponitems", "_primaryweaponmagazine", "_handgunweapon", "_handgunweaponitems", "_handgunweaponmagazine", "_assigneditems", "_binocular", "_backpa", "_secondaryweapon", "_secondaryweaponitems", "_secondaryweaponmagazine"]; +private ["_unit", "_allGear", "_headgear", "_goggles", +"_uniform", "_uniformitems", +"_vest", "_vestitems", +"_backpack", "_backpackitems", "_backpa", +"_primaryweapon", "_primaryweaponitems", "_primaryweaponmagazine", +"_secondaryweapon", "_secondaryweaponitems", "_secondaryweaponmagazine", +"_handgunweapon", "_handgunweaponitems", "_handgunweaponmagazine", +"_assigneditems", "_binocular", +"_activeWeaponAndMuzzle", "_activeWeapon", "_activeMuzzle", "_activeWeaponMode"]; // remove all starting gear of a player @@ -51,6 +59,7 @@ _handgunweaponitems = _allGear select 15; _handgunweaponmagazine = _allGear select 16; _assigneditems = _allGear select 17; _binocular = _allGear select 18; +_activeWeaponAndMuzzle = _allGear select 19; // start restoring the items @@ -69,16 +78,16 @@ if (_goggles != "") then { { _unit addItemToUniform _x; -}forEach _uniformitems; +} forEach _uniformitems; { _unit addItemToVest _x; -}forEach _vestitems; +} forEach _vestitems; private "_flagRemoveDummyBag"; _flagRemoveDummyBag = false; -if(format["%1", _backpack] != "") then { +if (format["%1", _backpack] != "") then { _unit addBackpack _backpack; _backpa = unitBackpack _unit; @@ -158,7 +167,36 @@ _assignedItems = _assignedItems - [_binocular]; _unit addWeapon _binocular; +// reload Laserdesignator +// we assume that if the unit had a Laserdesignator it probably had batteries for it if ("Laserdesignator" in assignedItems _unit) then { _unit selectWeapon "Laserdesignator"; - if (currentMagazine _unit == "") then {_unit addMagazine "Laserbatteries";}; + + if (currentMagazine _unit == "") then { + _unit addMagazine "Laserbatteries"; + }; +}; + +// restore the last active weapon, muzzle and weaponMode +_activeWeapon = _activeWeaponAndMuzzle select 0; +_activeMuzzle = _activeWeaponAndMuzzle select 1; +_activeWeaponMode = _activeWeaponAndMuzzle select 2; + +if (_activeMuzzle != "" and _activeMuzzle != _activeWeapon) then { + _unit selectWeapon _activeMuzzle; +} else { + if (_activeWeapon != "") then { + _unit selectWeapon _activeWeapon; + }; +}; + +if (currentWeapon _unit != "") then { + private ["_index"]; + _index = 0; + while { + _index < 100 && {currentWeaponMode _unit != _activeWeaponMode} + } do { + _unit action ["SwitchWeapon", _unit, _unit, _index]; + _index = _index + 1; + }; }; diff --git a/addons/sandbag/CfgVehicles.hpp b/addons/sandbag/CfgVehicles.hpp index 76a986bfbd..5a9b530062 100644 --- a/addons/sandbag/CfgVehicles.hpp +++ b/addons/sandbag/CfgVehicles.hpp @@ -5,7 +5,8 @@ class CfgVehicles { class ACE_Sandbags { displayName = CSTRING(DeploySandbag); condition = QUOTE(call FUNC(canDeploy)); - statement = QUOTE(call FUNC(deploy)); + //wait a frame to handle "Do When releasing action menu key" option: + statement = QUOTE([ARR_2({_this call FUNC(deploy)}, [])] call EFUNC(common,execNextFrame)); exceptions[] = {"isNotSwimming"}; showDisabled = 1; priority = 4; diff --git a/addons/sandbag/functions/fnc_canDeploy.sqf b/addons/sandbag/functions/fnc_canDeploy.sqf index a55b9f9875..0c5fda5b4c 100644 --- a/addons/sandbag/functions/fnc_canDeploy.sqf +++ b/addons/sandbag/functions/fnc_canDeploy.sqf @@ -6,10 +6,10 @@ * None * * Return Value: - * can deploy? + * Can deploy * * Example: - * call ace_sandbag_fnc_canDeploy; + * [] call ace_sandbag_fnc_canDeploy * * Public: No */ @@ -22,6 +22,7 @@ if (ACE_player getVariable [QGVAR(usingSandbag), false]) exitWith { false }; if ((getPosATL ACE_player select 2) - (getPos ACE_player select 2) > 1E-5) exitWith { false }; private ["_surfaceClass", "_surfaceType"]; + _surfaceClass = ([surfaceType (position ACE_player), "#"] call CBA_fnc_split) select 1; _surfaceType = getText (configfile >> "CfgSurfaces" >> _surfaceClass >> "soundEnviron"); diff --git a/addons/sandbag/functions/fnc_carry.sqf b/addons/sandbag/functions/fnc_carry.sqf index f2ba3dff8a..84ab8c1883 100644 --- a/addons/sandbag/functions/fnc_carry.sqf +++ b/addons/sandbag/functions/fnc_carry.sqf @@ -10,39 +10,39 @@ * None * * Example: - * [_sandbag, _unit] call ace_sandbag_fnc_carry; + * [_sandbag, _unit] call ace_sandbag_fnc_carry * * Public: No */ #include "script_component.hpp" -PARAMS_2(_sandbag,_unit); +params ["_sandbag", "_unit"]; _unit playActionNow "PutDown"; _unit setVariable [QGVAR(usingSandbag), true]; [{ - PARAMS_2(_sandbag,_unit); - + params ["_sandbag", "_unit"]; + GVAR(carrier) = ACE_player; - + [GVAR(carrier), "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); - + deleteVehicle _sandbag; - - GVAR(sandBag) = createVehicle ["ACE_SandbagObject_NoGeo", [0,0,0], [], 0, "NONE"]; + + GVAR(sandBag) = createVehicle ["ACE_SandbagObject_NoGeo", [0, 0, 0], [], 0, "NONE"]; GVAR(sandBag) enableSimulationGlobal false; - + // Force physx update { _x setPosASL (getPosASL _x); - } forEach (GVAR(carrier) nearObjects ["ACE_SandbagObject", 5]); + } count (GVAR(carrier) nearObjects ["ACE_SandbagObject", 5]); GVAR(carryPFH) = [{ if (GVAR(carrier) != ACE_player) exitWith { call FUNC(drop); }; - GVAR(sandBag) setPosASL ((eyePos ACE_player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0])); + GVAR(sandBag) setPosASL ((eyePos ACE_player) vectorAdd (positionCameraToWorld [0, 0, 1] vectorDiff positionCameraToWorld [0, 0, 0])); GVAR(sandBag) setDir (GVAR(deployDirection) + getDir ACE_player); }, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/sandbag/functions/fnc_deploy.sqf b/addons/sandbag/functions/fnc_deploy.sqf index 1e1121409b..5bb162e029 100644 --- a/addons/sandbag/functions/fnc_deploy.sqf +++ b/addons/sandbag/functions/fnc_deploy.sqf @@ -9,7 +9,7 @@ * None * * Example: - * call ace_sandbag_fnc_deploy; + * [] call ace_sandbag_fnc_deploy * * Public: No */ @@ -21,14 +21,14 @@ GVAR(placer) = ACE_player; [GVAR(placer), "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); -GVAR(sandBag) = createVehicle ["ACE_SandbagObject_NoGeo", [0,0,0], [], 0, "NONE"]; +GVAR(sandBag) = createVehicle ["ACE_SandbagObject_NoGeo", [0, 0, 0], [], 0, "NONE"]; GVAR(sandBag) enableSimulationGlobal false; GVAR(deployPFH) = [{ if (GVAR(placer) != ACE_player) exitWith { call FUNC(deployCancel); }; - GVAR(sandBag) setPosASL ((eyePos ACE_player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0])); + GVAR(sandBag) setPosASL ((eyePos ACE_player) vectorAdd (positionCameraToWorld [0, 0, 1] vectorDiff positionCameraToWorld [0, 0, 0])); GVAR(sandBag) setDir (GVAR(deployDirection) + getDir ACE_player); }, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/sandbag/functions/fnc_deployCancel.sqf b/addons/sandbag/functions/fnc_deployCancel.sqf index 65677ea887..bb7480a59e 100644 --- a/addons/sandbag/functions/fnc_deployCancel.sqf +++ b/addons/sandbag/functions/fnc_deployCancel.sqf @@ -9,7 +9,7 @@ * None * * Example: - * call ace_sandbag_fnc_deployCancel; + * [] call ace_sandbag_fnc_deployCancel * * Public: No */ diff --git a/addons/sandbag/functions/fnc_deployConfirm.sqf b/addons/sandbag/functions/fnc_deployConfirm.sqf index 2cb297c51e..61264c15fe 100644 --- a/addons/sandbag/functions/fnc_deployConfirm.sqf +++ b/addons/sandbag/functions/fnc_deployConfirm.sqf @@ -9,7 +9,7 @@ * None * * Example: - * call ace_sandbag_fnc_deployConfirm; + * [] call ace_sandbag_fnc_deployConfirm * * Public: No */ @@ -36,16 +36,16 @@ GVAR(placer) setVariable [QGVAR(usingSandbag), true]; private ["_sandBag", "_position", "_direction"]; _position = getPosASL GVAR(sandBag); _direction = getDir GVAR(sandBag); - + deleteVehicle GVAR(sandBag); - - _sandBag = createVehicle ["ACE_SandbagObject", [0,0,0], [], 0, "NONE"]; + + _sandBag = createVehicle ["ACE_SandbagObject", [0, 0, 0], [], 0, "NONE"]; _sandBag enableSimulationGlobal true; _sandBag setPosASL _position; _sandBag setDir _direction; - + GVAR(placer) removeItem "ACE_Sandbag_empty"; - + GVAR(sandBag) = objNull; GVAR(placer) = objNull; }, [], 1.0, 0.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/functions/fnc_drop.sqf b/addons/sandbag/functions/fnc_drop.sqf index 1ef61289bf..3ba825d423 100644 --- a/addons/sandbag/functions/fnc_drop.sqf +++ b/addons/sandbag/functions/fnc_drop.sqf @@ -9,7 +9,7 @@ * None * * Example: - * call ace_sandbag_fnc_deployCancel; + * [] call ace_sandbag_fnc_deployCancel * * Public: No */ @@ -34,14 +34,14 @@ GVAR(carrier) playActionNow "PutDown"; private ["_sandBag", "_position", "_direction"]; _position = getPosASL GVAR(sandBag); _direction = getDir GVAR(sandBag); - + deleteVehicle GVAR(sandBag); - - _sandBag = createVehicle ["ACE_SandbagObject", [0,0,0], [], 0, "NONE"]; + + _sandBag = createVehicle ["ACE_SandbagObject", [0, 0, 0], [], 0, "NONE"]; _sandBag enableSimulationGlobal true; _sandBag setPosASL _position; _sandBag setDir _direction; - + GVAR(sandBag) = objNull; GVAR(carrier) = objNull; }, [], 1.0, 0.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/functions/fnc_handleScrollWheel.sqf b/addons/sandbag/functions/fnc_handleScrollWheel.sqf index 2b831f5cdc..94697d7691 100644 --- a/addons/sandbag/functions/fnc_handleScrollWheel.sqf +++ b/addons/sandbag/functions/fnc_handleScrollWheel.sqf @@ -9,13 +9,13 @@ * handled * * Example: - * 1.2 call ace_sandbag_fnc_handleScrollWheel; + * [1.2] call ace_sandbag_fnc_handleScrollWheel * * Public: No */ #include "script_component.hpp" -PARAMS_1(_scroll); +params ["_scroll"]; if (GETMVAR(ACE_Modifier,0) == 0 || GVAR(deployPFH) == -1) exitWith { false }; diff --git a/addons/sandbag/functions/fnc_pickup.sqf b/addons/sandbag/functions/fnc_pickup.sqf index 360a18983a..dd0b93fd59 100644 --- a/addons/sandbag/functions/fnc_pickup.sqf +++ b/addons/sandbag/functions/fnc_pickup.sqf @@ -10,26 +10,26 @@ * None * * Example: - * [_sandbag, _unit] call ace_sandbag_fnc_pickup; + * [_sandbag, _unit] call ace_sandbag_fnc_pickup * * Public: No */ #include "script_component.hpp" -PARAMS_2(_sandbag,_unit); +params ["_sandbag", "_unit"]; _unit playActionNow "PutDown"; _unit setVariable [QGVAR(usingSandbag), true]; [{ - PARAMS_2(_sandbag,_unit); + params ["_sandbag", "_unit"]; _unit setVariable [QGVAR(usingSandbag), false]; deletevehicle _sandbag; - + // Force physx update { _x setPosASL (getPosASL _x); - } forEach (_unit nearObjects ["ACE_SandbagObject", 5]); - + } count (_unit nearObjects ["ACE_SandbagObject", 5]); + [_unit, "ACE_Sandbag_empty"] call EFUNC(common,addToInventory); }, [_sandbag, _unit], 1.5, 0.5] call EFUNC(common,waitAndExecute); diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index ac03046803..42e0f17818 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -10,23 +10,26 @@ * Return value: * Did we adjust anything? * + * Example: + * [player, ELEVATION_UP, false] call ace_scopes_fnc_adjustScope + * * Public: No */ #include "script_component.hpp" -PARAMS_3(_unit,_turretAndDirection,_majorStep); +private ["_weaponIndex", "_zeroing", "_optic", "_opticConfig", "_verticalIncrement", "_horizontalIncrement", "_maxVertical", "_maxHorizontal", "_adjustment"]; + +params ["_unit", "_turretAndDirection", "_majorStep"]; if (!(_unit isKindOf "Man")) exitWith {false}; if (currentMuzzle _unit != currentWeapon _unit) exitWith {false}; -private ["_weaponIndex", "_zeroing", "_optic", "_verticalIncrement", "_horizontalIncrement", "_maxVertical", "_maxHorizontal", "_elevation", "_windage", "_zero", "_adjustment"]; - _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); if (_weaponIndex < 0) exitWith {false}; _adjustment = _unit getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { - _adjustment = [[0,0,0], [0,0,0], [0,0,0]]; // [Windage, Elevation, Zero] + _adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; // [Windage, Elevation, Zero] }; if (isNil QGVAR(Optics)) then { @@ -34,18 +37,17 @@ if (isNil QGVAR(Optics)) then { }; _optic = GVAR(Optics) select _weaponIndex; -_verticalIncrement = getNumber (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_VerticalIncrement"); -_horizontalIncrement = getNumber (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_HorizontalIncrement"); -_maxVertical = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Vertical"); -_maxHorizontal = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Horizontal"); +_opticConfig = configFile >> "CfgWeapons" >> _optic; +_verticalIncrement = getNumber (_opticConfig >> "ACE_ScopeAdjust_VerticalIncrement"); +_horizontalIncrement = getNumber (_opticConfig >> "ACE_ScopeAdjust_HorizontalIncrement"); +_maxVertical = getArray (_opticConfig >> "ACE_ScopeAdjust_Vertical"); +_maxHorizontal = getArray (_opticConfig >> "ACE_ScopeAdjust_Horizontal"); if ((count _maxHorizontal < 2) || (count _maxVertical < 2)) exitWith {false}; if ((_verticalIncrement == 0) && (_horizontalIncrement == 0)) exitWith {false}; _zeroing = _adjustment select _weaponIndex; -_elevation = _zeroing select 0; -_windage = _zeroing select 1; -_zero = _zeroing select 2; +_zeroing params ["_elevation", "_windage", "_zero"]; switch (_turretAndDirection) do { case ELEVATION_UP: { _elevation = _elevation + _verticalIncrement }; diff --git a/addons/scopes/functions/fnc_adjustZero.sqf b/addons/scopes/functions/fnc_adjustZero.sqf index 12e911b537..363407e090 100644 --- a/addons/scopes/functions/fnc_adjustZero.sqf +++ b/addons/scopes/functions/fnc_adjustZero.sqf @@ -8,29 +8,30 @@ * Return value: * true * + * Example: + * [player] call ace_scopes_fnc_adjustZero + * * Public: No */ #include "script_component.hpp" -PARAMS_1(_unit); +private ["_weaponIndex", "_adjustment", "_zeroing"]; + +params ["_unit"]; if (vehicle _unit != _unit) exitWith {false}; -private ["_weaponIndex", "_adjustment", "_zeroing", "_elevation", "_windage", "_zero"]; - _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); if (_weaponIndex < 0) exitWith {false}; _adjustment = _unit getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { // [Windage, Elevation, Zero] - _adjustment = [[0,0,0], [0,0,0], [0,0,0]]; + _adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; }; -_zeroing = _adjustment select _weaponIndex; -_elevation = _zeroing select 0; -_windage = _zeroing select 1; -_zero = _zeroing select 2; +_zeroing = _adjustment select _weaponIndex; +_zeroing params ["_elevation", "_windage", "_zero"]; _zero = round((_zero + _elevation) * 10) / 10; _elevation = 0; diff --git a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf index 4950fe9ece..fbd3e1b636 100644 --- a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf +++ b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf @@ -11,20 +11,23 @@ * Return value: * True * + * Example: + * [player, 1.3, 0.3, 0.1] call ace_scopes_fnc_applyScopeAdjustment + * * Public: No */ #include "script_component.hpp" -EXPLODE_4_PVT(_this,_unit,_elevation,_windage,_zero); +private ["_adjustmentDifference", "_pitchBankYaw", "_adjustment", "_weaponIndex"]; -private ["_adjustmentDifference", "_pitchbankyaw", "_pitch", "_bank", "_yaw", "_adjustment", "_weaponIndex"]; +params ["_unit", "_elevation", "_windage", "_zero"]; _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); _adjustment = _unit getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { // [Windage, Elevation, Zero] - _adjustment = [[0,0,0], [0,0,0], [0,0,0]]; + _adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; _unit setVariable [QGVAR(Adjustment), _adjustment]; }; @@ -39,10 +42,11 @@ playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] se if (cameraView == "GUNNER") then { // Convert adjustmentDifference from mils to degrees _adjustmentDifference = [_adjustmentDifference, {_this * 0.05625}] call EFUNC(common,map); - _pitchbankyaw = [_unit] call EFUNC(common,getPitchBankYaw); - _pitch = (_pitchbankyaw select 0) + (_adjustmentDifference select 0); - _bank = (_pitchbankyaw select 1); - _yaw = (_pitchbankyaw select 2) + (_adjustmentDifference select 1); + _adjustmentDifference params ["_elevationDifference", "_windageDifference"]; + _pitchBankYaw = [_unit] call EFUNC(common,getPitchBankYaw); + _pitchBankYaw params ["_pitch", "_bank", "_yaw"]; + _pitch = _pitch + _elevationDifference; + _yaw = _yaw + _windageDifference; [_unit, _pitch, _bank, _yaw] call EFUNC(common,setPitchBankYaw); } else { [] call FUNC(showZeroing); diff --git a/addons/scopes/functions/fnc_canAdjustZero.sqf b/addons/scopes/functions/fnc_canAdjustZero.sqf index 619d82cf6e..36ea4ac793 100644 --- a/addons/scopes/functions/fnc_canAdjustZero.sqf +++ b/addons/scopes/functions/fnc_canAdjustZero.sqf @@ -8,17 +8,20 @@ * Return value: * Can we update the zero reference? * + * Example: + * [player] call ace_scopes_fnc_canAdjustZero + * * Public: No */ #include "script_component.hpp" -PARAMS_1(_unit); - private ["_weaponIndex", "_adjustment", "_elevation"]; +params ["_unit"]; + if (cameraView == "GUNNER") exitWith {false}; -if !(vehicle _unit == _unit) exitWith {false}; -if !(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) exitWith {false}; +if (vehicle _unit != _unit) exitWith {false}; +if (!(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])) exitWith {false}; _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); if (_weaponIndex < 0) exitWith {false}; @@ -26,7 +29,7 @@ if (_weaponIndex < 0) exitWith {false}; _adjustment = _unit getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { // [Windage, Elevation, Zero] - _adjustment = [[0,0,0], [0,0,0], [0,0,0]]; + _adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; }; _elevation = (_adjustment select _weaponIndex) select 0; diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 020431c27b..5ede2d2cf8 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -1,5 +1,5 @@ /* - * Author: KoffeinFlummi and esteldunedain + * Author: KoffeinFlummi, esteldunedain * Adjusts the flight path of the bullet according to the zeroing * * Argument: @@ -18,11 +18,11 @@ */ #include "script_component.hpp" -private ["_unit", "_adjustment", "_projectile", "_weaponIndex", "_zeroing", "_adjustment"]; -_unit = _this select 0; -_projectile = _this select 6; +private ["_adjustment", "_weaponIndex", "_zeroing", "_adjustment"]; -if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; +params ["_unit", "", "", "", "", "", "_projectile"]; + +if (!([_unit] call EFUNC(common,isPlayer))) exitWith {}; _adjustment = _unit getVariable [QGVAR(Adjustment), []]; if (_adjustment isEqualTo []) exitWith {}; @@ -32,9 +32,10 @@ if (_weaponIndex < 0) exitWith {}; _zeroing = _adjustment select _weaponIndex; -if (_zeroing isEqualTo [0,0,0]) exitWith {}; +if (_zeroing isEqualTo [0, 0, 0]) exitWith {}; // Convert zeroing from mils to degrees _zeroing = _zeroing vectorMultiply 0.05625; +_zeroing params ["_elevation", "_windage", "_zero"]; -[_projectile, (_zeroing select 1), (_zeroing select 0) + (_zeroing select 2), 0] call EFUNC(common,changeProjectileDirection); +[_projectile, _elevation, _elevation + _zero, 0] call EFUNC(common,changeProjectileDirection); diff --git a/addons/scopes/functions/fnc_getOptics.sqf b/addons/scopes/functions/fnc_getOptics.sqf index 289ed5e7bd..a80c5860e8 100644 --- a/addons/scopes/functions/fnc_getOptics.sqf +++ b/addons/scopes/functions/fnc_getOptics.sqf @@ -10,21 +10,25 @@ * 1: Optic of secondary * 2: Optic of handgun * + * Example: + * [player] call ace_scopes_fnc_getOptics + * * Public: No */ #include "script_component.hpp" -EXPLODE_1_PVT(_this,_unit); +private "_optics"; -private ["_array"]; -_array = ["", "", ""]; +params ["_unit"]; -if !(_unit isKindOf "CAManBase") exitWith {_array}; +_optics = ["", "", ""]; + +if (!(_unit isKindOf "CAManBase")) exitWith {_optics}; { if (count _x >= 2) then { - _array set [_forEachIndex, _x select 2]; + _optics set [_forEachIndex, _x select 2]; }; } forEach [primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit]; -_array +_optics diff --git a/addons/scopes/functions/fnc_inventoryCheck.sqf b/addons/scopes/functions/fnc_inventoryCheck.sqf index af4b347124..562bf731b4 100644 --- a/addons/scopes/functions/fnc_inventoryCheck.sqf +++ b/addons/scopes/functions/fnc_inventoryCheck.sqf @@ -1,5 +1,5 @@ /* - * Author: KoffeinFlummi and Commy2 + * Author: KoffeinFlummi, Commy2 * Check if weapon optics changed and reset zeroing if needed * * Arguments: @@ -8,18 +8,21 @@ * Return Value: * None * + * Example: + * [player] call ace_scopes_fnc_inventoryCheck + * * Public: No */ #include "script_component.hpp" -EXPLODE_1_PVT(_this,_player); - private ["_newOptics", "_adjustment"]; +params ["_player"]; + _adjustment = ACE_player getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { // [Windage, Elevation, Zero] - _adjustment = [[0,0,0], [0,0,0], [0,0,0]]; + _adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; ACE_player setVariable [QGVAR(Adjustment), _adjustment]; [ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); }; @@ -32,8 +35,8 @@ _newOptics = [_player] call FUNC(getOptics); { if (_newOptics select _forEachIndex != _x) then { // The optic for this weapon changed, set adjustment to zero - if !((_adjustment select _foreachindex) isEqualTo [0,0,0]) then { - _adjustment set [_forEachIndex, [0,0,0]]; + if (!((_adjustment select _foreachindex) isEqualTo [0, 0, 0])) then { + _adjustment set [_forEachIndex, [0, 0, 0]]; [ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); }; }; diff --git a/addons/scopes/functions/fnc_showZeroing.sqf b/addons/scopes/functions/fnc_showZeroing.sqf index 7cefc68563..d3d4a38a9d 100644 --- a/addons/scopes/functions/fnc_showZeroing.sqf +++ b/addons/scopes/functions/fnc_showZeroing.sqf @@ -1,5 +1,5 @@ /* - * Author: KoffeinFlummi and esteldunedain + * Author: KoffeinFlummi, esteldunedain * Display the adjustment knobs, update their value and fade them out later * * Arguments: @@ -8,13 +8,16 @@ * Return Value: * None * + * Example: + * [] call ace_scopes_fnc_showZeroing + * * Public: No */ #include "script_component.hpp" -disableSerialization; +private ["_weaponIndex", "_adjustment", "_layer", "_display", "_zeroing", "_vertical", "_horizontal"]; -private ["_weaponIndex","_adjustment","_layer","_display","_zeroing","_vertical","_horizontal"]; +disableSerialization; _weaponIndex = [ACE_player, currentWeapon ACE_player] call EFUNC(common,getWeaponIndex); if (_weaponIndex < 0) exitWith {}; @@ -22,7 +25,7 @@ if (_weaponIndex < 0) exitWith {}; _adjustment = ACE_player getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { // [Windage, Elevation, Zero] - _adjustment = [[0,0,0], [0,0,0], [0,0,0]]; + _adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; }; // Display the adjustment knobs @@ -35,10 +38,11 @@ if (isNull _display) exitWith {}; // Update values _zeroing = _adjustment select _weaponIndex; +_zeroing params ["_elevation", "_windage"]; _vertical = _display displayCtrl 12; _horizontal = _display displayCtrl 13; -_vertical ctrlSetText (str (_zeroing select 0)); -_horizontal ctrlSetText (str (_zeroing select 1)); +_vertical ctrlSetText (str _elevation); +_horizontal ctrlSetText (str _windage); // Set the ACE_time when to hide the knobs GVAR(timeToHide) = ACE_diagTime + 3.0; @@ -47,14 +51,13 @@ if !(isNil QGVAR(fadePFH)) exitWith {}; // Launch a PFH to wait and fade out the knobs GVAR(fadePFH) = [{ - if (ACE_diagTime >= GVAR(timeToHide)) exitWith { private "_layer"; + params ["", "_pfhId"]; _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; _layer cutFadeOut 2; GVAR(fadePFH) = nil; - [_this select 1] call cba_fnc_removePerFrameHandler; + [_pfhId] call cba_fnc_removePerFrameHandler; }; - }, 0.1, []] call CBA_fnc_addPerFrameHandler diff --git a/addons/sitting/CfgMoves.hpp b/addons/sitting/CfgMoves.hpp new file mode 100644 index 0000000000..fc902032e2 --- /dev/null +++ b/addons/sitting/CfgMoves.hpp @@ -0,0 +1,105 @@ +// Enable visual head movement while free-looking +#define MACRO_ANIMATION \ + head = "headDefault"; + +class CfgMovesBasic; +class CfgMovesMaleSdr: CfgMovesBasic { + class States { + class HubSittingChairA_idle1; + class GVAR(HubSittingChairA_idle1): HubSittingChairA_idle1 { + MACRO_ANIMATION + }; + class HubSittingChairA_idle2; + class GVAR(HubSittingChairA_idle2): HubSittingChairA_idle2 { + MACRO_ANIMATION + }; + class HubSittingChairA_idle3; + class GVAR(HubSittingChairA_idle3): HubSittingChairA_idle3 { + MACRO_ANIMATION + }; + class HubSittingChairA_move1; + class GVAR(HubSittingChairA_move1): HubSittingChairA_move1 { + MACRO_ANIMATION + }; + class HubSittingChairB_idle1; + class GVAR(HubSittingChairB_idle1): HubSittingChairB_idle1 { + MACRO_ANIMATION + }; + class HubSittingChairB_idle2; + class GVAR(HubSittingChairB_idle2): HubSittingChairB_idle2 { + MACRO_ANIMATION + }; + class HubSittingChairB_idle3; + class GVAR(HubSittingChairB_idle3): HubSittingChairB_idle3 { + MACRO_ANIMATION + }; + class HubSittingChairB_move1; + class GVAR(HubSittingChairB_move1): HubSittingChairB_move1 { + MACRO_ANIMATION + }; + class HubSittingChairC_idle1; + class GVAR(HubSittingChairC_idle1): HubSittingChairC_idle1 { + MACRO_ANIMATION + }; + class HubSittingChairC_idle2; + class GVAR(HubSittingChairC_idle2): HubSittingChairC_idle2 { + MACRO_ANIMATION + }; + class HubSittingChairC_idle3; + class GVAR(HubSittingChairC_idle3): HubSittingChairC_idle3 { + MACRO_ANIMATION + }; + class HubSittingChairC_move1; + class GVAR(HubSittingChairC_move1): HubSittingChairC_move1 { + MACRO_ANIMATION + }; + class HubSittingChairUA_idle1; + class GVAR(HubSittingChairUA_idle1): HubSittingChairUA_idle1 { + MACRO_ANIMATION + }; + class HubSittingChairUA_idle2; + class GVAR(HubSittingChairUA_idle2): HubSittingChairUA_idle2 { + MACRO_ANIMATION + }; + class HubSittingChairUA_idle3; + class GVAR(HubSittingChairUA_idle3): HubSittingChairUA_idle3 { + MACRO_ANIMATION + }; + class HubSittingChairUA_move1; + class GVAR(HubSittingChairUA_move1): HubSittingChairUA_move1 { + MACRO_ANIMATION + }; + class HubSittingChairUB_idle1; + class GVAR(HubSittingChairUB_idle1): HubSittingChairUB_idle1 { + MACRO_ANIMATION + }; + class HubSittingChairUB_idle2; + class GVAR(HubSittingChairUB_idle2): HubSittingChairUB_idle2 { + MACRO_ANIMATION + }; + class HubSittingChairUB_idle3; + class GVAR(HubSittingChairUB_idle3): HubSittingChairUB_idle3 { + MACRO_ANIMATION + }; + class HubSittingChairUB_move1; + class GVAR(HubSittingChairUB_move1): HubSittingChairUB_move1 { + MACRO_ANIMATION + }; + class HubSittingChairUC_idle1; + class GVAR(HubSittingChairUC_idle1): HubSittingChairUC_idle1 { + MACRO_ANIMATION + }; + class HubSittingChairUC_idle2; + class GVAR(HubSittingChairUC_idle2): HubSittingChairUC_idle2 { + MACRO_ANIMATION + }; + class HubSittingChairUC_idle3; + class GVAR(HubSittingChairUC_idle3): HubSittingChairUC_idle3 { + MACRO_ANIMATION + }; + class HubSittingChairUC_move1; + class GVAR(HubSittingChairUC_move1): HubSittingChairUC_move1 { + MACRO_ANIMATION + }; + }; +}; diff --git a/addons/sitting/CfgVehicles.hpp b/addons/sitting/CfgVehicles.hpp index ac690e2dcd..a156d5e87e 100644 --- a/addons/sitting/CfgVehicles.hpp +++ b/addons/sitting/CfgVehicles.hpp @@ -39,7 +39,7 @@ class CfgVehicles { class ACE_MainActions { \ displayName = ECSTRING(interaction,MainAction); \ selection = ""; \ - distance = 1.25; \ + distance = 1.5; \ condition = "true"; \ class GVAR(Sit) { \ displayName = CSTRING(Sit); \ diff --git a/addons/sitting/config.cpp b/addons/sitting/config.cpp index f12fa530fa..96d3edab7b 100644 --- a/addons/sitting/config.cpp +++ b/addons/sitting/config.cpp @@ -12,6 +12,7 @@ class CfgPatches { }; }; -#include "CfgEventHandlers.hpp" #include "ACE_Settings.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgMoves.hpp" #include "CfgVehicles.hpp" diff --git a/addons/sitting/functions/fnc_canSit.sqf b/addons/sitting/functions/fnc_canSit.sqf index c34281e496..fef36b4bbd 100644 --- a/addons/sitting/functions/fnc_canSit.sqf +++ b/addons/sitting/functions/fnc_canSit.sqf @@ -10,17 +10,16 @@ * Can Sit Down * * Example: - * [seat, player] call ace_sitting_fnc_canSit; + * [seat, player] call ace_sitting_fnc_canSit * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_2(_seat,_player); +params ["_seat", "_player"]; // Sitting enabled, is seat object, not occupied and standing up (or not on a big slope) GVAR(enable) && {getNumber (configFile >> "CfgVehicles" >> typeOf _seat >> QGVAR(canSit)) == 1} && -{isNil{_seat getVariable QGVAR(seatOccupied)}} && +{isNil {_seat getVariable QGVAR(seatOccupied)}} && {round (vectorUp _seat select 0) == 0 && {round (vectorUp _seat select 1) == 0} && {round (vectorUp _seat select 2) == 1}} diff --git a/addons/sitting/functions/fnc_canStand.sqf b/addons/sitting/functions/fnc_canStand.sqf index 4549b9891b..c516485a82 100644 --- a/addons/sitting/functions/fnc_canStand.sqf +++ b/addons/sitting/functions/fnc_canStand.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_player); +params ["_player"]; // Sitting -(_player getVariable [QGVAR(isSitting),false]) +(_player getVariable [QGVAR(isSitting), false]) diff --git a/addons/sitting/functions/fnc_getRandomAnimation.sqf b/addons/sitting/functions/fnc_getRandomAnimation.sqf index c83d230a90..ca9a9ccfb1 100644 --- a/addons/sitting/functions/fnc_getRandomAnimation.sqf +++ b/addons/sitting/functions/fnc_getRandomAnimation.sqf @@ -9,40 +9,40 @@ * Random Animation * * Example: - * _animation = call ace_sitting_fnc_getRandomAnimation; + * _animation = call ace_sitting_fnc_getRandomAnimation * * Public: No */ #include "script_component.hpp" -private ["_animations"]; +private "_animations"; // Animations Pool _animations = [ - "HubSittingChairUA_idle1", - "HubSittingChairUA_idle2", - "HubSittingChairUA_idle3", - "HubSittingChairUA_move1", - "HubSittingChairUB_idle1", - "HubSittingChairUB_idle2", - "HubSittingChairUB_idle3", - "HubSittingChairUB_move1", - "HubSittingChairUC_idle1", - "HubSittingChairUC_idle2", - "HubSittingChairUC_idle3", - "HubSittingChairUC_move1", - "HubSittingChairA_idle1", - "HubSittingChairA_idle2", - "HubSittingChairA_idle3", - "HubSittingChairA_move1", - "HubSittingChairB_idle1", - "HubSittingChairB_idle2", - "HubSittingChairB_idle3", - "HubSittingChairB_move1", - "HubSittingChairC_idle1", - "HubSittingChairC_idle2", - "HubSittingChairC_idle3", - "HubSittingChairC_move1" + QGVAR(HubSittingChairA_idle1), + QGVAR(HubSittingChairA_idle2), + QGVAR(HubSittingChairA_idle3), + QGVAR(HubSittingChairA_move1), + QGVAR(HubSittingChairB_idle1), + QGVAR(HubSittingChairB_idle2), + QGVAR(HubSittingChairB_idle3), + QGVAR(HubSittingChairB_move1), + QGVAR(HubSittingChairC_idle1), + QGVAR(HubSittingChairC_idle2), + QGVAR(HubSittingChairC_idle3), + QGVAR(HubSittingChairC_move1), + QGVAR(HubSittingChairUA_idle1), + QGVAR(HubSittingChairUA_idle2), + QGVAR(HubSittingChairUA_idle3), + QGVAR(HubSittingChairUA_move1), + QGVAR(HubSittingChairUB_idle1), + QGVAR(HubSittingChairUB_idle2), + QGVAR(HubSittingChairUB_idle3), + QGVAR(HubSittingChairUB_move1), + QGVAR(HubSittingChairUC_idle1), + QGVAR(HubSittingChairUC_idle2), + QGVAR(HubSittingChairUC_idle3), + QGVAR(HubSittingChairUC_move1) ]; // Select random animation diff --git a/addons/sitting/functions/fnc_handleInterrupt.sqf b/addons/sitting/functions/fnc_handleInterrupt.sqf index fb32635195..328675c172 100644 --- a/addons/sitting/functions/fnc_handleInterrupt.sqf +++ b/addons/sitting/functions/fnc_handleInterrupt.sqf @@ -9,13 +9,13 @@ * None * * Example: - * player call ace_sitting_fnc_handleInterrupt; + * player call ace_sitting_fnc_handleInterrupt * * Public: No */ #include "script_component.hpp" -PARAMS_1(_player); +params ["_player"]; if (_player getVariable [QGVAR(isSitting), false]) then { _player call FUNC(stand); diff --git a/addons/sitting/functions/fnc_hasChairMoved.sqf b/addons/sitting/functions/fnc_hasChairMoved.sqf index fe56438878..de3a38e0ce 100644 --- a/addons/sitting/functions/fnc_hasChairMoved.sqf +++ b/addons/sitting/functions/fnc_hasChairMoved.sqf @@ -10,18 +10,21 @@ * None * * Example: - * [seat, seatPos] call ace_sitting_fnc_hasChairMoved; + * [seat, seatPos] call ace_sitting_fnc_hasChairMoved * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_2(_seat,_seatPosOrig); +params ["_seat", "_seatPosOrig"]; TRACE_2("Chair position",_seatPosOrig,getPosASL _seat); +(getPosASL _seat) params ["_seatX", "_seatY", "_seatZ"]; +_seatPosOrig params ["_seatOrigX", "_seatOrigY", "_seatOrigZ"]; + // Check each coordinate due to possibility of tiny movements in simulation -(getPosASL _seat) select 0 < (_seatPosOrig select 0) - 0.01 || {(getPosASL _seat) select 0 > (_seatPosOrig select 0) + 0.01} || -{(getPosASL _seat) select 1 < (_seatPosOrig select 1) - 0.01 || {(getPosASL _seat) select 1 > (_seatPosOrig select 1) + 0.01}} || -{(getPosASL _seat) select 2 < (_seatPosOrig select 2) - 0.01 || {(getPosASL _seat) select 2 > (_seatPosOrig select 2) + 0.01}} +if (abs (_seatX - _seatOrigX) > 0.01) exitWith {true}; +if (abs (_seatY - _seatOrigY) > 0.01) exitWith {true}; +if (abs (_seatZ - _seatOrigZ) > 0.01) exitWith {true}; +false diff --git a/addons/sitting/functions/fnc_moduleInit.sqf b/addons/sitting/functions/fnc_moduleInit.sqf index 25da5be347..ae476317db 100644 --- a/addons/sitting/functions/fnc_moduleInit.sqf +++ b/addons/sitting/functions/fnc_moduleInit.sqf @@ -3,18 +3,22 @@ * Initializes the Sitting module. * * Arguments: - * Whatever the module provides. + * 0: The module logic + * 1: Units + * 2: Activated * * Return Value: * None + * + * Public: No */ #include "script_component.hpp" if !(isServer) exitWith {}; -PARAMS_3(_logic,_units,_activated); +params ["_logic", "_units", "_activated"]; -if !(_activated) exitWith {}; +if (!_activated) exitWith {}; [_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule); diff --git a/addons/sitting/functions/fnc_sit.sqf b/addons/sitting/functions/fnc_sit.sqf index d6b729d544..0c6825ed58 100644 --- a/addons/sitting/functions/fnc_sit.sqf +++ b/addons/sitting/functions/fnc_sit.sqf @@ -14,12 +14,11 @@ * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" private ["_configFile", "_sitDirection", "_sitPosition", "_sitRotation", "_sitDirectionVisual"]; -PARAMS_2(_seat,_player); +params ["_seat", "_player"]; // Set global variable for standing up GVAR(seat) = _seat; @@ -34,7 +33,8 @@ _sitPosition = getArray (_configFile >> QGVAR(sitPosition)); _sitRotation = if (isNumber (_configFile >> QGVAR(sitRotation))) then {getNumber (_configFile >> QGVAR(sitRotation))} else {45}; // Apply default if config entry not present // Get random animation and perform it (before moving player to ensure correct placement) -[_player, call FUNC(getRandomAnimation), 2] call EFUNC(common,doAnimation); +[_player, call FUNC(getRandomAnimation), 2] call EFUNC(common,doAnimation); // Correctly places when using non-transitional animations +[_player, "", 1] call EFUNC(common,doAnimation); // Correctly applies animation's config values (such as disallow throwing of grenades, intercept keybinds... etc). // Set direction and position _player setDir _sitDirection; @@ -49,12 +49,13 @@ _seat setVariable [QGVAR(seatOccupied), true, true]; // To prevent multiple peop _sitDirectionVisual = getDirVisual _player; // Needed for precision and issues with using above directly _seatPosOrig = getPosASL _seat; [{ - EXPLODE_5_PVT(_this select 0,_player,_sitDirectionVisual,_sitRotation,_seat,_seatPosOrig); - + params ["_args", "_pfhId"]; + _args params ["_player", "_sitDirectionVisual", "_sitRotation", "_seat", "_seatPosOrig"]; + // Remove PFH if not sitting any more if !(_player getVariable [QGVAR(isSitting), false]) exitWith { - [_this select 1] call cba_fnc_removePerFrameHandler; - TRACE_1("Remove PFH",_player getVariable [ARR_2(QGVAR(isSitting),false)]); + [_pfhId] call cba_fnc_removePerFrameHandler; + TRACE_1("Remove PFH",_player getVariable [ARR_2(QGVAR(isSitting), false)]); }; // Stand up if chair moves diff --git a/addons/sitting/functions/fnc_stand.sqf b/addons/sitting/functions/fnc_stand.sqf index df1ee6f169..978bcaf279 100644 --- a/addons/sitting/functions/fnc_stand.sqf +++ b/addons/sitting/functions/fnc_stand.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_player); +params ["_player"]; // Restore animation [_player, "", 2] call EFUNC(common,doAnimation); diff --git a/addons/slideshow/CfgVehicles.hpp b/addons/slideshow/CfgVehicles.hpp index 7bb3b81713..7e82d48ffc 100644 --- a/addons/slideshow/CfgVehicles.hpp +++ b/addons/slideshow/CfgVehicles.hpp @@ -6,7 +6,7 @@ class CfgVehicles { displayName = CSTRING(DisplayName); function = QFUNC(moduleInit); scope = 2; - isGlobal = 0; // Server only + isGlobal = 1; isTriggerActivated = 0; isDisposable = 0; icon = QUOTE(PATHTOF(UI\Icon_Module_Slideshow_ca.paa)); diff --git a/addons/slideshow/functions/fnc_addSlideActions.sqf b/addons/slideshow/functions/fnc_addSlideActions.sqf index 80e9b387af..1ebba306b4 100644 --- a/addons/slideshow/functions/fnc_addSlideActions.sqf +++ b/addons/slideshow/functions/fnc_addSlideActions.sqf @@ -10,19 +10,19 @@ * 4: Current Slideshow * * Return Value: - * None + * List of actions * * Example: * [[object], ["image"], ["name"], controller, 1] call ace_slideshow_fnc_addSlideActions * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_5(_objects,_images,_names,_controller,_currentSlideshow); +private "_actions"; + +params ["_objects", "_images", "_names", "_controller", "_currentSlideshow"]; -private ["_actions"]; _actions = []; { _actions pushBack @@ -32,10 +32,10 @@ _actions = []; _names select _forEachIndex, "", { - EXPLODE_2_PVT(_this select 2,_objects,_image); + (_this select 2) params ["_objects", "_image"]; { _x setObjectTextureGlobal [0, _image] - } forEach _objects; + } count _objects; }, {true}, {}, diff --git a/addons/slideshow/functions/fnc_autoTransition.sqf b/addons/slideshow/functions/fnc_autoTransition.sqf index 639a0fb70b..c8b03a707a 100644 --- a/addons/slideshow/functions/fnc_autoTransition.sqf +++ b/addons/slideshow/functions/fnc_autoTransition.sqf @@ -4,25 +4,23 @@ * * Arguments: * 0: Objects - * 1: Controller Objects - * 2: Image Paths - * 3: Action Names - * 4: Duration (0 disables automatic transitions) + * 1: Image Paths + * 2: State Variable Name + * 3: Duration (0 disables automatic transitions) * * Return Value: - * Parsed List + * None * * Example: - * [objects, controllers, images, actionNames, duration] call ace_slideshow_fnc_autoTransition + * [objects, images, "ace_slideshow_slideshow1", duration] call ace_slideshow_fnc_autoTransition * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_4(_objects,_images,_varString,_duration); +private "_currentSlide"; -private ["_currentSlide"]; +params ["_objects", "_images", "_varString", "_duration"]; // Get current slide number of this slideshow _currentSlide = missionNamespace getVariable [_varString, 0]; @@ -36,10 +34,8 @@ missionNamespace setVariable [_varString, _currentSlide]; // Set slide { _x setObjectTextureGlobal [0, _images select _currentSlide]; -} forEach _objects; +} count _objects; +// Log current slide and execute Next slide TRACE_4("Auto-transition",_images select _currentSlide,_currentSlide,count _images,_duration); - - -// Next slide [FUNC(autoTransition), [_objects, _images, _varString, _duration], _duration] call EFUNC(common,waitAndExecute); diff --git a/addons/slideshow/functions/fnc_createSlideshow.sqf b/addons/slideshow/functions/fnc_createSlideshow.sqf index debeac3340..665b954496 100644 --- a/addons/slideshow/functions/fnc_createSlideshow.sqf +++ b/addons/slideshow/functions/fnc_createSlideshow.sqf @@ -17,10 +17,11 @@ * * Public: Yes */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_5(_objects,_controllers,_images,_names,_duration); +private ["_currentSlideshow", "_actionsObject", "_actionsClass", "_mainAction", "_slidesAction", "_varString"]; + +params ["_objects", "_controllers", "_images", "_names", "_duration"]; // Verify data if (count _images != count _names || {count _images == 0} || {count _names == 0}) exitWith { @@ -30,7 +31,8 @@ if (count _images != count _names || {count _images == 0} || {count _names == 0} // Objects synced to the module { _objects pushBack _x; -} forEach (synchronizedObjects _logic); + nil +} count (synchronizedObjects _logic); // If no controllers use objects as controllers if (count _controllers == 0) then { @@ -39,36 +41,36 @@ if (count _controllers == 0) then { TRACE_4("Information",_objects,_controllers,_images,_names); -// Default images on whiteboards (first image) -{ - _x setObjectTextureGlobal [0, _images select 0]; -} forEach _objects; +if (isServer) then { + // Default images on whiteboards (first image) + { + _x setObjectTextureGlobal [0, _images select 0]; + } count _objects; + + // Number of slideshows (multiple modules support) + GVAR(slideshows) = GVAR(slideshows) + 1; +}; -// Number of slideshows (multiple modules support) -GVAR(slideshows) = GVAR(slideshows) + 1; -private ["_currentSlideshow"]; _currentSlideshow = GVAR(slideshows); // Local variable in case GVAR gets changed during execution of below code +// If interaction menu module is not present, set default duration value +if !(["ace_interact_menu"] call EFUNC(common,isModLoaded)) then { + _duration = 5; + diag_log text format ["[ACE]: Slideshow: Interaction Menu module not present, defaulting duration value to %1", _duration]; +}; + // Add interactions if automatic transitions are disabled, else setup automatic transitions if (_duration == 0) then { - private ["_actionsObject", "_actionsClass", "_mainAction", "_slidesAction"]; { - // Add MainAction if one does not already exist - _actionsObject = _x getVariable [QEGVAR(interact_menu,actions), []]; - _actionsClass = missionNamespace getVariable [format [QEGVAR(interact_menu,Act_%1), typeOf _x], []]; - if (count _actionsObject == 0 && {count _actionsClass == 0}) then { - _mainAction = ["ACE_MainActions", localize ELSTRING(interaction,MainAction), "", {}, {true}] call EFUNC(interact_menu,createAction); - [_x, 0, [], _mainAction] call EFUNC(interact_menu,addActionToObject); - TRACE_2("Adding ACE_MainActions",_actionsObject,_actionsClass); - }; - // Add Slides sub-action and populate with images _slidesAction = [QGVAR(Slides), localize LSTRING(Interaction), "", {}, {true}, {(_this select 2) call FUNC(addSlideActions)}, [_objects,_images,_names,_x,_currentSlideshow], [0,0,0], 2] call EFUNC(interact_menu,createAction); [_x, 0, ["ACE_MainActions"], _slidesAction] call EFUNC(interact_menu,addActionToObject); - } forEach _controllers; + nil + } count _controllers; } else { + if !(isServer) exitWith {}; + // Formatted GVAR string (multiple modules support) - private ["_varString"]; _varString = format [QGVAR(slideshow%1), _currentSlideshow]; TRACE_1("Current Slide",_varString); diff --git a/addons/slideshow/functions/fnc_makeList.sqf b/addons/slideshow/functions/fnc_makeList.sqf index 9ce4a723cc..8de87a2d96 100644 --- a/addons/slideshow/functions/fnc_makeList.sqf +++ b/addons/slideshow/functions/fnc_makeList.sqf @@ -18,7 +18,7 @@ //#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_3(_list,_removeWhitespace,_checkNil); +params ["_list", "_removeWhitespace", "_checkNil"]; private ["_splittedList", "_listNoWhitespace", "_nilCheckPassedList"]; @@ -30,7 +30,8 @@ _listNoWhitespace = []; if (_removeWhitespace) then { { _listNoWhitespace pushBack ([_x] call EFUNC(common,stringRemoveWhiteSpace)); - } forEach _splittedList; + nil + } count _splittedList; _list = _listNoWhitespace; }; @@ -45,7 +46,7 @@ if (_checkNil) then { _nilCheckPassedList = _nilCheckPassedList + "," + _x; }; }; - } forEach _list; + } count _list; // Add Array characters and parse into array _list = "[" + _nilCheckPassedList + "]"; @@ -54,4 +55,4 @@ if (_checkNil) then { TRACE_4("Lists",_splittedList,_listNoWhitespace,_nilCheckPassedList,_list); -_list +_list // return diff --git a/addons/slideshow/functions/fnc_moduleInit.sqf b/addons/slideshow/functions/fnc_moduleInit.sqf index 50de48693e..da1724dfcc 100644 --- a/addons/slideshow/functions/fnc_moduleInit.sqf +++ b/addons/slideshow/functions/fnc_moduleInit.sqf @@ -12,18 +12,16 @@ * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -if !(isServer) exitWith {}; - -PARAMS_3(_logic,_units,_activated); - -if !(_activated) exitWith {}; +// Exit on Headless Client +if (!hasInterface && !isDedicated) exitWith {}; private ["_objects", "_controllers", "_images", "_names", "_duration"]; -_logic = [_this, 0, objNull, [objNull]] call BIS_fnc_param; +params [["_logic", objNull, [objNull]], "_units", "_activated"]; + +if !(_activated) exitWith {}; if (isNull _logic) exitWith {}; // Extract variables from logic diff --git a/addons/spottingscope/functions/fnc_pickup.sqf b/addons/spottingscope/functions/fnc_pickup.sqf index 3730068092..81c9bc10a5 100644 --- a/addons/spottingscope/functions/fnc_pickup.sqf +++ b/addons/spottingscope/functions/fnc_pickup.sqf @@ -1,30 +1,30 @@ /* * Author: Rocko, Ruthberg - * * Pick up spotting scope * * Arguments: * 0: spotting scope * 1: unit * - * Return Value: - * Nothing - * * Return value: * None + * + * Example: + * [spotting_scope, player] call ace_spottingscope_fnc_pickup + * + * Public: No */ #include "script_component.hpp" -PARAMS_2(_spottingScope,_unit); +params ["_spottingScope", "_unit"]; if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { _unit playMove "AmovPercMstpSrasWrflDnon_diary"; }; [{ - PARAMS_2(_spottingScope,_unit); - + params ["_spottingScope", "_unit"]; + [_unit, "ACE_SpottingScope"] call EFUNC(common,addToInventory); deleteVehicle _spottingScope; - }, [_spottingScope, _unit], 1, 0]call EFUNC(common,waitAndExecute); diff --git a/addons/spottingscope/functions/fnc_place.sqf b/addons/spottingscope/functions/fnc_place.sqf index 4967151748..09f756c109 100644 --- a/addons/spottingscope/functions/fnc_place.sqf +++ b/addons/spottingscope/functions/fnc_place.sqf @@ -1,21 +1,22 @@ /* * Author: Rocko, Ruthberg - * * Place down spotting scope * * Arguments: * 0: unit * 1: scope class * - * Return Value: - * Nothing - * * Return value: * None + * + * Example: + * [player, "ACE_SpottingScope"] call ace_spottingscope_fnc_place + * + * Public: No */ #include "script_component.hpp" -PARAMS_2(_unit,_scopeClass); +params ["_unit", "_scopeClass"]; _unit removeItem _scopeClass; @@ -24,18 +25,17 @@ if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { }; [{ - PARAMS_1(_unit); - + params ["_unit"]; + private ["_direction", "_position", "_spottingScope"]; _direction = getDir _unit; _position = (getPosASL _unit) vectorAdd [0.8 * sin(_direction), 0.8 * cos(_direction), 0.02]; - + _spottingScope = "ACE_SpottingScopeObject" createVehicle [0, 0, 0]; _spottingScope setDir _direction; _spottingScope setPosASL _position; if ((getPosATL _spottingScope select 2) - (getPos _spottingScope select 2) < 1E-5) then { - _spottingScope setVectorUp (surfaceNormal (position _spottingScope)); + _spottingScope setVectorUp (surfaceNormal (position _spottingScope)); }; _unit reveal _spottingScope; - }, [_unit], 1, 0] call EFUNC(common,waitAndExecute); diff --git a/addons/tacticalladder/CfgVehicles.hpp b/addons/tacticalladder/CfgVehicles.hpp index bd66176e34..a1eda1a955 100644 --- a/addons/tacticalladder/CfgVehicles.hpp +++ b/addons/tacticalladder/CfgVehicles.hpp @@ -82,7 +82,8 @@ class CfgVehicles { displayName = CSTRING(Position); distance = 4; condition = "true"; - statement = QUOTE([ARR_2(_target,_player)] call FUNC(positionTL)); + //wait a frame to handle "Do When releasing action menu key" option: + statement = QUOTE([ARR_2({_this call FUNC(positionTL)}, [ARR_2(_target,_player)])] call EFUNC(common,execNextFrame)); showDisabled = 0; exceptions[] = {}; priority = 5; diff --git a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf index 63a97d97e9..456d245832 100644 --- a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf +++ b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf @@ -9,7 +9,7 @@ * None * * Example: - * [_ladder] call ace_tacticalladder_fnc_cancelTLdeploy; + * [_ladder] call ace_tacticalladder_fnc_cancelTLdeploy * * Public: No */ @@ -17,16 +17,16 @@ #define __ANIMS ["extract_1","extract_2","extract_3","extract_4","extract_5","extract_6","extract_7","extract_8","extract_9","extract_10","extract_11"] -PARAMS_1(_ladder); +params ["_ladder"]; detach _ladder; _ladder animate ["rotate", 0]; { _ladder animate [_x, 0]; -} forEach __ANIMS; +} count __ANIMS; call EFUNC(interaction,hideMouseHint); -[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); -[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); +[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); +[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); GVAR(ladder) = objNull; diff --git a/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf b/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf index 93263c6aa0..764e5c73d8 100644 --- a/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf +++ b/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf @@ -6,16 +6,16 @@ * 0: ladder * * Return Value: - * Success? + * Success * * Example: - * [_ladder] call ace_tacticalladder_fnc_confirmTLdeploy; + * [_ladder] call ace_tacticalladder_fnc_confirmTLdeploy * * Public: No */ #include "script_component.hpp" -PARAMS_1(_ladder); +params ["_ladder"]; private ["_pos1", "_pos2"]; _pos1 = getPosASL GVAR(ladder); @@ -23,8 +23,8 @@ _pos2 = (GVAR(ladder) modelToWorld (GVAR(ladder) selectionPosition "check2")) ca if (lineIntersects [_pos1, _pos2, GVAR(ladder)]) exitWith { false }; call EFUNC(interaction,hideMouseHint); -[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); -[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); +[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); +[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); detach _ladder; GVAR(ladder) = objNull; diff --git a/addons/tacticalladder/functions/fnc_deployTL.sqf b/addons/tacticalladder/functions/fnc_deployTL.sqf index 7ad135ca90..14c386dda1 100644 --- a/addons/tacticalladder/functions/fnc_deployTL.sqf +++ b/addons/tacticalladder/functions/fnc_deployTL.sqf @@ -3,13 +3,13 @@ * Deploy tactical ladder * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: - * call ace_tacticalladder_fnc_deployTL; + * [] call ace_tacticalladder_fnc_deployTL * * Public: No */ diff --git a/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf b/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf index d08cb6e208..6b5107b814 100644 --- a/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf +++ b/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf @@ -9,13 +9,13 @@ * Handled * * Example: - * 1 call ace_tacticalladder_fnc_handleScrollWheel; + * [1] call ace_tacticalladder_fnc_handleScrollWheel; * * Public: No */ #include "script_component.hpp" -PARAMS_1(_scroll); +params ["_scroll"]; if (isNull GVAR(ladder)) exitWith { false }; @@ -37,7 +37,7 @@ if (GETMVAR(ACE_Modifier,0) == 0) then { if (GVAR(ladder) animationPhase (format["extract_%1", _currentStep]) == 1) then { GVAR(ladder) animate [format["extract_%1", _currentStep], 0]; GVAR(currentStep) = _currentStep - 1; - }; + }; }; } else { // Tilting @@ -45,4 +45,4 @@ if (GETMVAR(ACE_Modifier,0) == 0) then { GVAR(ladder) animate ["rotate", GVAR(currentAngle)]; }; -true \ No newline at end of file +true diff --git a/addons/tacticalladder/functions/fnc_pickupTL.sqf b/addons/tacticalladder/functions/fnc_pickupTL.sqf index c603f1feca..ad409f8870 100644 --- a/addons/tacticalladder/functions/fnc_pickupTL.sqf +++ b/addons/tacticalladder/functions/fnc_pickupTL.sqf @@ -7,10 +7,10 @@ * 1: unit * * Return Value: - * Success? + * Success * * Example: - * [_ladder, _unit] call ace_tacticalladder_fnc_pickupTL; + * [_ladder, _unit] call ace_tacticalladder_fnc_pickupTL * * Public: No */ @@ -18,7 +18,7 @@ if ((backpack ACE_player) != "") exitWith { false }; -PARAMS_2(_ladder,_unit); +params ["_ladder", "_unit"]; deleteVehicle _ladder; _unit addBackpack "ACE_TacticalLadder_Pack"; diff --git a/addons/tacticalladder/functions/fnc_positionTL.sqf b/addons/tacticalladder/functions/fnc_positionTL.sqf index 103792c851..1035101556 100644 --- a/addons/tacticalladder/functions/fnc_positionTL.sqf +++ b/addons/tacticalladder/functions/fnc_positionTL.sqf @@ -10,7 +10,7 @@ * None * * Example: - * [_ladder, _unit] call ace_tacticalladder_fnc_positionTL; + * [_ladder, _unit] call ace_tacticalladder_fnc_positionTL * * Public: No */ @@ -18,11 +18,11 @@ #define __ANIMS ["extract_1","extract_2","extract_3","extract_4","extract_5","extract_6","extract_7","extract_8","extract_9","extract_10","extract_11"] -PARAMS_2(_ladder,_unit); +params ["_ladder", "_unit"]; { _ladder animate [_x, 0]; -} forEach __ANIMS; +} count __ANIMS; _unit switchMove "amovpercmstpslowwrfldnon_player_idlesteady03"; _ladder attachTo [_unit, [0, 0.75, 0], ""]; // Position ladder in front of player @@ -30,7 +30,7 @@ _ladder attachTo [_unit, [0, 0.75, 0], ""]; // Position ladder in front of playe _ladder animate ["rotate", 0]; { _ladder animate [_x, 1]; -} forEach ["extract_1", "extract_2", "extract_3"]; // Extract ladder at head height (extract_3) +} count ["extract_1", "extract_2", "extract_3"]; // Extract ladder at head height (extract_3) GVAR(ladder) = _ladder; GVAR(cancelTime) = ACE_time + 1; // Workaround to prevent accidental canceling diff --git a/addons/tripod/CfgVehicles.hpp b/addons/tripod/CfgVehicles.hpp index a489e18704..2a689ba349 100644 --- a/addons/tripod/CfgVehicles.hpp +++ b/addons/tripod/CfgVehicles.hpp @@ -17,7 +17,7 @@ class CfgVehicles { class Item_Base_F; class ACE_Item_Tripod: Item_Base_F { - author[] = {"Rocko", "Scubaman3D"}; + author[] = {"Rocko", "Scubaman3D"}; scope = 2; scopeCurator = 2; displayName = CSTRING(DisplayName); @@ -76,7 +76,8 @@ class CfgVehicles { displayName = CSTRING(Adjust); distance = 5; condition = "true"; - statement = QUOTE(_target call FUNC(adjust)); + //wait a frame to handle "Do When releasing action menu key" option: + statement = QUOTE([ARR_2({_this call FUNC(adjust)}, [_target])] call EFUNC(common,execNextFrame)); showDisabled = 0; exceptions[] = {}; priority = 5; diff --git a/addons/tripod/functions/fnc_adjust.sqf b/addons/tripod/functions/fnc_adjust.sqf index ce50d38cf0..1ba99cedbe 100644 --- a/addons/tripod/functions/fnc_adjust.sqf +++ b/addons/tripod/functions/fnc_adjust.sqf @@ -1,37 +1,39 @@ /* * Author: Ruthberg - * * Adjust tripod height * * Arguments: * 0: tripod * - * Return Value: - * Nothing - * * Return value: * None + * + * Example: + * [tripod] call ace_tripod_fnc_adjust + * + * Public: No */ #include "script_component.hpp" -PARAMS_1(_tripod); +params ["_tripod"]; GVAR(adjuster) = ACE_player; GVAR(adjusting) = true; GVAR(adjustPFH) = [{ - EXPLODE_1_PVT(_this select 0,_tripod); - + params ["_args", "_pfhId"]; + _args params ["_tripod"]; + if (GVAR(adjuster) != ACE_player || !GVAR(adjusting)) exitWith { call EFUNC(interaction,hideMouseHint); [ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Adjust), -1]] call EFUNC(Common,removeActionEventHandler); - [_this select 1] call cba_fnc_removePerFrameHandler; + [_pfhId] call cba_fnc_removePerFrameHandler; }; - + { _tripod animate [_x, 1 - GVAR(height)]; - } foreach ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"]; - + } count ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"]; + }, 0, [_tripod]] call CBA_fnc_addPerFrameHandler; [localize "STR_ACE_Tripod_Done", "", localize "STR_ACE_Tripod_ScrollAction"] call EFUNC(interaction,showMouseHint); diff --git a/addons/tripod/functions/fnc_handleScrollWheel.sqf b/addons/tripod/functions/fnc_handleScrollWheel.sqf index 7399bf0c2c..973a57dd2f 100644 --- a/addons/tripod/functions/fnc_handleScrollWheel.sqf +++ b/addons/tripod/functions/fnc_handleScrollWheel.sqf @@ -9,13 +9,13 @@ * handled * * Example: - * 1.2 call ace_tripod_fnc_handleScrollWheel; + * [1.2] call ace_tripod_fnc_handleScrollWheel; * * Public: No */ #include "script_component.hpp" -PARAMS_1(_scroll); +params ["_scroll"]; if (GETMVAR(ACE_Modifier,0) == 0 || GVAR(adjustPFH) == -1) exitWith { false }; diff --git a/addons/tripod/functions/fnc_pickup.sqf b/addons/tripod/functions/fnc_pickup.sqf index f264eb1e2e..24fc26ea1d 100644 --- a/addons/tripod/functions/fnc_pickup.sqf +++ b/addons/tripod/functions/fnc_pickup.sqf @@ -1,30 +1,30 @@ /* * Author: Rocko, Ruthberg - * * Pick up tripod * * Arguments: * 0: tripod * 1: unit * - * Return Value: - * Nothing - * * Return value: * None + * + * Example: + * [tripod, player] call ace_tripod_fnc_pickup + * + * Public: No */ #include "script_component.hpp" -PARAMS_2(_tripod,_unit); +params ["_tripod", "_unit"]; if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { _unit playMove "AmovPercMstpSrasWrflDnon_diary"; }; [{ - PARAMS_2(_tripod,_unit); + params ["_tripod", "_unit"]; [_unit, "ACE_Tripod"] call EFUNC(common,addToInventory); deleteVehicle _tripod; - }, [_tripod, _unit], 1, 0]call EFUNC(common,waitAndExecute); diff --git a/addons/tripod/functions/fnc_place.sqf b/addons/tripod/functions/fnc_place.sqf index 5e9c783589..ce7f445885 100644 --- a/addons/tripod/functions/fnc_place.sqf +++ b/addons/tripod/functions/fnc_place.sqf @@ -1,21 +1,22 @@ /* * Author: Rocko, Ruthberg - * * Place down tripod * * Arguments: * 0: unit * 1: tripod class * - * Return Value: - * Nothing - * * Return value: * None + * + * Example: + * [player, "ACE_Tripod"] call ace_tripod_fnc_place + * + * Public: No */ #include "script_component.hpp" -PARAMS_2(_unit,_tripodClass); +params ["_unit", "_tripodClass"]; _unit removeItem _tripodClass; @@ -24,27 +25,29 @@ if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { }; [{ - PARAMS_1(_unit); - + params ["_unit"]; + private ["_direction", "_position", "_tripod"]; _direction = getDir _unit; _position = (getPosASL _unit) vectorAdd [0.8 * sin(_direction), 0.8 * cos(_direction), 0.02]; - + _tripod = "ACE_TripodObject" createVehicle [0, 0, 0]; { _tripod animate [_x, 1]; - } foreach ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"]; - + } count ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"]; + [{ - EXPLODE_3_PVT(_this select 0,_tripod,_direction,_position); + params ["_args", "_pfhId"]; + _args params ["_tripod", "_direction", "_position"]; + if (_tripod animationPhase "slide_down_tripod" == 1) then { _tripod setDir _direction; _tripod setPosASL _position; if ((getPosATL _tripod select 2) - (getPos _tripod select 2) < 1E-5) then { - _tripod setVectorUp (surfaceNormal (position _tripod)); + _tripod setVectorUp (surfaceNormal (position _tripod)); }; - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_pfhId] call CBA_fnc_removePerFrameHandler; }; }, 0, [_tripod, _direction, _position]] call CBA_fnc_addPerFrameHandler; - + }, [_unit], 1, 0] call EFUNC(common,waitAndExecute); diff --git a/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf b/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf index d683073286..073054648e 100644 --- a/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf +++ b/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf @@ -20,7 +20,10 @@ private ["_previousMags","_newMags","_keyMagazine","_keyName"]; -PARAMS_3(_unit,_veh,_useCustom); +if (!params [["_unit", objNull, [objNull]], ["_veh", objNull, [objNull]], ["_useCustom", false, [false]]]) exitWith { + ERROR("Input wrong type"); +}; +TRACE_3("params",_unit,_veh,_useCustom); if (isNull _unit) exitWith {ERROR("null unit");}; if (isNull _veh) exitWith {ERROR("null vehicle");}; diff --git a/addons/vehiclelock/functions/fnc_getVehicleSideKey.sqf b/addons/vehiclelock/functions/fnc_getVehicleSideKey.sqf index 999f471ac3..eda75922c4 100644 --- a/addons/vehiclelock/functions/fnc_getVehicleSideKey.sqf +++ b/addons/vehiclelock/functions/fnc_getVehicleSideKey.sqf @@ -17,7 +17,8 @@ private ["_vehConfigSide","_vehSide","_returnValue"]; -PARAMS_1(_veh); +params ["_veh"]; +TRACE_1("params",_veh); if (isNull _veh) exitWith {ERROR("null vehicle"); "error"}; diff --git a/addons/vehiclelock/functions/fnc_handleVehicleInitPost.sqf b/addons/vehiclelock/functions/fnc_handleVehicleInitPost.sqf index 5a2bc3f7bd..be23dc8dd9 100644 --- a/addons/vehiclelock/functions/fnc_handleVehicleInitPost.sqf +++ b/addons/vehiclelock/functions/fnc_handleVehicleInitPost.sqf @@ -16,26 +16,30 @@ */ #include "script_component.hpp" -PARAMS_1(_vehicle); - if (!isServer) exitWith {}; +params ["_vehicle"]; +TRACE_1("params",_vehicle); + [{ //If the module wasn't placed, just exit (needs to be in wait because objectInitEH is before moduleInit) if (GVAR(VehicleStartingLockState) == -1) exitWith {}; + private ["_lock"]; - PARAMS_1(_vehicle); + + params ["_vehicle"]; + if ((_vehicle isKindOf "Car") || {_vehicle isKindOf "Tank"} || {_vehicle isKindOf "Helicopter"}) then { //set lock state (eliminates the ambigious 1-"Default" and 3-"Locked for Player" states) _lock = switch (GVAR(VehicleStartingLockState)) do { - case (0): {(locked _vehicle) in [2, 3]}; - case (1):{true}; - case (2):{false}; + case (0): { (locked _vehicle) in [2, 3] }; + case (1): { true }; + case (2): { false }; }; - if (((_lock) && {(locked _vehicle) != 2}) || {(!_lock) && {(locked _vehicle) != 0}}) then { + if ((_lock && {(locked _vehicle) != 2}) || {!_lock && {(locked _vehicle) != 0}}) then { TRACE_3("Setting Lock State",_lock,(typeOf _vehicle),_vehicle); ["VehicleLock_SetVehicleLock", [_vehicle], [_vehicle, _lock]] call EFUNC(common,targetEvent); }; }; //Delay call until mission start (so everyone has the eventHandler's installed) -}, [_vehicle], 0.25, 0.25] call EFUNC(common,waitAndExecute); +}, [_vehicle], 0.25] call EFUNC(common,waitAndExecute); diff --git a/addons/vehiclelock/functions/fnc_hasKeyForVehicle.sqf b/addons/vehiclelock/functions/fnc_hasKeyForVehicle.sqf index 779f4a363e..390104cefc 100644 --- a/addons/vehiclelock/functions/fnc_hasKeyForVehicle.sqf +++ b/addons/vehiclelock/functions/fnc_hasKeyForVehicle.sqf @@ -18,7 +18,8 @@ private ["_returnValue","_sideKeyName","_customKeys"]; -PARAMS_2(_unit,_veh); +params ["_unit", "_veh"]; +TRACE_2("params",_unit,_veh); if (isNull _unit) exitWith {ERROR("null unit"); false}; if (isNull _veh) exitWith {ERROR("null vehicle"); false}; diff --git a/addons/vehiclelock/functions/fnc_lockpick.sqf b/addons/vehiclelock/functions/fnc_lockpick.sqf index 613a7b35dc..f4837c742b 100644 --- a/addons/vehiclelock/functions/fnc_lockpick.sqf +++ b/addons/vehiclelock/functions/fnc_lockpick.sqf @@ -22,7 +22,8 @@ private ["_vehLockpickStrenth","_condition","_returnValue"]; -PARAMS_3(_unit,_veh,_funcType); +params ["_unit", "_veh", "_funcType"]; +TRACE_3("params",_unit,_veh,_funcType); if (isNull _unit) exitWith {ERROR("null unit"); false}; if (isNull _veh) exitWith {ERROR("null vehicle"); false}; @@ -41,25 +42,20 @@ if (_vehLockpickStrenth < 0) exitWith {false}; //Condition check for progressBar _condition = { - PARAMS_1(_args); - EXPLODE_2_PVT(_args,_unit,_veh); + params ["_args"]; + _args params ["_args", "_unit", "_veh"]; ((_unit distance _veh) < 5) && {(speed _veh) < 0.1} }; if (!([[_unit, _veh]] call _condition)) exitWith {false}; -_returnValue = false; -switch (true) do { -case (_funcType == "canLockpick"): { - _returnValue = true; - }; -case (_funcType == "startLockpick"): { +_returnValue = _funcType in ["canLockpick", "startLockpick", "finishLockpick"]; +switch (_funcType) do { + case "startLockpick": { [_vehLockpickStrenth, [_unit, _veh, "finishLockpick"], {(_this select 0) call FUNC(lockpick)}, {}, (localize LSTRING(Action_LockpickInUse)), _condition] call EFUNC(common,progressBar); - _returnValue = true; }; -case (_funcType == "finishLockpick"): { + case "finishLockpick": { ["VehicleLock_SetVehicleLock", [_veh], [_veh, false]] call EFUNC(common,targetEvent); - _returnValue = true; }; default { ERROR("bad function type"); diff --git a/addons/vehiclelock/functions/fnc_moduleInit.sqf b/addons/vehiclelock/functions/fnc_moduleInit.sqf index 510b8ec7be..9b2c3cf182 100644 --- a/addons/vehiclelock/functions/fnc_moduleInit.sqf +++ b/addons/vehiclelock/functions/fnc_moduleInit.sqf @@ -17,10 +17,12 @@ */ #include "script_component.hpp" -PARAMS_3(_logic,_syncedUnits,_activated); +if (!isServer) exitWith {}; + +params ["_logic", "_syncedUnits", "_activated"]; +TRACE_3("params",_logic,_syncedObjects,_activated); if (!_activated) exitWith {WARNING("Vehicle Lock Init Module - placed but not active");}; -if (!isServer) exitWith {}; //Set the GVAR for default lockpick strength [_logic, QGVAR(DefaultLockpickStrength), "DefaultLockpickStrength"] call EFUNC(common,readSettingFromModule); diff --git a/addons/vehiclelock/functions/fnc_moduleSync.sqf b/addons/vehiclelock/functions/fnc_moduleSync.sqf index ede20e3196..27577e4dbe 100644 --- a/addons/vehiclelock/functions/fnc_moduleSync.sqf +++ b/addons/vehiclelock/functions/fnc_moduleSync.sqf @@ -17,14 +17,18 @@ */ #include "script_component.hpp" -PARAMS_3(_logic,_syncedObjects,_activated); +if (!isServer) exitWith {}; + +params ["_logic", "_syncedObjects", "_activated"]; +TRACE_3("params",_logic,_syncedObjects,_activated); if !(_activated) exitWith {WARNING("Vehicle Lock Sync Module - placed but not active");}; -if (!isServer) exitWith {}; [{ private ["_listOfVehicles"]; - PARAMS_1(_syncedObjects); + + params ["_syncedObjects"]; + _listOfVehicles = []; { if ((_x isKindOf "Car") || (_x isKindOf "Tank") || (_x isKindOf "Helicopter")) then { diff --git a/addons/vehiclelock/functions/fnc_onOpenInventory.sqf b/addons/vehiclelock/functions/fnc_onOpenInventory.sqf index 8199f4b850..5db2cbebe0 100644 --- a/addons/vehiclelock/functions/fnc_onOpenInventory.sqf +++ b/addons/vehiclelock/functions/fnc_onOpenInventory.sqf @@ -16,7 +16,8 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_container); +params ["_unit", "_container"]; +TRACE_2("params",_unit,_container); //Only check for player: if (_unit != ace_player) exitWith {false}; diff --git a/addons/vehiclelock/functions/fnc_serverSetupCustomKeyEH.sqf b/addons/vehiclelock/functions/fnc_serverSetupCustomKeyEH.sqf index 9d8a396e31..e959a705e0 100644 --- a/addons/vehiclelock/functions/fnc_serverSetupCustomKeyEH.sqf +++ b/addons/vehiclelock/functions/fnc_serverSetupCustomKeyEH.sqf @@ -18,7 +18,8 @@ private ["_currentKeys"]; -PARAMS_2(_veh,_key); +params ["_veh", "_key"]; +TRACE_2("params",_veh,_key); if (!isServer) exitWith {ERROR("only run on server");}; if (isNull _veh) exitWith {ERROR("null vehicle");}; diff --git a/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf b/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf index cb51cb27a8..d2290ef732 100644 --- a/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf +++ b/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf @@ -18,7 +18,8 @@ private ["_lockNumber"]; -PARAMS_2(_veh,_isLocked); +params ["_veh", "_isLocked"]; +TRACE_2("params",_veh,_isLocked); _lockNumber = if (_isLocked) then {2} else {0}; TRACE_2("Setting Lock State", _veh, _lockNumber); diff --git a/addons/vehicles/functions/fnc_speedLimiter.sqf b/addons/vehicles/functions/fnc_speedLimiter.sqf index 7ddb07433a..151c02fd8a 100644 --- a/addons/vehicles/functions/fnc_speedLimiter.sqf +++ b/addons/vehicles/functions/fnc_speedLimiter.sqf @@ -1,10 +1,24 @@ -// by commy2 +/* + * Author: commy2 + * Toggle speed limiter for Driver in Vehicle. + * + * Arguments: + * 0: Driver + * 1: Vehicle + * + * Return Value: + * None + * + * Example: + * [player, car] call ace_vehicles_fnc_speedLimiter + * + * Public: No + */ #include "script_component.hpp" -private ["_driver", "_vehicle"]; +private "_maxSpeed"; -_driver = _this select 0; -_vehicle = _this select 1; +params ["_driver", "_vehicle"]; if (GETGVAR(isSpeedLimiter,false)) exitWith { [localize LSTRING(Off)] call EFUNC(common,displayTextStructured); @@ -16,19 +30,15 @@ if (GETGVAR(isSpeedLimiter,false)) exitWith { playSound "ACE_Sound_Click"; GVAR(isSpeedLimiter) = true; -private "_maxSpeed"; _maxSpeed = speed _vehicle max 10; [{ - private ["_driver", "_vehicle", "_maxSpeed"]; - - _driver = _this select 0 select 0; - _vehicle = _this select 0 select 1; - _maxSpeed = _this select 0 select 2; + params ["_args", "_idPFH"]; + _args params ["_driver", "_vehicle", "_maxSpeed"]; if (!GVAR(isSpeedLimiter) || {_driver != driver _vehicle}) exitWith { GVAR(isSpeedLimiter) = false; - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; private "_speed"; diff --git a/addons/vehicles/functions/fnc_startEngine.sqf b/addons/vehicles/functions/fnc_startEngine.sqf index 63afd78e2e..e2c171e018 100644 --- a/addons/vehicles/functions/fnc_startEngine.sqf +++ b/addons/vehicles/functions/fnc_startEngine.sqf @@ -1,23 +1,30 @@ -// by commy2 +/* + * Author: commy2 + * Delays engine start of vehicle. + * + * Arguments: + * 0: Vehicle + * 1: Is Engine on + * + * Return Value: + * None + * + * Example: + * [vehicle player, false] call ace_vehicle_fnc_startEngine + * + * Public: No + */ #include "script_component.hpp" -private ["_vehicle", "_isEngineOn"]; - -_vehicle = _this select 0; -_isEngineOn = _this select 1; +params ["_vehicle", "_isEngineOn"]; if (!_isEngineOn || {floor abs speed _vehicle > 0}) exitWith {}; [{ - private ["_vehicle", "_time", "_direction"]; + params ["_args", "_idPFH"]; + _args params ["_vehicle", "_time", "_direction"]; - _vehicle = _this select 0 select 0; - _time = _this select 0 select 1; - _direction = _this select 0 select 2; - - if (ACE_time > _time) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; - }; + if (ACE_time > _time) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; _vehicle setVelocity [0, 0, 0]; _vehicle setVectorDirAndUp _direction; diff --git a/addons/viewdistance/functions/fnc_adaptViewDistance.sqf b/addons/viewdistance/functions/fnc_adaptViewDistance.sqf index 2ef4b84ae6..ca03758df5 100644 --- a/addons/viewdistance/functions/fnc_adaptViewDistance.sqf +++ b/addons/viewdistance/functions/fnc_adaptViewDistance.sqf @@ -17,10 +17,10 @@ #include "script_component.hpp" -PARAMS_1(_show_prompt); - private["_land_vehicle","_air_vehicle"]; +params ["_show_prompt"]; + if (!GVAR(enabled) || isNull ACE_player) exitWith {}; _land_vehicle = (vehicle ACE_player) isKindOf "LandVehicle"; diff --git a/addons/viewdistance/functions/fnc_changeViewDistance.sqf b/addons/viewdistance/functions/fnc_changeViewDistance.sqf index 9060254c60..34a3f5ba46 100644 --- a/addons/viewdistance/functions/fnc_changeViewDistance.sqf +++ b/addons/viewdistance/functions/fnc_changeViewDistance.sqf @@ -20,7 +20,7 @@ private ["_text","_new_view_distance","_view_distance_limit","_object_view_distance_coeff"]; -PARAMS_2(_index_requested,_show_prompt); +params ["_index_requested", "_show_prompt"]; _new_view_distance = [_index_requested] call FUNC(returnValue); // changes the setting index into an actual view distance value _object_view_distance_coeff = [GVAR(objectViewDistanceCoeff)] call FUNC(returnObjectCoeff); // changes the setting index into a coefficient. diff --git a/addons/viewdistance/functions/fnc_initModule.sqf b/addons/viewdistance/functions/fnc_initModule.sqf index 7569383d0c..26072e5b5f 100644 --- a/addons/viewdistance/functions/fnc_initModule.sqf +++ b/addons/viewdistance/functions/fnc_initModule.sqf @@ -17,7 +17,7 @@ if (!isServer) exitWith {}; -PARAMS_3(_logic,_units,_activated); +params ["_logic", "_units", "_activated"]; if (!_activated) exitWith { diag_log text "[ACE]: View Distance Limit Module is placed but NOT active."; diff --git a/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf b/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf index 145b8ae9e6..71a23d7b54 100644 --- a/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf +++ b/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf @@ -1,7 +1,7 @@ /* * Author: Winter * Returns the object view distance coefficient according to the given index - * + * * * Arguments: * 0: Object View Distance setting Index @@ -17,10 +17,10 @@ #include "script_component.hpp" -PARAMS_1(_index); - private ["_return"]; +params ["_index"]; + _return = switch (_index) do { case 0: {0.00}; // Off case 1: {0.20}; // Very Low @@ -31,4 +31,4 @@ _return = switch (_index) do { default {0.50}; // something broke if this returns }; -_return; \ No newline at end of file +_return; diff --git a/addons/viewdistance/functions/fnc_returnValue.sqf b/addons/viewdistance/functions/fnc_returnValue.sqf index fb449cf702..d374d69d60 100644 --- a/addons/viewdistance/functions/fnc_returnValue.sqf +++ b/addons/viewdistance/functions/fnc_returnValue.sqf @@ -17,10 +17,10 @@ #include "script_component.hpp" -PARAMS_1(_index); - private ["_return"]; +params ["_index"]; + _return = switch (_index) do { case 0: {-1}; case 1: {500}; @@ -40,4 +40,4 @@ _return = switch (_index) do { default {1000}; }; -_return; \ No newline at end of file +_return; diff --git a/addons/weaponselect/functions/fnc_countMagazinesForGrenadeMuzzle.sqf b/addons/weaponselect/functions/fnc_countMagazinesForGrenadeMuzzle.sqf index f45ed0ea57..572a83edf1 100644 --- a/addons/weaponselect/functions/fnc_countMagazinesForGrenadeMuzzle.sqf +++ b/addons/weaponselect/functions/fnc_countMagazinesForGrenadeMuzzle.sqf @@ -1,21 +1,26 @@ /* * Author: esteldunedain - * * Count how many grenade magazines the unit has on the uniform and vest. * - * Argument: - * 0: Muzzle name + * Arguments: + * 0: Unit + * 1: Muzzle Class * - * Return value: - * 0: Number of magazines - * 1: First magazine name + * Return Value: + * 0: Number of magazines + * 1: First magazine name + * + * Example: + * [player, currentMuzzle player] call ace_weaponselect_fnc_countMagazinesForGrenadeMuzzle + * + * Public: No */ #include "script_component.hpp" -PARAMS_2(_unit,_muzzle); - private ["_uniformMags", "_vestMags", "_backpackMags", "_numberOfMagazines", "_magazineClasses", "_firstMagazine"]; +params ["_unit", "_muzzle"]; + _uniformMags = getMagazineCargo uniformContainer _unit; _vestMags = getMagazineCargo vestContainer _unit; _backpackMags = getMagazineCargo backpackContainer _unit; diff --git a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf index 81cb57d9f3..37956d2121 100644 --- a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf +++ b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf @@ -1,24 +1,28 @@ /* * Author: esteldunedain - * * Display a grenade type and quantity. * - * Argument: - * 0: magazine class - * 1: number of magazines + * Arguments: + * 0: magazine class + * 1: number of magazines * - * Return value: + * Return Value: * None + * + * Example: + * [currentMagazine player, 3] call ace_weaponselect_fnc_displayGrenadeTypeAndNumber + * + * Public: No */ #include "script_component.hpp" if !(GVAR(DisplayText)) exitwith {}; -PARAMS_2(_magazine,_numberofMagazines); - private ["_color", "_name", "_text", "_picture"]; -_color = [[1,0,0], [1,1,1]] select (_numberofMagazines > 0); +params ["_magazine", "_numberofMagazines"]; + +_color = [[1, 0, 0], [1, 1, 1]] select (_numberofMagazines > 0); _name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort"); _text = [format["%1 x%2", _name, _numberofMagazines], _color] call EFUNC(common,stringToColoredText); diff --git a/addons/weaponselect/functions/fnc_findNextGrenadeMagazine.sqf b/addons/weaponselect/functions/fnc_findNextGrenadeMagazine.sqf index 65d62826e5..2b2370260a 100644 --- a/addons/weaponselect/functions/fnc_findNextGrenadeMagazine.sqf +++ b/addons/weaponselect/functions/fnc_findNextGrenadeMagazine.sqf @@ -1,17 +1,29 @@ -// by commy2 +/* + * Author: commy2 + * Find the next Grenade Magazine. + * + * Arguments: + * 0: Grenade Type ("All", "Frag", "NonFrag") + * + * Return Value: + * Magazine classname + * + * Example: + * ["All"] call ace_weaponselect_fnc_findNextGrenadeMagazine + * + * Public: No + */ #include "script_component.hpp" -private ["_allMags", "_allMuzzles", "_magazines"]; +private ["_allMags", "_allMuzzles", "_magazines", "_start", "_index", "_nextMagazine"]; -PARAMS_1(_type); //"All", "Frag" or "NonFrag" +params ["_type"]; _allMags = missionNamespace getVariable [format [QGVAR(%1Magazines), _type], []]; _allMuzzles = missionNamespace getVariable [format [QGVAR(%1Muzzles), _type], []]; _magazines = magazines ACE_player; -private ["_start", "_index", "_nextMagazine"]; - _start = [GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag); _index = _allMuzzles find _start; diff --git a/addons/weaponselect/functions/fnc_findNextGrenadeMuzzle.sqf b/addons/weaponselect/functions/fnc_findNextGrenadeMuzzle.sqf index 0491afa413..5aa096f44e 100644 --- a/addons/weaponselect/functions/fnc_findNextGrenadeMuzzle.sqf +++ b/addons/weaponselect/functions/fnc_findNextGrenadeMuzzle.sqf @@ -1,17 +1,29 @@ -// by commy2 +/* + * Author: commy2 + * Find the next Grenade Muzzle. + * + * Arguments: + * 0: Grenade Type ("All", "Frag", "NonFrag") + * + * Return Value: + * Class name of next throw muzzle + * + * Example: + * ["All"] call ace_weaponselect_fnc_findNextGrenadeMuzzle + * + * Public: No + */ #include "script_component.hpp" -private ["_allMags", "_allMuzzles", "_magazines"]; +private ["_allMags", "_allMuzzles", "_magazines", "_start", "_index", "_nextMuzzle"]; -PARAMS_1(_type); //"All", "Frag" or "NonFrag" +params ["_type"]; _allMags = missionNamespace getVariable [format [QGVAR(%1Magazines), _type], []]; _allMuzzles = missionNamespace getVariable [format [QGVAR(%1Muzzles), _type], []]; _magazines = magazines ACE_player; -private ["_start", "_index", "_nextMuzzle"]; - _start = [GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag); _index = _allMuzzles find _start; diff --git a/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf b/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf index 37e2b1c873..20ef674dae 100644 --- a/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf +++ b/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf @@ -1,9 +1,23 @@ -// by commy2 +/* + * Author: commy2 + * Fire Vehicle Smoke Launcher. + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * None + * + * Example: + * [vehicle player] call ace_weaponselect_fnc_fireSmokeLauncher + * + * Public: No + */ #include "script_component.hpp" private ["_turret", "_weapons"]; -PARAMS_1(_vehicle); +params ["_vehicle"]; _turret = [_vehicle] call EFUNC(common,getTurretCommander); diff --git a/addons/weaponselect/functions/fnc_getSelectedGrenade.sqf b/addons/weaponselect/functions/fnc_getSelectedGrenade.sqf index 5e8c3f920f..aa89a13c98 100644 --- a/addons/weaponselect/functions/fnc_getSelectedGrenade.sqf +++ b/addons/weaponselect/functions/fnc_getSelectedGrenade.sqf @@ -1,4 +1,18 @@ -// by commy2 +/* + * Author: commy2 + * Returns the selected Grenade Muzzle. + * + * Arguments: + * None + * + * Return Value: + * Class name of selected throw muzzle + * + * Example: + * [] call ace_weaponselect_fnc_getSelectedGrenade + * + * Public: No + */ #include "script_component.hpp" [GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag) diff --git a/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf b/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf index 45e84d631d..c79f03c6f2 100644 --- a/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf +++ b/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf @@ -1,9 +1,24 @@ -// by commy2 +/* + * Author: commy2 + * Play the change firemode sound for specified weapon at units position. + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * None + * + * Example: + * [player, currentWeapon player] call ace_weaponselect_fnc_playChangeFiremodeSound + * + * Public: No + */ #include "script_component.hpp" private ["_sound"]; -PARAMS_2(_unit,_weapon); +params ["_unit", "_weapon"]; _sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound"); diff --git a/addons/weaponselect/functions/fnc_putWeaponAway.sqf b/addons/weaponselect/functions/fnc_putWeaponAway.sqf index a4cd743bfb..faddb4d869 100644 --- a/addons/weaponselect/functions/fnc_putWeaponAway.sqf +++ b/addons/weaponselect/functions/fnc_putWeaponAway.sqf @@ -1,17 +1,21 @@ /* * Author: commy2 - * * The unit will put its current weapon away. * - * Argument: - * 0: What unit should put the current weapon on back? (Object) + * Arguments: + * 0: Unit * - * Return value: - * None. + * Return Value: + * None + * + * Example: + * [player] call ace_weaponselect_fnc_putWeaponAway + * + * Public: NO */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; [_unit] call EFUNC(common,fixLoweredRifleAnimation); diff --git a/addons/weaponselect/functions/fnc_selectGrenadeAll.sqf b/addons/weaponselect/functions/fnc_selectGrenadeAll.sqf index 69ea5cdf99..a68670184a 100644 --- a/addons/weaponselect/functions/fnc_selectGrenadeAll.sqf +++ b/addons/weaponselect/functions/fnc_selectGrenadeAll.sqf @@ -1,25 +1,28 @@ /* * Author: esteldunedain, commy2 - * * Cycle through all grenades. * - * Argument: + * Arguments: + * 0: Unit + * + * Return Value: * None * - * Return value: - * None + * Example: + * [player] call ace_weaponselect_fnc_selectGrenadeAll + * + * Public: No */ #include "script_component.hpp" private ["_text", "_nextMuzzle"]; -PARAMS_1(_unit); +params ["_unit"]; _nextMuzzle = ["All"] call FUNC(findNextGrenadeMuzzle); if (_nextMuzzle != "") then { - private ["_magazines", "_magazine", "_count", "_return"]; _magazines = GVAR(AllMagazines) select (GVAR(AllMuzzles) find _nextMuzzle); reverse _magazines; diff --git a/addons/weaponselect/functions/fnc_selectGrenadeFrag.sqf b/addons/weaponselect/functions/fnc_selectGrenadeFrag.sqf index 91d0023e47..c221b6cc30 100644 --- a/addons/weaponselect/functions/fnc_selectGrenadeFrag.sqf +++ b/addons/weaponselect/functions/fnc_selectGrenadeFrag.sqf @@ -1,19 +1,23 @@ /* * Author: esteldunedain, commy2 - * * Cycle through frags. * - * Argument: + * Arguments: + * 0: Unit + * + * Return Value: * None * - * Return value: - * None + * Example: + * [player] call ace_weaponselect_fnc_selectGrenadeFrag + * + * Public: No */ #include "script_component.hpp" private ["_text", "_nextMuzzle"]; -PARAMS_1(_unit); +params ["_unit"]; _nextMuzzle = ["Frag"] call FUNC(findNextGrenadeMuzzle); diff --git a/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf b/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf index 28cc0e74d8..2f219989eb 100644 --- a/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf +++ b/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf @@ -1,19 +1,23 @@ /* * Author: esteldunedain, commy2 - * * Cycle through non explosive grenades. * - * Argument: + * Arguments: + * 0: Unit + * + * Return Value: * None * - * Return value: - * None + * Example: + * [player] call ace_weaponselect_fnc_selectGrenadeOther + * + * Public: No */ #include "script_component.hpp" private ["_nextMuzzle", "_text"]; -PARAMS_1(_unit); +params ["_unit"]; _nextMuzzle = ["NonFrag"] call FUNC(findNextGrenadeMuzzle); diff --git a/addons/weaponselect/functions/fnc_selectWeaponMode.sqf b/addons/weaponselect/functions/fnc_selectWeaponMode.sqf index 012bf94898..815b8d28cf 100644 --- a/addons/weaponselect/functions/fnc_selectWeaponMode.sqf +++ b/addons/weaponselect/functions/fnc_selectWeaponMode.sqf @@ -1,17 +1,22 @@ /* * Author: commy2 - * * The player will select the specified weapon or will change to the next firing mode if the weapon was already selected. * - * Argument: - * 0: A weapon (String) + * Arguments: + * 0: Unit + * 1: Weapon * - * Return value: - * None. + * Return Value: + * None + * + * Example: + * [player, currentWeapon player] call ace_weaponselect_fnc_selectWeaponMode + * + * Public: No */ #include "script_component.hpp" -PARAMS_2(_unit,_weapon); +params ["_unit", "_weapon"]; if (_weapon == "") exitWith {}; diff --git a/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf b/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf index 67e63cd830..71c9cfc7b4 100644 --- a/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf +++ b/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf @@ -1,17 +1,22 @@ /* * Author: commy2 - * * The player will select the specified weapon and change to the first additional muzzle. E.g. the grenade launcher of a assault rifle. * - * Argument: - * 0: A weapon (String) + * Arguments: + * 0: Unit + * 1: Weapon * - * Return value: - * None. + * Return Value: + * None + * + * Example: + * [player, currentWeapon player] call ace_weaponselect_fnc_selectWeaponMuzzle + * + * Public: No */ #include "script_component.hpp" -PARAMS_2(_unit,_weapon); +params ["_unit", "_weapon"]; if (_weapon == "") exitWith {}; diff --git a/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf b/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf index 9507c23a30..9695079da5 100644 --- a/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf +++ b/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf @@ -1,7 +1,23 @@ -// by commy2 +/* + * Author: commy2 + * Select weapon for unit in vehicle. + * + * Arguments: + * 0: Unit + * 1: Vehicle + * 2: Weapon index + * + * Return Value: + * None + * + * Example: + * [player, vehicle player, 1] call ace_weaponselect_fnc_selectWeaponVehicle + * + * Public: No + */ #include "script_component.hpp" -PARAMS_3(_unit,_vehicle,_index); +params ["_unit", "_vehicle", "_index"]; private "_turret"; _turret = [_unit] call EFUNC(common,getTurretIndex); diff --git a/addons/weaponselect/functions/fnc_setNextGrenadeMuzzle.sqf b/addons/weaponselect/functions/fnc_setNextGrenadeMuzzle.sqf index 4bf970fab1..ce7ec55393 100644 --- a/addons/weaponselect/functions/fnc_setNextGrenadeMuzzle.sqf +++ b/addons/weaponselect/functions/fnc_setNextGrenadeMuzzle.sqf @@ -1,21 +1,25 @@ /* * Author: esteldunedain - * * Select the next grenade muzzle to throw. * - * Argument: - * muzzle name + * Arguments: + * 0: Unit + * 1: Muzzlename * - * Return value: + * Return Value: * None * + * Example: + * [player, currentMuzzle player] call ace_weaponselect_fnc_setNextGrenadeMuzzle + * + * Public: No */ #include "script_component.hpp" -PARAMS_2(_unit,_muzzle); - private ["_uniformMags", "_vestMags", "_backpackMags", "_i", "_uniformMagsToRemove", "_vestMagsToRemove", "_backpackMagsToRemove", "_firstMagazine", "_throwMuzzleNames"]; +params ["_unit", "_muzzle"]; + _uniformMags = getMagazineCargo uniformContainer _unit; _vestMags = getMagazineCargo vestContainer _unit; _backpackMags = getMagazineCargo backpackContainer _unit; diff --git a/addons/weaponselect/functions/fnc_throwGrenade.sqf b/addons/weaponselect/functions/fnc_throwGrenade.sqf index ab06fd5b5d..2cdc8e63dc 100644 --- a/addons/weaponselect/functions/fnc_throwGrenade.sqf +++ b/addons/weaponselect/functions/fnc_throwGrenade.sqf @@ -1,11 +1,27 @@ -// by commy2 +/* + * Author: commy2 + * Display Grenade information on grenade throw. + * + * Arguments: + * 0: unit - Object the event handler is assigned to + * 1: weapon - Fired weapon + * 2: muzzle - Muzzle that was used + * 3: mode - Current mode of the fired weapon + * 4: ammo - Ammo used + * 5: magazine - magazine name which was used + * 6: projectile - Object of the projectile that was shot + * + * Return Value: + * None + * + * Example: + * [_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile] call ace_weaponselect_fnc_throwGrenade + * + * Public: No + */ #include "script_component.hpp" -private ["_unit","_weapon","_magazine"]; - -_unit = _this select 0; -_weapon = _this select 1; -_magazine = _this select 5; +params ["_unit", "_weapon", "", "", "", "_magazine"]; if (_weapon != "Throw") exitWith {}; diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index e81463f41a..44a5b0696c 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -47,7 +47,7 @@ GVAR(WindInfo) = true; }; if (_windSpeed > 0.2) then { - _playerDir = getDir ACE_player; + _playerDir = (ACE_player call CBA_fnc_headDir) select 0; _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); _windIndex = round(((_playerDir - _windDir + 360) % 360) / 30); _windIndex = _windIndex % 12; diff --git a/addons/winddeflection/functions/fnc_handleFired.sqf b/addons/winddeflection/functions/fnc_handleFired.sqf index d3f9da8153..6c668a8033 100644 --- a/addons/winddeflection/functions/fnc_handleFired.sqf +++ b/addons/winddeflection/functions/fnc_handleFired.sqf @@ -21,9 +21,7 @@ */ #include "script_component.hpp" -private ["_unit", "_bullet"]; -_unit = _this select 0; -_bullet = _this select 6; +params ["_unit", "", "", "", "_ammo", "", "_bullet"]; if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_bullet isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false}; @@ -34,6 +32,6 @@ if (!((_bullet isKindOf "BulletBase") || (_bullet isKindOf "GrenadeBase"))) exit if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {false}; if (!([_unit] call EFUNC(common,isPlayer))) exitWith {false}; -GVAR(trackedBullets) pushBack [_bullet, getNumber(configFile >> "cfgAmmo" >> (_this select 4) >> "airFriction")]; +GVAR(trackedBullets) pushBack [_bullet, getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction")]; true; \ No newline at end of file diff --git a/addons/winddeflection/functions/fnc_initModuleSettings.sqf b/addons/winddeflection/functions/fnc_initModuleSettings.sqf index 40be14a2b2..037ce15c47 100644 --- a/addons/winddeflection/functions/fnc_initModuleSettings.sqf +++ b/addons/winddeflection/functions/fnc_initModuleSettings.sqf @@ -15,10 +15,7 @@ #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; diff --git a/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf b/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf index 23d0be6b79..baff39516d 100644 --- a/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf +++ b/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf @@ -18,11 +18,12 @@ [{ // BEGIN_COUNTER(pfeh); - private["_accel", "_accelRef", "_bulletSpeed", "_bulletVelocity", "_deleted", "_deltaT", "_drag", "_dragRef", "_isWind", "_lastTime", "_trueSpeed", "_trueVelocity"]; + private["_accel", "_accelRef", "_bulletSpeed", "_bulletVelocity", "_deleted", "_deltaT", "_drag", "_dragRef", "_isWind", "_trueSpeed", "_trueVelocity"]; - _lastTime = (_this select 0) select 0; + params ["_args"]; + _args params ["_lastTime"]; _deltaT = ACE_time - _lastTime; - (_this select 0) set [0, ACE_time]; + _args set [0, ACE_time]; _deleted = 0; _isWind = (vectorMagnitude ACE_wind > 0); diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index 77273c60b7..e110970ae3 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -115,4 +115,34 @@ class CfgVehicles { sync[] = {}; }; }; + class GVAR(moduleSetMedic): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedic_displayName); + function = QFUNC(moduleSetMedic); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); + class ModuleDescription { + description = ""; + sync[] = {}; + }; + }; + class GVAR(moduleSetMedicalVehicle): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedicalVehicle_displayName); + function = QFUNC(moduleSetMedicalVehicle); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); + class ModuleDescription { + description = ""; + sync[] = {}; + }; + }; + class GVAR(moduleSetMedicalFacility): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedicalFacility_displayName); + function = QFUNC(moduleSetMedicalFacility); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); + class ModuleDescription { + description = ""; + sync[] = {}; + }; + }; }; diff --git a/addons/zeus/XEH_preInit.sqf b/addons/zeus/XEH_preInit.sqf index 1b2ac19263..3817db218f 100644 --- a/addons/zeus/XEH_preInit.sqf +++ b/addons/zeus/XEH_preInit.sqf @@ -8,6 +8,9 @@ PREP(bi_moduleProjectile); PREP(bi_moduleRemoteControl); PREP(handleZeusUnitAssigned); PREP(moduleCaptive); +PREP(moduleSetMedic); +PREP(moduleSetMedicalVehicle); +PREP(moduleSetMedicalFacility); PREP(moduleSurrender); PREP(moduleUnconscious); PREP(moduleZeusSettings); diff --git a/addons/zeus/config.cpp b/addons/zeus/config.cpp index 7505f2770e..810ce17396 100644 --- a/addons/zeus/config.cpp +++ b/addons/zeus/config.cpp @@ -19,7 +19,10 @@ class CfgPatches { }; class GVAR(medical): ADDON { units[] = { - QGVAR(moduleUnconscious) + QGVAR(moduleUnconscious), + QGVAR(moduleSetMedic), + QGVAR(moduleSetMedicalVehicle), + QGVAR(moduleSetMedicalFacility) }; }; }; diff --git a/addons/zeus/functions/fnc_handleZeusUnitAssigned.sqf b/addons/zeus/functions/fnc_handleZeusUnitAssigned.sqf index e5433bad27..65663e65fd 100644 --- a/addons/zeus/functions/fnc_handleZeusUnitAssigned.sqf +++ b/addons/zeus/functions/fnc_handleZeusUnitAssigned.sqf @@ -19,11 +19,11 @@ #include "script_component.hpp" -private ["_logic","_removeAddons","_numCfgs","_cfg","_requiredAddon"]; +private ["_removeAddons", "_numCfgs", "_cfg", "_requiredAddon"]; if !(isClass (configFile >> "ACE_Curator")) exitWith { ERROR("The ACE_Curator class does not exist") }; -_logic = _this select 0; +params ["_logic"]; _removeAddons = []; _numCfgs = count (configFile >> "ACE_Curator"); diff --git a/addons/zeus/functions/fnc_moduleCaptive.sqf b/addons/zeus/functions/fnc_moduleCaptive.sqf index 43879a2a59..8273c8ba6f 100644 --- a/addons/zeus/functions/fnc_moduleCaptive.sqf +++ b/addons/zeus/functions/fnc_moduleCaptive.sqf @@ -3,20 +3,20 @@ * Flips the capture state of the unit the module is placed on. * * Arguments: - * 0: The module logic - * 1: units - * 2: activated + * 0: The module logic + * 1: Synchronized units + * 2: Activated * - * ReturnValue: - * nil + * Return Value: + * None * - * Public: no + * Public: No */ #include "script_component.hpp" -PARAMS_3(_logic,_units,_activated); -private ["_mouseOver","_unit","_captive"]; +params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit", "_captive"]; if !(_activated && local _logic) exitWith {}; diff --git a/addons/zeus/functions/fnc_moduleSetMedic.sqf b/addons/zeus/functions/fnc_moduleSetMedic.sqf new file mode 100644 index 0000000000..661e33f907 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleSetMedic.sqf @@ -0,0 +1,52 @@ +/* + * Author: SilentSpike, Glowbal + * Assigns a medic role from the medical module to a unit + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit", "_medicN"]; + +if !(_activated && local _logic) exitWith {}; + +if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then { + [LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured); +} else { + _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]); + + if ((_mouseOver select 0) != "OBJECT") then { + [LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured); + } else { + _unit = effectivecommander (_mouseOver select 1); + + if !(_unit isKindOf "CAManBase") then { + [LSTRING(OnlyInfantry)] call EFUNC(common,displayTextStructured); + } else { + if !(alive _unit) then { + [LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured); + } else { + if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then { + [LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured); + } else { + _medicN = GETVAR(_unit,EGVAR(medical,medicClass),0); + if (_medicN < 1) then { + _unit setvariable [QEGVAR(medical,medicClass), 1, true]; + }; + }; + }; + }; + }; +}; + +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf b/addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf new file mode 100644 index 0000000000..22826108e7 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf @@ -0,0 +1,51 @@ +/* + * Author: SilentSpike, Glowbal + * Assigns a medic role from the medical module to a unit + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit"]; + +if !(_activated && local _logic) exitWith {}; + +if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then { + [LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured); +} else { + _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]); + + if ((_mouseOver select 0) != "OBJECT") then { + [LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured); + } else { + _unit = (_mouseOver select 1); + + if (_unit isKindOf "Man" || {!(_unit isKindOf "Building")}) then { + [LSTRING(OnlyStructures)] call EFUNC(common,displayTextStructured); + } else { + if !(alive _unit) then { + [LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured); + } else { + if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then { + [LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured); + } else { + if (!(GETVAR(_unit,EGVAR(medical,isMedicalFacility),false))) then { + _unit setvariable [QEGVAR(medical,isMedicalFacility), true, true]; + }; + }; + }; + }; + }; +}; + +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf b/addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf new file mode 100644 index 0000000000..9e5e788461 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf @@ -0,0 +1,52 @@ +/* + * Author: SilentSpike, Glowbal + * Assigns a medic role from the medical module to a unit + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit", "_medicN"]; + +if !(_activated && local _logic) exitWith {}; + +if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then { + [LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured); +} else { + _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]); + + if ((_mouseOver select 0) != "OBJECT") then { + [LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured); + } else { + _unit = (_mouseOver select 1); + + if (_unit isKindOf "Man" || {_unit isKindOf "Building"}) then { + [LSTRING(OnlyVehicles)] call EFUNC(common,displayTextStructured); + } else { + if !(alive _unit) then { + [LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured); + } else { + if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then { + [LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured); + } else { + _medicN = GETVAR(_unit,EGVAR(medical,medicClass),0); + if (_medicN < 1) then { + _unit setvariable [QEGVAR(medical,medicClass), 1, true]; + }; + }; + }; + }; + }; +}; + +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleSurrender.sqf b/addons/zeus/functions/fnc_moduleSurrender.sqf index 30ec8d8d35..95f35593a5 100644 --- a/addons/zeus/functions/fnc_moduleSurrender.sqf +++ b/addons/zeus/functions/fnc_moduleSurrender.sqf @@ -3,20 +3,20 @@ * Flips the surrender state of the unit the module is placed on. * * Arguments: - * 0: The module logic - * 1: units - * 2: activated + * 0: The module logic + * 1: Synchronized units + * 2: Activated * - * ReturnValue: - * nil + * Return Value: + * None * - * Public: no + * Public: No */ #include "script_component.hpp" -PARAMS_3(_logic,_units,_activated); -private ["_mouseOver","_unit","_surrendering"]; +params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit", "_surrendering"]; if !(_activated && local _logic) exitWith {}; diff --git a/addons/zeus/functions/fnc_moduleUnconscious.sqf b/addons/zeus/functions/fnc_moduleUnconscious.sqf index 401fef2aa4..d9f9031cee 100644 --- a/addons/zeus/functions/fnc_moduleUnconscious.sqf +++ b/addons/zeus/functions/fnc_moduleUnconscious.sqf @@ -3,20 +3,20 @@ * Flips the unconscious state of the unit the module is placed on. * * Arguments: - * 0: The module logic - * 1: units - * 2: activated + * 0: The module logic + * 1: Synchronized units + * 2: Activated * - * ReturnValue: - * nil + * Return Value: + * None * - * Public: no + * Public: No */ #include "script_component.hpp" -PARAMS_3(_logic,_units,_activated); -private ["_mouseOver","_unit","_conscious"]; +params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit", "_conscious"]; if !(_activated && local _logic) exitWith {}; diff --git a/addons/zeus/functions/fnc_moduleZeusSettings.sqf b/addons/zeus/functions/fnc_moduleZeusSettings.sqf index 3a582f7196..0b9c0f8dd8 100644 --- a/addons/zeus/functions/fnc_moduleZeusSettings.sqf +++ b/addons/zeus/functions/fnc_moduleZeusSettings.sqf @@ -15,10 +15,7 @@ #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 7c70978aa4..fd1c978188 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -137,6 +137,15 @@ Bewusstlosigkeit umschalten Alternar inconsciência + + Assign Medic + + + Assign Medical Vehicle + + + Assign Medical Facility + Unit must be alive Utiliser uniquement sur une unité vivante @@ -161,6 +170,12 @@ Si può usare solo su fanteria a piedi Usar somente em infantaria desmontada + + Unit must be a structure + + + Unit must be a vehicle + Unit must not be captive Jednostka nie może być więźniem diff --git a/addons/zeus/ui/Icon_Module_Zeus_Medic_ca.paa b/addons/zeus/ui/Icon_Module_Zeus_Medic_ca.paa new file mode 100644 index 0000000000..60963046a7 Binary files /dev/null and b/addons/zeus/ui/Icon_Module_Zeus_Medic_ca.paa differ diff --git a/documentation/development/arma-3-issues.md b/documentation/development/arma-3-issues.md index 4a3e9ea0fc..16f9988409 100644 --- a/documentation/development/arma-3-issues.md +++ b/documentation/development/arma-3-issues.md @@ -22,6 +22,7 @@ Keeping track of Arma 3 issues that need to be fixed. If you want to support us * [James2464: 0023725: All Environment Rocks Should Have PhysX LODs](http://feedback.arma3.com/view.php?id=23725) * [Jaynus: 0023679: Display event handler return values for mouse buttons should be respected](http://feedback.arma3.com/view.php?id=23679) * [Heisenberg: 0023741: Switching between optic modes of a sniper scope (AMS, DMS, MOS) will result in a blurred vision](http://feedback.arma3.com/view.php?id=23741) +* [AgentRev: 0022310: setObjectTextureGlobal causing "Cannot load texture" errors when used with valid mission files](http://feedback.arma3.com/view.php?id=22310) **Resolved:** diff --git a/documentation/development/coding-guidelines.md b/documentation/development/coding-guidelines.md index 1ab53046ec..a869911747 100644 --- a/documentation/development/coding-guidelines.md +++ b/documentation/development/coding-guidelines.md @@ -1,7 +1,7 @@ --- layout: wiki title: Coding Guidelines -description: +description: group: development parent: wiki order: 1 @@ -107,7 +107,7 @@ Every function should have a header of the following format: * Arguments: * 0: The first argument * 1: The second argument - * + * * Return Value: * The return value * @@ -124,26 +124,26 @@ Every function should have a header of the following format: ### 4.1 Module/PBO specific Macro Usage The family of `GVAR` macro's define global variable strings or constants for use within a module. Please use these to make sure we follow naming conventions across all modules and also prevent duplicate/overwriting between variables in different modules. The macro family expands as follows, for the example of the module 'balls': - -| Macros | is the same as | -| -------|---------| -| `GVAR(face)` | ace_balls_face | -|`QGVAR(face)` | ace_balls_face | + +| Macros | Expands to | +| -------|---------| +| `GVAR(face)` | ace_balls_face | +|`QGVAR(face)` | "ace_balls_face" | | `EGVAR(balls,face)` | ace_balls_face | | `EGVAR(leg,face)` | ace_leg_face | -| `QEGVAR(leg,face)` | ace_leg_face | +| `QEGVAR(leg,face)` | "ace_leg_face" | There also exists the FUNC family of Macros: -| Macros | is the same as | -| -------|---------| +| Macros | Expands to | +| -------|---------| |`FUNC(face)` | ace_balls_fnc_face or the call trace wrapper for that function.| |`EFUNC(balls,face)` | ace_balls_fnc_face or the call trace wrapper for that function.| |`EFUNC(leg,face) `| ace_leg_fnc_face or the call trace wrapper for that function.| |`DFUNC(face)` | ace_balls_fnc_face and will ALWAYS be the function global variable.| |`DEFUNC(leg,face)` | ace_leg_fnc_face and will ALWAYS be the function global variable.| -|`QFUNC(face)` | ace_balls_fnc_face | -|`QEFUNC(leg,face)` |ace_leg_fnc_face| +|`QFUNC(face)` | "ace_balls_fnc_face" | +|`QEFUNC(leg,face)` | "ace_leg_fnc_face" | The `FUNC` and `EFUNC` macros should NOT be used inside `QUOTE` macros if the intention is to get the function name or assumed to be the function variable due to call tracing (see below). If you need to 100% always be sure that you are getting the function name or variable use the `DFUNC` or `DEFUNC` macros. For example `QUOTE(FUNC(face)) == "ace_balls_fnc_face"` would be an illegal use of `FUNC` inside `QUOTE`. @@ -153,8 +153,8 @@ Using `FUNC` or `EFUNC` inside a `QUOTE` macro is fine if the intention is for i ACE3 implements a basic call tracing system that can dump the call stack on errors or wherever you want. To do this the `FUNC` macros in debug mode will expand out to include metadata about the call including line numbers and files. This functionality is automatic with the use of calls via `FUNC` and `EFUNC`, but any calls to other functions need to use the following macros: -| Macro | example | -| -------|---------| +| Macro | example | +| -------|---------| |`CALLSTACK(functionName)` | `[] call CALLSTACK(cba_fnc_someFunction)` | |`CALLSTACK_NAMED(function,functionName)` | `[] call CALLSTACK_NAMED(_anonymousFunction,'My anonymous function!')`| @@ -168,8 +168,8 @@ These macros will call these functions with the appropriate wrappers and enable #### 4.2.1 setVariable, getVariable family macros -| Macro | is the same as | -| -------|---------| +| Macro | Expands to | +| -------|---------| |`GETVAR(player,MyVarName,false)` | player getVariable ["MyVarName", false]| |`GETMVAR(MyVarName,objNull)` | missionNamespace getVariable ["MyVarName", objNull]| |`GETUVAR(MyVarName,displayNull)` | uiNamespace getVariable ["MyVarName", displayNull]| @@ -179,25 +179,25 @@ These macros will call these functions with the appropriate wrappers and enable #### 4.2.2 STRING family macros -Note that you need the strings in module stringtable.xml in the correct format +Note that you need the strings in module stringtable.xml in the correct format `STR_ACE__`
Example:
`STR_Balls_Banana`
Script strings: -| Macro | is the same as | -| -------|---------| +| Macro | Expands to | +| -------|---------| | `LSTRING(banana)` | "STR_ACE_balls_banana"| -| `ELSTRING(balls,banana)` | "STR_ACE_balls_banana"| +| `ELSTRING(balls,banana)` | "STR_ACE_balls_banana"| Config Strings (require `$` as first character): -| Macro | is the same as | -| -------|---------| -| `CSTRING(banana)` | "$STR_ACE_balls_banana" | -| `ECSTRING(balls,banana)` | "$STR_ACE_balls_banana" | +| Macro | Expands to | +| -------|---------| +| `CSTRING(banana)` | "$STR_ACE_balls_banana" | +| `ECSTRING(balls,banana)` | "$STR_ACE_balls_banana" | ## 5. Event Handlers @@ -206,8 +206,8 @@ Event handlers in ACE3 are implemented through our event system. They should be The commands are listed below. -| Even Handler | use | -| -------|---------| +| Even Handler | Use | +| -------|---------| |`[eventName, eventCodeBlock] call ace_common_fnc_addEventHandler` | adds an event handler with the event name and returns the event handler id.| | `[eventName, args] call ace_common_fnc_globalEvent` | calls an event with the listed args on all machines, the local machine, and the server. | |`[eventName, args] call ace_common_fnc_serverEvent` | calls an event just on the server computer (dedicated or self-hosted).| @@ -216,8 +216,8 @@ The commands are listed below. Events can be removed or cleared with the following commands. -| Even Handler | use | -| -------|---------| +| Even Handler | Use | +| -------|---------| |`[eventName, eventHandlerId] call ace_common_fnc_removeEventHandler` | will remove a specific event handler of the event name, using the ID returned from `ace_common_fnc_addEventHandler`.| |`[eventName] call ace_common_fnc_removeAllEventHandlers` | will remove all event handlers for that type of event.| @@ -243,8 +243,8 @@ if(HASH_HASKEY(_hash, "key")) then { A description of the above macros is below. -| Macro | use | -| -------|---------| +| Macro | Use | +| -------|---------| |`HASHCREATE` | used to create an empty hash.| | `HASH_SET(hash, key, val)` | will set the hash key to that value, a key can be anything, even objects. | |`HASH_GET(hash, key)` | will return the value of that key (or nil if it doesn't exist). | @@ -276,7 +276,7 @@ _anotherHash = HASHLIST_SELECT(_hashList, 0); // this should print "val: 1" player sideChat format["val: %1", HASH_GET(_anotherHash, "key1")]; -//Say we need to add a new key to the hashlist +//Say we need to add a new key to the hashlist //that we didn't initialize it with? We can simply //set a new key using the standard HASH_SET macro HASH_SET(_anotherHash, "anotherKey", "another value"); @@ -285,8 +285,8 @@ HASH_SET(_anotherHash, "anotherKey", "another value"); As you can see above working with hashlists are fairly simple, a more in depth explanation of the macros is below. -| Macro | use | -| -------|---------| +| Macro | Use | +| -------|---------| |`HASHLIST_CREATELIST(keys)` | creates a new hashlist with the default keys, pass [] for no default keys.| |`HASHLIST_CREATEHASH(hashlist)` | returns a blank hash template from a hashlist.| |`HASHLIST_PUSH(hashList, hash)` | pushes a new hash onto the end of the list.| diff --git a/documentation/feature/finger.md b/documentation/feature/finger.md index 9920ee9e66..3943980a97 100644 --- a/documentation/feature/finger.md +++ b/documentation/feature/finger.md @@ -3,6 +3,7 @@ layout: wiki title: Finger description: Finger pointing group: feature +category: realism parent: wiki --- diff --git a/documentation/feature/interaction.md b/documentation/feature/interaction.md index 340fabf3db..3916afede2 100644 --- a/documentation/feature/interaction.md +++ b/documentation/feature/interaction.md @@ -2,8 +2,8 @@ layout: wiki title: Interaction description: -category: Interaction group: feature +category: interaction parent: wiki --- diff --git a/documentation/feature/parachute.md b/documentation/feature/parachute.md index adc87b8aa3..39f353f08b 100644 --- a/documentation/feature/parachute.md +++ b/documentation/feature/parachute.md @@ -3,6 +3,7 @@ layout: wiki title: Parachute description: Add an altimeter and a non-steerable parachute group: feature +category: equipment parent: wiki --- diff --git a/documentation/feature/sitting.md b/documentation/feature/sitting.md index 81367ed71d..aee2ee859d 100644 --- a/documentation/feature/sitting.md +++ b/documentation/feature/sitting.md @@ -3,6 +3,7 @@ layout: wiki title: Sitting description: group: feature +category: interaction parent: wiki --- diff --git a/documentation/feature/slideshow.md b/documentation/feature/slideshow.md index 2dcd0d2f9f..0ff2372064 100644 --- a/documentation/feature/slideshow.md +++ b/documentation/feature/slideshow.md @@ -2,6 +2,7 @@ layout: wiki title: Slideshow group: feature +category: interaction parent: wiki --- @@ -10,7 +11,7 @@ This adds the ability to have images shown on some objects and have other object Please note that only objects with hiddenSelection 0 can be used to render images (whiteboard, TV, PC Screen being the most notable examples). ## 2. Usage -Note that this sections is for users, for mission makers refer to [the entry in mission-tools](./missionmaker/mission-tools.html) +Note that this sections is for users, for mission makers refer to [the entry in mission-tools](../missionmaker/mission-tools.html) Also if no remotes are defined the "screen" object itself becomes the remote. ### 2.1 Switching between images diff --git a/documentation/missionmaker/mission-tools.md b/documentation/missionmaker/mission-tools.md index 9904acbeae..eeb4c2be06 100644 --- a/documentation/missionmaker/mission-tools.md +++ b/documentation/missionmaker/mission-tools.md @@ -15,13 +15,14 @@ parent: wiki They can be found in the editor under: "Empty" >> "ACE Respawn" **Classnames:** -* `ACE_Rallypoint_West`, `ACE_Rallypoint_West_Base` -* `ACE_Rallypoint_East`, `ACE_Rallypoint_East_Base` -* `ACE_Rallypoint_Independent`, `ACE_Rallypoint_Independent_Base` +- `ACE_Rallypoint_West`, `ACE_Rallypoint_West_Base` +- `ACE_Rallypoint_East`, `ACE_Rallypoint_East_Base` +- `ACE_Rallypoint_Independent`, `ACE_Rallypoint_Independent_Base` Using the Interaction Menu on a rallypoint offers the ability to teleport from one flagpole to the other flagpole and vice versa. If you want to change the texture of the flag use this line: + ```c++ this setFlagTexture 'path\to\my\texture\my_awesome_clan_logo.paa'; ``` @@ -32,7 +33,7 @@ All units synced to the ["Rallypoint System" module](./modules.html#1.14-rallypo
Note:
-

It's important to mention that this doesn't work for player who join during a mission (JIP = Join in progress). That's something we can't change because that's the way Bohemia has implemented their module framework.

+

It's important to mention that this doesn't work for player who join during a mission (JIP = Join in progress). That's something we can't change because that's the way Bohemia Interactive has implemented their module framework.

To enable other units to move them add this to the unit's initialization code: @@ -77,6 +78,12 @@ Slide duration | 0 (0 = disabled, number is in seconds) - Only objects with hiddenSelection 0 can be used as "screens". - If you set a duration the remotes will be disabled. (If the remotes are disabled `ace_interaction` is not needed) - You can have multiple sets of images on different screens, see the advanced slideshow below. +- It is advisable images resolution sizes are powers of 2 (eg. 512x512) to avoid graphical glitches in them. + +
+
Note:
+

Mission MUST be in a PBO format (not bare folder) when used on a dedicated server due to an [issue](http://feedback.arma3.com/view.php?id=22310) to prevent errors.

+
### 3.2 Basic slideshow *A set of 4 images that are swapped via a remote* diff --git a/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_ca.png b/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_ca.png new file mode 100644 index 0000000000..0209ed8676 Binary files /dev/null and b/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_ca.png differ diff --git a/extras/assets/icons/png/Icon_Module/Icon_Module_Slideshow_ca.png b/extras/assets/icons/Icon_Module_png/Icon_Module_Slideshow_ca.png similarity index 100% rename from extras/assets/icons/png/Icon_Module/Icon_Module_Slideshow_ca.png rename to extras/assets/icons/Icon_Module_png/Icon_Module_Slideshow_ca.png diff --git a/tools/search_privates.py b/tools/search_privates.py index 37320214fc..207c6403e0 100644 --- a/tools/search_privates.py +++ b/tools/search_privates.py @@ -21,7 +21,7 @@ def get_private_declare(content): priv_split = sorted(set(priv_split)) priv_declared += priv_split; - srch = re.compile('PARAMS_[0-9].*|EXPLODE_[0-9]_PVT.*|DEFAULT_PARAM.*|KEY_PARAM.*|IGNORE_PRIVATE_WARNING.*') + srch = re.compile('params \[.*\]|PARAMS_[0-9].*|EXPLODE_[0-9]_PVT.*|DEFAULT_PARAM.*|KEY_PARAM.*|IGNORE_PRIVATE_WARNING.*') priv_srch_declared = srch.findall(content) priv_srch_declared = sorted(set(priv_srch_declared)) diff --git a/tools/search_unused_privates.py b/tools/search_unused_privates.py index b9bdd880ce..72a0dadcea 100644 --- a/tools/search_unused_privates.py +++ b/tools/search_unused_privates.py @@ -21,7 +21,7 @@ def get_private_declare(content): priv_split = sorted(set(priv_split)) priv_declared += priv_split; - srch = re.compile('PARAMS_[0-9].*|EXPLODE_[0-9]_PVT.*|DEFAULT_PARAM.*|KEY_PARAM.*|IGNORE_PRIVATE_WARNING.*') + srch = re.compile('params \[.*\]|PARAMS_[0-9].*|EXPLODE_[0-9]_PVT.*|DEFAULT_PARAM.*|KEY_PARAM.*|IGNORE_PRIVATE_WARNING.*') priv_srch_declared = srch.findall(content) priv_srch_declared = sorted(set(priv_srch_declared))