Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Adds fast and slow modes to cryo cells #1456

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions code/game/machinery/cryo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
var/temperature_warning_threshhold = 170
var/temperature_danger_threshhold = T0C

var/fast_stasis_mult = 0.8
var/slow_stasis_mult = 1.25
var/current_stasis_mult = 1

/obj/machinery/atmospherics/unary/cryo_cell/Initialize()
. = ..()
icon = 'icons/obj/machines/medical/cryogenics_split.dmi'
Expand Down Expand Up @@ -155,6 +159,10 @@
data["beakerLabel"] = beaker.name
data["beakerVolume"] = beaker.reagents.total_volume

data["fast_stasis_mult"] = fast_stasis_mult
data["slow_stasis_mult"] = slow_stasis_mult
data["current_stasis_mult"] = current_stasis_mult

// update the ui if it exists, returns null if no ui is passed/found
ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
Expand Down Expand Up @@ -196,6 +204,21 @@
go_out()
return TOPIC_REFRESH

if(href_list["goFast"])
current_stasis_mult = fast_stasis_mult
update_icon()
return TOPIC_REFRESH

if(href_list["goRegular"])
current_stasis_mult = 1
update_icon()
return TOPIC_REFRESH

if(href_list["goSlow"])
current_stasis_mult = slow_stasis_mult
update_icon()
return TOPIC_REFRESH

/obj/machinery/atmospherics/unary/cryo_cell/state_transition(singleton/machine_construction/default/new_state)
. = ..()
if(istype(new_state))
Expand Down Expand Up @@ -408,6 +431,12 @@
else
return null

/obj/machinery/atmospherics/unary/cryo_cell/RefreshParts()
..()
var/stasis_coeff = total_component_rating_of_type(/obj/item/stock_parts/manipulator)
fast_stasis_mult = max(1 - (stasis_coeff * 0.06), 0.66)
slow_stasis_mult = min(1 + (stasis_coeff * 0.08), 1.5)

/datum/data/function/proc/reset()
return

Expand Down
5 changes: 5 additions & 0 deletions code/modules/mob/living/carbon/human/human_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@
else
. = 80 * (1 - bodytemperature / species.cold_level_3)
. = max(20, .)
if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell))
var/obj/machinery/atmospherics/unary/cryo_cell/cryo = loc
if(cryo.current_stasis_mult)
var/gcf_stasis_mult = cryo.current_stasis_mult
. = . * gcf_stasis_mult
return round(.)

/mob/living/carbon/human
Expand Down
12 changes: 12 additions & 0 deletions nano/templates/cryo.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,16 @@ Used In File(s): \code\game\machinery\cryo.dm
<div class="itemContent" style="width: 26%;">
{{:helper.link('Eject Beaker', 'eject', {'ejectBeaker' : 1}, data.isBeakerLoaded ? null : 'disabled')}}
</div>
</div>
<div class="item">&nbsp;</div>
<div class="item">
<div class="itemLabel">
Cryostasis Speed:
</div>
<div class="itemContent" style="width: 40%;">
{{:helper.link('Fast', null, {'goFast' : 1}, data.current_stasis_mult === data.fast_stasis_mult ? 'selected' : null)}}
{{:helper.link('Regular', null, {'goRegular' : 1}, data.current_stasis_mult === 1 ? 'selected' : null)}}
{{:helper.link('Slow', null, {'goSlow' : 1}, data.current_stasis_mult === data.slow_stasis_mult ? 'selected' : null)}}
</div>
</div>
</div>
Loading