Skip to content

Commit

Permalink
Add Zeus utility modules
Browse files Browse the repository at this point in the history
- Add categories to zeus modules to group them based on their functionality
- Add new utility modules:
  1. Toggle simulation
  2. Update editable objects
- Clean up some of the zeus module code (standardise function headers, camel case, etc.)
  • Loading branch information
RSpeekenbrink authored and kymckay committed Nov 15, 2016
1 parent 608f8bb commit 324bf68
Show file tree
Hide file tree
Showing 35 changed files with 288 additions and 74 deletions.
27 changes: 27 additions & 0 deletions addons/zeus/CfgFactionClasses.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class CfgFactionClasses {
class GVAR(AI) {
displayName = "ACE AI";
priority = 2;
side = 7;
};
class GVAR(Captive) {
displayName = "ACE Captive";
priority = 2;
side = 7;
};
class GVAR(Medical) {
displayName = "ACE Medical";
priority = 2;
side = 7;
};
class GVAR(Repair) {
displayName = "ACE Repair";
priority = 2;
side = 7;
};
class GVAR(Utility) {
displayName = "ACE Utility";
priority = 2;
side = 7;
};
};
27 changes: 27 additions & 0 deletions addons/zeus/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,82 +94,109 @@ class CfgVehicles {
};
class GVAR(moduleAddSpareTrack): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Repair);
displayName = CSTRING(ModuleAddSpareTrack_DisplayName);
function = QFUNC(moduleAddSpareTrack);
icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);//@todo
};
class GVAR(moduleAddSpareWheel): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Repair);
displayName = CSTRING(ModuleAddSpareWheel_DisplayName);
function = QFUNC(moduleAddSpareWheel);
icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);//@todo
};
class GVAR(moduleCaptive): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Captive);
displayName = CSTRING(ModuleCaptive_DisplayName);
function = QFUNC(moduleCaptive);
icon = QPATHTOF(UI\Icon_Module_Zeus_Captive_ca.paa);
};
class GVAR(moduleDefendArea): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(AI);
displayName = CSTRING(ModuleDefendArea_DisplayName);
curatorInfoType = QGVAR(RscDefendArea);
};
class GVAR(moduleEditableObjects): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Utility);
displayName = CSTRING(ModuleEditableObjects_DisplayName);
curatorInfoType = QGVAR(RscEditableObjects);
};
class GVAR(moduleGlobalSetSkill): GVAR(moduleBase) {
category = QGVAR(AI);
displayName = CSTRING(ModuleGlobalSetSkill_DisplayName);
curatorInfoType = QGVAR(RscGlobalSetSkill);
};
class GVAR(moduleGroupSide): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Utility);
displayName = CSTRING(ModuleGroupSide_DisplayName);
curatorInfoType = QGVAR(RscGroupSide);
};
class GVAR(modulePatrolArea): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(AI);
displayName = CSTRING(ModulePatrolArea_DisplayName);
curatorInfoType = QGVAR(RscPatrolArea);
};
class GVAR(moduleSearchArea): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(AI);
displayName = CSTRING(ModuleSearchArea_DisplayName);
curatorInfoType = QGVAR(RscSearchArea);
};
class GVAR(moduleSearchNearby): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(AI);
displayName = CSTRING(ModuleSearchNearby_DisplayName);
function = QFUNC(moduleSearchNearby);
};
class GVAR(moduleSetMedic): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Medical);
displayName = CSTRING(ModuleSetMedic_DisplayName);
function = QFUNC(moduleSetMedic);
icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);
};
class GVAR(moduleSetMedicalFacility): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Medical);
displayName = CSTRING(ModuleSetMedicalFacility_DisplayName);
function = QFUNC(moduleSetMedicalFacility);
icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);
};
class GVAR(moduleSetMedicalVehicle): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Medical);
displayName = CSTRING(ModuleSetMedicalVehicle_DisplayName);
function = QFUNC(moduleSetMedicalVehicle);
icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);
};
class GVAR(moduleSimulation): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Utility);
displayName = CSTRING(ModuleSimulation_DisplayName);
function = QFUNC(moduleSimulation);
};
class GVAR(moduleSurrender): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Captive);
displayName = CSTRING(ModuleSurrender_DisplayName);
function = QFUNC(moduleSurrender);
icon = QPATHTOF(UI\Icon_Module_Zeus_Surrender_ca.paa);
};
class GVAR(moduleTeleportPlayers): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Utility);
displayName = CSTRING(ModuleTeleportPlayers_DisplayName);
curatorInfoType = QGVAR(RscTeleportPlayers);
};
class GVAR(moduleUnconscious): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Medical);
displayName = CSTRING(ModuleUnconscious_DisplayName);
function = QFUNC(moduleUnconscious);
icon = QPATHTOF(UI\Icon_Module_Zeus_Unconscious_ca.paa);
Expand Down
2 changes: 2 additions & 0 deletions addons/zeus/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PREP(moduleSearchNearby);
PREP(moduleSetMedic);
PREP(moduleSetMedicalVehicle);
PREP(moduleSetMedicalFacility);
PREP(moduleSimulation);
PREP(moduleSurrender);
PREP(moduleTeleportPlayers);
PREP(moduleUnconscious);
Expand All @@ -22,6 +23,7 @@ PREP(ui_attributeCargo);
//PREP(ui_attributePosition);
PREP(ui_attributeRadius);
PREP(ui_defendArea);
PREP(ui_editableObjects);
PREP(ui_globalSetSkill);
PREP(ui_groupSide);
PREP(ui_patrolArea);
Expand Down
23 changes: 23 additions & 0 deletions addons/zeus/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,26 @@ QGVAR(GlobalSkillAI) addPublicVariableEventHandler FUNC(moduleGlobalSetSkill);
[QGVAR(modulePatrolArea), CBA_fnc_taskPatrol] call CBA_fnc_addEventHandler;
[QGVAR(moduleSearchNearby), CBA_fnc_searchNearby] call CBA_fnc_addEventHandler;
[QGVAR(moduleSearchArea), CBA_fnc_taskSearchArea] call CBA_fnc_addEventHandler;

