[FIX] You can knock climbers off of tables again (#27423)

* You can knock climbers off of tables again

* Update code/game/objects/structures/tables_racks.dm

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Chap <erwin@lombok.demon.nl>

* Update code/game/objects/structures/tables_racks.dm

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Chap <erwin@lombok.demon.nl>

* Remove duplicate code and unnecessary check

* Don't test other fixes on the PR you are working on

* Some garbage collection

* Move unregistering to inside remove_climber proc

* How about a version that passes compilation

* Unregister here too

* Wrong var

* Update code/game/objects/structures.dm

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

---------

Signed-off-by: Chap <erwin@lombok.demon.nl>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: Adrer <adrermail@gmail.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
Chap
2024-11-24 19:58:52 +00:00
committed by GitHub
co-authored by DGamerL Adrer Burzah
parent faaf3bbcb6
commit a28c1a45f8
3 changed files with 24 additions and 9 deletions
+18 -4
View File
@@ -8,7 +8,7 @@
var/climbable
/// Determines if a structure adds the TRAIT_TURF_COVERED to its turf.
var/creates_cover = FALSE
var/mob/living/climber
var/list/mob/living/climbers = list()
var/broken = FALSE
/// How long this takes to unbuckle yourself from.
var/unbuckle_time = 0 SECONDS
@@ -32,6 +32,7 @@
return ..()
/obj/structure/Destroy()
climbers = null
if(SSticker)
GLOB.cameranet.updateVisibility(src)
if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
@@ -58,7 +59,7 @@
if(..())
return TRUE
if(C == user)
INVOKE_ASYNC(src, TYPE_PROC_REF(/obj/structure, do_climb), user)
INVOKE_ASYNC(src, TYPE_PROC_REF(/obj/structure, start_climb), user)
return TRUE
/obj/structure/proc/density_check()
@@ -93,12 +94,25 @@
if(!can_touch(user) || !climbable)
return FALSE
user.forceMove(get_turf(src))
if(get_turf(user) == get_turf(src))
return TRUE
/obj/structure/proc/start_climb(mob/living/user)
climbers += user
RegisterSignal(user, COMSIG_PARENT_QDELETING, PROC_REF(remove_climber)) // Just in case the climber is deleted before finishing
if(do_climb(user))
user.forceMove(get_turf(src))
if(HAS_MIND_TRAIT(user, TRAIT_TABLE_LEAP))
user.visible_message("<span class='warning'>[user] leaps up onto [src]!</span>")
else
user.visible_message("<span class='warning'>[user] climbs onto [src]!</span>")
climbers -= user
UnregisterSignal(user, COMSIG_PARENT_QDELETING)
/obj/structure/proc/remove_climber(mob/living/climber)
SIGNAL_HANDLER // COMSIG_PARENT_QDELETING
climbers -= climber
UnregisterSignal(climber, COMSIG_PARENT_QDELETING)
/obj/structure/proc/structure_shaken()
for(var/mob/living/M in get_turf(src))