From 56ea7d1382e7244cbd246cf91e7dcc87e6d34363 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Mon, 25 Apr 2016 16:10:44 -0400 Subject: [PATCH] Use PVEH instead of MPF for death messages This way no exception needs to be added in REsec for rSpawn and dayz_rollingMessages can be used instead of rTitleText. --- SQF/dayz_code/configVariables.sqf | 2 +- SQF/dayz_code/init/publicEH.sqf | 14 ++++++++++++++ SQF/dayz_code/system/REsec.sqf | 9 +-------- SQF/dayz_server/compile/server_playerDied.sqf | 12 ++++-------- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/SQF/dayz_code/configVariables.sqf b/SQF/dayz_code/configVariables.sqf index a3494adc1..9aa4d4699 100644 --- a/SQF/dayz_code/configVariables.sqf +++ b/SQF/dayz_code/configVariables.sqf @@ -24,7 +24,7 @@ DZE_AntiWallLimit = 3; // Number of activations before player_antiWall kills pla DZE_DamageBeforeMaint = 0.09; // Minimum damage built items must have before they can be maintained DZE_DeathMsgChat = "none"; //"none","global","side","system" Display death messages in selected chat channel. DZE_DeathMsgDynamicText = false; // Display death messages as dynamicText in the top left with weapon icons. -DZE_DeathMsgTitleText = false; // Display death messages as title text +DZE_DeathMsgCutText = false; // Display death messages as cutText DZE_DeathScreen = true; // True=Use Epoch death screen (Trade city obituaries have been amended) False=Use DayZ death screen (You are dead) DZE_HaloJump = true; // Enable halo jumping out of air vehicles above 400m DZE_modularBuild = true; // Enable Snap building by @raymix diff --git a/SQF/dayz_code/init/publicEH.sqf b/SQF/dayz_code/init/publicEH.sqf index aa06f3cf9..7afa09445 100644 --- a/SQF/dayz_code/init/publicEH.sqf +++ b/SQF/dayz_code/init/publicEH.sqf @@ -363,6 +363,20 @@ if (!isDedicated) then { _codeGuess = (_this select 1) select 0; format["You have set the combination to %1",_codeGuess] call dayz_rollingMessages; }; + + // EPOCH ADDITION + "PVDZE_deathMessage" addPublicVariableEventHandler { + // do not allow PVDZE_deathMessage in publicvariable.txt, it is only sent from the server machine + _message = _this select 1; + switch (toLower DZE_DeathMsgChat) do { + // Use FunctionsManager logic unit (BIS_functions_mainscope) to send chat messages so no side or quotation marks are shown + case "global": {BIS_functions_mainscope globalChat _message;}; + case "side": {BIS_functions_mainscope sideChat _message;}; + case "system": {systemChat _message;}; + }; + if (DZE_DeathMsgCutText) then {_message call dayz_rollingMessages;}; + if (DZE_DeathMsgDynamicText) then {/* add later */}; + }; // flies and swarm sound sync call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\client_flies.sqf"; diff --git a/SQF/dayz_code/system/REsec.sqf b/SQF/dayz_code/system/REsec.sqf index a7cd6ce05..0b4c685c4 100644 --- a/SQF/dayz_code/system/REsec.sqf +++ b/SQF/dayz_code/system/REsec.sqf @@ -17,14 +17,7 @@ private["_ofn","_nfn"]; }foreach TRACED_LIB; { _ofn=format["r%1code",_x]; - _nfn=format["r%1code%2",_x,round(random(100000))]; - //rSpawn is needed on clients only if one of these death message types is enabled - if (_x == "spawn" && {!isDedicated} && {DZE_DeathMsgDynamicText or (toLower DZE_DeathMsgChat != "none")}) then { - // treat as traced on clients - call compile format["%1=%2;%2={diag_log(""Allowed RE on clients for death message %2 args:""+str(_this));_this call %1};",_nfn,_ofn]; - } else { - call compile format["%1={diag_log(""WARNING illegal RE %1 with args:""+str(_this));};",_ofn]; - }; + call compile format["%1={diag_log(""WARNING illegal RE %1 with args:""+str(_this));};",_ofn]; }foreach REMOVED_LIB; #ifndef SKIP_REMOTEEXECUTIONSERVER diff --git a/SQF/dayz_server/compile/server_playerDied.sqf b/SQF/dayz_server/compile/server_playerDied.sqf index 0567649ab..49ae42f8d 100644 --- a/SQF/dayz_server/compile/server_playerDied.sqf +++ b/SQF/dayz_server/compile/server_playerDied.sqf @@ -60,15 +60,11 @@ if (_killerMethod in ["starve","dehyd","sick","bled","crushed","rad","zombie"]) }; if ((_killerWeapon != "unknown weapon") or {_killerMethod != "unknown"} or {_killerName != "unknown"}) then { - diag_log _message; - // Use FunctionsManager logic unit (BIS_functions_mainscope) to send chat messages so no side or quotation marks are shown - switch (toLower DZE_DeathMsgChat) do { - case "global": {[nil,nil,rspawn,[BIS_functions_mainscope,_message],{(_this select 0) globalChat (_this select 1)}] call RE;;}; - case "side": {[nil,nil,rspawn,[BIS_functions_mainscope,_message],{(_this select 0) sideChat (_this select 1)}] call RE;}; - case "system": {[nil,nil,rspawn,_message,{systemChat _this}] call RE;}; + diag_log _message; + if (toLower DZE_DeathMsgChat != "none" or DZE_DeathMsgCutText or DZE_DeathMsgDynamicText) then { + PVDZE_deathMessage = _message; + publicVariable "PVDZE_deathMessage"; }; - if (DZE_DeathMsgTitleText) then {[nil,nil,"per",rTITLETEXT,("\n\n" + _message),"PLAIN DOWN"] call RE;}; - // Store death messages to allow viewing at message board in trader citys. PlayerDeaths set [count PlayerDeaths,[_playerName,_killerName,_killerWeapon,_distance,ServerCurrentTime]]; };