diff --git a/SQF/dayz_code/compile/fn_damageHandler.sqf b/SQF/dayz_code/compile/fn_damageHandler.sqf index 76a9135a6..02169860c 100644 --- a/SQF/dayz_code/compile/fn_damageHandler.sqf +++ b/SQF/dayz_code/compile/fn_damageHandler.sqf @@ -14,7 +14,9 @@ _source = _this select 3; _isPZombie = player isKindOf "PZombie_VB"; _ammo = _this select 4; _model = typeOf player; -_Viralzed = typeOf _source in DayZ_ViralZeds; +_sourceType = typeOf _source; +_sourceVehicleType = typeOf (vehicle _source); +_Viralzed = _sourceType in DayZ_ViralZeds; _isMinor = (_hit in USEC_MinorWounds); _isHeadHit = (_hit == "head_hit"); _isPlayer = (isPlayer _source); @@ -155,12 +157,12 @@ if (_unit == player) then { if (((!(isNil {_source})) AND {(!(isNull _source))}) AND {((_source isKindOf "CAManBase") AND {(!local _source )})}) then { _wpst = weaponState _source; if (diag_ticktime-(_source getVariable ["lastloghit",0])>2) then { - private ["_sourceWeap"]; + //private ["_sourceWeap"]; _source setVariable ["lastloghit",diag_ticktime]; - + /* // Excessively intensive logging (Network send on every hit) _sourceDist = round(_unit distance _source); _sourceWeap = switch (true) do { - case ((vehicle _source) != _source) : { format ["in %1",getText(configFile >> "CfgVehicles" >> (typeOf (vehicle _source)) >> "displayName")] }; + case ((vehicle _source) != _source) : { format ["in %1",getText(configFile >> "CfgVehicles" >> _sourceVehicleType >> "displayName")] }; case (_isZombieHit) : { _ammo }; case (_wpst select 0 == "Throw") : { format ["with %1 thrown", _wpst select 3] }; case (["Horn", currentWeapon _source] call fnc_inString) : {"with suspicious vehicle "+str((getposATL _source) nearEntities [["Air", "LandVehicle", "Ship"],5])}; @@ -173,6 +175,7 @@ if (_unit == player) then { PVDZ_sec_atp = [_unit, _source, toArray _sourceWeap, _sourceDist]; //Send arbitrary string as array to allow stricter publicVariableVal.txt filter publicVariableServer "PVDZ_sec_atp"; }; + */ }; }; @@ -182,7 +185,7 @@ if (_unit == player) then { case (_ammo == "RunOver"): {"runover"}; case (_ammo == "Dragged"): {"eject"}; case (_ammo in MeleeAmmo): {"melee"}; - case (!isNil "_wpst" && {!(_wpst select 0 in ["","Throw"]) or (vehicle _source != _source)}): {"shot"}; + case (!isNil "_wpst" && {!(_wpst select 0 in ["","Throw"]) or {_sourceVehicleType isKindOf "LandVehicle" or {_sourceVehicleType isKindOf "Air"} or {_sourceVehicleType isKindOf "Ship"}}}): {"shot"}; default {"none"}; }; if (dayz_lastDamageSource != "none") then {dayz_lastDamageTime = diag_tickTime;}; @@ -237,7 +240,7 @@ if (_damage > 0.4) then { //Bullet types case 2: {_scale = _scale + 150}; //Zombies - case 3: {_scale = getNumber (configFile >> "CfgVehicles" >> (typeOf _source) >> "damageScale"); if (dayz_DamageMultiplier > 1) then {_scale = _scale * dayz_DamageMultiplier;};}; + case 3: {_scale = getNumber (configFile >> "CfgVehicles" >> _sourceType >> "damageScale"); if (dayz_DamageMultiplier > 1) then {_scale = _scale * dayz_DamageMultiplier;};}; //Dragged case 4: {_scale = _scale - 150}; //RunOver @@ -246,7 +249,7 @@ if (_damage > 0.4) then { //Display some info in the players log file. if (_unit == player) then { - diag_log format["DAMAGE: player hit by %1 in %2 with %3 for %4 scaled to %5, Conscious %6",(typeOf _source),_hit,if (_ammo == "") then { "" } else { _ammo },(str(_damage)),(str(_damage * _scale)),(str (!_unconscious))]; + diag_log format["DAMAGE: player hit by %1 in %2 with %3 for %4 scaled to %5, Conscious %6",_sourceVehicleType,_hit,if (_ammo == "") then { "" } else { _ammo },(str(_damage)),(str(_damage * _scale)),(str (!_unconscious))]; r_player_blood = r_player_blood - (_damage * _scale); //Pain and Infection @@ -271,7 +274,7 @@ if (_damage > 0.4) then { _isScratched = false; _rndBleed = floor(random 100); - _rndBleedChance = getNumber (configFile >> "CfgVehicles" >> (typeOf _source) >> "BleedChance"); + _rndBleedChance = getNumber (configFile >> "CfgVehicles" >> _sourceType >> "BleedChance"); _hitBleed = (_rndBleed < _rndBleedChance); if (_hitBleed) then { @@ -311,7 +314,7 @@ if (_damage > 0.4) then { if ((!r_player_infected) and !(r_player_Sepsis select 0)) then { if (_type == 3) then { _rndSepsis = floor(random 100); - _sepsisChance = getNumber (configFile >> "CfgVehicles" >> (typeOf _source) >> "sepsisChance"); + _sepsisChance = getNumber (configFile >> "CfgVehicles" >> _sourceType >> "sepsisChance"); if (_rndSepsis < _sepsisChance) then { r_player_Sepsis = [true, diag_tickTime]; @@ -391,7 +394,7 @@ if (_type == 1) then { if (_damage > 4) then { //serious ballistic damage if (_unit == player) then { - _id = [_source,"explosion"] spawn player_death; + _id = [_source,"explosion",_ammo] spawn player_death; }; } else { if (_damage > 2) then { diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index 638ab9e86..3cecfb2d2 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -1,4 +1,4 @@ -private ["_pos","_display","_body","_playerID","_array","_source","_method","_isBandit","_punishment","_humanityHit","_myKills","_humanity","_kills","_killsV","_myGroup","_model","_infected","_distance","_sourceVehicle","_sourceWeapon","_sourceName"]; +private ["_pos","_display","_body","_playerID","_array","_source","_method","_isBandit","_punishment","_humanityHit","_myKills","_humanity","_kills","_killsV","_myGroup","_model","_infected","_distance","_sourceVehicle","_sourceWeapon","_sourceName","_ammo"]; disableSerialization; if (deathHandled) exitWith {}; deathHandled = true; @@ -35,12 +35,14 @@ _distance = 0; if (count _this > 0) then { _source = _this select 0; _method = _this select 1; + _ammo = if (count _this > 2) then {_this select 2} else {""}; if (!isNull _source) then { if (!isNull _body) then {_distance = round (_body distance _source);}; _sourceVehicle = vehicle _source; _sourceWeapon = if (_sourceVehicle != _source) then {typeOf _sourceVehicle} else {currentWeapon _source}; if (_sourceWeapon == "Throw") then {_sourceWeapon = (weaponState _source) select 3;}; + if (_ammo in ["PipeBomb","RunOver"]) then {_sourceWeapon = _ammo;}; // Mine or Satchel if (alive _source) then { _sourceName = if (isPlayer _source) then {name _source} else {localize "STR_EPOCH_AI"}; }; diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index d2eee3d96..ce4667753 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -605,7 +605,7 @@ if (!isDedicated) then { death_4 = ""; }; - death_1 = format["%1 %3 (%4m)",_playerName,_icon,_sourceName,_distance]; + death_1 = format["%1 %3 (%4m)",_playerName,_icon,_sourceName,_distance]; death_1_time = diag_ticktime; _message = format ["%1
%2
%3
%4",death_1,death_2,death_3,death_4]; [_message,safeZoneX,safeZoneY,10,0,0,8000] spawn BIS_fnc_dynamicText; diff --git a/SQF/dayz_server/compile/server_playerDied.sqf b/SQF/dayz_server/compile/server_playerDied.sqf index 2409960f7..5c81b2c72 100644 --- a/SQF/dayz_server/compile/server_playerDied.sqf +++ b/SQF/dayz_server/compile/server_playerDied.sqf @@ -1,6 +1,6 @@ #include "\z\addons\dayz_server\compile\server_toggle_debug.hpp" -private ["_characterID","_minutes","_newObject","_playerID","_key","_pos","_infected","_sourceName","_sourceWeapon","_distance","_message","_method"]; +private ["_characterID","_minutes","_newObject","_playerID","_key","_pos","_infected","_sourceName","_sourceWeapon","_distance","_message","_method","_isMine"]; //[unit, weapon, muzzle, mode, ammo, magazine, projectile] _characterID = _this select 0; @@ -43,8 +43,10 @@ diag_log format ["Player UID#%3 CID#%4 %1 as %5 died at %2", // EPOCH DEATH MESSAGES -if (_method in ["explosion","melee","shot","shothead","shotheavy"]) then { - if (_sourceName == _playerName) then { +_isMine = _sourceWeapon == "RunOver"; + +if (_method in ["explosion","melee","shot","shothead","shotheavy"] && !_isMine) then { + if (_sourceName == _playerName && !_isMine) then { _message = ["suicide",_playerName]; } else { if (_sourceWeapon == "") then {_sourceWeapon = "unknown weapon";};