mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-17 09:10:27 +03:00
Fix "AI" text localized on wrong client in death message #1867
Fixes #1867
This commit is contained in:
42
SQF/dayz_code/compile/dze_deathMessage.sqf
Normal file
42
SQF/dayz_code/compile/dze_deathMessage.sqf
Normal file
@@ -0,0 +1,42 @@
|
||||
private ["_bodyName","_root","_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": {
|
||||
_weapon = _message select 3;
|
||||
_root = switch true do {
|
||||
case (_weapon in ["PipeBomb","Mine","MineE"]): {"CfgMagazines"}; // isClass in both
|
||||
case (isClass (configFile >> "CfgWeapons" >> _weapon)): {"CfgWeapons"};
|
||||
case (isClass (configFile >> "CfgVehicles" >> _weapon)): {"CfgVehicles"};
|
||||
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]
|
||||
};
|
||||
case "suicide": {format [localize "str_player_death_suicide",_bodyName]};
|
||||
};
|
||||
|
||||
switch (toLower DZE_DeathMsgChat) do {
|
||||
// Sending from logic (FunctionsManager) or agent (zombie, animal, trader) object shows message without side i.e. "BLUFOR" or quotes
|
||||
case "global": {BIS_functions_mainscope globalChat _message;};
|
||||
case "side": {BIS_functions_mainscope sideChat _message;};
|
||||
case "system": {systemChat _message;};
|
||||
};
|
||||
|
||||
if (DZE_DeathMsgRolling) then {
|
||||
_message call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
diag_log format["DeathMessage: %1",_message];
|
||||
@@ -34,7 +34,7 @@ if (!isNull _source) then {
|
||||
if (_sourceWeapon == "Throw") then {_sourceWeapon = (weaponState _source) select 3;};
|
||||
if (_ammo in ["PipeBomb","Mine","MineE"]) then {_sourceWeapon = _ammo;};
|
||||
if (alive _source) then {
|
||||
_sourceName = if (isPlayer _source) then {name _source} else {localize "STR_PLAYER_AI"};
|
||||
_sourceName = if (isPlayer _source) then {name _source} else {"AI"};
|
||||
};
|
||||
if (_source == _body) then {_sourceName = dayz_playerName;};
|
||||
};
|
||||
|
||||
@@ -159,6 +159,7 @@ if (!isDedicated) then {
|
||||
// EPOCH ADDITIONS
|
||||
dayz_autoRunOff = {dayz_autoRun = false; terminate dayz_autoRunThread; player playActionNow "Stop";};
|
||||
dog_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dog_findTargetAgent.sqf";
|
||||
dze_deathMessage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_deathMessage.sqf";
|
||||
dze_filterCheats = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_filterCheats.sqf";
|
||||
dze_isnearest_player = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_isNearestPlayer.sqf";
|
||||
dze_buildChecks = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_buildChecks.sqf";
|
||||
|
||||
@@ -327,41 +327,7 @@ if (!isDedicated) then {
|
||||
format[localize "STR_BLD_COMBO_SET",_codeGuess] call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
// EPOCH ADDITION
|
||||
"PVDZE_deathMessage" addPublicVariableEventHandler {
|
||||
private ["_root","_weapon"];
|
||||
_message = _this select 1;
|
||||
_message = switch (_message select 0) do {
|
||||
case "died": {format [localize "str_player_death_died",_message select 1,localize format["str_death_%1",_message select 2]]};
|
||||
case "killed": {
|
||||
_weapon = _message select 3;
|
||||
_root = switch true do {
|
||||
case (_weapon in ["PipeBomb","Mine","MineE"]): {"CfgMagazines"}; // isClass in both
|
||||
case (isClass (configFile >> "CfgWeapons" >> _weapon)): {"CfgWeapons"};
|
||||
case (isClass (configFile >> "CfgVehicles" >> _weapon)): {"CfgVehicles"};
|
||||
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",_message select 1,_message select 2,_message select 3,_message select 4]
|
||||
};
|
||||
case "suicide": {format [localize "str_player_death_suicide",_message select 1]};
|
||||
};
|
||||
switch (toLower DZE_DeathMsgChat) do {
|
||||
// Sending from logic (FunctionsManager) or agent (zombie, animal, trader) object shows message without side i.e. "BLUFOR" or quotes
|
||||
case "global": {BIS_functions_mainscope globalChat _message;};
|
||||
case "side": {BIS_functions_mainscope sideChat _message;};
|
||||
case "system": {systemChat _message;};
|
||||
};
|
||||
if (DZE_DeathMsgRolling) then {_message call dayz_rollingMessages;};
|
||||
diag_log format["DeathMessage: %1",_message];
|
||||
};
|
||||
"PVDZE_deathMessage" addPublicVariableEventHandler {(_this select 1) call dze_deathMessage};
|
||||
|
||||
// flies and swarm sound sync
|
||||
call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\client_flies.sqf";
|
||||
|
||||
Reference in New Issue
Block a user