diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 988fcc36751..4d7cb85d0b7 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -381,6 +381,16 @@ return return ..() +/obj/structure/table/proc/TryToThrowOnTable(var/mob/user,var/mob/victim) + for (var/atom/A in loc) + if (A == src) + continue + if (A.density) + to_chat(user, "\The [A] prevents you from dragging \the [victim] on top of \the [src]") + return FALSE + victim.forceMove(loc) + return TRUE + /obj/structure/table/attackby(obj/item/W as obj, mob/user as mob, params) if (!W) return @@ -391,7 +401,8 @@ var/mob/living/M = G.affecting if (G.state < GRAB_AGGRESSIVE) if(user.a_intent == I_HURT) - M.forceMove(loc) + if (!TryToThrowOnTable(user,M)) + return if (prob(15)) M.Knockdown(5) M.Stun(5) @@ -403,7 +414,8 @@ to_chat(user, "You need a better grip to do that!") return else - M.forceMove(loc) + if (!TryToThrowOnTable(user,M)) + return M.Knockdown(5) M.Stun(5) visible_message("[user] puts [M] on \the [src].") @@ -658,7 +670,8 @@ to_chat(user, "You need a better grip to do that!") return else - G.affecting.forceMove(loc) + if (!TryToThrowOnTable(user,G.affecting)) + return G.affecting.Knockdown(5) G.affecting.Stun(5) visible_message("[G.assailant] puts [G.affecting] on \the [src].")