mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
handle vehicle crashes and add wounds for fall damage
This commit is contained in:
parent
576a63c27e
commit
347be3c222
@ -15,6 +15,7 @@
|
||||
|
||||
params ["_typeOfProjectile"];
|
||||
|
||||
// --- projectiles
|
||||
if (_typeOfProjectile isKindOf "BulletBase") exitWith {"bullet"};
|
||||
if (_typeOfProjectile isKindOf "ShotgunBase") exitWith {"bullet"};
|
||||
if (_typeOfProjectile isKindOf "GrenadeCore") exitWith {"grenade"};
|
||||
@ -27,4 +28,11 @@ if (_typeOfProjectile isKindOf "MissileBase") exitWith {"explosive"};
|
||||
if (_typeOfProjectile isKindOf "LaserBombCore") exitWith {"explosive"};
|
||||
if (_typeOfProjectile isKindOf "BombCore") exitWith {"explosive"};
|
||||
if (_typeOfProjectile isKindOf "Grenade") exitWith {"grenade"};
|
||||
|
||||
// --- non-projectiles reported by custom handleDamge wrapper
|
||||
if ((_typeOfProjectile select [0,1]) isEqualTo "#") then {
|
||||
_typeOfProjectile = _typeOfProjectile select [1];
|
||||
};
|
||||
|
||||
// --- otherwise
|
||||
toLower _typeOfProjectile
|
||||
|
@ -14,21 +14,36 @@
|
||||
|
||||
// for travis
|
||||
#define HIT_STRUCTURAL QGVAR($#structural)
|
||||
#define HIT_CRASH QGVAR($#crash)
|
||||
|
||||
params ["_unit", "_selection", "_damage", "_shooter", "_ammo", "_hitPointIndex", "_instigator"];
|
||||
//diag_log text str _this;
|
||||
|
||||
// HD sometimes triggers for remote units - ignore.
|
||||
if (!local _unit) exitWith {nil};
|
||||
|
||||
// Get missing meta info
|
||||
private ["_hitPoint", "_oldDamage"];
|
||||
private _isCrash = false;
|
||||
|
||||
// Store
|
||||
if (_hitPointIndex < 0) then {
|
||||
_hitPoint = "#structural";
|
||||
_oldDamage = damage _unit;
|
||||
|
||||
// Handle vehicle crashes
|
||||
if (_damage == _unit getVariable [HIT_CRASH, -1]) then {
|
||||
_isCrash = true;
|
||||
_unit setVariable [HIT_CRASH, -1];
|
||||
} else {
|
||||
_unit setVariable [HIT_CRASH, _damage];
|
||||
};
|
||||
} else {
|
||||
_hitPoint = toLower (getAllHitPointsDamage _unit select 0 select _hitPointIndex);
|
||||
_oldDamage = _unit getHitIndex _hitPointIndex;
|
||||
|
||||
// No crash, reset
|
||||
_unit setVariable [HIT_CRASH, -1];
|
||||
};
|
||||
|
||||
private _newDamage = _damage - _oldDamage;
|
||||
@ -109,8 +124,17 @@ if (_hitPoint isEqualTo "ace_hdbracket") exitWith {
|
||||
|
||||
// Check for drowning damage.
|
||||
// Don't change the third expression. Safe method for FLOATs.
|
||||
if (_hitPoint isEqualTo "#structural" && {getOxygenRemaining _unit <= 0.5} && {_damage isEqualTo (_oldDamage + 0.005)}) then {
|
||||
if (_hitPoint isEqualTo "#structural" && {getOxygenRemaining _unit <= 0.5} && {_damage isEqualTo (_oldDamage + 0.005)}) exitWith {
|
||||
[QGVAR(woundReceived), [_unit, "Body", _newDamage, _unit, "#drowning"]] call CBA_fnc_localEvent;
|
||||
|
||||
0
|
||||
};
|
||||
|
||||
// Handle vehicle crashes
|
||||
if (_isCrash) exitWith {
|
||||
[QGVAR(woundReceived), [_unit, "Body", _newDamage, _unit, "#vehiclecrash"]] call CBA_fnc_localEvent;
|
||||
|
||||
0
|
||||
};
|
||||
|
||||
0
|
||||
|
Loading…
Reference in New Issue
Block a user