Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- File: fn_handleDamage.sqf
- Author: John "Paratus" VanderZwet & Skalicon
- Description:
- Handles special damage events
- */
- private["_unit","_damage","_source","_projectile","_hitBox","_curWep","_driver","_luck","_doBreak"];
- _unit = _this select 0;
- _hitBox = _this select 1;
- _damage = _this select 2;
- _source = _this select 3;
- _projectile = _this select 4;
- _curWep = "";
- _curMag = "";
- //diag_log format["%1, %2, %3, %4, %5, %6, %7", _unit, _hitBox, _damage, _source, _projectile, _unit getVariable["restrained",false],_unit getVariable["isCivRestrained",false]];
- if(isPlayer _source && _source isKindOf "Man") then {
- _curWep = currentWeapon _source;
- _curMag = currentMagazine _source;
- };
- // Prison and court!
- if (life_is_arrested || !isNil "life_jury_active") then
- {
- _damage = 0;
- };
- // Stun grenades
- if (_projectile in ["mini_Grenade"]) then{
- _damage = 0;
- [] spawn life_fnc_handleFlashbang;
- };
- //rubber bullets or vehicle death
- if ((((_curMag in ["30Rnd_65x39_caseless_mag_Tracer","30Rnd_45ACP_Mag_SMG_01_Tracer_Green"]) || (_curWep in ["SMG_02_F","hgun_P07_F","hgun_P07_snds_F"])) && (_projectile in ["B_65x39_Caseless","B_9x21_Ball","B_45ACP_Ball"])) OR (side _source == west && "acc_pointer_IR" in (primaryWeaponItems _source))) then {
- if ((((getDammage _unit) + _damage) >= 0.90) || (_damage >= 0.95)) then {
- _damage = 0;
- [_source] spawn life_fnc_handleDowned;
- };
- };
- /* //IR Laser non-lethal
- if(side _source == west && "acc_pointer_IR" in (primaryWeaponItems _source)) then
- {
- if ((((getDammage _unit) + _damage) >= 0.90) || (_damage >= 0.95)) then {
- _damage = 0;
- [_source] spawn life_fnc_handleDowned;
- };
- }; */
- //laser tag'd!
- if (life_laser_inprogress) then
- {
- if (((((getDammage _unit) + _damage) >= 0.95) || (_damage >= 0.95)) && ((player getVariable ["laserTeam",0]) != (_source getVariable ["laserTeam",0]))) then
- {
- [_source] spawn life_fnc_handleTagged;
- };
- _damage = 0;
- };
- if ((vehicle _source isKindOf "LandVehicle") && _source != _unit && driver (vehicle _source) == _source && vehicle _unit == _unit) then
- {
- if ((((getDammage _unit) + _damage) >= 0.95) || (_damage >= 0.95)) then {
- _damage = 0;
- if(alive (driver _source) && side (driver _source) != west && (time - life_last_vdm) > 5) then
- {
- life_last_vdm = time;
- serv_killed = [(driver _source),"187V"];
- publicVariableServer "serv_killed";
- };
- };
- };
- if (_damage > 0.4 && (!isPlayer _source || (vehicle _source isKindOf "LandVehicle"))) then
- {
- if (_hitBox == "legs") then {
- _doBreak = true;
- if (47 in life_talents) then
- {
- _luck = floor (random 2);
- if (_luck == 0) exitWith {systemChat "Someone less hardy could have been seriously injured.";_doBreak = false;};
- };
- if (_doBreak) then { [true] spawn life_fnc_brokenLeg; };
- };
- };
- if ((_unit getVariable ["restrained",false]) && !(_unit getVariable ["isCivRestrained",false]) && (isPlayer _source) && (vehicle _unit != vehicle _source) && !(_projectile in ["HandGrenade"])) then
- {
- _damage = 0;
- };
- [] call life_fnc_hudUpdate;
- _damage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement