Skip to content

Commit

Permalink
Merge pull request #3217 from OverDriveZ/pixel-sliding
Browse files Browse the repository at this point in the history
Pixel sliding iteration I [ready to merge]
  • Loading branch information
Tk420634 authored Sep 29, 2023
2 parents 5fb7f93 + 791d647 commit ecda6b0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
21 changes: 21 additions & 0 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,27 @@
to_chat(src, span_warning("[L] is restraining [P], you cannot push past."))
return 1

if(GLOB.pixel_slide)
var/origtargetloc = L.loc
if(!pulledby)
if(M.a_intent != INTENT_HELP)
GLOB.pixel_slide_other_has_help_int = 0
return TRUE
else
GLOB.pixel_slide_other_has_help_int = 1
if(IS_STAMCRIT(src))
to_chat(src, span_warning("You're too exhausted to scoot closer to [L]."))
return TRUE
visible_message(span_notice("[src] is attempting to scoot closer to [L]."),
span_notice("You are now attempting to scoot closer to [L]."),
target = L, target_message = span_notice("[src] is attempting to scoot closer to you."))
var/src_passmob = (pass_flags & PASSMOB)
pass_flags |= PASSMOB
Move(origtargetloc)
if(!src_passmob)
pass_flags &= ~PASSMOB
return TRUE

//CIT CHANGES START HERE - makes it so resting stops you from moving through standing folks without a short delay
if(!CHECK_MOBILITY(src, MOBILITY_STAND) && CHECK_MOBILITY(L, MOBILITY_STAND))
var/origtargetloc = L.loc
Expand Down
39 changes: 39 additions & 0 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
GLOBAL_VAR_INIT(pixel_slide, 0) //if 1, initiate pixel sliding
GLOBAL_VAR_INIT(pixel_slide_other_has_help_int, 0) //This variable queries wheter or not the other mob is in help intent

/mob/Destroy()//This makes sure that mobs with clients/keys are not just deleted from the game.
GLOB.mob_list -= src
GLOB.dead_mob_list -= src
Expand Down Expand Up @@ -818,6 +821,15 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
if(pixel_x <= (16 + get_standard_pixel_x_offset()))
pixel_x++
is_shifted = TRUE
if((pixel_x > (16 + get_standard_pixel_x_offset())) && !is_blocked_turf(get_step(src, EAST), 1))
if(!GLOB.pixel_slide)
GLOB.pixel_slide = 1
step(src, EAST)
spawn(1) //this spawn is heavily needed to improve smoothness, remove carefully!
if(GLOB.pixel_slide_other_has_help_int)
pixel_x = -16
GLOB.pixel_slide = 0
is_shifted = TRUE

/mob/living/westshift()
set hidden = TRUE
Expand All @@ -826,6 +838,15 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
if(pixel_x >= -(16 + get_standard_pixel_x_offset()))
pixel_x--
is_shifted = TRUE
if((pixel_x < -(16 + get_standard_pixel_x_offset())) && !is_blocked_turf(get_step(src, WEST), 1))
if(!GLOB.pixel_slide)
GLOB.pixel_slide = 1
step(src, WEST)
spawn(1) //this spawn is heavily needed to improve smoothness, remove carefully!
if(GLOB.pixel_slide_other_has_help_int)
pixel_x = 16
GLOB.pixel_slide = 0
is_shifted = TRUE

/mob/living/northshift()
set hidden = TRUE
Expand All @@ -834,6 +855,15 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
if(pixel_y <= (16 + get_standard_pixel_y_offset()))
pixel_y++
is_shifted = TRUE
if((pixel_y > (16 + get_standard_pixel_y_offset())) && !is_blocked_turf(get_step(src, NORTH), 1))
if(!GLOB.pixel_slide)
GLOB.pixel_slide = 1
step(src, NORTH)
spawn(1) //this spawn is heavily needed to improve smoothness, remove carefully!
if(GLOB.pixel_slide_other_has_help_int)
pixel_y = -16
GLOB.pixel_slide = 0
is_shifted = TRUE

/mob/living/southshift()
set hidden = TRUE
Expand All @@ -842,6 +872,15 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
if(pixel_y >= -(16 + get_standard_pixel_y_offset()))
pixel_y--
is_shifted = TRUE
if((pixel_y < -(16 + get_standard_pixel_y_offset())) && !is_blocked_turf(get_step(src, SOUTH), 1))
if(!GLOB.pixel_slide)
GLOB.pixel_slide = 1
step(src, SOUTH)
spawn(1) //this spawn is heavily needed to improve smoothness, remove carefully!
if(GLOB.pixel_slide_other_has_help_int)
pixel_y = 16
GLOB.pixel_slide = 0
is_shifted = TRUE

/mob/proc/IsAdvancedToolUser()//This might need a rename but it should replace the can this mob use things check
return FALSE
Expand Down

0 comments on commit ecda6b0

Please sign in to comment.