mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #3362 from acemod/delayedCaptivity
Delay captivity until 0.05s after settings are initialized
This commit is contained in:
commit
84ba6f29f2
@ -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;
|
||||
|
@ -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