diff --git a/code/__defines/input.dm b/code/__defines/input.dm index cbc703935a6..16afe5a2f3c 100644 --- a/code/__defines/input.dm +++ b/code/__defines/input.dm @@ -10,7 +10,7 @@ // Combine the held WASD and arrow keys together (OR) into byond N/S/E/W dir #define MOVEMENT_KEYS_TO_DIR(MK) ((((MK)>>4)|(MK))&(ALL_CARDINALS)) -// Bitflags for pressed modifier keys. +// Bitflags for pressed modifier keys. // Values chosen specifically to not conflict with dir bitfield, in case we want to smoosh them together. #define CTRL_KEY (1<<8) #define SHIFT_KEY (1<<9) diff --git a/code/_helpers/type2type.dm b/code/_helpers/type2type.dm index 700bbbfc571..ef25f44142b 100644 --- a/code/_helpers/type2type.dm +++ b/code/_helpers/type2type.dm @@ -98,12 +98,18 @@ if(!direction) return "" var/list/dirs = list() - if(direction & NORTH) dirs += "NORTH" - if(direction & SOUTH) dirs += "SOUTH" - if(direction & EAST) dirs += "EAST" - if(direction & WEST) dirs += "WEST" - if(direction & UP) dirs += "UP" - if(direction & DOWN) dirs += "DOWN" + if(direction & NORTH) + dirs += "NORTH" + if(direction & SOUTH) + dirs += "SOUTH" + if(direction & EAST) + dirs += "EAST" + if(direction & WEST) + dirs += "WEST" + if(direction & UP) + dirs += "UP" + if(direction & DOWN) + dirs += "DOWN" return dirs.Join(" ") // Converts an angle (degrees) into an ss13 direction @@ -315,4 +321,4 @@ error("File not found ([filename])") catch(var/exception/E) if(error_on_invalid_return) - error("Exception when loading file as string: [E]") \ No newline at end of file + error("Exception when loading file as string: [E]") diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index ef50823c48c..40b4ea9d4ef 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -637,4 +637,4 @@ return selfimage /atom/movable/proc/get_cell() - return + return \ No newline at end of file diff --git a/code/global.dm b/code/global.dm index c96f920ce9a..f594b47f76a 100644 --- a/code/global.dm +++ b/code/global.dm @@ -87,6 +87,7 @@ var/list/reverse_dir = list( // reverse_dir[dir] = reverse of dir 41, 43, 36, 38, 37, 39, 44, 46, 45, 47, 16, 18, 17, 19, 24, 26, 25, 27, 20, 22, 21, 23, 28, 30, 29, 31, 48, 50, 49, 51, 56, 58, 57, 59, 52, 54, 53, 55, 60, 62, 61, 63 ) +var/global/const/SQRT_TWO = 1.41421356237 var/datum/configuration/config = null diff --git a/code/modules/keybindings/bindings_movekeys.dm b/code/modules/keybindings/bindings_movekeys.dm index 3e34fa9f334..896618084a6 100644 --- a/code/modules/keybindings/bindings_movekeys.dm +++ b/code/modules/keybindings/bindings_movekeys.dm @@ -22,7 +22,7 @@ var/global/list/MOVE_KEY_MAPPINGS = list( // Map text sent by skin.dmf to our numeric codes. (This can be optimized away once we update skin.dmf) var/movekey = MOVE_KEY_MAPPINGS[movekeyName] - + // Validate input. Must be one (and only one) of the key codes) if(isnull(movekey) || (movekey & ~0xFFF) || (movekey & (movekey - 1))) log_debug("Client [ckey] sent an illegal movement key down: [movekeyName] ([movekey])") @@ -54,12 +54,12 @@ var/global/list/MOVE_KEY_MAPPINGS = list( // Map text sent by skin.dmf to our numeric codes. (This can be optimized away once we update skin.dmf) var/movekey = MOVE_KEY_MAPPINGS[movekeyName] - + // Validate input. Must be one (and only one) of the key codes) if(isnull(movekey) || (movekey & ~0xFFF) || (movekey & (movekey - 1))) log_debug("Client [ckey] sent an illegal movement key up: [movekeyName] ([movekey])") return - + // Clear bit indicating we were holding the key move_keys_held &= ~movekey mod_keys_held &= ~movekey diff --git a/code/modules/keybindings/setup.dm b/code/modules/keybindings/setup.dm index b4031b91ed2..8e7851099a5 100644 --- a/code/modules/keybindings/setup.dm +++ b/code/modules/keybindings/setup.dm @@ -1,15 +1,19 @@ // Set a client's focus to an object and override these procs on that object to let it handle keypresses -/datum/proc/key_down(key, client/user) // Called when a key is pressed down initially +/// Called when a key is pressed down initially +/datum/proc/key_down(key, client/user) return -/datum/proc/key_up(key, client/user) // Called when a key is released + +/// Called when a key is released +/datum/proc/key_up(key, client/user) return -/datum/proc/keyLoop(client/user) // Called once every server tick + +/// Called once every server tick +/datum/proc/keyLoop(client/user) set waitfor = FALSE return -/// Set mob's focus -/// TODO - Do we even need this concept? +/// Set mob's focus. TODO: Decide if required. /mob/proc/set_focus(datum/new_focus) if(focus == new_focus) return @@ -20,15 +24,26 @@ if(!keys) return "" var/list/out = list() - if(keys & NORTH_KEY) out += "NORTH" - if(keys & SOUTH_KEY) out += "SOUTH" - if(keys & EAST_KEY) out += "EAST" - if(keys & WEST_KEY) out += "WEST" - if(keys & W_KEY) out += "W" - if(keys & A_KEY) out += "A" - if(keys & S_KEY) out += "S" - if(keys & D_KEY) out += "D" - if(keys & CTRL_KEY) out += "CTRL" - if(keys & SHIFT_KEY) out += "SHIFT" - if(keys & ALT_KEY) out += "ALT" + if(keys & NORTH_KEY) + out += "NORTH" + if(keys & SOUTH_KEY) + out += "SOUTH" + if(keys & EAST_KEY) + out += "EAST" + if(keys & WEST_KEY) + out += "WEST" + if(keys & W_KEY) + out += "W" + if(keys & A_KEY) + out += "A" + if(keys & S_KEY) + out += "S" + if(keys & D_KEY) + out += "D" + if(keys & CTRL_KEY) + out += "CTRL" + if(keys & SHIFT_KEY) + out += "SHIFT" + if(keys & ALT_KEY) + out += "ALT" return out.Join(" ") diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 19476f24606..ceb49fa47ae 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -233,4 +233,4 @@ var/list/progressbars = null //VOREStation Edit - var/datum/focus //What receives our keyboard inputs. src by default // VOREStation Add - Key Handling + var/datum/focus //What receives our keyboard inputs. src by default diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index c2f1d635afe..6cbb6240123 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -159,8 +159,8 @@ // We're still cooling down from the last move if(!my_mob.checkMoveCooldown()) + DEBUG_INPUT("--------") return - DEBUG_INPUT("--------") next_move_dir_add = 0 // This one I *think* exists so you can tap move and it will move even if delay isn't quite up. next_move_dir_sub = 0 // I'm not really sure why next_move_dir_sub even exists. diff --git a/interface/skin.dmf b/interface/skin.dmf index 025b11e0fd1..8af2d728d2c 100644 --- a/interface/skin.dmf +++ b/interface/skin.dmf @@ -268,7 +268,7 @@ macro "macro" elem name = "TAB" command = ".winset \"mainwindow.macro=hotkeymode hotkey_toggle.is-checked=true mapwindow.map.focus=true\"" - elem + elem name = "Shift" command = "KeyDown Shift" elem @@ -492,7 +492,7 @@ macro "hotkeymode" elem name = "TAB" command = ".winset \"mainwindow.macro=macro hotkey_toggle.is-checked=false input.focus=true\"" - elem + elem name = "Shift" command = "KeyDown Shift" elem