From 0b9c4a7ade8f6d1c4e42802bc8661731d96d1751 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Thu, 13 Oct 2016 13:44:55 -0400 Subject: [PATCH] Allow physics damage from vehicle crash Vanilla commit: https://github.com/DayZMod/DayZ/commit/804445830ffa38bba742cc20c6645b75333725f5 This was exiting with 0 damage if _hit=="". It accounts for vehicles not being damaged at all when crashing full speed into walls. It was also causing the player to sometimes glitch out of the vehicle or into the ground when crashing as you noticed before @icomrade. Also fixed driver getting a humanity hit for damaging passengers in crash. Reverting 22b2a3a since this is more reliable. --- SQF/dayz_code/compile/fn_damageHandler.sqf | 11 ++++++++--- SQF/dayz_code/stringtable.xml | 3 +++ SQF/dayz_server/compile/server_playerDied.sqf | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/SQF/dayz_code/compile/fn_damageHandler.sqf b/SQF/dayz_code/compile/fn_damageHandler.sqf index 45475c8cd..0d70ea92d 100644 --- a/SQF/dayz_code/compile/fn_damageHandler.sqf +++ b/SQF/dayz_code/compile/fn_damageHandler.sqf @@ -43,6 +43,7 @@ _falling = (((_hit == "legs") AND {(_source==_unit)}) AND {((_ammo=="") AND {(Da _end = false; if (!_falling) then { + if (_ammo == "" && _hit == "" && vehicle player != player) then {_ammo = "Crash";}; //No _ammo type exit, indirect/physics damage. if (_ammo == "") exitwith { _end = true; }; @@ -82,9 +83,9 @@ if (_unit == player) then { _unit setVariable["inCombat",true,true]; }; - if (_hit == "") exitWith //Ignore none part dmg. Exit after processing humanity hit + if (_hit == "" && _ammo != "Crash") exitWith //Ignore none part dmg. Exit after processing humanity hit. Don't punish driver for damaging passenger in crash { - if (_source != driver (vehicle player) && _isPlayer && alive player) then + if (_source != player && _isPlayer && alive player) then { _isBandit = (player getVariable["humanity",0]) <= -5000; //_isBandit = (_model in ["Bandit1_DZ","BanditW1_DZ"]); @@ -189,6 +190,7 @@ if (_unit == player) then { dayz_lastDamageSource = switch (true) do { case (_falling): {"fall"}; case (_isZombieHit): {"zombie"}; + case (_ammo == "Crash"): {"crash"}; case (_ammo == "RunOver"): {"runover"}; case (_ammo == "Dragged"): {"eject"}; case (_ammo in MeleeAmmo): {"melee"}; @@ -200,7 +202,7 @@ if (_unit == player) then { }; //Ignore none part dmg. Exit after processing humanity hit -if (_hit == "") exitWith { 0 }; +if (_hit == "" && _ammo != "Crash") exitWith { 0 }; //Pure base blood damage _scale = 200; @@ -212,6 +214,7 @@ _type = switch true do { case (_isZombieHit): { 3 }; case (_ammo == "RunOver"): { 4 }; case (_ammo == "Dragged"): { 5 }; + case (_ammo == "Crash"): { 6 }; default { 0 }; }; @@ -253,6 +256,8 @@ if (_damage > 0.4) then { case 4: {_scale = _scale - 150}; //Dragged case 5: {_scale = 25}; + //Crash + case 6: {_scale = 100}; }; //Display some info in the players log file. diff --git a/SQF/dayz_code/stringtable.xml b/SQF/dayz_code/stringtable.xml index d9afe5e7f..4ec906b73 100644 --- a/SQF/dayz_code/stringtable.xml +++ b/SQF/dayz_code/stringtable.xml @@ -7500,6 +7500,9 @@ falling. + + a vehicle crash. + being run over. wurde überfahren. diff --git a/SQF/dayz_server/compile/server_playerDied.sqf b/SQF/dayz_server/compile/server_playerDied.sqf index 07ec5a369..86d754ed7 100644 --- a/SQF/dayz_server/compile/server_playerDied.sqf +++ b/SQF/dayz_server/compile/server_playerDied.sqf @@ -56,7 +56,7 @@ if (_method in ["explosion","melee","shot","shothead","shotheavy"] && !(_method }; } else { // No source name, distance or weapon needed: "%1 died from %2" str_death_%1 (see stringtable) - // Possible methods: ["bled","combatlog","crushed","dehyd","eject","fall","starve","sick","rad","runover","unknown","zombie"] + // Possible methods: ["bled","combatlog","crash","crushed","dehyd","eject","fall","starve","sick","rad","runover","unknown","zombie"] _message = ["died",_playerName,_method]; };