mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added support for locality switch and killed units
This commit is contained in:
parent
c7edd83296
commit
85cbe5eb5f
@ -26,3 +26,19 @@ class Extended_Respawn_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Extended_Killed_EventHandlers {
|
||||||
|
class CAManBase {
|
||||||
|
class ADDON {
|
||||||
|
killed = QUOTE(call FUNC(handleKilled));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class Extended_Local_EventHandlers {
|
||||||
|
class CAManBase {
|
||||||
|
class ADDON {
|
||||||
|
local = QUOTE(call FUNC(handleLocal));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -36,6 +36,8 @@ PREP(handleDamage_fractures);
|
|||||||
PREP(handleDamage_internalInjuries);
|
PREP(handleDamage_internalInjuries);
|
||||||
PREP(handleDamage_wounds);
|
PREP(handleDamage_wounds);
|
||||||
PREP(handleUnitVitals);
|
PREP(handleUnitVitals);
|
||||||
|
PREP(handleKilled);
|
||||||
|
PREP(handleLocal);
|
||||||
PREP(hasItem);
|
PREP(hasItem);
|
||||||
PREP(hasItems);
|
PREP(hasItems);
|
||||||
PREP(hasMedicalEnabled);
|
PREP(hasMedicalEnabled);
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
|
|
||||||
private "_unit";
|
private "_unit";
|
||||||
_unit = _this select 0;
|
_unit = _this select 0;
|
||||||
|
_force = if (count _this > 1) then {_this select 1} else {false};
|
||||||
|
|
||||||
if ([_unit] call FUNC(hasMedicalEnabled)) then {
|
if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
|
||||||
|
if ((_unit getvariable[QGVAR(addedToUnitLoop),false] || !alive _unit) && !_force) exitwith{};
|
||||||
if !(local _unit) exitwith{
|
if !(local _unit) exitwith {
|
||||||
[[_unit], QUOTE(DFUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
[[_unit, _force], QUOTE(DFUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||||
};
|
};
|
||||||
if (_unit getvariable[QGVAR(addedToUnitLoop),false]) exitwith{};
|
_unit setvariable [QGVAR(addedToUnitLoop), true, true];
|
||||||
_unit setvariable [QGVAR(addedToUnitLoop),true, true];
|
|
||||||
|
|
||||||
if (isNil QGVAR(InjuredCollection)) then {
|
if (isNil QGVAR(InjuredCollection)) then {
|
||||||
GVAR(InjuredCollection) = [];
|
GVAR(InjuredCollection) = [];
|
||||||
@ -56,5 +56,4 @@ if ([_unit] call FUNC(hasMedicalEnabled)) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}, 1, [_unit]] call CBA_fnc_addPerFrameHandler;
|
}, 1, [_unit]] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
25
addons/medical/functions/fnc_handleKilled.sqf
Normal file
25
addons/medical/functions/fnc_handleKilled.sqf
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Author: Glowbal
|
||||||
|
* Called when a unit is killed
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* ReturnValue:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private["_unit"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
if (!local _unit) exitwith {};
|
||||||
|
|
||||||
|
_unit setvariable [QGVAR(pain), 0];
|
||||||
|
if (GVAR(level) >= 2) then {
|
||||||
|
_unit setvariable [QGVAR(heartRate), 0];
|
||||||
|
_unit setvariable [QGVAR(bloodPressure), [0, 0]];
|
||||||
|
_unit setvariable [QGVAR(airwayStatus), 0];
|
||||||
|
};
|
25
addons/medical/functions/fnc_handleLocal.sqf
Normal file
25
addons/medical/functions/fnc_handleLocal.sqf
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Author: Glowbal
|
||||||
|
* Called when a unit switched locality
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The Unit <OBJECT>
|
||||||
|
* 1: Is local <BOOL>
|
||||||
|
*
|
||||||
|
* ReturnValue:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private["_unit", "_local"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_local = _this select 1;
|
||||||
|
if (_local) then {
|
||||||
|
if (_unit getvariable[QGVAR(addedToUnitLoop),false]) then {
|
||||||
|
[_unit, true] call FUNC(addToInjuredCollection);
|
||||||
|
};
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user