Skip to content

Commit

Permalink
Merge pull request #3078 from jaj22/fix-punishment-notify-master
Browse files Browse the repository at this point in the history
Move FF damage notifications into evaluateEvent (master)
  • Loading branch information
Bob-Murphy authored Dec 3, 2023
2 parents 9cc8e90 + e84d6ac commit c500a7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
9 changes: 1 addition & 8 deletions A3A/addons/core/functions/Punishment/fn_punishment.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,16 @@ _varspace setVariable ["overhead",_overhead];
_varspace setVariable ["name",_name];
_varspace setVariable ["player",_originalBody];

///////////////Victim Notifier//////////////
private _injuredComrade = "";
///////////////Log incident/////////////////
private _victimStats = "damaged systemPunished [AI]";
if (_victim isKindOf "Man") then {
_injuredComrade = ["Injured comrade: ",name _victim] joinString ""; //TODO: Localize
[localize "STR_A3A_fn_punish_ff_noti", [_name," ",localize "STR_A3A_fn_punish_pun_hurt"] joinString ""] remoteExecCall ["A3A_fnc_customHint", _victim, false];
private _UIDVictim = ["AI", getPlayerUID _victim] select (isPlayer _victim);
_victimStats = ["damaged ",name _victim," [",_UIDVictim,"]"] joinString "";
};

/////////////Instigator Notifier////////////
private _playerStats = ["Total-time: ",str _timeTotal," (incl. +",str _timeAdded,"), Offence+Overhead: ",str _offenceTotal," [",str (_offenceTotal-_overhead),"+",str _overhead,"] (incl. +",str _offenceAdded,")"] joinString "";
private _instigatorLog = [["WARNING","GUILTY"] select (_offenceTotal >= 1)," | ",_name," [",_UID,"] ",_victimStats,", ",_playerStats] joinString "";
Info(_instigatorLog);

[localize "STR_A3A_fn_punish_punEval_warning", [localize "STR_A3A_fn_punish_pun_fire",_injuredComrade,_customMessage] joinString "<br/>"] remoteExecCall ["A3A_fnc_customHint", _originalBody, false];

if (_offenceTotal < 1) exitWith {"WARNING";};

////////Exit Remote Control (if any)////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ if (_instigator getVariable ["A3A_FFPun_CD", 0] > servertime) exitWith {"PUNISHM
_instigator setVariable ["A3A_FFPun_CD", servertime + 1, false]; // Local Exec faster

/////////////////Definitions////////////////
private _injuredComrade = ["", format ["%1 %2",localize "STR_A3A_fn_punish_punEval_injured",name _victim]] select (_victim isKindOf "Man");
private _victimStats = ["damaged ",["systemPunished",name _victim] select (_victim isKindOf "Man")," "] joinString "";
_victimStats = [_victimStats,"[",["AI",getPlayerUID _victim] select (isPlayer _victim),"]"] joinString "";
private _notifyVictim = {
if (isPlayer _victim) then {[localize "STR_A3A_fn_punish_ff_noti", format[localize "STR_A3A_fn_punish_punEval_hurt",name _instigator]] remoteExec ["A3A_fnc_customHint", _victim, false];};
if (isPlayer _victim) then {[localize "STR_A3A_fn_punish_ff_noti", format [localize "STR_A3A_fn_punish_punEval_hurt", name _instigator]] remoteExec ["A3A_fnc_customHint", _victim, false];};
};
private _notifyInstigator = {
params ["_exempMessage"];
private _comradeStats = ["",[localize "STR_A3A_fn_punish_punEval_injured"," ",name _victim,""] joinString ""] select (_victim isKindOf "Man");
[localize "STR_A3A_fn_punish_punEval_warning", [_exempMessage,_comradeStats,_customMessage] joinString "<br/>"] remoteExec ["A3A_fnc_customHint", _instigator, false];
[localize "STR_A3A_fn_punish_punEval_warning", [_exempMessage, _injuredComrade, _customMessage] joinString "<br/>"] remoteExec ["A3A_fnc_customHint", _instigator, false];
};
private _logPvPHurt = {
if (!(_victim isKindOf "Man")) exitWith {};
Expand Down Expand Up @@ -152,6 +152,11 @@ if (!(_exemption isEqualTo "")) exitWith {
_exemption;
};

///////Non-exempt victim & instigator notifiers//////
call _notifyVictim;
[localize "STR_A3A_fn_punish_punEval_warning", [localize "STR_A3A_fn_punish_pun_fire", _injuredComrade, _customMessage] joinString "<br/>"] remoteExecCall ["A3A_fnc_customHint", _instigator, false];


if (tkPunish == 2) exitWith {"NOTIFYONLY"};

///////////////Drop The Hammer//////////////
Expand Down

0 comments on commit c500a7a

Please sign in to comment.