diff --git a/aurorastation.dme b/aurorastation.dme index 87b09b2bbfc..4b0c9a4ad81 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -659,6 +659,7 @@ #include "code\game\machinery\seed_extractor.dm" #include "code\game\machinery\Sleeper.dm" #include "code\game\machinery\spaceheater.dm" +#include "code\game\machinery\stasis_bed.dm" #include "code\game\machinery\station_holomap.dm" #include "code\game\machinery\status_display.dm" #include "code\game\machinery\status_display_ai.dm" diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index 6bdd16357cc..2ff74f50b2e 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -828,7 +828,7 @@ var/global/list/common_tools = list( /proc/can_operate(mob/living/carbon/M) //If it's 2, commence surgery, if it's 1, fail surgery, if it's 0, attack var/surgery_attempt = SURGERY_IGNORE var/located = FALSE - if(locate(/obj/machinery/optable, M.loc)) + if(istype(M.buckled_to, /obj/machinery/stasis_bed) || locate(/obj/machinery/optable, M.loc)) located = TRUE surgery_attempt = SURGERY_SUCCESS else if(locate(/obj/structure/bed/roller, M.loc)) diff --git a/code/game/machinery/stasis_bed.dm b/code/game/machinery/stasis_bed.dm new file mode 100644 index 00000000000..04c125f1a79 --- /dev/null +++ b/code/game/machinery/stasis_bed.dm @@ -0,0 +1,125 @@ +/obj/machinery/stasis_bed + name = "lifeform stasis unit" + desc = "A not so comfortable looking bed with some nozzles at the top and bottom. It will keep someone in stasis." + desc_info = "You can alt-click this to toggle it on or off." + icon = 'icons/obj/stasis_bed.dmi' + icon_state = "stasis" + + buckle_lying = TRUE + can_buckle = list(/mob/living/carbon/human) + + idle_power_usage = 40 + active_power_usage = 340 + + var/mob/living/carbon/human/occupant + + var/stasis_enabled = FALSE + var/chilled_occupant = FALSE + var/last_stasis_sound = FALSE + var/stasis_can_toggle = 0 + + component_types = list( + /obj/item/circuitboard/stasis_bed, + /obj/item/stock_parts/micro_laser = 1, + /obj/item/stock_parts/capacitor = 2, + /obj/item/stock_parts/scanning_module = 2, + /obj/item/stock_parts/console_screen + ) + +/obj/machinery/stasis_bed/Initialize(mapload, d, populate_components) + . = ..() + update_icon() + +/obj/machinery/stasis_bed/attackby(obj/item/I, mob/user) + if(default_part_replacement(user, I)) + return + else if(default_deconstruction_screwdriver(user, I)) + return + else if(default_deconstruction_crowbar(user, I)) + return + return ..() + +/obj/machinery/stasis_bed/proc/play_power_sound() + var/_running = stasis_running() + if(last_stasis_sound != _running) + var/sound_freq = rand(5120, 8800) + if(_running) + playsound(src, 'sound/machines/synth_yes.ogg', 50, TRUE, frequency = sound_freq) + else + playsound(src, 'sound/machines/synth_no.ogg', 50, TRUE, frequency = sound_freq) + last_stasis_sound = _running + +/obj/machinery/stasis_bed/AltClick(mob/user) + if((world.time >= stasis_can_toggle) && !use_check_and_message(user) && !(stat & (NOPOWER|BROKEN))) + stasis_enabled = !stasis_enabled + stasis_can_toggle = world.time + 5 SECONDS + playsound(src, 'sound/machines/click.ogg', 60, TRUE) + user.visible_message(SPAN_NOTICE("\The [src] [stasis_enabled ? "powers on" : "shuts down"]."), \ + SPAN_NOTICE("You [stasis_enabled ? "power on" : "shut down"] \the [src]."), \ + SPAN_NOTICE("You hear a nearby machine [stasis_enabled ? "power on" : "shut down"].")) + play_power_sound() + update_icon() + +/obj/machinery/stasis_bed/Exited(atom/movable/AM, atom/newloc) + if(AM == occupant) + var/mob/living/L = AM + thaw_occupant(L) + . = ..() + +/obj/machinery/stasis_bed/proc/stasis_running() + return stasis_enabled && !(stat & (NOPOWER|BROKEN)) + +/obj/machinery/stasis_bed/update_icon() + cut_overlays() + if(stat & BROKEN) + icon_state = "[initial(icon_state)]_broken" + return ..() + icon_state = initial(icon_state) + if(panel_open || (stat & MAINT)) + add_overlay("stasis_maintenance") + if(stasis_running()) + add_overlay("stasis_on") + +/obj/machinery/stasis_bed/power_change() + . = ..() + play_power_sound() + +/obj/machinery/stasis_bed/proc/chill_occupant(mob/living/target) + if(target != occupant) + return + if(!stasis_running()) + return + + playsound(src, 'sound/effects/spray.ogg', 5, TRUE, 2, frequency = rand(24750, 26550)) + target.ExtinguishMobCompletely() + update_use_power(2) + chilled_occupant = TRUE + +/obj/machinery/stasis_bed/proc/thaw_occupant(mob/living/target) + if(target != occupant) + return + + update_use_power(1) + occupant = null + chilled_occupant = FALSE + +/obj/machinery/stasis_bed/post_buckle(mob/living/carbon/human/H) + if(H.buckled_to == src) + occupant = H + if(stasis_running()) + chill_occupant(H) + else + thaw_occupant(H) + update_icon() + +/obj/machinery/stasis_bed/machinery_process() + if(stat & (NOPOWER|BROKEN)) + return + if(!occupant) + update_use_power(1) + return + + if(!chilled_occupant) + chill_occupant(occupant) + + occupant.SetStasis(15) \ No newline at end of file diff --git a/code/game/objects/items/weapons/circuitboards/machinery/miscboards.dm b/code/game/objects/items/weapons/circuitboards/machinery/miscboards.dm index ddc5e602504..1eba66dbe27 100644 --- a/code/game/objects/items/weapons/circuitboards/machinery/miscboards.dm +++ b/code/game/objects/items/weapons/circuitboards/machinery/miscboards.dm @@ -21,6 +21,19 @@ "/obj/item/stock_parts/console_screen" = 1, "/obj/item/reagent_containers/glass/beaker/large" = 1) +/obj/item/circuitboard/stasis_bed + name = T_BOARD("Lifeform Stasis Unit") + desc = "The circuitboard for a lifeform stasis unit." + build_path = /obj/machinery/stasis_bed + origin_tech = list(TECH_MAGNET = 4, TECH_ENGINEERING = 4, TECH_BIO = 4) + board_type = "machine" + req_components = list( + "/obj/item/stock_parts/micro_laser" = 1, + "/obj/item/stock_parts/capacitor" = 2, + "/obj/item/stock_parts/scanning_module" = 2, + "/obj/item/stock_parts/console_screen" = 1 + ) + /obj/item/circuitboard/cryotube name = T_BOARD("Cryo Cell") desc = "The circuitboard for a cryo tube." diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index cfabcfe2487..37cf71184b7 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -31,7 +31,7 @@ slowdown = 5 /obj/structure/bed/Initialize() - ..() + . = ..() LAZYADD(can_buckle, /mob/living) /obj/structure/bed/New(newloc, new_material = MATERIAL_STEEL, new_padding_material) diff --git a/code/game/sound.dm b/code/game/sound.dm index 154e4111a50..9ac6c0b8523 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -42,12 +42,12 @@ #define DROP_SOUND_VOLUME 20 #define THROW_SOUND_VOLUME 90 -/proc/playsound(atom/source, soundin, vol, vary, extrarange, falloff, is_global, usepressure = 1, environment = -1, required_preferences = 0, required_asfx_toggles = 0) +/proc/playsound(atom/source, soundin, vol, vary, extrarange, falloff, is_global, usepressure = 1, environment = -1, required_preferences = 0, required_asfx_toggles = 0, frequency = 0) if (isarea(source)) crash_with("[source] is an area and is trying to make the sound: [soundin]") return - var/sound/original_sound = playsound_get_sound(soundin, vol, falloff, 0, environment) + var/sound/original_sound = playsound_get_sound(soundin, vol, falloff, frequency, environment) if (!original_sound) crash_with("Could not construct original sound.") diff --git a/code/modules/research/designs/circuit/machine_circuits.dm b/code/modules/research/designs/circuit/machine_circuits.dm index 15d98c3fc36..f66392a60c4 100644 --- a/code/modules/research/designs/circuit/machine_circuits.dm +++ b/code/modules/research/designs/circuit/machine_circuits.dm @@ -76,6 +76,11 @@ req_tech = list(TECH_DATA = 2, TECH_ENGINEERING = 2) build_path = /obj/item/circuitboard/sleeper +/datum/design/circuit/machine/stasis_bed + name = "Lifeform Stasis Unit" + req_tech = list(TECH_MAGNET = 4, TECH_ENGINEERING = 4, TECH_BIO = 4) + build_path = /obj/item/circuitboard/stasis_bed + /datum/design/circuit/machine/bodyscannerm name = "Body Scanner" req_tech = list(TECH_DATA = 2, TECH_ENGINEERING = 2) diff --git a/html/changelogs/geeves-stasis_bed.yml b/html/changelogs/geeves-stasis_bed.yml new file mode 100644 index 00000000000..1d2a911763e --- /dev/null +++ b/html/changelogs/geeves-stasis_bed.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Ported stasis beds. RnD can print their circuitboards once they've reached level four research in magnets, engineering and bio." \ No newline at end of file diff --git a/icons/obj/stasis_bed.dmi b/icons/obj/stasis_bed.dmi new file mode 100644 index 00000000000..72180cdd4d5 Binary files /dev/null and b/icons/obj/stasis_bed.dmi differ