Added a getTypeOfDamage function.

This commit is contained in:
Glowbal 2015-02-03 21:47:45 +01:00
parent 79aa8d1c7a
commit a50276ddaf
2 changed files with 38 additions and 9 deletions

View File

@ -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

View File

@ -17,7 +17,7 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_damageReturn"]; private ["_damageReturn", "_typeOfDamage"];
if !(local (_this select 0)) exitWith {nil}; 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)]; _this set [4, typeOf (_this select 4)];
}; };
_damageReturn = (_this select 2); _damageReturn = (_this select 2);
_typeOfDamage = [_this select 4] call FUNC(getTypeOfDamage)
if (GVAR(level) >= 0) then { 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 { 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 { if (GVAR(level) >= 2) then {
_damageReturn = (_this + [_damageReturn]) call FUNC(handleDamage_advanced); _damageReturn = (_this + [_damageReturn, _typeOfDamage]) call FUNC(handleDamage_advanced);
};
}; };
_damageReturn _damageReturn