mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Move SelfActions from postInit to config (#6791)
* Move zeus SelfActions to config * Port CBA PR #1048 * Move Land_Camping_Light_off_F TurnOn action to config * Move createModule function to script func * Update addons/zeus/functions/fnc_canCreateModule.sqf Co-Authored-By: dedmen <dedmen@users.noreply.github.com> * Apply suggestions from code review Co-Authored-By: dedmen <dedmen@users.noreply.github.com> * Teaching it a lesson about spacing * Update CBA: script_macros_common.hpp * Just change admin in cba macro
This commit is contained in:
parent
9e609b3394
commit
48f45ae27a
@ -706,6 +706,30 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
|
||||
class Land_Camping_Light_off_F: ThingX {
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
displayName = CSTRING(MainAction);
|
||||
distance = 2;
|
||||
|
||||
// to make "Camping Lantern (Off)" be turned on we replace it with "Camping Lantern"
|
||||
class GVAR(TurnOn) {
|
||||
displayName = CSTRING(TurnOn);
|
||||
icon = "\A3\Ui_f\data\IGUI\Cfg\VehicleToggles\LightsIconOn_ca.paa";
|
||||
condition = QUOTE(alive _target);
|
||||
statement = QUOTE(\
|
||||
private _position = getPosATL _target;\
|
||||
private _vectorDirAndUp = [ARR_2(vectorDir _target,vectorUp _target)];\
|
||||
deleteVehicle _target;\
|
||||
private _newLamp = 'Land_Camping_Light_F' createVehicle [ARR_3(0,0,0)];\
|
||||
_newLamp setPosATL _position;\
|
||||
_newLamp setVectorDirAndUp _vectorDirAndUp;\
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class RoadCone_F: ThingX {
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
|
@ -135,21 +135,3 @@ GVAR(isOpeningDoor) = false;
|
||||
}];
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
||||
// to make "Camping Lantern (Off)" be turned on we replace it with "Camping Lantern"
|
||||
private _action = [
|
||||
QGVAR(TurnOn),
|
||||
localize LSTRING(TurnOn),
|
||||
"\A3\Ui_f\data\IGUI\Cfg\VehicleToggles\LightsIconOn_ca.paa",
|
||||
{
|
||||
private _position = getPosATL _target;
|
||||
private _vectorDirAndUp = [vectorDir _target, vectorUp _target];
|
||||
deleteVehicle _target;
|
||||
private _newLamp = "Land_Camping_Light_F" createVehicle [0,0,0];
|
||||
_newLamp setPosATL _position;
|
||||
_newLamp setVectorDirAndUp _vectorDirAndUp;
|
||||
},
|
||||
{alive _target}
|
||||
] call EFUNC(interact_menu,createAction);
|
||||
["Land_Camping_Light_off_F", 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass);
|
||||
|
@ -324,4 +324,27 @@ class CfgVehicles {
|
||||
class ModuleArsenal_F: Module_F {
|
||||
function=QFUNC(bi_moduleArsenal);
|
||||
};
|
||||
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class GVAR(create) {
|
||||
displayName = CSTRING(CreateZeus);
|
||||
condition = QUOTE(call FUNC(canCreateModule));
|
||||
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
|
||||
//Set GVAR(zeus) to null first to disable the action through the isNil check
|
||||
statement = QUOTE(GVAR(zeus) = objNull; [ARR_2(QQGVAR(createZeus), ACE_player)] call CBA_fnc_serverEvent);
|
||||
showDisabled = 1;
|
||||
icon = "\A3\Ui_F_Curator\Data\Logos\arma3_curator_eye_32_ca.paa";
|
||||
};
|
||||
class GVAR(delete) {
|
||||
displayName = CSTRING(DeleteZeus);
|
||||
condition = QUOTE(!(isNil QQGVAR(zeus) || {isNull GVAR(zeus)}));
|
||||
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
|
||||
statement = QUOTE(deleteVehicle GVAR(zeus); GVAR(zeus) = nil);
|
||||
showDisabled = 1;
|
||||
icon = "\A3\Ui_F_Curator\Data\Logos\arma3_curator_eye_32_ca.paa";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -5,6 +5,7 @@ PREP(bi_moduleCurator);
|
||||
PREP(bi_moduleMine);
|
||||
PREP(bi_moduleProjectile);
|
||||
PREP(bi_moduleRemoteControl);
|
||||
PREP(canCreateModule);
|
||||
PREP(getModuleDestination);
|
||||
PREP(handleZeusUnitAssigned);
|
||||
PREP(moduleAddArsenal);
|
||||
|
@ -81,42 +81,4 @@ if (hasInterface) then {
|
||||
GVAR(zeus) = _zeus;
|
||||
[localize "str_a3_cfgvehicles_moduletasksetstate_f_arguments_state_values_created_0"] call EFUNC(common,displayTextStructured);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[QEGVAR(interact_menu,newControllableObject), {
|
||||
params ["_type"];
|
||||
if (!(_type isKindOf "CAManBase")) exitWith {};
|
||||
TRACE_1("Adding zeus actions",_type);
|
||||
|
||||
private _action = [
|
||||
QGVAR(create),
|
||||
LLSTRING(CreateZeus),
|
||||
"\A3\Ui_F_Curator\Data\Logos\arma3_curator_eye_32_ca.paa",
|
||||
{
|
||||
GVAR(zeus) = objNull; // to disable menu while zeus is being created
|
||||
[QGVAR(createZeus), ACE_player] call CBA_fnc_serverEvent;
|
||||
},
|
||||
{
|
||||
switch (GVAR(canCreateZeus)) do {
|
||||
case CAN_CREATE_ADMIN: {isServer || {IS_ADMIN_LOGGED}};
|
||||
case CAN_CREATE_CONSOLE: {call BIS_fnc_isDebugConsoleAllowed};
|
||||
case CAN_CREATE_ALL: {true};
|
||||
default {false};
|
||||
}
|
||||
&& {isNil QGVAR(zeus)}
|
||||
}
|
||||
] call EFUNC(interact_menu,createAction);
|
||||
[_type, 1, ["ACE_SelfActions"], _action] call EFUNC(interact_menu,addActionToClass);
|
||||
|
||||
_action = [
|
||||
QGVAR(delete),
|
||||
LLSTRING(DeleteZeus),
|
||||
"\A3\Ui_F_Curator\Data\Logos\arma3_curator_eye_32_ca.paa",
|
||||
{
|
||||
deleteVehicle GVAR(zeus);
|
||||
GVAR(zeus) = nil;
|
||||
},
|
||||
{!(isNil QGVAR(zeus) || {isNull GVAR(zeus)})}
|
||||
] call EFUNC(interact_menu,createAction);
|
||||
[_type, 1, ["ACE_SelfActions"], _action] call EFUNC(interact_menu,addActionToClass);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
|
25
addons/zeus/functions/fnc_canCreateModule.sqf
Normal file
25
addons/zeus/functions/fnc_canCreateModule.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Dystopian
|
||||
* Check whether local player is currently allowed to create a Zeus Module
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* Allowed to create module <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* call ace_zeus_fnc_canCreateModule
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
isNil QQGVAR(zeus) && {
|
||||
switch (GVAR(canCreateZeus)) do {
|
||||
case CAN_CREATE_ADMIN: {isServer || {IS_ADMIN_LOGGED}};
|
||||
case CAN_CREATE_CONSOLE: {call BIS_fnc_isDebugConsoleAllowed};
|
||||
case CAN_CREATE_ALL: {true};
|
||||
default {false};
|
||||
}
|
||||
}
|
@ -1707,7 +1707,8 @@ Example:
|
||||
Author:
|
||||
commy2
|
||||
------------------------------------------- */
|
||||
#define IS_ADMIN serverCommandAvailable "#kick"
|
||||
#define IS_ADMIN_SYS(x) x##kick
|
||||
#define IS_ADMIN serverCommandAvailable 'IS_ADMIN_SYS(#)'
|
||||
|
||||
/* -------------------------------------------
|
||||
Macro: IS_ADMIN_LOGGED
|
||||
@ -1727,7 +1728,8 @@ Example:
|
||||
Author:
|
||||
commy2
|
||||
------------------------------------------- */
|
||||
#define IS_ADMIN_LOGGED serverCommandAvailable "#shutdown"
|
||||
#define IS_ADMIN_LOGGED_SYS(x) x##shutdown
|
||||
#define IS_ADMIN_LOGGED serverCommandAvailable 'IS_ADMIN_LOGGED_SYS(#)'
|
||||
|
||||
/* -------------------------------------------
|
||||
Macro: FILE_EXISTS
|
||||
|
Loading…
Reference in New Issue
Block a user