From b345db4ae9a4ca632cc7a23cd0a622131b02ae42 Mon Sep 17 00:00:00 2001 From: jonpas Date: Sun, 27 Sep 2015 00:29:19 +0200 Subject: [PATCH] Added Zeus modules for adding Spare Tracks and Wheels --- addons/zeus/CfgVehicles.hpp | 27 ++++++++++-- addons/zeus/XEH_preInit.sqf | 2 + addons/zeus/config.cpp | 7 ++++ .../functions/fnc_moduleAddSpareTrack.sqf | 41 +++++++++++++++++++ .../functions/fnc_moduleAddSpareWheel.sqf | 41 +++++++++++++++++++ addons/zeus/stringtable.xml | 22 +++++++++- 6 files changed, 135 insertions(+), 5 deletions(-) create mode 100644 addons/zeus/functions/fnc_moduleAddSpareTrack.sqf create mode 100644 addons/zeus/functions/fnc_moduleAddSpareWheel.sqf diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index e110970ae3..35c43b0e84 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -117,7 +117,7 @@ class CfgVehicles { }; class GVAR(moduleSetMedic): GVAR(moduleBase) { curatorCanAttach = 1; - displayName = CSTRING(ModuleSetMedic_displayName); + displayName = CSTRING(ModuleSetMedic_DisplayName); function = QFUNC(moduleSetMedic); icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); class ModuleDescription { @@ -127,7 +127,7 @@ class CfgVehicles { }; class GVAR(moduleSetMedicalVehicle): GVAR(moduleBase) { curatorCanAttach = 1; - displayName = CSTRING(ModuleSetMedicalVehicle_displayName); + displayName = CSTRING(ModuleSetMedicalVehicle_DisplayName); function = QFUNC(moduleSetMedicalVehicle); icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); class ModuleDescription { @@ -137,7 +137,7 @@ class CfgVehicles { }; class GVAR(moduleSetMedicalFacility): GVAR(moduleBase) { curatorCanAttach = 1; - displayName = CSTRING(ModuleSetMedicalFacility_displayName); + displayName = CSTRING(ModuleSetMedicalFacility_DisplayName); function = QFUNC(moduleSetMedicalFacility); icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); class ModuleDescription { @@ -145,4 +145,25 @@ class CfgVehicles { sync[] = {}; }; }; + + class GVAR(moduleAddSpareTrack): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleAddSpareTrack_DisplayName); + function = QFUNC(moduleAddSpareTrack); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa));//@todo + class ModuleDescription { + description = CSTRING(ModuleAddSpareTrack_Description); + sync[] = {}; + }; + }; + class GVAR(moduleAddSpareWheel): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleAddSpareWheel_DisplayName); + function = QFUNC(moduleAddSpareWheel); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa));//@todo + class ModuleDescription { + description = CSTRING(ModuleAddSpareWheel_Description); + sync[] = {}; + }; + }; }; diff --git a/addons/zeus/XEH_preInit.sqf b/addons/zeus/XEH_preInit.sqf index 5aee98c3f3..9837d7162b 100644 --- a/addons/zeus/XEH_preInit.sqf +++ b/addons/zeus/XEH_preInit.sqf @@ -8,6 +8,8 @@ PREP(bi_moduleMine); PREP(bi_moduleProjectile); PREP(bi_moduleRemoteControl); PREP(handleZeusUnitAssigned); +PREP(moduleAddSpareTrack); +PREP(moduleAddSpareWheel); PREP(moduleCaptive); PREP(moduleSetMedic); PREP(moduleSetMedicalVehicle); diff --git a/addons/zeus/config.cpp b/addons/zeus/config.cpp index 810ce17396..853edaf2e9 100644 --- a/addons/zeus/config.cpp +++ b/addons/zeus/config.cpp @@ -25,11 +25,18 @@ class CfgPatches { QGVAR(moduleSetMedicalFacility) }; }; + class GVAR(cargoAndRepair): ADDON { + units[] = { + QGVAR(moduleAddSpareTrack), + QGVAR(moduleAddSpareWheel) + }; + }; }; class ACE_Curator { GVAR(captives) = "ace_captives"; GVAR(medical) = "ace_medical"; + GVAR(cargoAndRepair[]) = {"ace_cargo", "ace_repair"}; }; #include "CfgEventHandlers.hpp" diff --git a/addons/zeus/functions/fnc_moduleAddSpareTrack.sqf b/addons/zeus/functions/fnc_moduleAddSpareTrack.sqf new file mode 100644 index 0000000000..3acb024476 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleAddSpareTrack.sqf @@ -0,0 +1,41 @@ +/* + * Author: Jonpas + * Adds a Spare Track to the vehicle. + * + * 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_cargo"] call EFUNC(common,isModLoaded) && ["ace_repair"] 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 { + if (getNumber (configFile >> "CfgVehicles" >> "ACE_Track" >> QEGVAR(cargo,size)) > [_mouseOverUnit] call EFUNC(cargo,getCargoSpaceLeft)) then { + [LSTRING(OnlyEnoughCargoSpace)] call EFUNC(common,displayTextStructured); + } else { + ["AddCargoByClass", ["ACE_Track", _mouseOverUnit, 1, true]] call EFUNC(common,localEvent); + }; + }; + }; +}; + +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleAddSpareWheel.sqf b/addons/zeus/functions/fnc_moduleAddSpareWheel.sqf new file mode 100644 index 0000000000..c353af189b --- /dev/null +++ b/addons/zeus/functions/fnc_moduleAddSpareWheel.sqf @@ -0,0 +1,41 @@ +/* + * Author: Jonpas + * Adds a Spare Wheel to the vehicle. + * + * 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_cargo"] call EFUNC(common,isModLoaded) && ["ace_repair"] 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 { + if (getNumber (configFile >> "CfgVehicles" >> "ACE_Wheel" >> QEGVAR(cargo,size)) > [_mouseOverUnit] call EFUNC(cargo,getCargoSpaceLeft)) then { + [LSTRING(OnlyEnoughCargoSpace)] call EFUNC(common,displayTextStructured); + } else { + ["AddCargoByClass", ["ACE_Wheel", _mouseOverUnit, 1, true]] call EFUNC(common,localEvent); + }; + }; + }; +}; + +deleteVehicle _logic; diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 46aadce4a2..6063f5011a 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -212,6 +212,18 @@ Přiřadit Zdravotnické Zařízení Asignar instalación médica + + Add Spare Wheel + + + Adds a Spare Wheel to the vehicle + + + Add Spare Track + + + Adds a Spare Track to the vehicle + Unit must be alive Utiliser uniquement sur une unité vivante @@ -250,6 +262,12 @@ Юнит должен быть транспортом La unidad debe ser un vehículo + + Unit must be a vehicle with cargo space + + + Unit must have cargo space left + Unit must not be captive Jednostka nie może być więźniem @@ -299,4 +317,4 @@ Añadir cualquier objeto creado a todos los directores en la misión - \ No newline at end of file +