mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
Makes locking movement a hotkey (#53771)
* kinda done * Update code/datums/keybinding/mob.dm Co-authored-by: Rohesie <rohesie@gmail.com> * Update code/datums/keybinding/mob.dm Co-authored-by: Rohesie <rohesie@gmail.com> * Update code/datums/keybinding/mob.dm Co-authored-by: Rohesie <rohesie@gmail.com> * Update code/datums/keybinding/mob.dm Co-authored-by: Rohesie <rohesie@gmail.com> Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
@@ -65,6 +65,7 @@
|
||||
#define COMSIG_KB_MOB_TARGETRIGHTLEG_DOWN "keybinding_mob_targetrightleg_down"
|
||||
#define COMSIG_KB_MOB_TARGETBODYGROIN_DOWN "keybinding_mob_targetbodygroin_down"
|
||||
#define COMSIG_KB_MOB_TARGETLEFTLEG_DOWN "keybinding_mob_targetleftleg_down"
|
||||
#define COMSIG_KB_MOB_BLOCKMOVEMENT_DOWN "keybinding_mob_blockmovement_down"
|
||||
|
||||
//Robot
|
||||
#define COMSIG_KB_SILICON_TOGGLEMODULEONE_DOWN "keybinding_silicon_togglemoduleone_down"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
/datum/keybinding/mob/face_north
|
||||
hotkey_keys = list("CtrlW", "CtrlNorth")
|
||||
hotkey_keys = list("AltW", "AltNorth")
|
||||
name = "face_north"
|
||||
full_name = "Face North"
|
||||
description = ""
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
|
||||
/datum/keybinding/mob/face_east
|
||||
hotkey_keys = list("CtrlD", "CtrlEast")
|
||||
hotkey_keys = list("AltD", "AltEast")
|
||||
name = "face_east"
|
||||
full_name = "Face East"
|
||||
description = ""
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
/datum/keybinding/mob/face_south
|
||||
hotkey_keys = list("CtrlS", "CtrlSouth")
|
||||
hotkey_keys = list("AltS", "AltSouth")
|
||||
name = "face_south"
|
||||
full_name = "Face South"
|
||||
description = ""
|
||||
@@ -51,7 +51,7 @@
|
||||
return TRUE
|
||||
|
||||
/datum/keybinding/mob/face_west
|
||||
hotkey_keys = list("CtrlA", "CtrlWest")
|
||||
hotkey_keys = list("AltA", "AltWest")
|
||||
name = "face_west"
|
||||
full_name = "Face West"
|
||||
description = ""
|
||||
@@ -165,7 +165,7 @@
|
||||
return TRUE
|
||||
|
||||
/datum/keybinding/mob/toggle_move_intent
|
||||
hotkey_keys = list("Alt")
|
||||
hotkey_keys = list("C")
|
||||
name = "toggle_move_intent"
|
||||
full_name = "Hold to toggle move intent"
|
||||
description = "Held down to cycle to the other move intent, release to cycle back"
|
||||
@@ -296,3 +296,22 @@
|
||||
return
|
||||
user.body_l_leg()
|
||||
return TRUE
|
||||
|
||||
/datum/keybinding/mob/prevent_movement
|
||||
hotkey_keys = list("Alt")
|
||||
name = "block_movement"
|
||||
full_name = "Block movement"
|
||||
description = "Prevents you from moving"
|
||||
keybind_signal = COMSIG_KB_MOB_BLOCKMOVEMENT_DOWN
|
||||
|
||||
/datum/keybinding/mob/prevent_movement/down(client/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
user.movement_locked = TRUE
|
||||
|
||||
/datum/keybinding/mob/prevent_movement/up(client/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
user.movement_locked = FALSE
|
||||
|
||||
@@ -170,6 +170,8 @@
|
||||
var/parallax_movedir = 0
|
||||
var/parallax_layers_max = 4
|
||||
var/parallax_animate_timer
|
||||
///Are we locking our movement input?
|
||||
var/movement_locked = FALSE
|
||||
|
||||
/**
|
||||
* Assoc list with all the active maps - when a screen obj is added to
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Only way to do that is to tie the behavior into the focus's keyLoop().
|
||||
|
||||
/atom/movable/keyLoop(client/user)
|
||||
if(!user.keys_held["Ctrl"])
|
||||
if(!user.movement_locked)
|
||||
var/movement_dir = NONE
|
||||
for(var/_key in user.keys_held)
|
||||
movement_dir = movement_dir | user.movement_keys[_key]
|
||||
|
||||
@@ -41,13 +41,13 @@
|
||||
winset(src, null, "input.focus=true ; input.text=[url_encode(_key)]")
|
||||
return
|
||||
|
||||
//offset by 1 because the buffer address is 0 indexed because the math was simpler
|
||||
//offset by 1 because the buffer address is 0 indexed because the math was simpler
|
||||
keys_held[current_key_address + 1] = _key
|
||||
//the time a key was pressed isn't actually used anywhere (as of 2019-9-10) but this allows easier access usage/checking
|
||||
keys_held[_key] = world.time
|
||||
current_key_address = ((current_key_address + 1) % HELD_KEY_BUFFER_LENGTH)
|
||||
var/movement = movement_keys[_key]
|
||||
if(!(next_move_dir_sub & movement) && !keys_held["Ctrl"])
|
||||
if(!(next_move_dir_sub & movement) && !movement_locked)
|
||||
next_move_dir_add |= movement
|
||||
|
||||
// Client-level keybindings are ones anyone should be able to do at any time
|
||||
|
||||
Reference in New Issue
Block a user