mirror of
https://github.com/quotefox/Hyper-Station-13.git
synced 2026-07-21 04:33:16 +01:00
Railing Climbing Fix
Fixes the ability to climb railings by removing the forcemove call that teleports players and instead refactoring the do_climb and climb_structure procedures in structure code itself.
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
var/climb_time = 20
|
||||
var/climb_stun = 20
|
||||
var/climbable = FALSE
|
||||
var/rail_climbing = FALSE
|
||||
var/passable = FALSE
|
||||
var/mob/living/structureclimber
|
||||
var/broken = 0 //similar to machinery's stat BROKEN
|
||||
|
||||
@@ -58,14 +60,30 @@
|
||||
|
||||
/obj/structure/proc/do_climb(atom/movable/A)
|
||||
if(climbable)
|
||||
density = FALSE
|
||||
. = step(A,get_dir(A,src.loc))
|
||||
density = TRUE
|
||||
if(rail_climbing == FALSE)
|
||||
density = FALSE
|
||||
. = step(A,get_dir(A,src.loc))
|
||||
density = TRUE
|
||||
else
|
||||
//We're dealing with something like a railing with similar collision to glass and a false density.
|
||||
passable = TRUE //Passable flag overrites CheckExit and CanPass procs to return true.
|
||||
|
||||
if(A.loc == src.loc)
|
||||
//Step one further than just onto the object, we want to step over it to the next tile if possible.
|
||||
. = step(A, get_dir(A, get_step(src, src.dir)))
|
||||
else
|
||||
. = step(A,get_dir(A,src.loc))
|
||||
passable = FALSE
|
||||
A.do_twist(targetangle = 45, timer = 8)
|
||||
|
||||
/obj/structure/proc/climb_structure(mob/living/user)
|
||||
src.add_fingerprint(user)
|
||||
user.visible_message("<span class='warning'>[user] starts climbing onto [src].</span>", \
|
||||
if(rail_climbing == FALSE)
|
||||
user.visible_message("<span class='warning'>[user] starts climbing onto [src].</span>", \
|
||||
"<span class='notice'>You start climbing onto [src]...</span>")
|
||||
else
|
||||
user.visible_message("<span class='warning'>[user] starts climbing over [src].</span>", \
|
||||
"<span class='notice'>You start climbing over [src]...</span>")
|
||||
var/adjusted_climb_time = climb_time
|
||||
if(user.restrained()) //climbing takes twice as long when restrained.
|
||||
adjusted_climb_time *= 2
|
||||
@@ -77,14 +95,22 @@
|
||||
if(do_mob(user, user, adjusted_climb_time))
|
||||
if(src.loc) //Checking if structure has been destroyed
|
||||
if(do_climb(user))
|
||||
user.visible_message("<span class='warning'>[user] climbs onto [src].</span>", \
|
||||
"<span class='notice'>You climb onto [src].</span>")
|
||||
log_combat(user, src, "climbed onto")
|
||||
if(rail_climbing == FALSE)
|
||||
user.visible_message("<span class='warning'>[user] climbs onto [src].</span>", \
|
||||
"<span class='notice'>You climb onto [src].</span>")
|
||||
log_combat(user, src, "climbed onto")
|
||||
else
|
||||
user.visible_message("<span class='warning'>[user] climbs over [src].</span>", \
|
||||
"<span class='notice'>You climb over [src].</span>")
|
||||
log_combat(user, src, "climbed over")
|
||||
if(climb_stun)
|
||||
user.Stun(climb_stun)
|
||||
. = 1
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You fail to climb onto [src].</span>")
|
||||
if(rail_climbing == FALSE)
|
||||
to_chat(user, "<span class='warning'>You fail to climb onto [src].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You fail to climb over [src].</span>")
|
||||
structureclimber = null
|
||||
|
||||
/obj/structure/examine(mob/user)
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
flags_1 = CONDUCT_1
|
||||
|
||||
density = FALSE
|
||||
climbable = TRUE
|
||||
rail_climbing = TRUE
|
||||
climb_time = 15
|
||||
//var/passable = FALSE // Equivalent of density check for other structures like tables, has to be different due to different collision
|
||||
layer = 4
|
||||
anchored = TRUE
|
||||
flags_1 = ON_BORDER_1
|
||||
@@ -65,6 +69,9 @@
|
||||
if(istype(mover) && (mover.pass_flags & PASSGLASS) || is_type_in_typecache(mover, freepass))
|
||||
return 1
|
||||
|
||||
if(passable)
|
||||
return 1
|
||||
|
||||
if(get_dir(loc, target) != dir)
|
||||
return 1
|
||||
|
||||
@@ -203,7 +210,6 @@
|
||||
if(RCD_DECONSTRUCT)
|
||||
to_chat(user, "<span class='notice'>You deconstruct the [src].</span>")
|
||||
qdel(src)
|
||||
NeighborsCheck()
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -307,32 +313,6 @@
|
||||
return FALSE
|
||||
return FALSE
|
||||
|
||||
/obj/structure/railing/MouseDrop_T(mob/living/M, mob/living/user)
|
||||
if(!istype(user))
|
||||
return
|
||||
if(!isliving(user))
|
||||
return
|
||||
|
||||
//Sanity check so players can't climb over railings into occupied spaces.
|
||||
var/turf/T = get_step(src, src.dir)
|
||||
if(CanPass(user, T) == 0)
|
||||
return FALSE
|
||||
|
||||
usr.visible_message("<span class='warning'>[user] starts climbing onto \the [src]!</span>")
|
||||
|
||||
if(!do_after(user, 15, src))
|
||||
return
|
||||
|
||||
if(get_turf(user) == get_turf(src))
|
||||
usr.dir = get_dir(usr.loc, get_step(src, src.dir))//turn and face railing
|
||||
usr.forceMove(T)
|
||||
else
|
||||
usr.dir = get_dir(usr.loc, loc)//turn and face railing
|
||||
usr.forceMove(get_turf(src))
|
||||
|
||||
usr.visible_message("<span class='warning'>[user] climbed over \the [src]!</span>")
|
||||
usr.do_twist(targetangle = 45, timer = 8)
|
||||
|
||||
/obj/structure/railing/proc/can_be_rotated(mob/user,rotation_type)
|
||||
if(anchored)
|
||||
to_chat(user, "<span class='warning'>[src] cannot be rotated while it is fastened to the floor!</span>")
|
||||
|
||||
Reference in New Issue
Block a user