mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Delay captivity until 0.05s after settings are initialized
This commit is contained in:
parent
fbcfbb92a6
commit
6523b715fe
@ -34,3 +34,10 @@ if (!hasInterface) exitWith {};
|
||||
["isNotEscorting", {!(GETVAR(_this select 0,GVAR(isEscorting),false))}] call EFUNC(common,addCanInteractWithCondition);
|
||||
["isNotHandcuffed", {!(GETVAR(_this select 0,GVAR(isHandcuffed),false))}] call EFUNC(common,addCanInteractWithCondition);
|
||||
["isNotSurrendering", {!(GETVAR(_this select 0,GVAR(isSurrendering),false))}] call EFUNC(common,addCanInteractWithCondition);
|
||||
|
||||
["SettingsInitialized", {
|
||||
// Hold on a little bit longer to ensure anims will work
|
||||
[{
|
||||
GVAR(captivityEnabled) = true;
|
||||
}, [], 0.05] call EFUNC(common,waitAndExecute);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -32,4 +32,6 @@ PREP(setSurrendered);
|
||||
PREP(vehicleCaptiveMoveIn);
|
||||
PREP(vehicleCaptiveMoveOut);
|
||||
|
||||
GVAR(captivityEnabled) = false;
|
||||
|
||||
ADDON = true;
|
||||
|
@ -24,12 +24,8 @@ TRACE_3("params",_logic,_units,_activated);
|
||||
if (!_activated) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
//Modules run before postInit can instal the event handler, so we need to wait a little bit
|
||||
[{
|
||||
params ["_units"];
|
||||
{
|
||||
{
|
||||
["SetHandcuffed", [_x], [_x, true]] call EFUNC(common,targetEvent);
|
||||
} forEach _units;
|
||||
}, [_units], 0.05] call EFUNC(common,waitAndExecute);
|
||||
} forEach _units;
|
||||
|
||||
deleteVehicle _logic;
|
||||
|
@ -24,12 +24,8 @@ TRACE_3("params",_logic,_units,_activated);
|
||||
if (!_activated) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
//Modules run before postInit can instal the event handler, so we need to wait a little bit
|
||||
[{
|
||||
params ["_units"];
|
||||
{
|
||||
{
|
||||
["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent);
|
||||
} forEach _units;
|
||||
}, [_units], 0.05] call EFUNC(common,waitAndExecute);
|
||||
} forEach _units;
|
||||
|
||||
deleteVehicle _logic;
|
||||
|
@ -22,6 +22,18 @@ TRACE_2("params",_unit,_state);
|
||||
if (!local _unit) exitWith {
|
||||
ERROR("running setHandcuffed on remote unit");
|
||||
};
|
||||
|
||||
if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith {
|
||||
// It's to soon to call this function, delay it
|
||||
if (EGVAR(common,settingsInitFinished)) then {
|
||||
// Settings are already initialized, but the small wait isn't over
|
||||
[DFUNC(setHandCuffed), _this, 0.05] call EFUNC(common,waitAndExecute);
|
||||
} else {
|
||||
// Settings are not initialized yet
|
||||
[DFUNC(setHandCuffed), _this] call EFUNC(common,runAfterSettingsInit);
|
||||
};
|
||||
};
|
||||
|
||||
if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith {
|
||||
ERROR("setHandcuffed: current state same as new");
|
||||
};
|
||||
|
@ -23,6 +23,17 @@ if (!local _unit) exitWith {
|
||||
ERROR("running surrender on remote unit");
|
||||
};
|
||||
|
||||
if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith {
|
||||
// It's to soon to call this function, delay it
|
||||
if (EGVAR(common,settingsInitFinished)) then {
|
||||
// Settings are already initialized, but the small wait isn't over
|
||||
[DFUNC(setSurrendered), _this, 0.05] call EFUNC(common,waitAndExecute);
|
||||
} else {
|
||||
// Settings are not initialized yet
|
||||
[DFUNC(setSurrendered), _this] call EFUNC(common,runAfterSettingsInit);
|
||||
};
|
||||
};
|
||||
|
||||
if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) exitWith {
|
||||
ERROR("Surrender: current state same as new");
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user