mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Surrender Fixes
Remove XEH GetIn and use vehicleChanged Event Handle Zeus (showHUD) Attempt to handle failed animation change
This commit is contained in:
parent
25645c2ae9
commit
dec34b4b30
@ -10,15 +10,6 @@ class Extended_PostInit_EventHandlers {
|
||||
};
|
||||
};
|
||||
|
||||
//release escorted captive when entering a vehicle
|
||||
class Extended_GetIn_EventHandlers {
|
||||
class All {
|
||||
class GVAR(AutoDetachCaptive) {
|
||||
getIn = QUOTE(_this call FUNC(handleGetIn));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//reset captive animation after leaving vehicle
|
||||
class Extended_GetOut_EventHandlers {
|
||||
class All {
|
||||
@ -45,4 +36,3 @@ class Extended_InitPost_EventHandlers {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -21,6 +21,9 @@ if (isServer) then {
|
||||
}];
|
||||
};
|
||||
|
||||
["playerVehicleChanged", {_this call FUNC(handleVehicleChanged)}] call EFUNC(common,addEventHandler);
|
||||
["zeusDisplayChanged", {_this call FUNC(handleZeusDisplayChanged)}] call EFUNC(common,addEventHandler);
|
||||
|
||||
//TODO: Medical Integration Events???
|
||||
|
||||
// [_unit, "knockedOut", {
|
||||
|
@ -16,12 +16,13 @@ PREP(doFriskPerson);
|
||||
PREP(doLoadCaptive);
|
||||
PREP(doRemoveHandcuffs);
|
||||
PREP(doUnloadCaptive);
|
||||
PREP(handleGetIn);
|
||||
PREP(handleGetOut);
|
||||
PREP(handleKilled);
|
||||
PREP(handleKnockedOut);
|
||||
PREP(handlePlayerChanged);
|
||||
PREP(handleUnitInitPost);
|
||||
PREP(handleVehicleChanged);
|
||||
PREP(handleZeusDisplayChanged);
|
||||
PREP(handleWokeUp);
|
||||
PREP(moduleSurrender);
|
||||
PREP(setHandcuffed);
|
||||
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Handles when a unit gets in to a vehicle. Release escorted captive when entering a vehicle
|
||||
*
|
||||
* Arguments:
|
||||
* 0: _vehicle <OBJECT>
|
||||
* 2: dunno <OBJECT>
|
||||
* 1: _unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* The return value <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [car2, x, player] call ACE_captives_fnc_handleGetIn
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_vehicle,_dontcare,_unit);
|
||||
|
||||
if ((local _unit) && (_unit getVariable [QGVAR(isEscorting), false])) then {
|
||||
_unit setVariable [QGVAR(isEscorting), false, true];
|
||||
};
|
@ -1,2 +1,25 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Handles when a unit gets knocked out. Ends surrendering.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [bob, true] call ACE_captives_fnc_handleKnockedOut
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
||||
//ToDo: Waiting on medical integration
|
||||
|
||||
PARAMS_1(_unit);
|
||||
|
||||
if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop
|
||||
[_unit, _false] call FUNC(surrender);
|
||||
};
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
PARAMS_2(_newUnit,_oldUnit);
|
||||
|
||||
//set showHUD based on new unit status:
|
||||
if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then {
|
||||
TRACE_1("Player Change (showHUD false)",_newUnit);
|
||||
showHUD false;
|
||||
@ -25,3 +26,8 @@ if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable
|
||||
TRACE_1("Player Change (showHUD true)",_newUnit);
|
||||
showHUD true;
|
||||
};
|
||||
|
||||
//If old player was escorting, stop
|
||||
if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
|
||||
_oldUnit setVariable [QGVAR(isEscorting), false, true];
|
||||
};
|
||||
|
30
addons/captives/functions/fnc_handleVehicleChanged.sqf
Normal file
30
addons/captives/functions/fnc_handleVehicleChanged.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Handles when a player's vehicle changes (supports scripted vehicle changes)
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit <OBJECT>
|
||||
* 1: newVehicle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [player, car] call ACE_captives_fnc_handleVehicleChanged
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_vehicle);
|
||||
|
||||
//When moved into a vehicle (action or scripted)
|
||||
if ((vehicle _unit) != _unit) then {
|
||||
if (_unit getVariable [QGVAR(isEscorting), false]) then {
|
||||
_unit setVariable [QGVAR(isEscorting), false, true];
|
||||
};
|
||||
|
||||
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
|
||||
[_unit, false] call FUNC(surrender);
|
||||
};
|
||||
};
|
31
addons/captives/functions/fnc_handleZeusDisplayChanged.sqf
Normal file
31
addons/captives/functions/fnc_handleZeusDisplayChanged.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Handles handles ZeusDisplayChanged event
|
||||
* Need to reset showHUD after closing zeus
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Display is now open <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [bob1, false] call ACE_captives_fnc_handleZeusDisplayChanged
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_zeusIsOpen);
|
||||
|
||||
//set showHUD based on unit status:
|
||||
if (!_zeusIsOpen) then {
|
||||
if ((_unit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then {
|
||||
TRACE_1("Player Change (showHUD false)",_newUnit);
|
||||
showHUD false;
|
||||
} else {
|
||||
TRACE_1("Player Change (showHUD true)",_newUnit);
|
||||
showHUD true;
|
||||
};
|
||||
};
|
@ -30,6 +30,9 @@ if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) then {
|
||||
|
||||
if (_state) then {
|
||||
_unit setVariable [QGVAR(isHandcuffed), true, true];
|
||||
if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop
|
||||
[_unit, _false] call FUNC(surrender);
|
||||
};
|
||||
[_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus);
|
||||
_unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true];
|
||||
|
||||
|
@ -30,11 +30,6 @@ if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) then {
|
||||
|
||||
if (_state) then {
|
||||
_unit setVariable [QGVAR(isSurrendering), true, true];
|
||||
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
showHUD false;
|
||||
};
|
||||
|
||||
// fix anim on mission start (should work on dedicated servers)
|
||||
[{
|
||||
@ -45,19 +40,27 @@ if (_state) then {
|
||||
};
|
||||
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute);
|
||||
|
||||
//PFEH - (TODO: move to event system?)
|
||||
//Start up a pfeh to make sure the unit actualy goes into the animation
|
||||
//Only change variables and captivity when they reach that state
|
||||
//fixes vaulting to break animation
|
||||
[{
|
||||
EXPLODE_1_PVT((_this select 0),_unit);
|
||||
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
|
||||
//If unit dies, gets knocked out, or is handcuffed then end surrender
|
||||
if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
|
||||
[_unit, false] call FUNC(surrender);
|
||||
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_2_PVT(_args,_unit,_maxTime);
|
||||
|
||||
if (time > _maxTime) exitWith {
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
_unit setVariable [QGVAR(isSurrendering), false, true];
|
||||
ERROR("Surrender animation failed");
|
||||
};
|
||||
} else {
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
if ((animationState _unit) == "ACE_AmovPercMstpSsurWnonDnon") exitWith {
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
showHUD false;
|
||||
};
|
||||
}, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler;
|
||||
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
|
||||
};
|
||||
}, 0, [_unit, (time + 20)]] call CBA_fnc_addPerFrameHandler;
|
||||
} else {
|
||||
_unit setVariable [QGVAR(isSurrendering), false, true];
|
||||
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
|
||||
|
Loading…
Reference in New Issue
Block a user