Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display self-revive cooldown in unconscious state #246

Merged
merged 6 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion A3A/addons/core/functions/Revive/fn_unconscious.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ private _bleedOut = time + 450;
private _isPlayer = false;
private _playersX = false;
private _inPlayerGroup = false;
private _handlerCountdown = 0;
_unit setBleedingremaining 300;

private _fnc_applyPostEffect = {
Expand All @@ -16,6 +17,45 @@ private _fnc_applyPostEffect = {
"filmGrain" ppEffectEnable true;
};

private _fnc_selfReviveCountdownStart = {
private _diff = (_unit getVariable ["A3A_selfReviveTimeout", -1]) - time;
private _initialCountDown = [_diff] call BIS_fnc_countDown;

if (_diff > 0) then {
_handlerCountdown = addMissionEventHandler [
"EachFrame",
{
[
localize "STR_antistasi_actions_unconscious_self_withstand_countdown",
format[
[(([0] call BIS_fnc_countdown) / 60) + .01, "HH:MM"] call BIS_fnc_timetostring
],
true
] call A3A_fnc_customHint
}
];
}
else {
_handlerCountdown = addMissionEventHandler [
"EachFrame",
{
[
localize "STR_antistasi_actions_unconscious_self_withstand_countdown",
format[
"<t color='#008000'>%1</t>",
localize "STR_antistasi_actions_unconscious_self_withstand_ready"
],
true
] call A3A_fnc_customHint
}
];
};
};

private _fnc_selfReviveCountdownStop = {
removeMissionEventHandler ["EachFrame", _handlerCountdown];
};

if (isPlayer _unit) then {
_isPlayer = true;

Expand Down Expand Up @@ -63,6 +103,7 @@ else {

if (_isPlayer) then {
[] call _fnc_applyPostEffect;
[] call _fnc_selfReviveCountdownStart;
};

_unit setFatigue 1;
Expand Down Expand Up @@ -161,6 +202,7 @@ if (_isPlayer) then {
if (_isPlayer) then {
(findDisplay 46) displayRemoveEventHandler ["KeyDown", respawnMenu];
[_unit,"remove"] remoteExec ["A3A_fnc_flagaction",0,_unit];
[] call _fnc_selfReviveCountdownStop;
}
else {
_unit stop false;
Expand All @@ -175,7 +217,8 @@ if (_isPlayer and (_unit getVariable ["respawn",false])) exitWith {};

if (time > _bleedOut) exitWith {
if (_isPlayer) then {
_unit call A3A_fnc_respawn
_unit call A3A_fnc_respawn;
[] call _fnc_selfReviveCountdownStop;
}
else {
_unit setDamage 1;
Expand All @@ -186,6 +229,7 @@ if (alive _unit) then {
_unit setUnconscious false;
_unit switchMove "unconsciousoutprone";
_unit setBleedingRemaining 0;
[] call _fnc_selfReviveCountdownStop;

if (isPlayer _unit) then {
[] call SCRT_fnc_misc_updateRichPresence;
Expand Down
8 changes: 8 additions & 0 deletions A3A/addons/scrt/Stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9469,6 +9469,14 @@
<French>&lt;br/&gt;Appuyez sur H pour résister.</French>
<Korean>&lt;br/&gt;H키를 눌러 스스로 일어나십시오.</Korean>
</Key>
<Key ID="STR_antistasi_actions_unconscious_self_withstand_countdown">
<Original>Self-Revive Cooldown</Original>
<Korean>자가소생 쿨다운</Korean>
</Key>
<Key ID="STR_antistasi_actions_unconscious_self_withstand_ready">
<Original>Available</Original>
<Korean>준비됨</Korean>
</Key>
<Key ID="STR_antistasi_actions_common_access_vehicle_marker_text">
<Original>Access Vehicle Market</Original>
<Russian>Посмотреть чёрный рынок техники</Russian>
Expand Down