mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 05:23:22 +01:00
Stasis Beds (#11755)
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
@@ -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."
|
||||
|
||||
@@ -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)
|
||||
|
||||
+2
-2
@@ -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.")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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."
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Reference in New Issue
Block a user