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

Adds a verb to hide action buttons #5304

Merged
merged 3 commits into from
Dec 30, 2023
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
8 changes: 4 additions & 4 deletions code/datums/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
var/cost = 0 // By default an action has no cost -> will be utilized by skill actions/xeno actions
var/action_flags = 0 // Check out __game.dm for flags
/// Whether the action is hidden from its owner
/// Useful for when you want to preserve action state while preventing
/// a mob from using said action
var/hidden = FALSE
var/hidden = FALSE //Preserve action state while preventing mob from using action
///Hide the action from the owner without preventing them from using it (incase of keybind listen_signal)
var/player_hidden = FALSE
var/unique = TRUE
/// A signal on the mob that will cause the action to activate
var/listen_signal
Expand Down Expand Up @@ -227,7 +227,7 @@
var/atom/movable/screen/action_button/B = A.button
if(reload_screen)
client.add_to_screen(B)
if(A.hidden)
if(A.hidden || A.player_hidden)
B.screen_loc = null
continue
button_number++
Expand Down
29 changes: 29 additions & 0 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -842,3 +842,32 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
total_t3_playtime += get_job_playtime(src, caste_name)

return total_t3_playtime

/client/verb/action_hide_menu()
set name = "Show/Hide Actions"
set category = "IC"

var/mob/user = usr

var/list/actions_list = list()
for(var/datum/action/action as anything in user.actions)
var/action_name = action.name
if(action.player_hidden)
action_name += " (Hidden)"
actions_list[action_name] += action

if(!LAZYLEN(actions_list))
to_chat(user, SPAN_WARNING("You have no actions available."))
return

var/selected_action_name = tgui_input_list(user, "Show or hide selected action", "Show/Hide Actions", actions_list, 30 SECONDS)
if(!selected_action_name)
to_chat(user, SPAN_WARNING("You did not select an action."))
return

var/datum/action/selected_action = actions_list[selected_action_name]
selected_action.player_hidden = !selected_action.player_hidden
user.update_action_buttons()

if(!selected_action.player_hidden && selected_action.hidden) //Inform the player that even if they are unhiding it, itll still not be visible
to_chat(user, SPAN_NOTICE("[selected_action] is forcefully hidden, bypassing player unhiding."))