From 3c99618f87ba9ea033232f422b9a1073fc04762d Mon Sep 17 00:00:00 2001 From: Segrain Date: Wed, 21 Aug 2013 06:00:08 +0300 Subject: [PATCH] New verb. --- code/game/machinery/OpTable.dm | 50 +++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index 7078d9df90..e1aa0ebfa7 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -91,10 +91,10 @@ /obj/machinery/optable/proc/check_victim() if(locate(/mob/living/carbon/human, src.loc)) - var/mob/M = locate(/mob/living/carbon/human, src.loc) + var/mob/living/carbon/human/M = locate(/mob/living/carbon/human, src.loc) if(M.resting) src.victim = M - icon_state = "table2-active" + icon_state = M.pulse ? "table2-active" : "table2-idle" return 1 src.victim = null icon_state = "table2-idle" @@ -103,22 +103,40 @@ /obj/machinery/optable/process() check_victim() -/obj/machinery/optable/attackby(obj/item/weapon/W as obj, mob/living/carbon/user as mob) +/obj/machinery/optable/proc/take_victim(mob/living/carbon/human/H, mob/living/carbon/user as mob) + if (H == user) + user.visible_message("[user] climbs on the operating table.","You climb on the operating table.") + else + visible_message("\red [H] has been laid on the operating table by [user].", 3) + if (H.client) + H.client.perspective = EYE_PERSPECTIVE + H.client.eye = src + H.resting = 1 + H.loc = src.loc + for(var/obj/O in src) + O.loc = src.loc + src.add_fingerprint(user) + icon_state = H.pulse ? "table2-active" : "table2-idle" + src.victim = H +/obj/machinery/optable/verb/climb_on() + set name = "Climb On Table" + 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!" + 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(ismob(W:affecting)) - var/mob/M = W:affecting - if (M.client) - M.client.perspective = EYE_PERSPECTIVE - M.client.eye = src - M.resting = 1 - M.loc = src.loc - visible_message("\red [M] has been laid on the operating table by [user].", 3) - for(var/obj/O in src) - O.loc = src.loc - src.add_fingerprint(user) - icon_state = "table2-active" - src.victim = M + if(ishuman(W:affecting)) + take_victim(W:affecting,usr) del(W) return user.drop_item()