mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge pull request #13881 from VOREStation/upstream-merge-8199
[MIRROR] Ports Diagonal Movement [READY FOR MERGE]
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(" ")
|
||||
|
||||
Reference in New Issue
Block a user