Add Zeus Module for FRIES (#4597)

* Initial commit

* Revert unrelated changes

* Add newline

* Fix undefined var, localize text

* Shorten strings, add missing parameters

* Fix logical error

* Fix capitalization, Update string, Only add EH on server

* Add missing uses of the private command

* Remove excess formatting

* Add module category
This commit is contained in:
Ozan Eğitmen 2016-12-15 07:55:06 +02:00 committed by PabstMirror
parent c009000bd9
commit ef4d289836
6 changed files with 80 additions and 4 deletions

View File

@ -106,6 +106,12 @@ class CfgVehicles {
function = QFUNC(moduleAddSpareWheel); function = QFUNC(moduleAddSpareWheel);
icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);//@todo 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) { class GVAR(moduleCaptive): GVAR(moduleBase) {
curatorCanAttach = 1; curatorCanAttach = 1;
category = QGVAR(Captive); category = QGVAR(Captive);

View File

@ -7,6 +7,7 @@ PREP(bi_moduleRemoteControl);
PREP(handleZeusUnitAssigned); PREP(handleZeusUnitAssigned);
PREP(moduleAddSpareTrack); PREP(moduleAddSpareTrack);
PREP(moduleAddSpareWheel); PREP(moduleAddSpareWheel);
PREP(moduleAddOrRemoveFRIES);
PREP(moduleCaptive); PREP(moduleCaptive);
PREP(moduleGlobalSetSkill); PREP(moduleGlobalSetSkill);
PREP(moduleGroupSide); PREP(moduleGroupSide);

View File

@ -2,7 +2,7 @@
["ace_settingsInitialized",{ ["ace_settingsInitialized",{
// Only add an InitPost EH if setting is enabled (and apply retroactively) // 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; ["AllVehicles", "InitPost", FUNC(addObjectToCurator), true, [], true] call CBA_fnc_addClassEventHandler;
}; };
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
@ -17,6 +17,7 @@ QGVAR(GlobalSkillAI) addPublicVariableEventHandler FUNC(moduleGlobalSetSkill);
// Editable object commands must be ran on server, this events are used in the respective module // Editable object commands must be ran on server, this events are used in the respective module
if (isServer) then { if (isServer) then {
[QGVAR(equipFries), EFUNC(fastroping,equipFRIES)] call CBA_fnc_addEventHandler;
[QGVAR(addObjects), { [QGVAR(addObjects), {
params ["_objects", ["_curator", objNull]]; params ["_objects", ["_curator", objNull]];

View File

@ -22,7 +22,7 @@ class CfgPatches {
url = ECSTRING(main,URL); url = ECSTRING(main,URL);
VERSION_CONFIG; VERSION_CONFIG;
}; };
// Use additional cfgPatches to contextually remove modules from zeus // Use additional CfgPatches to contextually remove modules from zeus
class GVAR(captives): ADDON { class GVAR(captives): ADDON {
units[] = { units[] = {
QGVAR(moduleCaptive), QGVAR(moduleCaptive),
@ -43,12 +43,18 @@ class CfgPatches {
QGVAR(moduleAddSpareWheel) QGVAR(moduleAddSpareWheel)
}; };
}; };
class GVAR(fastroping): ADDON {
units[] = {
QGVAR(moduleAddOrRemoveFRIES)
};
};
}; };
class ACE_Curator { class ACE_Curator {
GVAR(captives) = "ace_captives"; GVAR(captives) = "ace_captives";
GVAR(medical) = "ace_medical"; GVAR(medical) = "ace_medical";
GVAR(cargoAndRepair)[] = {"ace_cargo", "ace_repair"}; GVAR(cargoAndRepair)[] = {"ace_cargo", "ace_repair"};
GVAR(fastroping) = "ace_fastroping";
}; };
#include "CfgFactionClasses.hpp" #include "CfgFactionClasses.hpp"

View File

@ -0,0 +1,53 @@
/*
* Author: 654wak654
* Add/Removes FRIES from a helicopter.
*
* Arguments:
* 0: The module logic <OBJECT>
* 1: Synchronized units <ARRAY>
* 2: Activated <BOOL>
*
* 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;

View File

@ -393,6 +393,15 @@
<Italian>Apri Resa</Italian> <Italian>Apri Resa</Italian>
<Japanese>捕虜としてトグル</Japanese> <Japanese>捕虜としてトグル</Japanese>
</Key> </Key>
<Key ID="STR_ACE_Zeus_ModuleAddOrRemoveFRIES_DisplayName">
<English>Add/Remove FRIES</English>
</Key>
<Key ID="STR_ACE_Zeus_NotFastRopeCompatible">
<English>%1 is not fastrope compatible.</English>
</Key>
<Key ID="STR_ACE_Zeus_CantRemoveFRIES">
<English>Unable to remove FRIES, ropes are deployed.</English>
</Key>
<Key ID="STR_ACE_Zeus_ModuleTeleportPlayers_DisplayName"> <Key ID="STR_ACE_Zeus_ModuleTeleportPlayers_DisplayName">
<English>Teleport Players</English> <English>Teleport Players</English>
<French>Téléporter joueurs</French> <French>Téléporter joueurs</French>