Merge pull request #2119 from Citadel-Station-13/upstream-merge-29379

[MIRROR] You can now control-click action buttons to lock them in place
This commit is contained in:
LetterJay
2017-07-25 12:54:34 -05:00
committed by GitHub
5 changed files with 24 additions and 4 deletions
+13 -3
View File
@@ -13,17 +13,21 @@
if(modifiers["shift"])
moved = 0
usr.update_action_buttons() //redraw buttons that are no longer considered "moved"
return 1
return TRUE
if(modifiers["ctrl"])
locked = !locked
to_chat(usr, "<span class='notice'>Action button \"[name]\" [locked ? "" : "un"]locked.</span>")
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 it in place. Alt-click this button to reset all buttons to their default positions."
icon = 'icons/mob/actions.dmi'
icon_state = "bg_default"
var/hidden = 0
@@ -37,11 +41,17 @@
moved = FALSE
usr.update_action_buttons(TRUE)
return TRUE
if(modifiers["ctrl"])
locked = !locked
to_chat(usr, "<span class='notice'>Action button \"[name]\" [locked ? "" : "un"]locked.</span>")
return TRUE
if(modifiers["alt"])
for(var/V in usr.actions)
var/datum/action/A = V
var/obj/screen/movable/action_button/B = A.button
B.moved = FALSE
B.locked = usr.client.prefs.buttons_locked
locked = usr.client.prefs.buttons_locked
moved = FALSE
usr.update_action_buttons(TRUE)
to_chat(usr, "<span class='notice'>Action button positions have been reset.</span>")
+2
View File
@@ -58,6 +58,8 @@
hide_actions_toggle = new
hide_actions_toggle.InitialiseIcon(src)
if(mymob.client)
hide_actions_toggle.locked = mymob.client.prefs.buttons_locked
hand_slots = list()
@@ -11,6 +11,7 @@
/obj/screen/movable
var/snap2grid = FALSE
var/moved = FALSE
var/locked = FALSE
//Snap Screen Object
//Tied to the grid, snaps to the nearest turf
@@ -20,6 +21,8 @@
/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.
+2
View File
@@ -45,6 +45,7 @@
M.actions += src
if(M.client)
M.client.screen += button
button.locked = M.client.prefs.buttons_locked
M.update_action_buttons()
else
Remove(owner)
@@ -57,6 +58,7 @@
M.update_action_buttons()
owner = null
button.moved = FALSE //so the button appears in its normal position when given to another owner.
button.locked = FALSE
/datum/action/proc/Trigger()
if(!IsAvailable())
+4 -1
View File
@@ -30,6 +30,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/UI_style = "Midnight"
var/buttons_locked = FALSE
var/hotkeys = FALSE
var/tgui_fancy = TRUE
var/tgui_lock = TRUE
@@ -278,6 +279,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<h2>General Settings</h2>"
dat += "<b>UI Style:</b> <a href='?_src_=prefs;task=input;preference=ui'>[UI_style]</a><br>"
dat += "<b>Keybindings:</b> <a href='?_src_=prefs;preference=hotkeys'>[(hotkeys) ? "Hotkeys" : "Default"]</a><br>"
dat += "<b>Action Buttons:</b> <a href='?_src_=prefs;preference=action_buttons'>[(buttons_locked) ? "Locked In Place" : "Unlocked"]</a><br>"
dat += "<b>tgui Style:</b> <a href='?_src_=prefs;preference=tgui_fancy'>[(tgui_fancy) ? "Fancy" : "No Frills"]</a><br>"
dat += "<b>tgui Monitors:</b> <a href='?_src_=prefs;preference=tgui_lock'>[(tgui_lock) ? "Primary" : "All"]</a><br>"
dat += "<b>Window Flashing:</b> <a href='?_src_=prefs;preference=winflash'>[(windowflashing) ? "Yes" : "No"]</a><br>"
@@ -1497,7 +1499,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if("hotkeys")
hotkeys = !hotkeys
if("action_buttons")
buttons_locked = !buttons_locked
if("tgui_fancy")
tgui_fancy = !tgui_fancy
if("tgui_lock")