Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Medical - Add damage handling for crew inside destroyed vehicles #8752

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions addons/medical_engine/functions/fnc_handleDamage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,33 @@ if (
0
};

// Being inside an exploding vehicle doesn't fire the EH for each hitpoint so the "ace_hdbracket" code never runs
// _ammo is always "FuelExplosion", EH fires for each explosion. Damage is dependent on amount of fuel remaining in the vehicle
if (
_hitPoint isEqualTo "#structural" &&
{_vehicle != _unit} &&
{_ammo isEqualTo "FuelExplosion"}
) exitWith {
private _destrType = getText (configOf _vehicle >> "destrType");
// Skip vehicles that don't explode
if (_destrType == "") exitWith {};
// DestructWreck is typically found on Aircraft/Heavy vehicles, DestructDefault is typically found on cars & boats.
private _lethality = [1.25, 2] select (_destrType == "DestructWreck");
// Focus damage on chest & head for increased lethality
private _damageSelectionArray = [
HITPOINT_INDEX_HEAD, 5, HITPOINT_INDEX_BODY, 3, HITPOINT_INDEX_LARM, 1,
HITPOINT_INDEX_RARM, 1, HITPOINT_INDEX_LLEG, 1, HITPOINT_INDEX_RLEG, 1
];

[QEGVAR(medical,woundReceived), [_unit, "Body", _newDamage * _lethality, _shooter, _ammo, _damageSelectionArray]] call CBA_fnc_localEvent;
// Set crew on fire
if (["ace_fire"] call EFUNC(common,isModLoaded)) then {
[QEGVAR(fire,burn), [_unit, 5 * _newDamage, _shooter]] call CBA_fnc_globalEvent;
};
TRACE_5("Vehicle Destroyed",_unit,_shooter,_instigator,_damage,_newDamage);

0
};

// We store our own damage values so engine damage is unnecessary
0