Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // File: fn_handleVehicleDamage.sqf
- // Author: John "Paratus" VanderZwet
- // Description: Handles special damage events
- private ["_unit","_damage","_source","_projectile","_hitBox"];
- _heavyVeh = [
- "O_Heli_Light_02_unarmed_F",
- "O_Heli_Transport_04_F",
- "O_Heli_Transport_04_bench_F",
- "B_MRAP_01_F",
- "I_MRAP_03_F",
- "O_MRAP_02_F",
- "B_Truck_01_box_F",
- "B_Truck_01_transport_F",
- "B_Truck_01_fuel_F",
- "B_T_Truck_01_covered_F",
- "I_Heli_Transport_02_F",
- "B_Heli_Transport_01_F"
- ];
- _unit = _this select 0;
- _projectile = "";
- if ((_this select 4) isEqualTo "<NULL-object>") then {
- _hitBox = _this select 2;
- _damage = _this select 3;
- _source = _this select 4;
- } else {
- _hitBox = _this select 1;
- _damage = _this select 2;
- _source = _this select 3;
- _projectile = _this select 4;
- };
- if (_projectile != "") then {
- if !(isNull _unit) then {
- if (local _unit) then {[_source] call life_fnc_setAggressive} else {[_source] remoteExecCall ["life_fnc_setAggressive",_unit]};
- };
- };
- if (_hitBox != "?") then {
- _oldDamage = if (_hitBox isEqualTo "") then { damage _unit } else { _unit getHit _hitBox };
- if !(isNil "_oldDamage") then {
- if (isNull _source && _projectile isEqualTo "") exitWith {
- _scale = if (_hitBox select [0,5] == "wheel") then {0.15} else {0.35};
- _damage = ((_damage - _oldDamage) * _scale) + _oldDamage;
- };
- };
- };
- if (_projectile == "mini_Grenade") then {
- _damage = 0;
- };
- if (_hitBox == "palivo") then { _damage = _damage / 3 };
- //RPG damage nonsense, thanks Pizza Man
- if ((typeOf _unit) in _heavyVehicles) then {
- if (_projectile in ["R_PG7_F", "ammo_Penetrator_PG7"]) then {
- _hitPointAreas = (getAllHitPointsDamage _unit) select 0;
- {if (((toLower _x) find "wheel") >= 0) then {_unit setHitPointDamage [_x, 1];}} forEach _hitPointAreas;
- {if (((toLower _x) find "engine") >= 0) then {_unit setHitPointDamage [_x, 1];}} forEach _hitPointAreas;
- if ((["palivo", "fuel_hit", "ammo_hit", "glass"] findIf {(_hitBox find _x) >= 0}) >= 0) then {_damage = 0;};
- if (_hitBox isEqualTo "") then {
- _damage = switch (typeOf _unit) do {
- case "B_Truck_01_fuel_F": {_damage * 3;};
- case "O_Heli_Light_02_unarmed_F": {_damage * 0.80;};
- case "B_Heli_Transport_01_F": {_damage * 0.80;};
- case "B_MRAP_01_F": {0;}; //TBD, leave at 0 for now
- default {_damage * 0.75;};
- };
- };
- };
- };
- _damage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement