mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix Load Patient/Captive actions (#5544)
* Disable (un)load patient action if unit is dead but was uncoscious before * Remove handcuffs on death (prevents stand-up ragoll restart), Don't show load patient and captive at the same time * Only allow unloading from outside - fix #5525 as discussed * Also prevent unloading captives from inside * Add debug logging
This commit is contained in:
parent
32b2d99887
commit
a48db26996
@ -63,3 +63,11 @@ class Extended_Local_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Extended_Killed_EventHandlers {
|
||||||
|
class CAManBase {
|
||||||
|
class ADDON {
|
||||||
|
killed = QUOTE(_this call FUNC(handleKilled));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
PREP(canApplyHandcuffs);
|
PREP(canApplyHandcuffs);
|
||||||
PREP(canEscortCaptive);
|
PREP(canEscortCaptive);
|
||||||
PREP(canFriskPerson);
|
PREP(canFriskPerson);
|
||||||
@ -18,6 +17,7 @@ PREP(handleAnimChangedHandcuffed);
|
|||||||
PREP(handleAnimChangedSurrendered);
|
PREP(handleAnimChangedSurrendered);
|
||||||
PREP(handleGetIn);
|
PREP(handleGetIn);
|
||||||
PREP(handleGetOut);
|
PREP(handleGetOut);
|
||||||
|
PREP(handleKilled);
|
||||||
PREP(handleLocal);
|
PREP(handleLocal);
|
||||||
PREP(handleOnUnconscious);
|
PREP(handleOnUnconscious);
|
||||||
PREP(handlePlayerChanged);
|
PREP(handlePlayerChanged);
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
|
|
||||||
params ["_unit", "_target","_vehicle"];
|
params ["_unit", "_target","_vehicle"];
|
||||||
|
|
||||||
|
// Don't show "Load Captive" if unit is unconscious (already has "Load Patient")
|
||||||
|
if (_target getVariable ["ACE_isUnconscious", false]) exitWith {false};
|
||||||
|
|
||||||
if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then {
|
if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then {
|
||||||
//Looking at a vehicle while escorting, get target from attached objects:
|
//Looking at a vehicle while escorting, get target from attached objects:
|
||||||
{
|
{
|
||||||
|
@ -18,4 +18,5 @@
|
|||||||
|
|
||||||
params ["_player", "_unit"];
|
params ["_player", "_unit"];
|
||||||
|
|
||||||
((vehicle _unit) != _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}
|
// Don't show "Unload Captive" if unit is unconscious (already has "Unload Patient")
|
||||||
|
(vehicle _unit != _unit) && {vehicle _player == _player} && {_unit getVariable [QGVAR(isHandcuffed), false]} && {!(_unit getVariable ["ACE_isUnconscious", false])}
|
||||||
|
24
addons/captives/functions/fnc_handleKilled.sqf
Normal file
24
addons/captives/functions/fnc_handleKilled.sqf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Author: Jonpas
|
||||||
|
* Called when a unit dies.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [bob] call ace_captives_fnc_handleKilled
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit"];
|
||||||
|
TRACE_1("handleKilled",_unit);
|
||||||
|
|
||||||
|
// Remove handcuffs on a dead unit, removing them after unit goes into ragdoll causes a stand-up twitch and restarts the ragdoll
|
||||||
|
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
|
||||||
|
[_unit, false] call FUNC(setHandcuffed);
|
||||||
|
};
|
@ -17,6 +17,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit","_dead"];
|
params ["_unit","_dead"];
|
||||||
|
TRACE_2("handleRespawn",_unit,_dead);
|
||||||
|
|
||||||
if (!local _unit) exitWith {};
|
if (!local _unit) exitWith {};
|
||||||
|
|
||||||
|
@ -545,7 +545,7 @@ class CfgVehicles {
|
|||||||
class GVAR(loadPatient) {
|
class GVAR(loadPatient) {
|
||||||
displayName = CSTRING(LoadPatient);
|
displayName = CSTRING(LoadPatient);
|
||||||
distance = 5;
|
distance = 5;
|
||||||
condition = QUOTE(_target getVariable[ARR_2(QUOTE(QUOTE(ACE_isUnconscious)),false)] && vehicle _target == _target);
|
condition = QUOTE(_target getVariable [ARR_2(QUOTE(QUOTE(ACE_isUnconscious)), false)] && {alive _target} && {vehicle _target == _target});
|
||||||
statement = QUOTE([ARR_2(_player, _target)] call DFUNC(actionLoadUnit));
|
statement = QUOTE([ARR_2(_player, _target)] call DFUNC(actionLoadUnit));
|
||||||
showDisabled = 0;
|
showDisabled = 0;
|
||||||
priority = 2;
|
priority = 2;
|
||||||
@ -555,7 +555,7 @@ class CfgVehicles {
|
|||||||
class GVAR(UnLoadPatient) {
|
class GVAR(UnLoadPatient) {
|
||||||
displayName = CSTRING(UnloadPatient);
|
displayName = CSTRING(UnloadPatient);
|
||||||
distance = 5;
|
distance = 5;
|
||||||
condition = QUOTE(_target getVariable[ARR_2(QUOTE(QUOTE(ACE_isUnconscious)),false)] && vehicle _target != _target);
|
condition = QUOTE(_target getVariable [ARR_2(QUOTE(QUOTE(ACE_isUnconscious)), false)] && {vehicle _target != _target} && {vehicle _player == _player});
|
||||||
statement = QUOTE([ARR_2(_player, _target)] call DFUNC(actionUnloadUnit));
|
statement = QUOTE([ARR_2(_player, _target)] call DFUNC(actionUnloadUnit));
|
||||||
showDisabled = 0;
|
showDisabled = 0;
|
||||||
priority = 2;
|
priority = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user