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

Medical Engine - Add vehicle explosion handling #8832

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 @@ -67,6 +67,34 @@ if (
0
};

// Being inside an exploding vehicle doesn't trigger for each hitpoint
// It seems to fire twice with ammo type "FuelExplosion" or "FuelExplosionBig"
if (
_hitPoint isEqualTo "#structural" &&
{_ammo isKindOf "FuelExplosion"} &&
{_vehicle != _unit} &&
{_damage == 1}
pterolatypus marked this conversation as resolved.
Show resolved Hide resolved
) exitwith {
// triggers twice, so do half damage each time. not very important as it's basically always lethal
private _hit = GET_NUMBER(configFile >> "CfgAmmo" >> _ammo >> "indirectHit", 10)/2;
private _uniform = uniform _unit;
if (_uniform isEqualTo "") then {
_uniform = getText (configOf _unit >> "nakedUniform");
};
private _uniformClass = GET_STRING(configFile >> "CfgWeapons" >> _uniform >> "ItemInfo" >> "uniformClass", "U_BasicBody");
private _damages = [];
{
private _armor = [_unit, _x] call FUNC(getHitpointArmor);
// would be nice to move this into getHitpointArmor
private _shielding = GET_NUMBER(configFile >> "CfgVehicles" >> _uniformClass >> "Hitpoints" >> _x >> "explosionShielding", 1);
_damages pushBack [_hit*_shielding/_armor, ALL_BODY_PARTS select _forEachIndex, _hit*_shielding];
} forEach ALL_HITPOINTS;
TRACE_6("Vehicle explosion",_unit,_shooter,_instigator,_damage,_newDamage,_damages);
[QEGVAR(medical,woundReceived), [_unit, _damages, _unit, _ammo]] call CBA_fnc_localEvent;

0
};

// This hitpoint is set to trigger last, evaluate all the stored damage values
// to determine where wounds are applied
if (_hitPoint isEqualTo "ace_hdbracket") exitWith {
Expand Down