From 0e2a116117cafbc3c366668be983dd5b27d2ecb9 Mon Sep 17 00:00:00 2001 From: Matt Atlas Date: Tue, 22 Oct 2019 19:36:35 +0200 Subject: [PATCH] Ports the neural suppressor from Bay (#7124) Neural Suppressor -> You click table with a man laying on it. The man goes to sleep. Really is that easy. --- code/game/machinery/OpTable.dm | 40 +++++++++++++++----- html/changelogs/mattatlas-medbay_update.yml | 41 +++++++++++++++++++++ 2 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 html/changelogs/mattatlas-medbay_update.yml diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index 220f37ecca9..b82e42c2fe9 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -16,6 +16,7 @@ var/mob/living/carbon/human/victim = null var/strapped = 0.0 + var/suppressing = FALSE var/obj/machinery/computer/operating/computer = null @@ -27,6 +28,10 @@ computer.table = src break +/obj/machinery/optable/examine(var/mob/user) + . = ..() + to_chat(user, "The neural suppressors are switched [suppressing ? "on" : "off"].") + /obj/machinery/optable/ex_act(severity) switch(severity) @@ -50,9 +55,21 @@ visible_message("\The [usr] destroys \the [src]!") src.density = 0 qdel(src) - return + return + if(!victim) + to_chat(user, "There is nobody on \the [src]. It would be pointless to turn the suppressor on.") + return TRUE + if(user != victim && !suppressing) // Skip checks if you're doing it to yourself or turning it off, this is an anti-griefing mechanic more than anything. + user.visible_message("\The [user] begins switching on \the [src]'s neural suppressor.") + if(!do_after(user, 30, src) || !use_check_and_message(user)) + return + if(!victim) + to_chat(user, "There is nobody on \the [src]. It would be pointless to turn the suppressor on.") + + suppressing = !suppressing + user.visible_message("\The [user] switches [suppressing ? "on" : "off"] \the [src]'s neural suppressor.") /obj/machinery/optable/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(air_group || (height==0)) return 1 @@ -71,13 +88,18 @@ return /obj/machinery/optable/proc/check_victim() - if(locate(/mob/living/carbon/human, src.loc)) - var/mob/living/carbon/human/M = locate(/mob/living/carbon/human, src.loc) - if(M.lying) - src.victim = M - icon_state = M.pulse ? "[modify_state]-active" : "[modify_state]-idle" - return 1 - src.victim = null + if(!victim || !victim.lying || victim.loc != loc) + suppressing = FALSE + victim = null + var/mob/living/carbon/human/H = locate() in loc + if(istype(H)) + if(H.lying) + icon_state = H.pulse ? "[modify_state]-active" : "[modify_state]-idle" + victim = H + if(victim) + if(suppressing && victim.sleeping < 3) + victim.Sleeping(3 - victim.sleeping) + return 1 icon_state = "[modify_state]-idle" return 0 @@ -178,4 +200,4 @@ if(patient.buckled) to_chat(usr, "Unbuckle \the [patient] first!") return 0 - return 1 \ No newline at end of file + return 1 diff --git a/html/changelogs/mattatlas-medbay_update.yml b/html/changelogs/mattatlas-medbay_update.yml new file mode 100644 index 00000000000..f13c5e0a356 --- /dev/null +++ b/html/changelogs/mattatlas-medbay_update.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Added a neural suppressor to surgery operating tables. Putting people on them and clicking the table will activate it, making them fall asleep. No need for anesthetic.." \ No newline at end of file