diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index 22d827e16f..c7111e42bc 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -106,6 +106,12 @@ class CfgVehicles { function = QFUNC(moduleAddSpareWheel); icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);//@todo }; + class GVAR(moduleAddOrRemoveFRIES): GVAR(moduleBase) { + curatorCanAttach = 1; + category = QGVAR(Utility); + displayName = CSTRING(ModuleAddOrRemoveFRIES_DisplayName); + function = QFUNC(moduleAddOrRemoveFRIES); + }; class GVAR(moduleCaptive): GVAR(moduleBase) { curatorCanAttach = 1; category = QGVAR(Captive); diff --git a/addons/zeus/XEH_PREP.hpp b/addons/zeus/XEH_PREP.hpp index 4a54c03920..a04b0a6d2c 100644 --- a/addons/zeus/XEH_PREP.hpp +++ b/addons/zeus/XEH_PREP.hpp @@ -7,6 +7,7 @@ PREP(bi_moduleRemoteControl); PREP(handleZeusUnitAssigned); PREP(moduleAddSpareTrack); PREP(moduleAddSpareWheel); +PREP(moduleAddOrRemoveFRIES); PREP(moduleCaptive); PREP(moduleGlobalSetSkill); PREP(moduleGroupSide); diff --git a/addons/zeus/XEH_postInit.sqf b/addons/zeus/XEH_postInit.sqf index 1ddcaf30d8..44bd406552 100644 --- a/addons/zeus/XEH_postInit.sqf +++ b/addons/zeus/XEH_postInit.sqf @@ -2,7 +2,7 @@ ["ace_settingsInitialized",{ // Only add an InitPost EH if setting is enabled (and apply retroactively) - if (isServer && GVAR(autoAddObjects)) then { + if (isServer && {GVAR(autoAddObjects)}) then { ["AllVehicles", "InitPost", FUNC(addObjectToCurator), true, [], true] call CBA_fnc_addClassEventHandler; }; }] call CBA_fnc_addEventHandler; @@ -17,8 +17,9 @@ QGVAR(GlobalSkillAI) addPublicVariableEventHandler FUNC(moduleGlobalSetSkill); // Editable object commands must be ran on server, this events are used in the respective module if (isServer) then { + [QGVAR(equipFries), EFUNC(fastroping,equipFRIES)] call CBA_fnc_addEventHandler; [QGVAR(addObjects), { - params ["_objects", ["_curator",objNull]]; + params ["_objects", ["_curator", objNull]]; if !(isNull _curator) exitWith { _curator addCuratorEditableObjects [_objects, true]; }; @@ -28,7 +29,7 @@ if (isServer) then { }] call CBA_fnc_addEventHandler; [QGVAR(removeObjects), { - params ["_objects", ["_curator",objNull]]; + params ["_objects", ["_curator", objNull]]; if !(isNull _curator) exitWith { _curator removeCuratorEditableObjects [_objects, true]; }; diff --git a/addons/zeus/config.cpp b/addons/zeus/config.cpp index 84659b0641..248d2af71c 100644 --- a/addons/zeus/config.cpp +++ b/addons/zeus/config.cpp @@ -22,7 +22,7 @@ class CfgPatches { url = ECSTRING(main,URL); VERSION_CONFIG; }; - // Use additional cfgPatches to contextually remove modules from zeus + // Use additional CfgPatches to contextually remove modules from zeus class GVAR(captives): ADDON { units[] = { QGVAR(moduleCaptive), @@ -43,12 +43,18 @@ class CfgPatches { QGVAR(moduleAddSpareWheel) }; }; + class GVAR(fastroping): ADDON { + units[] = { + QGVAR(moduleAddOrRemoveFRIES) + }; + }; }; class ACE_Curator { GVAR(captives) = "ace_captives"; GVAR(medical) = "ace_medical"; GVAR(cargoAndRepair)[] = {"ace_cargo", "ace_repair"}; + GVAR(fastroping) = "ace_fastroping"; }; #include "CfgFactionClasses.hpp" diff --git a/addons/zeus/functions/fnc_moduleAddOrRemoveFRIES.sqf b/addons/zeus/functions/fnc_moduleAddOrRemoveFRIES.sqf new file mode 100644 index 0000000000..5c8998b767 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleAddOrRemoveFRIES.sqf @@ -0,0 +1,53 @@ +/* + * Author: 654wak654 + * Add/Removes FRIES from a helicopter. + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; + +if !(_activated && {local _logic}) exitWith {}; + +if !(["ace_fastroping"] call EFUNC(common,isModLoaded)) then { + [LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured); +} else { + (GETMVAR(BIS_fnc_curatorObjectPlaced_mouseOver,[""])) params ["_mouseOverType", "_mouseOverUnit"]; + + if (_mouseOverType != "OBJECT") then { + [LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured); + } else { + if !(alive _mouseOverUnit) then { + [LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured); + } else { + private _config = configFile >> "CfgVehicles" >> typeOf _mouseOverUnit; + private _displayName = getText (_config >> "displayName"); + if !(isNumber (_config >> QEGVAR(fastroping,enabled))) then { + [[LSTRING(NotFastRopeCompatible), _displayName]] call EFUNC(common,displayTextStructured); + } else { + private _fries = GETVAR(_mouseOverUnit,EGVAR(fastroping,FRIES),objNull); + if (isNull _fries) then { + [QGVAR(equipFries), [_mouseOverUnit]] call CBA_fnc_serverEvent; + } else { + if ([_mouseOverUnit] call EFUNC(fastroping,canCutRopes)) then { + [[LSTRING(CantRemoveFRIES), _displayName]] call EFUNC(common,displayTextStructured); + } else { + [_mouseOverUnit] call EFUNC(fastroping,cutRopes); + deleteVehicle _fries; + }; + }; + }; + }; + }; +}; + +deleteVehicle _logic; diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 5ae5014139..ed85bd3377 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -393,6 +393,15 @@ Apri Resa 捕虜としてトグル + + Add/Remove FRIES + + + %1 is not fastrope compatible. + + + Unable to remove FRIES, ropes are deployed. + Teleport Players Téléporter joueurs