-
Notifications
You must be signed in to change notification settings - Fork 738
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
Add Zeus utility modules #4661
Changes from 11 commits
51de0bd
d2638cf
9332101
d27c68c
1683b5d
f329405
7037676
2398ac9
5a87acf
aa3289d
221d0ae
40ba9ef
7868eaf
be7c4d6
4b690e8
a1ebaed
dd85fcb
59ef96c
1c73355
30c694d
aab2cb7
438255a
008bb40
6c6bb58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class CfgFactionClasses { | ||
class ACE_UI_Util { | ||
displayName = "ACE Util"; | ||
priority = 2; | ||
side = 7; | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Author: Fisher | ||
* 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(NoObjectSelected)] call EFUNC(common,displayTextStructured); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't it so that it runs on both server & local? @SilentSpike There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 { | ||
private _simulationEnabled = simulationEnabled _object; | ||
_object enableSimulationGlobal (!_simulationEnabled); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tab. should be four spaces to let travis pass |
||
}; | ||
|
||
deleteVehicle _logic; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. white space here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. white space There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. white space : ( |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Author: Fisher | ||
* Adds all objects in given radius to all curators. | ||
* | ||
* Arguments: | ||
* 0: Dummy controls group <CONTROL> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Public: No | ||
*/ | ||
|
||
#include "script_component.hpp" | ||
|
||
disableSerialization; | ||
|
||
params ["_control"]; | ||
private _display = ctrlParent _control; | ||
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); | ||
|
||
_control ctrlRemoveAllEventHandlers "setFocus"; | ||
|
||
scopeName "Main"; | ||
private _fnc_errorAndClose = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. function seems to be unused, remove? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, will be unnecessary for this module to validate anything 👍 |
||
params ["_msg"]; | ||
_display closeDisplay 0; | ||
deleteVehicle _logic; | ||
[_msg] call EFUNC(common,displayTextStructured); | ||
breakOut "Main"; | ||
}; | ||
|
||
private _fnc_onUnload = { | ||
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); | ||
if (isNull _logic) exitWith {}; | ||
|
||
if (_this select 1 == 2) then { | ||
deleteVehicle _logic; | ||
}; | ||
}; | ||
|
||
private _fnc_onConfirm = { | ||
params [["_ctrlButtonOK", controlNull, [controlNull]]]; | ||
|
||
private _display = ctrlparent _ctrlButtonOK; | ||
if (isNull _display) exitWith {}; | ||
|
||
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); | ||
if (isNull _logic) exitWith {}; | ||
|
||
private _radius = GETVAR(_display,GVAR(radius),50); | ||
private _position = GETVAR(_display,GVAR(position),getPos _logic); | ||
private _objectsToAdd = nearestObjects [_position, ["All"], _radius]; | ||
|
||
{ | ||
_x addCuratorEditableObjects [_objectsToAdd, true]; | ||
} forEach allCurators; | ||
|
||
deleteVehicle _logic; | ||
}; | ||
|
||
_display displayAddEventHandler ["unload", _fnc_onUnload]; | ||
_control ctrlAddEventHandler ["buttonClick", _fnc_onConfirm]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Author: Fisher | ||
* Removes all objects in given radius for all curators. | ||
* | ||
* Arguments: | ||
* 0: Dummy controls group <CONTROL> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Public: No | ||
*/ | ||
|
||
#include "script_component.hpp" | ||
|
||
disableSerialization; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SilentSpike There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These UI initialisation functions will stem from an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If they don't run in scheduled environment, then |
||
|
||
params ["_control"]; | ||
private _display = ctrlParent _control; | ||
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); | ||
|
||
_control ctrlRemoveAllEventHandlers "setFocus"; | ||
|
||
scopeName "Main"; | ||
private _fnc_errorAndClose = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
params ["_msg"]; | ||
_display closeDisplay 0; | ||
deleteVehicle _logic; | ||
[_msg] call EFUNC(common,displayTextStructured); | ||
breakOut "Main"; | ||
}; | ||
|
||
private _fnc_onUnload = { | ||
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); | ||
if (isNull _logic) exitWith {}; | ||
|
||
if (_this select 1 == 2) then { | ||
deleteVehicle _logic; | ||
}; | ||
}; | ||
|
||
private _fnc_onConfirm = { | ||
params [["_ctrlButtonOK", controlNull, [controlNull]]]; | ||
|
||
private _display = ctrlparent _ctrlButtonOK; | ||
if (isNull _display) exitWith {}; | ||
|
||
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); | ||
if (isNull _logic) exitWith {}; | ||
|
||
private _radius = GETVAR(_display,GVAR(radius),50); | ||
private _position = GETVAR(_display,GVAR(position),getPos _logic); | ||
private _objectsToAdd = nearestObjects [_position, ["All"], _radius]; | ||
|
||
{ | ||
_x removeCuratorEditableObjects [_objectsToAdd, true]; | ||
} forEach allCurators; | ||
|
||
deleteVehicle _logic; | ||
}; | ||
|
||
_display displayAddEventHandler ["unload", _fnc_onUnload]; | ||
_control ctrlAddEventHandler ["buttonClick", _fnc_onConfirm]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SilentSpike
So this function runs everywhere... Which machine is the module local to? Server or Zeus client? Shouldn't this be a
isServer
check for simplicity regardless?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Module will be local to zeus client. However in the case of this module, we may want to actually exploit the module framework and make it only run on the server (then use the simulationGlobal command).
To do so, in the module's cfgVehicles entry you simple set
isGlobal = 0;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and remove this locality check yes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then make the command instead of
enableSimulationGlobal
justenableSimulation
?