From a82ec718f388aadc0fb194ec0810bf25cb52a1d9 Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Wed, 24 Dec 2014 12:43:36 +1030 Subject: [PATCH] Fixes #7508 --- code/game/objects/structures.dm | 32 +++++++++++--------- code/game/objects/structures/tables_racks.dm | 6 ++++ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index f24c3c7839c..d105caae00a 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -76,23 +76,27 @@ if (!can_touch(user) || !climbable) return 0 - var/turf/T = src.loc - if(!T || !istype(T)) return 0 - if (!user.Adjacent(src)) - user << "\red You can't climb there, the way is blocked." + user << "You can't climb there, the way is blocked." return 0 + var/obj/occupied = turf_is_crowded() + if(occupied) + user << "There's \a [occupied] in the way." + return 0 + return 1 + +/obj/structure/proc/turf_is_crowded() + var/turf/T = get_turf(src) + if(!T || !istype(T)) + return 0 for(var/obj/O in T.contents) if(istype(O,/obj/structure)) var/obj/structure/S = O - if(S.climbable) - continue - + if(S.climbable) continue if(O && O.density && !(O.flags & ON_BORDER)) //ON_BORDER structures are handled by the Adjacent() check. - user << "\red There's \a [O] in the way." - return 0 - return 1 + return O + return 0 /obj/structure/proc/do_climb(var/mob/living/user) if (!can_climb(user)) @@ -118,14 +122,14 @@ if(M.lying) return //No spamming this on people. M.Weaken(5) - M << "\red You topple as \the [src] moves under you!" + M << "You topple as \the [src] moves under you!" if(prob(25)) var/damage = rand(15,30) var/mob/living/carbon/human/H = M if(!istype(H)) - H << "\red You land heavily!" + H << "You land heavily!" M.adjustBruteLoss(damage) return @@ -144,12 +148,12 @@ affecting = H.get_organ("head") if(affecting) - M << "\red You land heavily on your [affecting.display_name]!" + M << "You land heavily on your [affecting.display_name]!" affecting.take_damage(damage, 0) if(affecting.parent) affecting.parent.add_autopsy_data("Misadventure", damage) else - H << "\red You land heavily!" + H << "You land heavily!" H.adjustBruteLoss(damage) H.UpdateDamageIcon() diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 400d732e561..64ef0c8fad2 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -470,9 +470,15 @@ return /obj/structure/table/proc/unflipping_check(var/direction) + for(var/mob/M in oview(src,0)) return 0 + var/obj/occupied = turf_is_crowded() + if(occupied) + usr << "There's \a [occupied] in the way." + return 0 + var/list/L = list() if(direction) L.Add(direction)