Skip to content

Commit

Permalink
[MIRROR] Adds fast and slow modes to cryo cells
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNightingale authored and SierraHelper committed Nov 13, 2023
1 parent c3e67d8 commit 9d6c644
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
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>

0 comments on commit 9d6c644

Please sign in to comment.