From d8828d9df1d14239b7148f28ce84a3dce19d5d89 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Thu, 19 Jan 2017 17:36:26 -0500 Subject: [PATCH] Fix "AI" text localization again This was my mistake from 131329f. SourceName needs to be checked, not bodyName. --- SQF/dayz_code/compile/dze_deathMessage.sqf | 18 ++++++++++++++---- SQF/dayz_code/compile/player_death.sqf | 2 +- SQF/dayz_server/compile/server_playerDied.sqf | 14 +++++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/SQF/dayz_code/compile/dze_deathMessage.sqf b/SQF/dayz_code/compile/dze_deathMessage.sqf index 772cb655e..a38f0bc9a 100644 --- a/SQF/dayz_code/compile/dze_deathMessage.sqf +++ b/SQF/dayz_code/compile/dze_deathMessage.sqf @@ -1,14 +1,19 @@ -private ["_bodyName","_root","_type","_weapon"]; +private ["_bodyName","_root","_sourceName","_type","_weapon"]; _message = _this; _type = _message select 0; _bodyName = _message select 1; -if (_bodyName == "AI") then {_bodyName = localize "STR_PLAYER_AI";}; _message = switch _type do { case "died": {format [localize "str_player_death_died",_bodyName,localize format["str_death_%1",_message select 2]]}; case "killed": { + _sourceName = _message select 2; _weapon = _message select 3; + + if (_sourceName == "AI") then { + _sourceName = localize "STR_PLAYER_AI"; + }; + _root = switch true do { case (_weapon in ["PipeBomb","Mine","MineE"]): {"CfgMagazines"}; // isClass in both case (isClass (configFile >> "CfgWeapons" >> _weapon)): {"CfgWeapons"}; @@ -16,14 +21,19 @@ _message = switch _type do { case (isClass (configFile >> "CfgMagazines" >> _weapon)): {"CfgMagazines"}; default {""}; }; + if (_root == "") then { _message set [5,""]; } else { _message set [3,getText (configFile >> _root >> _weapon >> "displayName")]; _message set [5,getText (configFile >> _root >> _weapon >> "picture")]; }; - if (DZE_DeathMsgDynamicText) then {_message call dayz_killFeed}; - format [localize "str_player_death_killed",_bodyName,_message select 2,_message select 3,_message select 4] + + if (DZE_DeathMsgDynamicText) then { + _message call dayz_killFeed; + }; + + format [localize "str_player_death_killed",_bodyName,_sourceName,_message select 3,_message select 4] }; case "suicide": {format [localize "str_player_death_suicide",_bodyName]}; }; diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index 04f600127..5e716f931 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -41,7 +41,7 @@ if (!isNull _source) then { //Send Death Notice diag_log format["Player_Death: Body:%1 BodyName:%2 Infected:%3 SourceName:%4 SourceWeapon:%5 Distance:%6 Method:%7",_body,dayz_playerName,_infected,_sourceName,_sourceWeapon,_distance,_method]; -PVDZ_plr_Death = [dayz_characterID,0,_body,_playerID,toArray dayz_playerName,_infected,toArray _sourceName,toArray _sourceWeapon,_distance,toArray _method]; //Send name as array to avoid publicVariable value restrictions +PVDZ_plr_Death = [dayz_characterID,0,_body,_playerID,toArray dayz_playerName,_infected,toArray _sourceName,toArray _sourceWeapon,_distance,_method]; //Send name as array to avoid publicVariable value restrictions publicVariableServer "PVDZ_plr_Death"; _body setVariable ["deathType",_method,true]; diff --git a/SQF/dayz_server/compile/server_playerDied.sqf b/SQF/dayz_server/compile/server_playerDied.sqf index 358591a3a..04ca9f2e2 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","_playerName","_key","_pos","_infected","_sourceName","_sourceWeapon","_distance","_message","_method","_suicide","_bodyName"]; +private ["_characterID","_minutes","_newObject","_playerID","_playerName","_key","_pos","_infected","_sourceName","_sourceWeapon","_distance","_message","_method","_suicide","_bodyName","_type"]; //[unit, weapon, muzzle, mode, ammo, magazine, projectile] _characterID = _this select 0; @@ -12,7 +12,7 @@ _infected = _this select 5; _sourceName = toString (_this select 6); _sourceWeapon = toString (_this select 7); _distance = _this select 8; -_method = toString (_this select 9); +_method = _this select 9; //Mark player as dead so we bypass the ghost system dayz_died set [count dayz_died, _playerID]; @@ -65,16 +65,20 @@ if (_playerName != "unknown" or _sourceName != "unknown") then { //Don't use regular PV here since JIP clients don't need it owner _newObject publicVariableClient "PVDZE_deathMessage"; //Send to dead player (not in playableUnits) { - if (isPlayer _x) then { + if !(getPlayerUID _x in ["",_playerID]) then { owner _x publicVariableClient "PVDZE_deathMessage"; }; } count playableUnits; }; + _type = _message select 0; _bodyName = _message select 1; - if (_bodyName == "AI") then {_bodyName = localize "STR_PLAYER_AI";}; - _message = switch (_message select 0) do { + if (_type == "killed" && _sourceName == "AI") then { + _message set [2, (localize "STR_PLAYER_AI")]; + }; + + _message = switch _type do { case "died": {format [localize "str_player_death_died", _bodyName, localize format["str_death_%1",_message select 2]]}; case "killed": {format [localize "str_player_death_killed", _bodyName, _message select 2, _message select 3, _message select 4]}; case "suicide": {format [localize "str_player_death_suicide", _bodyName]};