From 6fa9ebddc2391d607a9389fdc19ebdd4a0fc435c Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Fri, 22 Aug 2014 12:14:01 +0200 Subject: [PATCH] Fixes #6106 and prevents placing a mountain of humans on the same op-table. --- code/game/machinery/OpTable.dm | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index aa58228104..641e9473ad 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -123,18 +123,26 @@ set category = "Object" set src in oview(1) - if(usr.stat || !ishuman(usr) || usr.buckled || usr.restrained()) - return - - if(src.victim) - usr << "\blue The table is already occupied!" + if(usr.stat || !ishuman(usr) || usr.restrained() || !check_table(usr)) return take_victim(usr,usr) /obj/machinery/optable/attackby(obj/item/weapon/W as obj, mob/living/carbon/user as mob) if (istype(W, /obj/item/weapon/grab)) - if(iscarbon(W:affecting)) - take_victim(W:affecting,usr) + var/obj/item/weapon/grab/G = W + if(iscarbon(G.affecting) && check_table(G.affecting)) + take_victim(G.affecting,usr) del(W) - return \ No newline at end of file + return + +/obj/machinery/optable/proc/check_table(mob/living/carbon/patient as mob) + if(src.victim) + usr << "\blue The table is already occupied!" + return 0 + + if(patient.buckled) + usr << "\blue Unbuckle first!" + return 0 + + return 1