Allow physics damage from vehicle crash

Vanilla commit:

804445830f

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.
This commit is contained in:
ebaydayz
2016-10-13 13:44:55 -04:00
parent c89031e089
commit 0b9c4a7ade
3 changed files with 12 additions and 4 deletions

View File

@@ -43,6 +43,7 @@ _falling = (((_hit == "legs") AND {(_source==_unit)}) AND {((_ammo=="") AND {(Da
_end = false; _end = false;
if (!_falling) then { if (!_falling) then {
if (_ammo == "" && _hit == "" && vehicle player != player) then {_ammo = "Crash";};
//No _ammo type exit, indirect/physics damage. //No _ammo type exit, indirect/physics damage.
if (_ammo == "") exitwith { _end = true; }; if (_ammo == "") exitwith { _end = true; };
@@ -82,9 +83,9 @@ if (_unit == player) then {
_unit setVariable["inCombat",true,true]; _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 = (player getVariable["humanity",0]) <= -5000;
//_isBandit = (_model in ["Bandit1_DZ","BanditW1_DZ"]); //_isBandit = (_model in ["Bandit1_DZ","BanditW1_DZ"]);
@@ -189,6 +190,7 @@ if (_unit == player) then {
dayz_lastDamageSource = switch (true) do { dayz_lastDamageSource = switch (true) do {
case (_falling): {"fall"}; case (_falling): {"fall"};
case (_isZombieHit): {"zombie"}; case (_isZombieHit): {"zombie"};
case (_ammo == "Crash"): {"crash"};
case (_ammo == "RunOver"): {"runover"}; case (_ammo == "RunOver"): {"runover"};
case (_ammo == "Dragged"): {"eject"}; case (_ammo == "Dragged"): {"eject"};
case (_ammo in MeleeAmmo): {"melee"}; case (_ammo in MeleeAmmo): {"melee"};
@@ -200,7 +202,7 @@ if (_unit == player) then {
}; };
//Ignore none part dmg. Exit after processing humanity hit //Ignore none part dmg. Exit after processing humanity hit
if (_hit == "") exitWith { 0 }; if (_hit == "" && _ammo != "Crash") exitWith { 0 };
//Pure base blood damage //Pure base blood damage
_scale = 200; _scale = 200;
@@ -212,6 +214,7 @@ _type = switch true do {
case (_isZombieHit): { 3 }; case (_isZombieHit): { 3 };
case (_ammo == "RunOver"): { 4 }; case (_ammo == "RunOver"): { 4 };
case (_ammo == "Dragged"): { 5 }; case (_ammo == "Dragged"): { 5 };
case (_ammo == "Crash"): { 6 };
default { 0 }; default { 0 };
}; };
@@ -253,6 +256,8 @@ if (_damage > 0.4) then {
case 4: {_scale = _scale - 150}; case 4: {_scale = _scale - 150};
//Dragged //Dragged
case 5: {_scale = 25}; case 5: {_scale = 25};
//Crash
case 6: {_scale = 100};
}; };
//Display some info in the players log file. //Display some info in the players log file.

View File

@@ -7500,6 +7500,9 @@
<Key ID="str_death_fall"> <Key ID="str_death_fall">
<English>falling.</English> <English>falling.</English>
</Key> </Key>
<Key ID="str_death_crash">
<English>a vehicle crash.</English>
</Key>
<Key ID="str_death_runover"> <Key ID="str_death_runover">
<English>being run over.</English> <English>being run over.</English>
<German>wurde überfahren.</German> <German>wurde überfahren.</German>

View File

@@ -56,7 +56,7 @@ if (_method in ["explosion","melee","shot","shothead","shotheavy"] && !(_method
}; };
} else { } else {
// No source name, distance or weapon needed: "%1 died from %2" str_death_%1 (see stringtable) // 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]; _message = ["died",_playerName,_method];
}; };