From 108d2ca63aef15b8baa6742cd7175422bccce938 Mon Sep 17 00:00:00 2001
From: Cody Brittain <1779662+Generalcamo@users.noreply.github.com>
Date: Tue, 17 Mar 2026 05:30:15 -0400
Subject: [PATCH] Added new effects for stasis (#22038)
Stasis now gives a ripple effect on the mob when they are under it, as
well as giving them a HUD icon. In addition, this improves stasis bed
code, fixing a bug and adding some neat stuff too.
---
code/__HELPERS/visual_filters.dm | 17 ++++
code/game/machinery/stasis_bed.dm | 86 ++++++++++++++-----
code/game/objects/effects/overlays.dm | 5 ++
code/modules/mob/living/carbon/carbon.dm | 7 ++
code/modules/mob/living/carbon/human/life.dm | 11 +++
html/changelogs/GeneralCamo - Stasis.yml | 63 ++++++++++++++
icons/mob/screen/hud_status.dmi | Bin 727 -> 826 bytes
7 files changed, 167 insertions(+), 22 deletions(-)
create mode 100644 html/changelogs/GeneralCamo - Stasis.yml
diff --git a/code/__HELPERS/visual_filters.dm b/code/__HELPERS/visual_filters.dm
index adc02ce8fa8..79b2d74e0b7 100644
--- a/code/__HELPERS/visual_filters.dm
+++ b/code/__HELPERS/visual_filters.dm
@@ -154,3 +154,20 @@
.["y"] = y
if(!isnull(size))
.["size"] = size
+
+/proc/ripple_filter(radius, size, falloff, repeat, x, y, flags)
+ . = list("type" = "ripple")
+ if(!isnull(radius))
+ .["radius"] = radius
+ if(!isnull(size))
+ .["size"] = size
+ if(!isnull(falloff))
+ .["falloff"] = falloff
+ if(!isnull(repeat))
+ .["repeat"] = repeat
+ if(!isnull(flags))
+ .["flags"] = flags
+ if(!isnull(x))
+ .["x"] = x
+ if(!isnull(y))
+ .["y"] = y
diff --git a/code/game/machinery/stasis_bed.dm b/code/game/machinery/stasis_bed.dm
index 5a297f5116c..ef5b6a0f5c4 100644
--- a/code/game/machinery/stasis_bed.dm
+++ b/code/game/machinery/stasis_bed.dm
@@ -1,3 +1,4 @@
+#define STASIS_TOGGLE_COOLDOWN 50
/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."
@@ -8,8 +9,8 @@
buckle_lying = TRUE
can_buckle = list(/mob/living/carbon/human)
- idle_power_usage = 40
- active_power_usage = 340
+ idle_power_usage = 300
+ active_power_usage = 3000
var/mob/living/carbon/human/occupant
@@ -27,12 +28,16 @@
*/
var/stasis_source_name = "Stasis Bed"
+ /// Icon State of the on icon
+ VAR_PRIVATE/mattress_state = "stasis_on"
+
+ /// Stores the on effect
+ VAR_PRIVATE/obj/effect/overlay/vis/mattress_on
+
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/item/stock_parts/micro_laser = 2,
+ /obj/item/stock_parts/capacitor = 2
)
/obj/machinery/stasis_bed/mechanics_hints(mob/user, distance, is_adjacent)
@@ -43,12 +48,17 @@
/obj/machinery/stasis_bed/upgrade_hints(mob/user, distance, is_adjacent)
. += ..()
- . += "Upgraded scanning modules increase the unit's stasis strength."
+ . += "Upgraded microlasers increase the unit's stasis strength."
+ . += "Upgraded capacitors decrease the unit's power consumption."
/obj/machinery/stasis_bed/Initialize(mapload, d, populate_components)
. = ..()
update_icon()
+/obj/machinery/stasis_bed/Destroy()
+ . = ..()
+ QDEL_NULL(mattress_on)
+
/obj/machinery/stasis_bed/attackby(obj/item/attacking_item, mob/user)
if(default_part_replacement(user, attacking_item))
return TRUE
@@ -60,13 +70,20 @@
/obj/machinery/stasis_bed/RefreshParts()
..()
- var/scanner_rating = 0
+ var/laser_rating = 0
+ var/capacitor_rating = 0
for(var/obj/item/stock_parts/P in component_parts)
- if(isscanner(P))
- scanner_rating += P.rating
+ if(ismicrolaser(P))
+ laser_rating += P.rating
+ if(iscapacitor(P))
+ capacitor_rating += P.rating
+
+ stasis_power = initial(stasis_power) * laser_rating / 2
+ idle_power_usage = (initial(idle_power_usage) * (laser_rating / 2)) / (capacitor_rating / 2)
+ active_power_usage = (initial(active_power_usage) * laser_rating) / (capacitor_rating / 2)
+ update_current_power_usage()
- stasis_power = initial(stasis_power) * scanner_rating / 2
/obj/machinery/stasis_bed/proc/play_power_sound()
var/_running = stasis_running()
@@ -81,8 +98,9 @@
/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
+ stasis_can_toggle = world.time + STASIS_TOGGLE_COOLDOWN
playsound(src, 'sound/machines/click.ogg', 60, TRUE)
+ balloon_alert_to_viewers("turned [stasis_enabled ? "on" : "off"]", vision_distance = 3)
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"]."))
@@ -93,6 +111,7 @@
if(AM == occupant)
var/mob/living/L = AM
thaw_occupant(L)
+ occupant = null
. = ..()
/obj/machinery/stasis_bed/proc/stasis_running()
@@ -106,8 +125,29 @@
icon_state = initial(icon_state)
if(panel_open || (stat & MAINT))
AddOverlays("stasis_maintenance")
- if(stasis_running())
- AddOverlays("stasis_on")
+ updateVisOverlay()
+
+/obj/machinery/stasis_bed/proc/updateVisOverlay()
+ if(!mattress_state)
+ remove_vis_contents(mattress_on)
+ return
+ var/_running = stasis_running()
+ if(!mattress_on)
+ mattress_on = new()
+ mattress_on.icon = icon
+ mattress_on.icon_state = mattress_state
+ mattress_on.layer = layer
+ mattress_on.plane = plane
+ mattress_on.dir = dir
+ mattress_on.alpha = 0
+
+ add_vis_contents(mattress_on)
+
+ if(mattress_on.alpha ? !_running : _running)
+ var/new_alpha = _running ? 255 : 0
+ var/easing_direction = _running ? EASE_OUT : EASE_IN
+ var/anim_time = _running ? 5 SECONDS : 2.5 SECONDS
+ animate(mattress_on, time = anim_time, alpha = new_alpha, easing = CUBIC_EASING|easing_direction)
/obj/machinery/stasis_bed/power_change()
. = ..()
@@ -116,10 +156,8 @@
/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))
+ var/freq = rand(24750, 26550)
+ playsound(src, 'sound/effects/spray.ogg', 5, TRUE, 2, frequency = freq)
target.ExtinguishMobCompletely()
update_use_power(POWER_USE_ACTIVE)
chilled_occupant = TRUE
@@ -129,7 +167,6 @@
return
update_use_power(POWER_USE_IDLE)
- occupant = null
chilled_occupant = FALSE
/obj/machinery/stasis_bed/post_buckle(mob/living/carbon/human/H)
@@ -139,6 +176,7 @@
chill_occupant(H)
else
thaw_occupant(H)
+ occupant = null
update_icon()
/obj/machinery/stasis_bed/process()
@@ -148,7 +186,11 @@
update_use_power(POWER_USE_IDLE)
return
- if(!chilled_occupant)
- chill_occupant(occupant)
+ if(stasis_running())
+ if(!chilled_occupant)
+ chill_occupant(occupant)
+ occupant.SetStasis(stasis_power, stasis_source_name)
+ else if(chilled_occupant)
+ thaw_occupant(occupant)
- occupant.SetStasis(stasis_power, stasis_source_name)
+#undef STASIS_TOGGLE_COOLDOWN
diff --git a/code/game/objects/effects/overlays.dm b/code/game/objects/effects/overlays.dm
index 7a55e494dc2..d497552c069 100644
--- a/code/game/objects/effects/overlays.dm
+++ b/code/game/objects/effects/overlays.dm
@@ -114,3 +114,8 @@
/obj/effect/overlay/teleport_pulse/Initialize(mapload, ...)
. = ..()
QDEL_IN(src, 8)
+
+/obj/effect/overlay/vis
+ mouse_opacity = MOUSE_OPACITY_TRANSPARENT
+ anchored = TRUE
+ vis_flags = VIS_INHERIT_DIR
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index cb01f89d521..1fc9a1c9628 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -560,6 +560,13 @@
for(var/source in stasis_sources)
stasis_value += stasis_sources[source]
stasis_sources.Cut()
+ if(stasis_value == 0)
+ remove_filter("stasis_status_ripple")
+ else if(!get_filter("stasis_status_ripple"))
+ add_filter("stasis_status_ripple", 2, ripple_filter(flags = WAVE_BOUNDED, radius = 0, size = 2))
+ var/filter = get_filter("stasis_status_ripple")
+ animate(filter, radius = 0, time = 0.2 SECONDS, size = 2, easing = JUMP_EASING, loop = -1, flags = ANIMATION_PARALLEL)
+ animate(radius = 32, time = 1.5 SECONDS, size = 0)
/mob/living/carbon/get_contained_external_atoms()
. = contents - internal_organs
diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm
index c9ed32b003e..01db3e1e224 100644
--- a/code/modules/mob/living/carbon/human/life.dm
+++ b/code/modules/mob/living/carbon/human/life.dm
@@ -872,6 +872,7 @@
#define DRUNK_STRING "drunk"
#define BLEEDING_STRING "bleeding"
#define POSING_STRING "posing"
+#define STASIS_STRING "stasis"
/mob/living/carbon/human/handle_regular_hud_updates()
if(hud_updateflag) // update our mob's hud overlays, AKA what others see flaoting above our head
@@ -1137,6 +1138,15 @@
qdel(status_overlays[DRUNK_STRING])
status_overlays -= DRUNK_STRING
+ var/has_stasis_status = LAZYISIN(status_overlays, STASIS_STRING)
+ if(InStasis())
+ if(!has_stasis_status)
+ add_status_to_hud(STASIS_STRING, "Your biological functions are slowed. You can't interact with much in this state.")
+ else if(has_stasis_status)
+ client.screen -= status_overlays[STASIS_STRING]
+ qdel(status_overlays[STASIS_STRING])
+ status_overlays -= STASIS_STRING
+
var/has_bleeding_limb = FALSE
var/has_bleeding_status = LAZYISIN(status_overlays, BLEEDING_STRING)
for(var/obj/item/organ/external/damaged_limb as anything in bad_external_organs)
@@ -1170,6 +1180,7 @@
#undef DRUNK_STRING
#undef BLEEDING_STRING
#undef POSING_STRING
+#undef STASIS_STRING
/mob/living/carbon/human/proc/add_status_to_hud(var/set_overlay, var/set_status_message)
var/atom/movable/screen/status/new_status = new /atom/movable/screen/status(null, ui_style2icon(client.prefs.UI_style), set_overlay, set_status_message)
diff --git a/html/changelogs/GeneralCamo - Stasis.yml b/html/changelogs/GeneralCamo - Stasis.yml
new file mode 100644
index 00000000000..ba2e084ce3e
--- /dev/null
+++ b/html/changelogs/GeneralCamo - Stasis.yml
@@ -0,0 +1,63 @@
+################################
+# 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
+# - (fixes bugs)
+# wip
+# - (work in progress)
+# qol
+# - (quality of life)
+# soundadd
+# - (adds a sound)
+# sounddel
+# - (removes a sound)
+# rscadd
+# - (adds a feature)
+# rscdel
+# - (removes a feature)
+# imageadd
+# - (adds an image or sprite)
+# imagedel
+# - (removes an image or sprite)
+# spellcheck
+# - (fixes spelling or grammar)
+# experiment
+# - (experimental change)
+# balance
+# - (balance changes)
+# code_imp
+# - (misc internal code change)
+# refactor
+# - (refactors code)
+# config
+# - (makes a change to the config files)
+# admin
+# - (makes changes to administrator tools)
+# server
+# - (miscellaneous changes to server)
+#################################
+
+# Your name.
+author: GeneralCamo
+
+# 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, this gets changed to [] after reading. Just remove the brackets when you add new shit.
+# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - rscadd: "Going into stasis now has a status icon."
+ - rscadd: "Ported the stasis effect filter from tgstation."
+ - rscadd: "Ported the stasis bed animation from tgstation."
+ - bugfix: "Stasis beds are now required to be turned on to provide stasis."
+ - balance: "Reworked stasis bed upgrades. Lasers are used to upgrade stasis bed level instead of scanners, but will now increase the power consumption. Capacitors will make them more efficient."
+ - balance: "Greatly increased the base power consumption of the stasis bed."
diff --git a/icons/mob/screen/hud_status.dmi b/icons/mob/screen/hud_status.dmi
index 2e44b23dadeaf0ed4f505df573a71545f0f51c31..3ec40096a2aa1e4eac98fbc20e9edab1bacc2847 100644
GIT binary patch
delta 710
zcmV;%0y+KH1-b@*iBL{Q4GJ0x0000DNk~Le0001B0000$2m=5B0MhD$JOBUyT2M?>
zMZmzo78V*SD>F7WJP!f_@bK``($XgP5rwb0NR=KufyE&cS{00001bW%=J
z06^y0W&i*Hl#z^re=*8{jN;5V_Y-Uk53z)9?Y8=tEH00HhvL_t(oh3%K&
za)Tfcgf9(g6Ph+@8wLe^|JUptYK(d)igY>?*Xkdd{a6kV0XBtc$7xOf7fve@5HRTf
z%7EQ&-xU&i03i;CSCkNAR(vCxz4g@xpgsCeA;ghwL$iHfe?5RWRsDBQ=|%VfQwhYW
zm6RvR6U6cO&b0(3kmp(-@)IFG02?7FfjnO-Awci|^uMx%fCNbRx*!4rd`t1e0?7Z$
zW(b-^4uA+Rfc$SamJps`9Dx2_Ku`kmp8)V<6qvvTa5Z3O5dug{6I2mg09p#nRB<&X
z|78i9A|L?8f37oH1+0H?0$OD>LY|#MR0O6qXg95Q3s3JG1P}j%_d((}TJm@DKaf&%
zD|oyH?NI-ZyXOKPFUFujw)adzWelGFGYJ*}Iw{sp(DYvM8SXV&T7ylSo=IBkwEkJ1
zB_-(G;M1&PEbr#
zMZmzo78V*SD>F7WJP!f_@bK``($XgAF%w-c9yn)pc`y}|H4{x94Hgp<
zV27Y$Vq(A_FPod2pP!$`#>TWIDDFZy|H;U%#2t_T0003EbW%=J06^y0W&i*Hjggpw
ze;#GZ3a)-GV1EGsD78MfA&UFc0004=NklvDu3427}FwzBQEB?{er{}*in
z=(=2j=uA7k97q3Xz8u0O3h`Ui<odzy6dmf5**I
z08oh^SOSb@$OY(bWcTuk_Ace9KZ(nl9cl^zwspk4>
w;vfa+xv_6`Ag2692lFViHJJTn9ekfY0k$V4qfXXoqyPW_07*qoM6N<$g3Sy8d;kCd