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

Toggle liberation UI #34

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions KC_Liberation_Master_Framework/functions/fn_addActionsPlayer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -373,4 +373,23 @@ _player addAction [
"
];

// Toggle liberation UI visibility
_player addAction [
"Toggle Liberation UI",
{
if (KP_liberation_overlay_visible == true) then {
KP_liberation_overlay_visible = false;
} else {
KP_liberation_overlay_visible = true;
};},
nil,
-860,
false,
true,
"",
"
alive _originalTarget
"
];

true
12 changes: 7 additions & 5 deletions KC_Liberation_Master_Framework/scripts/client/ui/ui_manager.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ KP_liberation_ammo = 0;
KP_liberation_fuel = 0;
KP_liberation_air_vehicle_building_near = false;
KP_liberation_recycle_building_near = false;
KP_liberation_overlay_visible = false;

waitUntil { !isNil "synchro_done" };
waitUntil { synchro_done };
Expand All @@ -33,7 +34,6 @@ private _bar = controlNull;
private _barwidth = 0;

private _overlay = displayNull;
private _overlayVisible = false;
private _showHud = false;
private _showResources = false;
private _currentFob = "";
Expand All @@ -43,16 +43,16 @@ while {true} do {
_showHud = alive player && {!dialog && {isNull curatorCamera && {!cinematic_camera_started && !halojumping}}};
_visibleMap = visibleMap;

if (_showHud && {!_overlayVisible}) then {
if (_showHud && {!KP_liberation_overlay_visible}) then {
"KPLIB_ui" cutRsc ["KPLIB_overlay", "PLAIN", 1];
_uiticks = 0;
};
if (!_showHud && {_overlayVisible}) then {
if (!_showHud && {KP_liberation_overlay_visible}) then {
"KPLIB_ui" cutText ["", "PLAIN"];
};

_overlay = uiNamespace getVariable ["KPLIB_overlay", displayNull];
_overlayVisible = !isNull _overlay;
KP_liberation_overlay_visible = !isNull _overlay;

// Player is at FOB
if (_currentFob != "" || {_visibleMap}) then {
Expand Down Expand Up @@ -85,7 +85,7 @@ while {true} do {
KP_liberation_recycle_building_near = false;
};

if (_overlayVisible) then {
if (KP_liberation_overlay_visible) then {

(_overlay displayCtrl (266)) ctrlSetText format [ "%1", GRLIB_ui_notif ];
(_overlay displayCtrl (267)) ctrlSetText format [ "%1", GRLIB_ui_notif ];
Expand Down Expand Up @@ -169,8 +169,10 @@ while {true} do {
"zone_capture" setmarkerposlocal markers_reset;
};
};

};


_uiticks = _uiticks + 1;
if (_uiticks > 1000) then {_uiticks = 0;};
uiSleep 0.25;
Expand Down