Update files
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
#define STASIS_TOGGLE_COOLDOWN 50
|
||||
/obj/machinery/stasis
|
||||
name = "Lifeform Stasis Unit"
|
||||
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."
|
||||
icon = 'icons/obj/machines/stasis.dmi'
|
||||
icon_state = "stasis"
|
||||
base_icon_state = "stasis"
|
||||
density = FALSE
|
||||
// obj_flags = NO_BUILD
|
||||
can_buckle = TRUE
|
||||
buckle_lying = 90
|
||||
circuit = /obj/item/circuitboard/machine/stasis
|
||||
@@ -14,14 +16,13 @@
|
||||
payment_department = ACCOUNT_MED
|
||||
var/stasis_enabled = TRUE
|
||||
var/last_stasis_sound = FALSE
|
||||
var/stasis_can_toggle = 0
|
||||
COOLDOWN_DECLARE(stasis_can_toggle)
|
||||
var/mattress_state = "stasis_on"
|
||||
var/obj/effect/overlay/vis/mattress_on
|
||||
|
||||
/obj/machinery/stasis/examine(mob/user)
|
||||
..()
|
||||
var/turn_on_or_off = stasis_enabled ? "turn off" : "turn on"
|
||||
to_chat(user, "<span class='notice'>Alt-click to [turn_on_or_off] the machine.</span>")
|
||||
. = ..()
|
||||
. += span_notice("Alt-click to [stasis_enabled ? "turn off" : "turn on"] the machine.")
|
||||
|
||||
/obj/machinery/stasis/proc/play_power_sound()
|
||||
var/_running = stasis_running()
|
||||
@@ -34,61 +35,67 @@
|
||||
last_stasis_sound = _running
|
||||
|
||||
/obj/machinery/stasis/AltClick(mob/user)
|
||||
if(world.time >= stasis_can_toggle && user.canUseTopic(src))
|
||||
. = ..()
|
||||
if(!can_interact(user))
|
||||
return
|
||||
if(COOLDOWN_FINISHED(src, stasis_can_toggle) && user.canUseTopic(src, !issilicon(user)))
|
||||
stasis_enabled = !stasis_enabled
|
||||
stasis_can_toggle = world.time + STASIS_TOGGLE_COOLDOWN
|
||||
COOLDOWN_START(src, stasis_can_toggle, STASIS_TOGGLE_COOLDOWN)
|
||||
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_hear("You hear a nearby machine [stasis_enabled ? "power on" : "shut down"]."))
|
||||
play_power_sound()
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
/obj/machinery/stasis/Exited(atom/movable/AM, atom/newloc)
|
||||
if(AM == occupant)
|
||||
var/mob/living/L = AM
|
||||
/obj/machinery/stasis/Exited(atom/movable/gone, atom/newloc)
|
||||
if(gone == occupant)
|
||||
var/mob/living/L = gone
|
||||
if(IS_IN_STASIS(L))
|
||||
thaw_them(L)
|
||||
. = ..()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/stasis/proc/stasis_running()
|
||||
return stasis_enabled && is_operational()
|
||||
|
||||
/obj/machinery/stasis/update_icon()
|
||||
. = ..()
|
||||
var/_running = stasis_running()
|
||||
var/list/overlays_to_remove = managed_vis_overlays
|
||||
|
||||
if(mattress_state)
|
||||
if(!mattress_on || !managed_vis_overlays)
|
||||
mattress_on = SSvis_overlays.add_vis_overlay(src, icon, mattress_state, layer, plane, dir, alpha = 0, unique = TRUE)
|
||||
|
||||
if(mattress_on.alpha ? !_running : _running) //check the inverse of _running compared to truthy alpha, to see if they differ
|
||||
var/new_alpha = _running ? 255 : 0
|
||||
var/easing_direction = _running ? EASE_OUT : EASE_IN
|
||||
animate(mattress_on, alpha = new_alpha, time = 50, easing = CUBIC_EASING|easing_direction)
|
||||
|
||||
overlays_to_remove = managed_vis_overlays - mattress_on
|
||||
|
||||
SSvis_overlays.remove_vis_overlay(src, overlays_to_remove)
|
||||
|
||||
if(occupant)
|
||||
SSvis_overlays.add_vis_overlay(src, 'icons/obj/machines/stasis.dmi', "tubes", LYING_MOB_LAYER + 0.1, plane, dir) //using vis_overlays instead of normal overlays for mouse_opacity here
|
||||
|
||||
/obj/machinery/stasis/update_icon_state()
|
||||
if(stat & BROKEN)
|
||||
icon_state = "stasis_broken"
|
||||
return
|
||||
icon_state = "[base_icon_state]_broken"
|
||||
return ..()
|
||||
if(panel_open || stat & MAINT)
|
||||
icon_state = "stasis_maintenance"
|
||||
icon_state = "[base_icon_state]_maintenance"
|
||||
return ..()
|
||||
icon_state = base_icon_state
|
||||
return ..()
|
||||
|
||||
/obj/machinery/stasis/update_overlays()
|
||||
. = ..()
|
||||
if(!mattress_state)
|
||||
return
|
||||
icon_state = "stasis"
|
||||
var/_running = stasis_running()
|
||||
if(!mattress_on)
|
||||
mattress_on = SSvis_overlays.add_vis_overlay(src, icon, mattress_state, BELOW_OBJ_LAYER, plane, dir, alpha = 0, unique = TRUE)
|
||||
else
|
||||
vis_contents += mattress_on
|
||||
if(managed_vis_overlays)
|
||||
managed_vis_overlays += mattress_on
|
||||
else
|
||||
managed_vis_overlays = list(mattress_on)
|
||||
|
||||
if(mattress_on.alpha ? !_running : _running) //check the inverse of _running compared to truthy alpha, to see if they differ
|
||||
var/new_alpha = _running ? 255 : 0
|
||||
var/easing_direction = _running ? EASE_OUT : EASE_IN
|
||||
animate(mattress_on, alpha = new_alpha, time = 50, easing = CUBIC_EASING|easing_direction)
|
||||
|
||||
/obj/machinery/stasis/obj_break(damage_flag)
|
||||
. = ..()
|
||||
play_power_sound()
|
||||
update_icon()
|
||||
if(.)
|
||||
play_power_sound()
|
||||
|
||||
/obj/machinery/stasis/power_change()
|
||||
. = ..()
|
||||
play_power_sound()
|
||||
update_icon()
|
||||
if(.)
|
||||
play_power_sound()
|
||||
|
||||
/obj/machinery/stasis/proc/chill_out(mob/living/target)
|
||||
if(target != occupant)
|
||||
@@ -96,12 +103,13 @@
|
||||
var/freq = rand(24750, 26550)
|
||||
playsound(src, 'sound/effects/spray.ogg', 5, TRUE, 2, frequency = freq)
|
||||
target.apply_status_effect(/datum/status_effect/grouped/stasis, STASIS_MACHINE_EFFECT)
|
||||
|
||||
// ADD_TRAIT(target, TRAIT_TUMOR_SUPPRESSED, TRAIT_GENERIC)
|
||||
target.ExtinguishMob()
|
||||
use_power = ACTIVE_POWER_USE
|
||||
|
||||
/obj/machinery/stasis/proc/thaw_them(mob/living/target)
|
||||
target.remove_status_effect(/datum/status_effect/grouped/stasis, STASIS_MACHINE_EFFECT)
|
||||
// REMOVE_TRAIT(target, TRAIT_TUMOR_SUPPRESSED, TRAIT_GENERIC)
|
||||
if(target == occupant)
|
||||
use_power = IDLE_POWER_USE
|
||||
|
||||
@@ -111,16 +119,16 @@
|
||||
occupant = L
|
||||
if(stasis_running() && check_nap_violations())
|
||||
chill_out(L)
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
/obj/machinery/stasis/post_unbuckle_mob(mob/living/L)
|
||||
thaw_them(L)
|
||||
if(L == occupant)
|
||||
occupant = null
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
/obj/machinery/stasis/process()
|
||||
if( !( occupant && isliving(occupant) && check_nap_violations() ) )
|
||||
if(!(occupant && isliving(occupant) && check_nap_violations()))
|
||||
use_power = IDLE_POWER_USE
|
||||
return
|
||||
var/mob/living/L_occupant = occupant
|
||||
@@ -131,12 +139,15 @@
|
||||
thaw_them(L_occupant)
|
||||
|
||||
/obj/machinery/stasis/screwdriver_act(mob/living/user, obj/item/I)
|
||||
. = default_deconstruction_screwdriver(user, "stasis_maintenance", "stasis", I)
|
||||
update_icon()
|
||||
. = ..()
|
||||
. |= default_deconstruction_screwdriver(user, "[base_icon_state]_maintenance", "[base_icon_state]", I)
|
||||
update_appearance()
|
||||
|
||||
/obj/machinery/stasis/crowbar_act(mob/living/user, obj/item/I)
|
||||
return default_deconstruction_crowbar(I)
|
||||
. = ..()
|
||||
return default_deconstruction_crowbar(I) || .
|
||||
|
||||
/obj/machinery/stasis/nap_violation(mob/violator)
|
||||
unbuckle_mob(violator, TRUE)
|
||||
|
||||
#undef STASIS_TOGGLE_COOLDOWN
|
||||
|
||||
@@ -920,14 +920,14 @@
|
||||
/obj/item/stock_parts/cell = 1)
|
||||
needs_anchored = FALSE
|
||||
|
||||
// /obj/item/circuitboard/machine/stasis
|
||||
// name = "\improper Lifeform Stasis Unit (Machine Board)"
|
||||
// icon_state = "medical"
|
||||
// build_path = /obj/machinery/stasis
|
||||
// req_components = list(
|
||||
// /obj/item/stack/cable_coil = 3,
|
||||
// /obj/item/stock_parts/manipulator = 1,
|
||||
// /obj/item/stock_parts/capacitor = 1)
|
||||
/obj/item/circuitboard/machine/stasis
|
||||
name = "\improper Lifeform Stasis Unit (Machine Board)"
|
||||
icon_state = "medical"
|
||||
build_path = /obj/machinery/stasis
|
||||
req_components = list(
|
||||
/obj/item/stack/cable_coil = 3,
|
||||
/obj/item/stock_parts/manipulator = 1,
|
||||
/obj/item/stock_parts/capacitor = 1)
|
||||
|
||||
/obj/item/circuitboard/machine/medipen_refiller
|
||||
name = "Medipen Refiller (Machine Board)"
|
||||
@@ -1482,11 +1482,3 @@
|
||||
icon_state = "engineering"
|
||||
build_path = /obj/machinery/research/explosive_compressor
|
||||
req_components = list(/obj/item/stock_parts/matter_bin = 3)
|
||||
|
||||
/obj/item/circuitboard/machine/stasis
|
||||
name = "Lifeform Stasis Unit (Machine Board)"
|
||||
build_path = /obj/machinery/stasis
|
||||
req_components = list(
|
||||
/obj/item/stack/cable_coil = 3,
|
||||
/obj/item/stock_parts/manipulator = 1,
|
||||
/obj/item/stock_parts/capacitor = 1)
|
||||
|
||||
Reference in New Issue
Block a user