Skip to content

Commit

Permalink
Merge pull request #1 from brainslush/notifications
Browse files Browse the repository at this point in the history
Add better notifications
  • Loading branch information
brainslush authored May 4, 2019
2 parents b376006 + b144a39 commit ffa649b
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
36 changes: 35 additions & 1 deletion addons/recover/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,43 @@ GVAR(RespawnTime) = if (isNumber(missionConfigFile >> "RespawnDelay")) then {
// add respawn event
[
QGVAR(Respawn),{
// handle notifications
private _notifyPrior = {
params["_notifyTime"];

private _seconds = _notifyTime * 60;
if (GVAR(RespawnDelay) > _seconds) then {
[
{
if (GVAR(Notify)) then {
[[
LLSTRING(NotificationRespawnPartA),
_this,
LLSTRING(NotificationRespawnPartBM)
] joinString " "] call CBA_fnc_notify;
};
}, _notifyTime, GVAR(RespawnDelay) - _seconds
] call CBA_fnc_waitAndExecute;
};
};

private _minutes = floor(GVAR(RespawnDelay) / 60);
private _seconds = GVAR(RespawnDelay) % 60;
private _notifyTimes = [60, 45, 30, 15, 10, 5, 1];

if (GVAR(RespawnDelay) >= 5) then {
[[LLSTRING(NotificationRespawnPartA), GVAR(RespawnDelay), LLSTRING(NotificationRespawnPartB)] joinString " "] call CBA_fnc_notify;
if (GVAR(Notify) && {!(_minutes in _notifyTimes) || {_seconds > 5}}) then {
[[
LLSTRING(NotificationRespawnPartA),
str(_minutes) + ":" + str(_seconds),
LLSTRING(NotificationRespawnPartB)
] joinString " "] call CBA_fnc_notify;
};
{
[_x] call _notifyPrior;
} forEach _notifyTimes;
};
// handle respawn
[
{
[false, false, false] call ace_spectator_fnc_setSpectator;
Expand Down
7 changes: 7 additions & 0 deletions addons/recover/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@
{GVAR(RespawnDelay) = parseNumber GVAR(Delay);}
] call CBA_settings_fnc_init;
GVAR(RespawnDelay) = parseNumber GVAR(Delay);
[
QGVAR(Notify), "CHECKBOX",
[LSTRING(SettingNotifyName), LSTRING(SettingNotifyDesc)],
LSTRING(Category),
true, // default value
false // isGlobal
] call CBA_settings_fnc_init;
16 changes: 14 additions & 2 deletions addons/recover/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@
<English>Time delay until player can respawn after his body was returned in seconds.</English>
<German>Zeit in Sekunden bis zum Respawn des Spielers, nachdem seine Leiche zurueck gerfuehrt wurde.</German>
</Key>
<Key ID="STR_recycleme_Recover_SettingNotifyName">
<English>Notfiy</English>
<German>Benachrichtigen</German>
</Key>
<Key ID="STR_recycleme_Recover_SettingNotifyDesc">
<English>Spectators will be notified about the time until respawn.</English>
<German>Zuschauer werden ueber die verbleibende Zeit bis zum Respawn benachrichtigt.</German>
</Key>
<Key ID="STR_recycleme_Recover_Action">
<English>Return Bodybag</English>
<German>Leichensack zurueckfuehren</German>
Expand All @@ -58,8 +66,12 @@
<German>Du wirst in </German>
</Key>
<Key ID="STR_recycleme_Recover_NotificationRespawnPartB">
<English> seconds.</English>
<German> Sekunden respawnen.</German>
<English> .</English>
<German> respawnen.</German>
</Key>
<Key ID="STR_recycleme_Recover_NotificationRespawnPartBM">
<English> minutes.</English>
<German> Minuten respawnen.</German>
</Key>
</Package>
</Project>

0 comments on commit ffa649b

Please sign in to comment.