From 9b6f1248c6939b4d265e77c23d5c23f810cee217 Mon Sep 17 00:00:00 2001 From: alex-gh Date: Sat, 27 Oct 2018 13:11:42 +0200 Subject: [PATCH] Fixed tabling through solid objects. --- code/game/objects/structures.dm | 29 ++++++++------------ code/game/objects/structures/tables_racks.dm | 12 +++++--- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index e38350a0136..faf86394dba 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -64,26 +64,26 @@ if(C == user) do_climb(user) +/obj/structure/proc/density_check() + for(var/obj/O in orange(0, src)) + if(O.density && !istype(O, /obj/machinery/door/window)) //Ignores windoors, as those already block climbing, otherwise a windoor on the opposite side of a table would prevent climbing. + return O + var/turf/T = get_turf(src) + if(T.density) + return T + return null /obj/structure/proc/do_climb(var/mob/living/user) - if(!can_touch(user) || !climbable) return + var/blocking_object = density_check() + if(blocking_object) + to_chat(user, "You cannot climb [src], as it is blocked by \a [blocking_object]!") + return - for(var/obj/O in range(0, src)) - if(O.density == 1 && O != src && !istype(O, /obj/machinery/door/window)) //Ignores windoors, as those already block climbing, otherwise a windoor on the opposite side of a table would prevent climbing. - to_chat(user, "You cannot climb [src], as it is blocked by \a [O]!") - return - for(var/turf/T in range(0, src)) - if(T.density == 1) - to_chat(user, "You cannot climb [src], as it is blocked by \a [T]!") - return var/turf/T = src.loc if(!T || !istype(T)) return - var/obj/machinery/door/poddoor/shutters/S = locate() in T.contents - if(S && S.density) return - usr.visible_message("[user] starts climbing onto \the [src]!") climber = user if(!do_after(user, 50, target = src)) @@ -94,11 +94,6 @@ climber = null return - S = locate() in T.contents - if(S && S.density) - climber = null - return - usr.loc = get_turf(src) if(get_turf(user) == get_turf(src)) usr.visible_message("[user] climbs onto \the [src]!") diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 3ec50187bfb..999e90cd89f 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -180,12 +180,16 @@ var/obj/item/grab/G = I if(G.affecting.buckled) to_chat(user, "[G.affecting] is buckled to [G.affecting.buckled]!") - return 0 + return FALSE if(G.state < GRAB_AGGRESSIVE) to_chat(user, "You need a better grip to do that!") - return 0 + return FALSE if(!G.confirm()) - return 0 + return FALSE + var/blocking_object = density_check() + if(blocking_object) + to_chat(user, "You cannot do this there is \a [blocking_object] in the way!") + return FALSE G.affecting.forceMove(get_turf(src)) G.affecting.Weaken(2) item_placed(G.affecting) @@ -193,7 +197,7 @@ "[G.assailant] pushes [G.affecting] onto [src].") add_attack_logs(G.assailant, G.affecting, "Pushed onto a table") qdel(I) - return 1 + return TRUE qdel(I) /obj/structure/table/attackby(obj/item/I, mob/user, params)