diff --git a/addons/medical/functions/fnc_getTypeOfDamage.sqf b/addons/medical/functions/fnc_getTypeOfDamage.sqf new file mode 100644 index 0000000000..2153a5659c --- /dev/null +++ b/addons/medical/functions/fnc_getTypeOfDamage.sqf @@ -0,0 +1,31 @@ +/** + * fn_getTypeOfDamage.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + +#include "script_component.hpp" + +private ["_typeOfProjectile","_typeOfInjury"]; +_typeOfProjectile = _this select 0; +_typeOfInjury = switch (true) do { + case (_typeOfProjectile isKindOf "Backblast"): {"backblast"}; + case (_typeOfProjectile iskindof "BulletBase"): {"Bullet"}; + case (_typeOfProjectile iskindof "GrenadeCore"): {"Grenade"}; + case (_typeOfProjectile iskindof "TimeBombCore"): {"Explosive"}; + case (_typeOfProjectile iskindof "MineCore"): {"Explosive"}; + case (_typeOfProjectile iskindof "FuelExplosion"): {"Explosive"}; + case (_typeOfProjectile iskindof "ShellBase"): {"Shell"}; + case (_typeOfProjectile iskindof "RocketBase"): {"Explosive"}; + case (_typeOfProjectile iskindof "MissileBase"): {"Explosive"}; + case (_typeOfProjectile iskindof "LaserBombCore"): {"Explosive"}; + case (_typeOfProjectile iskindof "BombCore"): {"Explosive"}; + case (_typeOfProjectile iskindof "Grenade"): {"Grenade"}; + case (_typeOfProjectile == "VehicleCrash"): {"VehicleCrash"}; + default {"Unknown"}; +}; +_typeOfInjury \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index d3f70dfb05..e2ef7f40f3 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -17,7 +17,7 @@ #include "script_component.hpp" -private ["_damageReturn"]; +private ["_damageReturn", "_typeOfDamage"]; if !(local (_this select 0)) exitWith {nil}; @@ -25,19 +25,17 @@ if (typeName (_this select 4) == "OBJECT") then { _this set [4, typeOf (_this select 4)]; }; - _damageReturn = (_this select 2); - +_typeOfDamage = [_this select 4] call FUNC(getTypeOfDamage) if (GVAR(level) >= 0) then { - _damageReturn = (_this + [_damageReturn]) call FUNC(handleDamage_basic); + _damageReturn = (_this + [_damageReturn, _typeOfDamage]) call FUNC(handleDamage_basic); }; if (GVAR(level) >= 1) then { - _damageReturn = (_this + [_damageReturn]) call FUNC(handleDamage_medium); -}; + _damageReturn = (_this + [_damageReturn, _typeOfDamage]) call FUNC(handleDamage_medium); -if (GVAR(level) >= 2) then { - _damageReturn = (_this + [_damageReturn]) call FUNC(handleDamage_advanced); + if (GVAR(level) >= 2) then { + _damageReturn = (_this + [_damageReturn, _typeOfDamage]) call FUNC(handleDamage_advanced); + }; }; - _damageReturn