diff --git a/code/_onclick/hud/action_button.dm b/code/_onclick/hud/action_button.dm index 5780e86a298..15ed4429965 100644 --- a/code/_onclick/hud/action_button.dm +++ b/code/_onclick/hud/action_button.dm @@ -1,4 +1,3 @@ - /obj/screen/movable/action_button var/datum/action/linked_action screen_loc = null @@ -6,18 +5,26 @@ /obj/screen/movable/action_button/Click(location,control,params) var/list/modifiers = params2list(params) if(modifiers["shift"]) - moved = 0 + if(locked) + to_chat(usr, "Action button \"[name]\" is locked, unlock it first.") + return TRUE + moved = FALSE usr.update_action_buttons() //redraw buttons that are no longer considered "moved" - return 1 - if(usr.next_move >= world.time) // Is this needed ? + return TRUE + if(modifiers["ctrl"]) + locked = !locked + to_chat(usr, "Action button \"[name]\" [locked ? "" : "un"]locked.") + return TRUE + if(usr.next_click > world.time) return + usr.next_click = world.time + 1 linked_action.Trigger() - return 1 + return TRUE //Hide/Show Action Buttons ... Button /obj/screen/movable/action_button/hide_toggle name = "Hide Buttons" - desc = "Shift-click any button to reset its position. Alt-click to reset all buttons to their default positions." + desc = "Shift-click any button to reset its position, and Control-click it to lock/unlock its position. Alt-click this button to reset all buttons to their default positions." icon = 'icons/mob/actions/actions.dmi' icon_state = "bg_default" var/hidden = 0 @@ -25,9 +32,16 @@ /obj/screen/movable/action_button/hide_toggle/Click(location,control,params) var/list/modifiers = params2list(params) if(modifiers["shift"]) + if(locked) + to_chat(usr, "Action button \"[name]\" is locked, unlock it first.") + return TRUE moved = FALSE usr.update_action_buttons(TRUE) return TRUE + if(modifiers["ctrl"]) + locked = !locked + to_chat(usr, "Action button \"[name]\" [locked ? "" : "un"]locked.") + return TRUE if(modifiers["alt"]) for(var/V in usr.actions) var/datum/action/A = V @@ -69,7 +83,6 @@ var/image/img = image(icon, src, hidden ? "show" : "hide") overlays += img - /obj/screen/movable/action_button/MouseEntered(location,control,params) openToolTip(usr,src,params,title = name,content = desc) @@ -77,7 +90,6 @@ /obj/screen/movable/action_button/MouseExited() closeToolTip(usr) - /mob/proc/update_action_buttons_icon() for(var/X in actions) var/datum/action/A = X @@ -122,7 +134,6 @@ client.screen += hud_used.hide_actions_toggle - #define AB_MAX_COLUMNS 10 /datum/hud/proc/ButtonNumberToScreenCoords(number) // TODO : Make this zero-indexed for readabilty diff --git a/code/_onclick/hud/movable_screen_objects.dm b/code/_onclick/hud/movable_screen_objects.dm index 668e0e67fc7..366931cea33 100644 --- a/code/_onclick/hud/movable_screen_objects.dm +++ b/code/_onclick/hud/movable_screen_objects.dm @@ -11,6 +11,7 @@ /obj/screen/movable var/snap2grid = FALSE var/moved = FALSE + var/locked = TRUE var/x_off = -16 var/y_off = -16 @@ -20,8 +21,10 @@ /obj/screen/movable/snap snap2grid = TRUE - /obj/screen/movable/MouseDrop(over_object, src_location, over_location, src_control, over_control, params) + if(locked) //no! I am locked! begone! + return + var/list/PM = params2list(params) //No screen-loc information? abort. @@ -47,7 +50,6 @@ moved = screen_loc - //Debug procs /client/proc/test_movable_UI() set category = "Debug" @@ -67,7 +69,6 @@ screen += M - /client/proc/test_snap_UI() set category = "Debug" set name = "Spawn Snap UI Object" @@ -84,4 +85,4 @@ S.screen_loc = screen_l - screen += S \ No newline at end of file + screen += S diff --git a/code/datums/action.dm b/code/datums/action.dm index 0f0559e0b9d..a5f63cc6fe4 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -43,6 +43,7 @@ M.actions += src if(M.client) M.client.screen += button + button.locked = TRUE M.update_action_buttons() /datum/action/proc/Remove(mob/M) @@ -52,6 +53,7 @@ if(M.client) M.client.screen -= button button.moved = FALSE //so the button appears in its normal position when given to another owner. + button.locked = FALSE M.actions -= src M.update_action_buttons()