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);
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);

View File

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

View File

@ -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]; };

View File

@ -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"

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>
<Japanese>捕虜としてトグル</Japanese>
</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">
<English>Teleport Players</English>
<French>Téléporter joueurs</French>