Merge pull request #13881 from VOREStation/upstream-merge-8199

[MIRROR] Ports Diagonal Movement [READY FOR MERGE]
This commit is contained in:
Casey
2022-10-09 23:07:54 -04:00
committed by CHOMPStation2
parent 0972599a01
commit 24a6d07198
9 changed files with 54 additions and 32 deletions

View File

@@ -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

View File

@@ -91,6 +91,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

View File

@@ -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(" ")

View File

@@ -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

View File

@@ -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.