mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-20 20:37:34 +01:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 <b>scanning modules</b> increase the unit's stasis strength."
|
||||
. += "Upgraded <b>microlasers</b> increase the unit's stasis strength."
|
||||
. += "Upgraded <b>capacitors</b> 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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."
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 727 B After Width: | Height: | Size: 826 B |
Reference in New Issue
Block a user