From 71e83499fce52aef934f16a3985941d256bbcecc Mon Sep 17 00:00:00 2001 From: Darius <5933805+LeDrascol@users.noreply.github.com> Date: Fri, 24 Feb 2023 19:49:32 -0500 Subject: [PATCH 1/2] Allow classic pixel shifting Uncomments the removed lines for pixel shifting verbs, allowing them to be used again. --- code/modules/keybindings/keybind/movement.dm | 4 ++-- code/modules/mob/mob.dm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/modules/keybindings/keybind/movement.dm b/code/modules/keybindings/keybind/movement.dm index 4e14b69ae9..296b127cb4 100644 --- a/code/modules/keybindings/keybind/movement.dm +++ b/code/modules/keybindings/keybind/movement.dm @@ -74,7 +74,7 @@ var/mob/M = user.mob M.westface() return TRUE -/* + /datum/keybinding/mob/shift_north hotkey_keys = list("CtrlShiftW", "CtrlShiftNorth") name = "pixel_shift_north" @@ -122,7 +122,7 @@ var/mob/M = user.mob M.westshift() return TRUE -*/ + /datum/keybinding/living/hold_sprint hotkey_keys = list() classic_keys = list() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 8794f2f9a3..63021287e5 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -669,7 +669,7 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0) setDir(SOUTH) client.last_turn = world.time + MOB_FACE_DIRECTION_DELAY return TRUE -/* + /mob/verb/eastshift() set hidden = TRUE if(!canface()) @@ -701,7 +701,7 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0) if(pixel_y >= -32) pixel_y-- is_shifted = TRUE -*/ + /mob/proc/IsAdvancedToolUser()//This might need a rename but it should replace the can this mob use things check return FALSE From 556840700f266068aeb941c5a4ed68be4a6225ed Mon Sep 17 00:00:00 2001 From: Darius <5933805+LeDrascol@users.noreply.github.com> Date: Fri, 24 Feb 2023 20:10:55 -0500 Subject: [PATCH 2/2] Better old-shift compatability This commit: - Moves the pixel shifting defines to mob defines - Updates pixel shifting define names to be more unique - Updates old pixel shifting to use shift limits --- code/__SANDCODE/DEFINES/mobs.dm | 4 ++++ code/modules/mob/mob.dm | 8 +++---- .../code/modules/pixel_shift/pixel_shift.dm | 22 +++++++------------ 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/code/__SANDCODE/DEFINES/mobs.dm b/code/__SANDCODE/DEFINES/mobs.dm index dc7c4a98e0..9dca2a6744 100644 --- a/code/__SANDCODE/DEFINES/mobs.dm +++ b/code/__SANDCODE/DEFINES/mobs.dm @@ -10,3 +10,7 @@ #define THIRST_LEVEL_START_MIN 250 #define THIRST_LEVEL_START_MAX 400 + +// Pixel shifting +#define PIXEL_SHIFT_MAXIMUM 16 +#define PIXEL_SHIFT_PASSABLE_THRESHOLD 8 diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 63021287e5..61c8ca454e 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -674,7 +674,7 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0) set hidden = TRUE if(!canface()) return FALSE - if(pixel_x <= 32) + if(pixel_x <= PIXEL_SHIFT_MAXIMUM + base_pixel_x) pixel_x++ is_shifted = TRUE @@ -682,7 +682,7 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0) set hidden = TRUE if(!canface()) return FALSE - if(pixel_x >= -32) + if(pixel_x >= -PIXEL_SHIFT_MAXIMUM + base_pixel_x) pixel_x-- is_shifted = TRUE @@ -690,7 +690,7 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0) set hidden = TRUE if(!canface()) return FALSE - if(pixel_y <= 32) + if(pixel_y <= PIXEL_SHIFT_MAXIMUM + base_pixel_y) pixel_y++ is_shifted = TRUE @@ -698,7 +698,7 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0) set hidden = TRUE if(!canface()) return FALSE - if(pixel_y >= -32) + if(pixel_y >= -PIXEL_SHIFT_MAXIMUM + base_pixel_y) pixel_y-- is_shifted = TRUE diff --git a/modular_sand/code/modules/pixel_shift/pixel_shift.dm b/modular_sand/code/modules/pixel_shift/pixel_shift.dm index 253ab050f3..013ef11b71 100644 --- a/modular_sand/code/modules/pixel_shift/pixel_shift.dm +++ b/modular_sand/code/modules/pixel_shift/pixel_shift.dm @@ -1,6 +1,3 @@ -#define MAXIMUM_PIXEL_SHIFT 16 -#define PASSABLE_SHIFT_THRESHOLD 8 - /mob /// If we are in the shifting setting. var/shifting = FALSE @@ -60,35 +57,35 @@ passthroughable = NONE // switch(direction) // diagonal pixel-shifting, rejoice if(CHECK_BITFIELD(direction, NORTH)) - if(pixel_y <= MAXIMUM_PIXEL_SHIFT + base_pixel_y) + if(pixel_y <= PIXEL_SHIFT_MAXIMUM + base_pixel_y) pixel_y++ client?.pixel_y++ is_shifted = TRUE if(CHECK_BITFIELD(direction, EAST)) - if(pixel_x <= MAXIMUM_PIXEL_SHIFT + base_pixel_x) + if(pixel_x <= PIXEL_SHIFT_MAXIMUM + base_pixel_x) pixel_x++ client?.pixel_x++ is_shifted = TRUE if(CHECK_BITFIELD(direction, SOUTH)) - if(pixel_y >= -MAXIMUM_PIXEL_SHIFT + base_pixel_y) + if(pixel_y >= -PIXEL_SHIFT_MAXIMUM + base_pixel_y) pixel_y-- client?.pixel_y-- is_shifted = TRUE if(CHECK_BITFIELD(direction, WEST)) - if(pixel_x >= -MAXIMUM_PIXEL_SHIFT + base_pixel_x) + if(pixel_x >= -PIXEL_SHIFT_MAXIMUM + base_pixel_x) pixel_x-- client?.pixel_x-- is_shifted = TRUE // Yes, I know this sets it to true for everything if more than one is matched. // Movement doesn't check diagonals, and instead just checks EAST or WEST, depending on where you are for those. - if(pixel_y > PASSABLE_SHIFT_THRESHOLD) + if(pixel_y > PIXEL_SHIFT_PASSABLE_THRESHOLD) passthroughable |= EAST | SOUTH | WEST - if(pixel_x > PASSABLE_SHIFT_THRESHOLD) + if(pixel_x > PIXEL_SHIFT_PASSABLE_THRESHOLD) passthroughable |= NORTH | SOUTH | WEST - if(pixel_y < -PASSABLE_SHIFT_THRESHOLD) + if(pixel_y < -PIXEL_SHIFT_PASSABLE_THRESHOLD) passthroughable |= NORTH | EAST | WEST - if(pixel_x < -PASSABLE_SHIFT_THRESHOLD) + if(pixel_x < -PIXEL_SHIFT_PASSABLE_THRESHOLD) passthroughable |= NORTH | EAST | SOUTH /mob/living/CanAllowThrough(atom/movable/mover, turf/target) @@ -96,6 +93,3 @@ if(!istype(mover, /obj/item/projectile) && !mover.throwing && passthroughable & mover.dir) return TRUE return ..() - -#undef MAXIMUM_PIXEL_SHIFT -#undef PASSABLE_SHIFT_THRESHOLD