mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
added PM's solution
This commit is contained in:
parent
e14d49393a
commit
40e422f95a
@ -3,10 +3,10 @@ class Extended_PreInit_EventHandlers {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
|
||||
};
|
||||
};
|
||||
/*
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) );
|
||||
};
|
||||
};
|
||||
*/
|
||||
|
||||
|
@ -16,28 +16,13 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
/*
|
||||
|
||||
DFUNC(pfhClientInit) = {
|
||||
|
||||
if (GVAR(EnableSwitchUnits)) exitWith {
|
||||
|
||||
private ["_sides"];
|
||||
_sides = [];
|
||||
|
||||
if(GVAR(SwitchToWest)) then {_sides pushBack west;};
|
||||
if(GVAR(SwitchToEast)) then {_sides pushBack east;};
|
||||
if(GVAR(SwitchToIndependent)) then {_sides pushBack independent;};
|
||||
if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian;};
|
||||
|
||||
if (player getVariable ["ACE_CanSwitchUnits", false]) then {
|
||||
[player, _sides] call FUNC(initPlayer);
|
||||
if (missionNamespace getVariable [QGVAR(EnableSwitchUnits), false]) then {
|
||||
[player] call FUNC(startSwitchUnits);
|
||||
} else {
|
||||
["SettingChanged", {
|
||||
PARAMS_2(_name,_value);
|
||||
if ((_name == QGVAR(EnableSwitchUnits)) && {_value}) then {
|
||||
[player] call FUNC(startSwitchUnits);
|
||||
};
|
||||
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
}] call FUNC(addEventhandler);
|
||||
};
|
||||
|
||||
[FUNC(pfhClientInit), 0.5, []] call cba_fnc_addPerFrameHandler;
|
||||
|
||||
*/
|
||||
|
@ -9,6 +9,7 @@ PREP(isValidAi);
|
||||
PREP(markAiOnMap);
|
||||
PREP(module);
|
||||
PREP(nearestPlayers);
|
||||
PREP(startSwitchUnits);
|
||||
PREP(switchBack);
|
||||
PREP(switchUnit);
|
||||
|
||||
|
@ -37,17 +37,3 @@ GVAR(Module) = true;
|
||||
[QGVAR(EnableSwitchUnits), true, false, true] call EFUNC(common,setSetting);
|
||||
|
||||
diag_log text "[ACE]: SwitchUnits Module Initialized.";
|
||||
|
||||
if (GVAR(EnableSwitchUnits)) then {
|
||||
private ["_sides"];
|
||||
_sides = [];
|
||||
|
||||
if(GVAR(SwitchToWest)) then {_sides pushBack west;};
|
||||
if(GVAR(SwitchToEast)) then {_sides pushBack east;};
|
||||
if(GVAR(SwitchToIndependent)) then {_sides pushBack independent;};
|
||||
if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian;};
|
||||
|
||||
if (player getVariable ["ACE_CanSwitchUnits", false]) then {
|
||||
[player, _sides] call FUNC(initPlayer);
|
||||
};
|
||||
};
|
||||
|
33
addons/switchunits/functions/fnc_startSwitchUnits.sqf
Normal file
33
addons/switchunits/functions/fnc_startSwitchUnits.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Author: bux578
|
||||
* Starts the SwitchUnits functionality
|
||||
*
|
||||
* Arguments:
|
||||
* 0: player <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_player] call FUNC(startSwitchUnits)
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_1_PVT[_this,_player];
|
||||
|
||||
if (GVAR(EnableSwitchUnits)) then {
|
||||
private ["_sides"];
|
||||
_sides = [];
|
||||
|
||||
if(GVAR(SwitchToWest)) then {_sides pushBack west;};
|
||||
if(GVAR(SwitchToEast)) then {_sides pushBack east;};
|
||||
if(GVAR(SwitchToIndependent)) then {_sides pushBack independent;};
|
||||
if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian;};
|
||||
|
||||
if (_player getVariable ["ACE_CanSwitchUnits", false]) then {
|
||||
[_player, _sides] call FUNC(initPlayer);
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user