Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Zeus utility modules #4661

Merged
merged 24 commits into from
Nov 15, 2016
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
51de0bd
Merge remote-tracking branch 'refs/remotes/acemod/master'
RSpeekenbrink Nov 11, 2016
d2638cf
Added Zeus Module: Simulation
RSpeekenbrink Nov 11, 2016
9332101
Added AddObjects and Remove Objects & ACE Util Category
RSpeekenbrink Nov 12, 2016
d27c68c
Removed Tabs
RSpeekenbrink Nov 12, 2016
1683b5d
Merge remote-tracking branch 'refs/remotes/acemod/master' into ZeusUtil
RSpeekenbrink Nov 12, 2016
f329405
Code Cleanup
RSpeekenbrink Nov 12, 2016
7037676
Fix array in fnc_moduleSimulation.sqf
RSpeekenbrink Nov 12, 2016
2398ac9
Tab and Newline Cleanup
RSpeekenbrink Nov 12, 2016
5a87acf
Filename Upercase on remote fix (fnc_removeObjects)
RSpeekenbrink Nov 12, 2016
aa3289d
Filename Upercase on remote fix (fnc_addObjects)
RSpeekenbrink Nov 12, 2016
221d0ae
Reduce network traffic of toggle simulation module
kymckay Nov 12, 2016
40ba9ef
Edited functions to meet Review
RSpeekenbrink Nov 12, 2016
7868eaf
Merge remote-tracking branch 'origin/ZeusUtil' into ZeusUtil
RSpeekenbrink Nov 12, 2016
be7c4d6
Remove fnc_errorAndClose from fnc_ui_addObjects.sqf
RSpeekenbrink Nov 12, 2016
4b690e8
Remove White Space from fnc_moduleSImulation
RSpeekenbrink Nov 12, 2016
a1ebaed
_fnc_errorAndClose & removed from fnc_ui_removeObjects
RSpeekenbrink Nov 12, 2016
dd85fcb
Space @ EOF removed :)
RSpeekenbrink Nov 12, 2016
59ef96c
simplified code (Tested in MP & SP)
RSpeekenbrink Nov 12, 2016
1c73355
Merge add/remove editable objects zeus modules
kymckay Nov 12, 2016
30c694d
Clean up ace_zeus
kymckay Nov 12, 2016
aab2cb7
Clean up some camel case
kymckay Nov 12, 2016
438255a
Remove disableSerialization from fnc_ui_editableObjects
RSpeekenbrink Nov 12, 2016
008bb40
Fix zeus feedback of toggle simulation module
kymckay Nov 13, 2016
6c6bb58
Remove unnecessary `disableSerialization` usage
kymckay Nov 13, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
};
};
28 changes: 28 additions & 0 deletions addons/zeus/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,82 +94,110 @@ 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);
isGlobal = 0;
};
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"];

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

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

[QGVAR(removeObjects), {
params ["_objects", "_curator"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SilentSpike
Do you mean:
params ["_objects", ["_curator", objNull]];
so that the exitWith thing works as alternative syntax?
Alternativeley change !isNull _curator to !isNil "_curator"

same above

Copy link
Contributor

@commy2 commy2 Nov 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that this works anyway (at least in unscheduled env.) due to isNull silently failing when _curator is undefined, but I still think relying on this SQF ... "feature" is bad design.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch commy, I don't know why I totally forgot params can supply a default value when writing this 👍


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
25 changes: 25 additions & 0 deletions addons/zeus/functions/fnc_moduleSimulation.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Author: Fisher
* Toggle Simulation on object (runs on server only via module framework).
*
* Arguments:
* 0: The module logic <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/

#include "script_component.hpp"

params ["_logic"];

private _object = attachedTo _logic;
if (isNull _object) then {
[LSTRING(NoObjectSelected)] call EFUNC(common,displayTextStructured);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this script does indeed only run on the server, then why does it show a text there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it so that it runs on both server & local? @SilentSpike

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a good catch, hmm, I suppose it probably should run on the client and then send an event to the server so that this client feedback can be given.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not optimal in terms of minimising network traffic, but much better UX for zeus and also these modules are only running when prompted by zeus anyway so it's not a big deal.

} else {
_object enableSimulationGlobal !(simulationEnabled _object);
};

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