// Editable object commands must be ran on server, this events are used in the respective module
if (isServer) then {
[QGVAR(addObjects), {
params ["_objects", ["_curator",objNull]];

if !(isNull _curator) exitWith { _curator addCuratorEditableObjects [_objects, true]; };

{
_x addCuratorEditableObjects [_objects, true];
} forEach allCurators;
}] call CBA_fnc_addEventHandler;

[QGVAR(removeObjects), {
params ["_objects", ["_curator",objNull]];

if !(isNull _curator) exitWith { _curator removeCuratorEditableObjects [_objects, true]; };

{
_x removeCuratorEditableObjects [_objects, true];
} forEach allCurators;
}] call CBA_fnc_addEventHandler;
};
3 changes: 3 additions & 0 deletions addons/zeus/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ class CfgPatches {
name = COMPONENT_NAME;
units[] = {
QGVAR(moduleDefendArea),
QGVAR(moduleEditableObjects),
QGVAR(moduleGlobalSetSkill),
QGVAR(moduleGroupSide),
QGVAR(modulePatrolArea),
QGVAR(moduleSearchArea),
QGVAR(moduleSearchNearby),
QGVAR(moduleSimulation),
QGVAR(moduleTeleportPlayers)
};
weapons[] = {};
Expand Down Expand Up @@ -49,6 +51,7 @@ class ACE_Curator {
GVAR(cargoAndRepair)[] = {"ace_cargo", "ace_repair"};
};

#include "CfgFactionClasses.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "ACE_Settings.hpp"
Expand Down
4 changes: 2 additions & 2 deletions addons/zeus/functions/fnc_bi_moduleCurator.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 2: activated <BOOL>
*
* Return Value:
* nil
* None
*
* Public: No
*/
Expand Down Expand Up @@ -98,7 +98,7 @@ if (_activated) then {
//--- Handle ownership
[_logic,_ownerVar,_ownerUID,_adminVar] spawn {
scriptname "BIS_fnc_moduleCurator: Owner";

params ["_logic", "_ownerVar", "_ownerUID", "_adminVar"];

if (_adminVar != "") then {_ownerVar = _adminVar;};
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_bi_moduleMine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* 2: activated <BOOL>
*
* Return Value:
* nil
* None
*
* Public: No
*/
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_bi_moduleProjectile.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 2: activated <BOOL>
*
* Return Value:
* nil
* None
*
* Public: No
*/
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* 2: activated <BOOL>
*
* Return Value:
* nil
* None
*
* Public: No
*/
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_handleZeusUnitAssigned.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* 1: The zeus player <UNIT>
*
* Return Value:
* nil
* None
*
* Public: No
*/
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleCaptive.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 2: Activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
Expand Down
5 changes: 1 addition & 4 deletions addons/zeus/functions/fnc_moduleGlobalSetSkill.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
* 1: Variable new value <ANY>
*
* Return Value:
* None <NIL>
*
* Example:
* "ace_zeus_GlobalSkillAI" addPublicVariableEventHandler ace_zeus_fnc_moduleGlobalSetSkill
* None
*
* Public: No
*/
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleGroupSide.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* 1: Chosen side <SIDE>
*
* Return Value:
* None <NIL>
* None
*
* Example:
* [this, west] call ace_zeus_fnc_moduleGroupSide
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleSearchNearby.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 2: Activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleSetMedic.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 2: Activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 2: Activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 2: Activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
Expand Down
27 changes: 27 additions & 0 deletions addons/zeus/functions/fnc_moduleSimulation.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Author: Fisher, SilentSpike
* Toggle Simulation on object.
*
* Arguments:
* 0: The module logic <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/

#include "script_component.hpp"

params ["_logic"];

if !(local _logic) exitWith {};

private _object = attachedTo _logic;
if (isNull _object) then {
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
} else {
[QEGVAR(common,enableSimulationGlobal), [_object, !(simulationEnabled _object)]] call CBA_fnc_serverEvent;
};

deleteVehicle _logic;
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleSurrender.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 2: Activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleTeleportPlayers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 2: Teleport group <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Example:
* [player, "5854854754", false] call ace_zeus_fnc_moduleTeleportPlayers
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleUnconscious.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 2: Activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
Expand Down
2 changes: 1 addition & 1 deletion addons/zeus/functions/fnc_moduleZeusSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 2: activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
Expand Down
Loading

0 comments on commit 324bf68

Please sign in to comment.