Ports Diagonal Movement

This commit is contained in:
Cerebulon
2022-10-08 03:36:57 -04:00
committed by VirgoBot
parent a637852c29
commit e99eba7945
18 changed files with 3539 additions and 2 deletions
+8
View File
@@ -10,7 +10,11 @@
// 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))
<<<<<<< HEAD
// Bitflags for pressed modifier keys.
=======
// Bitflags for pressed modifier keys.
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
// 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)
@@ -18,4 +22,8 @@
// Uncomment to get a lot of debug logging for movement keys.
// #define DEBUG_INPUT(A) to_world_log(A)
<<<<<<< HEAD
#define DEBUG_INPUT(A)
=======
#define DEBUG_INPUT(A)
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
+7
View File
@@ -54,8 +54,11 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
// The numbers just define the ordering, they are meaningless otherwise.
#define INIT_ORDER_WEBHOOKS 50
#define INIT_ORDER_SQLITE 40
<<<<<<< HEAD
#define INIT_ORDER_GARBAGE 39
#define INIT_ORDER_MEDIA_TRACKS 38 // Gotta get that lobby music up, yo
=======
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
#define INIT_ORDER_INPUT 37
#define INIT_ORDER_CHEMISTRY 35
#define INIT_ORDER_VIS 32
@@ -117,6 +120,7 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
#define FIRE_PRIORITY_PROJECTILES 150
#define FIRE_PRIORITY_CHAT 400
#define FIRE_PRIORITY_OVERLAYS 500
<<<<<<< HEAD
#define FIRE_PRIORITY_INPUT 1000 // This must always always be the max highest priority. Player input must never be lost.
// Macro defining the actual code applying our overlays lists to the BYOND overlays list. (I guess a macro for speed)
@@ -141,3 +145,6 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
}\
A.flags &= ~OVERLAY_QUEUED;\
} while (FALSE)
=======
#define FIRE_PRIORITY_INPUT 1000 // This must always always be the max highest priority. Player input must never be lost.
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
+16 -1
View File
@@ -98,12 +98,27 @@
if(!direction)
return ""
var/list/dirs = list()
<<<<<<< HEAD
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"
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
return dirs.Join(" ")
// Converts an angle (degrees) into an ss13 direction
@@ -315,4 +330,4 @@
error("File not found ([filename])")
catch(var/exception/E)
if(error_on_invalid_return)
error("Exception when loading file as string: [E]")
error("Exception when loading file as string: [E]")
+4
View File
@@ -10,4 +10,8 @@ SUBSYSTEM_DEF(input)
var/list/clients = GLOB.clients // Let's sing the list cache song
for(var/i in 1 to clients.len)
var/client/C = clients[i]
<<<<<<< HEAD
C?.keyLoop()
=======
C?.keyLoop()
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
+1 -1
View File
@@ -637,4 +637,4 @@
return selfimage
/atom/movable/proc/get_cell()
return
return
+1
View File
@@ -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
+7
View File
@@ -80,11 +80,14 @@
// Runechat messages
var/list/seen_messages
<<<<<<< HEAD
//Hide top bars
var/fullscreen = FALSE
//Hide status bar
var/show_status_bar = TRUE
=======
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
///////////
// INPUT //
///////////
@@ -112,4 +115,8 @@
/// Movement dir of the most recently pressed movement key. Used in cardinal-only movement mode.
var/last_move_dir_pressed = NONE
<<<<<<< HEAD
#endif
=======
#endif
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
@@ -4,11 +4,14 @@
// THE TRADITIONAL STYLE FROM /TG (modified)
/atom/movable/keyLoop(client/user)
<<<<<<< HEAD
// Bail out if the user is holding the "face direction" key (Maybe?)
// TODO - I think this breaks non-hotkeys WASD movement, so maybe adopt the /tg solution)
if(user.mod_keys_held & CTRL_KEY)
return
=======
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
var/must_call_move = FALSE
var/movement_dir = MOVEMENT_KEYS_TO_DIR(user.move_keys_held)
if(user.next_move_dir_add)
@@ -22,7 +22,11 @@ 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]
<<<<<<< HEAD
=======
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
// 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 +58,20 @@ 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]
<<<<<<< HEAD
=======
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
// 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
<<<<<<< HEAD
=======
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
// Clear bit indicating we were holding the key
move_keys_held &= ~movekey
mod_keys_held &= ~movekey
@@ -74,4 +86,8 @@ var/global/list/MOVE_KEY_MAPPINGS = list(
// Called every game tick
/client/keyLoop()
<<<<<<< HEAD
mob.focus?.keyLoop(src)
=======
mob.focus?.keyLoop(src)
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
+43
View File
@@ -1,5 +1,6 @@
// Set a client's focus to an object and override these procs on that object to let it handle keypresses
<<<<<<< HEAD
/datum/proc/key_down(key, client/user) // Called when a key is pressed down initially
return
/datum/proc/key_up(key, client/user) // Called when a key is released
@@ -10,6 +11,22 @@
/// Set mob's focus
/// TODO - Do we even need this concept?
=======
/// Called when a key is pressed down initially
/datum/proc/key_down(key, client/user)
return
/// Called when a key is released
/datum/proc/key_up(key, client/user)
return
/// Called once every server tick
/datum/proc/keyLoop(client/user)
set waitfor = FALSE
return
/// Set mob's focus. TODO: Decide if required.
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
/mob/proc/set_focus(datum/new_focus)
if(focus == new_focus)
return
@@ -20,6 +37,7 @@
if(!keys)
return ""
var/list/out = list()
<<<<<<< HEAD
if(keys & NORTH_KEY) out += "NORTH"
if(keys & SOUTH_KEY) out += "SOUTH"
if(keys & EAST_KEY) out += "EAST"
@@ -32,3 +50,28 @@
if(keys & SHIFT_KEY) out += "SHIFT"
if(keys & ALT_KEY) out += "ALT"
return out.Join(" ")
=======
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(" ")
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
@@ -1,6 +1,8 @@
/mob/living
see_invisible = SEE_INVISIBLE_LIVING
appearance_flags = TILE_BOUND|PIXEL_SCALE|KEEP_TOGETHER|LONG_GLIDE
//Health and life related vars
var/maxHealth = 100 //Maximum health that should be possible. Avoid adjusting this if you can, and instead use modifiers datums.
var/health = 100 //A mob's health
@@ -1,3 +1,5 @@
/mob/CanPass(atom/movable/mover, turf/target)
if(ismob(mover))
var/mob/moving_mob = mover
@@ -202,7 +204,11 @@ default behaviour is:
if(!T2) // Map edge
now_pushing = 0
return
<<<<<<< HEAD
var/move_time = movement_delay(loc, t)
=======
var/move_time = movement_delay(loc, t) * SQRT_TWO
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
move_time = DS2NEARESTTICK(move_time)
if(AM.Move(T2, t, move_time))
Move(T, t, move_time)
+15
View File
@@ -40,8 +40,12 @@
else
living_mob_list += src
lastarea = get_area(src)
<<<<<<< HEAD
set_focus(src) // VOREStation Add - Key Handling
hook_vr("mob_new",list(src)) //VOREStation Code
=======
set_focus(src) // Key Handling
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
update_transform() // Some mobs may start bigger or smaller than normal.
return ..()
@@ -1270,3 +1274,14 @@ GLOBAL_LIST_EMPTY_TYPED(living_players_by_zlevel, /list)
/mob/proc/grab_ghost(force)
if(mind)
return mind.grab_ghost(force = force)
<<<<<<< HEAD
=======
/mob/proc/get_sound_volume_multiplier()
return !ear_deaf
/mob/proc/handle_reagent_transfer(var/datum/reagents/holder, var/amount = 1, var/chem_type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0)
var/datum/reagents/R = new /datum/reagents(amount)
. = holder.trans_to_holder(R, amount, multiplier, copy)
R.touch_mob(src)
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
+4
View File
@@ -230,7 +230,11 @@
var/registered_z
var/in_enclosed_vehicle = 0 //For mechs and fighters ambiance. Can be used in other cases.
<<<<<<< HEAD
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
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
+4
View File
@@ -160,7 +160,11 @@
// We're still cooling down from the last move
if(!my_mob.checkMoveCooldown())
return
<<<<<<< HEAD
DEBUG_INPUT("--------")
=======
DEBUG_INPUT("--------")
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
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.
+11
View File
@@ -355,6 +355,17 @@
/obj/structure/catwalk/CheckFall(var/atom/movable/falling_atom)
return falling_atom.fall_impact(src)
/atom/movable/proc/can_fall_to(turf/landing)
// Check if there is anything in our turf we are standing on to prevent falling.
for(var/obj/O in loc)
if(!O.CanFallThru(src, landing))
return FALSE
// See if something in turf below prevents us from falling into it.
for(var/atom/A in landing)
if(!A.CanPass(src, src.loc, 1, 0))
return FALSE
return TRUE
/obj/structure/lattice/CanFallThru(atom/movable/mover as mob|obj, turf/target as turf)
if(target.z >= z)
return TRUE // We don't block sideways or upward movement.
+77
View File
@@ -84,6 +84,7 @@ macro "borghotkeymode"
name = "CTRL+SHIFT+NORTH"
command = "shiftnorth"
elem
<<<<<<< HEAD
name = "CTRL+SHIFT+SOUTH"
command = "shiftsouth"
elem
@@ -92,6 +93,13 @@ macro "borghotkeymode"
elem
name = "CTRL+SHIFT+EAST"
command = "shifteast"
=======
name = "South"
command = "KeyDown South"
elem
name = "South+UP"
command = "KeyUp South"
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
elem
name = "INSERT"
command = "a-intent right"
@@ -126,9 +134,12 @@ macro "borghotkeymode"
name = "5"
command = ".me"
elem
<<<<<<< HEAD
name = "6"
command = ".Subtle"
elem
=======
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
name = "A"
command = "KeyDown A"
elem
@@ -176,6 +187,12 @@ macro "borghotkeymode"
elem
name = "S+UP"
command = "KeyUp S"
<<<<<<< HEAD
=======
elem
name = "CTRL+S+REP"
command = ".movedown"
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
elem
name = "T"
command = ".say"
@@ -268,7 +285,11 @@ macro "macro"
elem
name = "TAB"
command = ".winset \"mainwindow.macro=hotkeymode hotkey_toggle.is-checked=true mapwindow.map.focus=true\""
<<<<<<< HEAD
elem
=======
elem
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
name = "Shift"
command = "KeyDown Shift"
elem
@@ -353,11 +374,19 @@ macro "macro"
name = "CTRL+SHIFT+SOUTH"
command = "shiftsouth"
elem
<<<<<<< HEAD
name = "CTRL+SHIFT+WEST"
command = "shiftwest"
elem
name = "CTRL+SHIFT+EAST"
command = "shifteast"
=======
name = "South"
command = "KeyDown South"
elem
name = "South+UP"
command = "KeyUp South"
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
elem
name = "INSERT"
command = "a-intent right"
@@ -492,7 +521,11 @@ macro "hotkeymode"
elem
name = "TAB"
command = ".winset \"mainwindow.macro=macro hotkey_toggle.is-checked=false input.focus=true\""
<<<<<<< HEAD
elem
=======
elem
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
name = "Shift"
command = "KeyDown Shift"
elem
@@ -570,6 +603,7 @@ macro "hotkeymode"
elem
name = "South+UP"
command = "KeyUp South"
<<<<<<< HEAD
elem
name = "CTRL+SHIFT+NORTH"
command = "shiftnorth"
@@ -582,6 +616,8 @@ macro "hotkeymode"
elem
name = "CTRL+SHIFT+EAST"
command = "shifteast"
=======
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
elem
name = "INSERT"
command = "a-intent right"
@@ -616,6 +652,7 @@ macro "hotkeymode"
name = "5"
command = ".me"
elem
<<<<<<< HEAD
name = "6"
command = ".Subtle"
elem
@@ -624,6 +661,22 @@ macro "hotkeymode"
elem
name = "A+UP"
command = "KeyUp A"
=======
name = "A"
command = "KeyDown A"
elem
name = "A+UP"
command = "KeyUp A"
elem
name = "CTRL+A+REP"
command = ".moveleft"
elem
name = "D"
command = "KeyDown D"
elem
name = "D+UP"
command = "KeyUp D"
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
elem
name = "D"
command = "KeyDown D"
@@ -678,6 +731,12 @@ macro "hotkeymode"
elem
name = "S+UP"
command = "KeyUp S"
<<<<<<< HEAD
=======
elem
name = "CTRL+S+REP"
command = ".movedown"
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
elem
name = "T"
command = ".say"
@@ -687,6 +746,12 @@ macro "hotkeymode"
elem
name = "W+UP"
command = "KeyUp W"
<<<<<<< HEAD
=======
elem
name = "CTRL+W+REP"
command = ".moveup"
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
elem
name = "X"
command = ".northeast"
@@ -851,6 +916,7 @@ macro "borgmacro"
elem
name = "South+UP"
command = "KeyUp South"
<<<<<<< HEAD
elem
name = "CTRL+SHIFT+NORTH"
command = "shiftnorth"
@@ -863,6 +929,8 @@ macro "borgmacro"
elem
name = "CTRL+SHIFT+EAST"
command = "shifteast"
=======
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
elem
name = "INSERT"
command = "a-intent right"
@@ -911,6 +979,15 @@ macro "borgmacro"
elem
name = "CTRL+S+UP"
command = "KeyUp S"
<<<<<<< HEAD
=======
elem
name = "CTRL+W"
command = "KeyDown W"
elem
name = "CTRL+W+UP"
command = "KeyUp W"
>>>>>>> c463104999a... Ports Diagonal Movement (#8199)
elem
name = "CTRL+W"
command = "KeyDown W"
+3314
View File
File diff suppressed because it is too large Load Diff