[MIRROR] cryotube pod improvements (#1681)
* Bay-like cryotube pods * Update cryo.dm * Delete cryo.dm.rej * Delete cryo.dm * cryogenics.dmi
This commit is contained in:
committed by
Poojawa
parent
237691f6fd
commit
ec253c4e28
@@ -1,365 +1,382 @@
|
|||||||
/obj/machinery/atmospherics/components/unary/cryo_cell
|
#define CRYOMOBS 'icons/obj/cryo_mobs.dmi'
|
||||||
name = "cryo cell"
|
|
||||||
icon = 'icons/obj/cryogenics.dmi'
|
/obj/machinery/atmospherics/components/unary/cryo_cell
|
||||||
icon_state = "pod0"
|
name = "cryo cell"
|
||||||
density = 1
|
icon = 'icons/obj/cryogenics.dmi'
|
||||||
anchored = 1
|
icon_state = "pod-off"
|
||||||
obj_integrity = 350
|
density = 1
|
||||||
max_integrity = 350
|
anchored = 1
|
||||||
armor = list(melee = 0, bullet = 0, laser = 0, energy = 100, bomb = 0, bio = 100, rad = 100, fire = 30, acid = 30)
|
obj_integrity = 350
|
||||||
layer = ABOVE_WINDOW_LAYER
|
max_integrity = 350
|
||||||
|
armor = list(melee = 0, bullet = 0, laser = 0, energy = 100, bomb = 0, bio = 100, rad = 100, fire = 30, acid = 30)
|
||||||
var/on = FALSE
|
|
||||||
state_open = FALSE
|
var/on = FALSE
|
||||||
var/autoeject = FALSE
|
state_open = FALSE
|
||||||
var/volume = 100
|
var/autoeject = FALSE
|
||||||
var/running_bob_animation = FALSE
|
var/volume = 100
|
||||||
|
|
||||||
var/efficiency = 1
|
var/efficiency = 1
|
||||||
var/sleep_factor = 750
|
var/sleep_factor = 750
|
||||||
var/paralyze_factor = 1000
|
var/paralyze_factor = 1000
|
||||||
var/heat_capacity = 20000
|
var/heat_capacity = 20000
|
||||||
var/conduction_coefficient = 0.30
|
var/conduction_coefficient = 0.30
|
||||||
|
|
||||||
var/obj/item/weapon/reagent_containers/glass/beaker = null
|
var/obj/item/weapon/reagent_containers/glass/beaker = null
|
||||||
var/reagent_transfer = 0
|
var/reagent_transfer = 0
|
||||||
|
|
||||||
var/obj/item/device/radio/radio
|
var/obj/item/device/radio/radio
|
||||||
var/radio_key = /obj/item/device/encryptionkey/headset_med
|
var/radio_key = /obj/item/device/encryptionkey/headset_med
|
||||||
var/radio_channel = "Medical"
|
var/radio_channel = "Medical"
|
||||||
|
|
||||||
|
var/running_bob_anim = FALSE
|
||||||
|
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/Initialize()
|
/obj/machinery/atmospherics/components/unary/cryo_cell/Initialize()
|
||||||
. = ..()
|
. = ..()
|
||||||
initialize_directions = dir
|
initialize_directions = dir
|
||||||
var/obj/item/weapon/circuitboard/machine/cryo_tube/B = new
|
var/obj/item/weapon/circuitboard/machine/cryo_tube/B = new
|
||||||
B.apply_default_parts(src)
|
B.apply_default_parts(src)
|
||||||
|
|
||||||
radio = new(src)
|
radio = new(src)
|
||||||
radio.keyslot = new radio_key
|
radio.keyslot = new radio_key
|
||||||
radio.subspace_transmission = 1
|
radio.subspace_transmission = 1
|
||||||
radio.canhear_range = 0
|
radio.canhear_range = 0
|
||||||
radio.recalculateChannels()
|
radio.recalculateChannels()
|
||||||
|
|
||||||
/obj/item/weapon/circuitboard/machine/cryo_tube
|
/obj/item/weapon/circuitboard/machine/cryo_tube
|
||||||
name = "Cryotube (Machine Board)"
|
name = "Cryotube (Machine Board)"
|
||||||
build_path = /obj/machinery/atmospherics/components/unary/cryo_cell
|
build_path = /obj/machinery/atmospherics/components/unary/cryo_cell
|
||||||
origin_tech = "programming=4;biotech=3;engineering=4;plasmatech=3"
|
origin_tech = "programming=4;biotech=3;engineering=4;plasmatech=3"
|
||||||
req_components = list(
|
req_components = list(
|
||||||
/obj/item/weapon/stock_parts/matter_bin = 1,
|
/obj/item/weapon/stock_parts/matter_bin = 1,
|
||||||
/obj/item/stack/cable_coil = 1,
|
/obj/item/stack/cable_coil = 1,
|
||||||
/obj/item/weapon/stock_parts/console_screen = 1,
|
/obj/item/weapon/stock_parts/console_screen = 1,
|
||||||
/obj/item/stack/sheet/glass = 2)
|
/obj/item/stack/sheet/glass = 2)
|
||||||
|
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/on_construction()
|
/obj/machinery/atmospherics/components/unary/cryo_cell/on_construction()
|
||||||
..(dir, dir)
|
..(dir, dir)
|
||||||
|
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/RefreshParts()
|
/obj/machinery/atmospherics/components/unary/cryo_cell/RefreshParts()
|
||||||
var/C
|
var/C
|
||||||
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
|
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
|
||||||
C += M.rating
|
C += M.rating
|
||||||
|
|
||||||
efficiency = initial(efficiency) * C
|
efficiency = initial(efficiency) * C
|
||||||
sleep_factor = initial(sleep_factor) * C
|
sleep_factor = initial(sleep_factor) * C
|
||||||
paralyze_factor = initial(paralyze_factor) * C
|
paralyze_factor = initial(paralyze_factor) * C
|
||||||
heat_capacity = initial(heat_capacity) / C
|
heat_capacity = initial(heat_capacity) / C
|
||||||
conduction_coefficient = initial(conduction_coefficient) * C
|
conduction_coefficient = initial(conduction_coefficient) * C
|
||||||
|
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/Destroy()
|
/obj/machinery/atmospherics/components/unary/cryo_cell/Destroy()
|
||||||
qdel(radio)
|
qdel(radio)
|
||||||
radio = null
|
radio = null
|
||||||
if(beaker)
|
if(beaker)
|
||||||
qdel(beaker)
|
qdel(beaker)
|
||||||
beaker = null
|
beaker = null
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/contents_explosion(severity, target)
|
/obj/machinery/atmospherics/components/unary/cryo_cell/contents_explosion(severity, target)
|
||||||
..()
|
..()
|
||||||
if(beaker)
|
if(beaker)
|
||||||
beaker.ex_act(severity, target)
|
beaker.ex_act(severity, target)
|
||||||
|
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/handle_atom_del(atom/A)
|
/obj/machinery/atmospherics/components/unary/cryo_cell/handle_atom_del(atom/A)
|
||||||
..()
|
..()
|
||||||
if(A == beaker)
|
if(A == beaker)
|
||||||
beaker = null
|
beaker = null
|
||||||
updateUsrDialog()
|
updateUsrDialog()
|
||||||
|
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/on_deconstruction()
|
/obj/machinery/atmospherics/components/unary/cryo_cell/on_deconstruction()
|
||||||
if(beaker)
|
if(beaker)
|
||||||
beaker.forceMove(loc)
|
beaker.forceMove(loc)
|
||||||
beaker = null
|
beaker = null
|
||||||
|
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/update_icon()
|
/obj/machinery/atmospherics/components/unary/cryo_cell/update_icon()
|
||||||
handle_update_icon()
|
cut_overlays()
|
||||||
|
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/proc/handle_update_icon() //making another proc to avoid spam in update_icon
|
if(state_open)
|
||||||
overlays.Cut() //empty the overlay proc, just in case
|
icon_state = "pod-open"
|
||||||
|
else if(occupant)
|
||||||
if(panel_open)
|
var/image/occupant_overlay
|
||||||
icon_state = "pod0-o"
|
|
||||||
else if(state_open)
|
if(ismonkey(occupant)) // Monkey
|
||||||
icon_state = "pod0"
|
occupant_overlay = mutable_appearance(CRYOMOBS, "monkey")
|
||||||
else if(on && is_operational())
|
|
||||||
if(occupant)
|
else if(isalienadult(occupant))
|
||||||
var/image/pickle = image(occupant.icon, occupant.icon_state)
|
|
||||||
pickle.overlays = occupant.overlays
|
if(istype(occupant, /mob/living/carbon/alien/humanoid/royal)) // Queen and prae
|
||||||
pickle.pixel_y = 22
|
occupant_overlay = image(CRYOMOBS, "alienq")
|
||||||
overlays += pickle
|
|
||||||
icon_state = "pod1"
|
else if(istype(occupant, /mob/living/carbon/alien/humanoid/hunter)) // Hunter
|
||||||
var/up = 0 //used to see if we are going up or down, 1 is down, 2 is up
|
occupant_overlay = image(CRYOMOBS, "alienh")
|
||||||
spawn(0) // Without this, the icon update will block. The new thread will die once the occupant leaves.
|
|
||||||
running_bob_animation = TRUE
|
else if(istype(occupant, /mob/living/carbon/alien/humanoid/sentinel)) // Sentinel
|
||||||
while(occupant)
|
occupant_overlay = image(CRYOMOBS, "aliens")
|
||||||
overlays -= "lid1" //have to remove the overlays first, to force an update- remove cloning pod overlay
|
|
||||||
overlays -= pickle //remove mob overlay
|
else // Drone (or any other alien that isn't any of the above)
|
||||||
|
occupant_overlay = image(CRYOMOBS, "aliend")
|
||||||
switch(pickle.pixel_y) //this looks messy as fuck but it works, switch won't call itself twice
|
|
||||||
|
else if(ishuman(occupant) || islarva(occupant) || (isanimal(occupant) && !ismegafauna(occupant))) // Mobs that are smaller than cryotube
|
||||||
if(23) //inbetween state, for smoothness
|
occupant_overlay = image(occupant.icon, occupant.icon_state)
|
||||||
switch(up) //this is set later in the switch, to keep track of where the mob is supposed to go
|
occupant_overlay.copy_overlays(occupant)
|
||||||
if(2) //2 is up
|
|
||||||
pickle.pixel_y = 24 //set to highest
|
else // Anything else
|
||||||
|
occupant_overlay = image(CRYOMOBS, "generic")
|
||||||
if(1) //1 is down
|
|
||||||
pickle.pixel_y = 22 //set to lowest
|
occupant_overlay.dir = SOUTH
|
||||||
|
occupant_overlay.pixel_y = 22
|
||||||
if(22) //mob is at it's lowest
|
|
||||||
pickle.pixel_y = 23 //set to inbetween
|
if(on && is_operational() && !running_bob_anim)
|
||||||
up = 2 //have to go up
|
icon_state = "pod-on"
|
||||||
|
running_bob_anim = TRUE
|
||||||
if(24) //mob is at it's highest
|
run_bob_anim(TRUE, occupant_overlay)
|
||||||
pickle.pixel_y = 23 //set to inbetween
|
else
|
||||||
up = 1 //have to go down
|
icon_state = "pod-off"
|
||||||
|
add_overlay(occupant_overlay)
|
||||||
overlays += pickle //re-add the mob to the icon
|
add_overlay("cover-off")
|
||||||
overlays += "lid1" //re-add the overlay of the pod, they are inside it, not floating
|
else if(on && is_operational())
|
||||||
|
icon_state = "pod-on"
|
||||||
sleep(7) //don't want to jiggle violently, just slowly bob
|
add_overlay("cover-on")
|
||||||
return
|
else
|
||||||
running_bob_animation = FALSE
|
icon_state = "pod-off"
|
||||||
else
|
add_overlay("cover-off")
|
||||||
icon_state = "pod1"
|
|
||||||
overlays += "lid0" //have to remove the overlays first, to force an update- remove cloning pod overlay
|
if(panel_open)
|
||||||
else
|
add_overlay("pod-panel")
|
||||||
icon_state = "pod0"
|
|
||||||
overlays += "lid0" //if no occupant, just put the lid overlay on, and ignore the rest
|
/obj/machinery/atmospherics/components/unary/cryo_cell/proc/run_bob_anim(anim_up, image/occupant_overlay)
|
||||||
|
if(!on || !occupant || !is_operational())
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/process()
|
running_bob_anim = FALSE
|
||||||
..()
|
return
|
||||||
|
cut_overlays()
|
||||||
if(!on)
|
if(occupant_overlay.pixel_y != 23) // Same effect as occupant_overlay.pixel_y == 22 || occupant_overlay.pixel_y == 24
|
||||||
return
|
anim_up = occupant_overlay.pixel_y == 22 // Same effect as if(occupant_overlay.pixel_y == 22) anim_up = TRUE ; if(occupant_overlay.pixel_y == 24) anim_up = FALSE
|
||||||
if(!is_operational())
|
if(anim_up)
|
||||||
on = FALSE
|
occupant_overlay.pixel_y++
|
||||||
update_icon()
|
else
|
||||||
return
|
occupant_overlay.pixel_y--
|
||||||
var/datum/gas_mixture/air1 = AIR1
|
add_overlay(occupant_overlay)
|
||||||
var/turf/T = get_turf(src)
|
add_overlay("cover-on")
|
||||||
if(occupant)
|
addtimer(CALLBACK(src, .proc/run_bob_anim, anim_up, occupant_overlay), 7, TIMER_UNIQUE)
|
||||||
var/mob/living/mob_occupant = occupant
|
|
||||||
if(mob_occupant.health >= mob_occupant.getMaxHealth()) // Don't bother with fully healed people.
|
/obj/machinery/atmospherics/components/unary/cryo_cell/process()
|
||||||
on = FALSE
|
..()
|
||||||
update_icon()
|
|
||||||
playsound(T, 'sound/machines/cryo_warning.ogg', volume) // Bug the doctors.
|
if(!on)
|
||||||
radio.talk_into(src, "Patient fully restored", radio_channel, get_spans(), get_default_language())
|
return
|
||||||
if(autoeject) // Eject if configured.
|
if(!is_operational())
|
||||||
radio.talk_into(src, "Auto ejecting patient now", radio_channel, get_spans(), get_default_language())
|
on = FALSE
|
||||||
open_machine()
|
update_icon()
|
||||||
return
|
return
|
||||||
else if(mob_occupant.stat == DEAD) // We don't bother with dead people.
|
var/datum/gas_mixture/air1 = AIR1
|
||||||
return
|
var/turf/T = get_turf(src)
|
||||||
if(autoeject) // Eject if configured.
|
if(occupant)
|
||||||
open_machine()
|
var/mob/living/mob_occupant = occupant
|
||||||
return
|
if(mob_occupant.health >= 100) // Don't bother with fully healed people.
|
||||||
if(air1.gases.len)
|
on = FALSE
|
||||||
if(mob_occupant.bodytemperature < T0C) // Sleepytime. Why? More cryo magic.
|
update_icon()
|
||||||
mob_occupant.Sleeping((mob_occupant.bodytemperature / sleep_factor) * 100)
|
playsound(T, 'sound/machines/cryo_warning.ogg', volume) // Bug the doctors.
|
||||||
mob_occupant.Paralyse((mob_occupant.bodytemperature / paralyze_factor) * 100)
|
radio.talk_into(src, "Patient fully restored", radio_channel, get_spans(), get_default_language())
|
||||||
|
if(autoeject) // Eject if configured.
|
||||||
if(beaker)
|
radio.talk_into(src, "Auto ejecting patient now", radio_channel, get_spans(), get_default_language())
|
||||||
if(reagent_transfer == 0) // Magically transfer reagents. Because cryo magic.
|
open_machine()
|
||||||
beaker.reagents.trans_to(occupant, 1, 10 * efficiency) // Transfer reagents, multiplied because cryo magic.
|
return
|
||||||
beaker.reagents.reaction(occupant, VAPOR)
|
else if(mob_occupant.stat == DEAD) // We don't bother with dead people.
|
||||||
air1.gases["o2"][MOLES] -= 2 / efficiency // Lets use gas for this.
|
return
|
||||||
if(++reagent_transfer >= 10 * efficiency) // Throttle reagent transfer (higher efficiency will transfer the same amount but consume less from the beaker).
|
if(autoeject) // Eject if configured.
|
||||||
reagent_transfer = 0
|
open_machine()
|
||||||
return 1
|
return
|
||||||
|
if(air1.gases.len)
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/process_atmos()
|
if(mob_occupant.bodytemperature < T0C) // Sleepytime. Why? More cryo magic.
|
||||||
..()
|
mob_occupant.Sleeping((mob_occupant.bodytemperature / sleep_factor) * 100)
|
||||||
if(!on)
|
mob_occupant.Paralyse((mob_occupant.bodytemperature / paralyze_factor) * 100)
|
||||||
return
|
|
||||||
var/datum/gas_mixture/air1 = AIR1
|
if(beaker)
|
||||||
if(!NODE1 || !AIR1 || !air1.gases.len || air1.gases["o2"][MOLES] < 5) // Turn off if the machine won't work.
|
if(reagent_transfer == 0) // Magically transfer reagents. Because cryo magic.
|
||||||
on = FALSE
|
beaker.reagents.trans_to(occupant, 1, 10 * efficiency) // Transfer reagents, multiplied because cryo magic.
|
||||||
update_icon()
|
beaker.reagents.reaction(occupant, VAPOR)
|
||||||
return
|
air1.gases["o2"][MOLES] -= 2 / efficiency // Lets use gas for this.
|
||||||
if(occupant)
|
if(++reagent_transfer >= 10 * efficiency) // Throttle reagent transfer (higher efficiency will transfer the same amount but consume less from the beaker).
|
||||||
var/mob/living/mob_occupant = occupant
|
reagent_transfer = 0
|
||||||
var/cold_protection = 0
|
return 1
|
||||||
var/mob/living/carbon/human/H = occupant
|
|
||||||
if(istype(H))
|
/obj/machinery/atmospherics/components/unary/cryo_cell/process_atmos()
|
||||||
cold_protection = H.get_cold_protection(air1.temperature)
|
..()
|
||||||
|
if(!on)
|
||||||
var/temperature_delta = air1.temperature - mob_occupant.bodytemperature // The only semi-realistic thing here: share temperature between the cell and the occupant.
|
return
|
||||||
if(abs(temperature_delta) > 1)
|
var/datum/gas_mixture/air1 = AIR1
|
||||||
var/air_heat_capacity = air1.heat_capacity()
|
if(!NODE1 || !AIR1 || !air1.gases.len || air1.gases["o2"][MOLES] < 5) // Turn off if the machine won't work.
|
||||||
var/heat = ((1 - cold_protection) / 10 + conduction_coefficient) \
|
on = FALSE
|
||||||
* temperature_delta * \
|
update_icon()
|
||||||
(air_heat_capacity * heat_capacity / (air_heat_capacity + heat_capacity))
|
return
|
||||||
air1.temperature = max(air1.temperature - heat / air_heat_capacity, TCMB)
|
if(occupant)
|
||||||
mob_occupant.bodytemperature = max(mob_occupant.bodytemperature + heat / heat_capacity, TCMB)
|
var/mob/living/mob_occupant = occupant
|
||||||
|
var/cold_protection = 0
|
||||||
air1.gases["o2"][MOLES] -= 0.5 / efficiency // Magically consume gas? Why not, we run on cryo magic.
|
var/mob/living/carbon/human/H = occupant
|
||||||
|
if(istype(H))
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/power_change()
|
cold_protection = H.get_cold_protection(air1.temperature)
|
||||||
..()
|
|
||||||
update_icon()
|
var/temperature_delta = air1.temperature - mob_occupant.bodytemperature // The only semi-realistic thing here: share temperature between the cell and the occupant.
|
||||||
|
if(abs(temperature_delta) > 1)
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/relaymove(mob/user)
|
var/air_heat_capacity = air1.heat_capacity()
|
||||||
container_resist(user)
|
var/heat = ((1 - cold_protection) / 10 + conduction_coefficient) \
|
||||||
|
* temperature_delta * \
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/open_machine(drop = 0)
|
(air_heat_capacity * heat_capacity / (air_heat_capacity + heat_capacity))
|
||||||
if(!state_open && !panel_open)
|
air1.temperature = max(air1.temperature - heat / air_heat_capacity, TCMB)
|
||||||
on = FALSE
|
mob_occupant.bodytemperature = max(mob_occupant.bodytemperature + heat / heat_capacity, TCMB)
|
||||||
..()
|
|
||||||
for(var/mob/M in contents) //only drop mobs
|
air1.gases["o2"][MOLES] -= 0.5 / efficiency // Magically consume gas? Why not, we run on cryo magic.
|
||||||
M.forceMove(get_turf(src))
|
|
||||||
if(isliving(M))
|
/obj/machinery/atmospherics/components/unary/cryo_cell/power_change()
|
||||||
var/mob/living/L = M
|
..()
|
||||||
L.update_canmove()
|
update_icon()
|
||||||
occupant = null
|
|
||||||
|
/obj/machinery/atmospherics/components/unary/cryo_cell/relaymove(mob/user)
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/close_machine(mob/living/carbon/user)
|
container_resist(user)
|
||||||
if((isnull(user) || istype(user)) && state_open && !panel_open)
|
|
||||||
..(user)
|
/obj/machinery/atmospherics/components/unary/cryo_cell/open_machine(drop = 0)
|
||||||
return occupant
|
if(!state_open && !panel_open)
|
||||||
|
on = FALSE
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/container_resist(mob/living/user)
|
..()
|
||||||
to_chat(user, "<span class='notice'>You struggle inside the cryotube, kicking the release with your foot... (This will take around 30 seconds.)</span>")
|
for(var/mob/M in contents) //only drop mobs
|
||||||
audible_message("<span class='notice'>You hear a thump from [src].</span>")
|
M.forceMove(get_turf(src))
|
||||||
if(do_after(user, 300))
|
if(isliving(M))
|
||||||
if(occupant == user) // Check they're still here.
|
var/mob/living/L = M
|
||||||
open_machine()
|
L.update_canmove()
|
||||||
|
occupant = null
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/examine(mob/user)
|
update_icon()
|
||||||
..()
|
|
||||||
if(occupant)
|
/obj/machinery/atmospherics/components/unary/cryo_cell/close_machine(mob/living/carbon/user)
|
||||||
if(on)
|
if((isnull(user) || istype(user)) && state_open && !panel_open)
|
||||||
to_chat(user, "Someone's inside [src]!")
|
..(user)
|
||||||
else
|
return occupant
|
||||||
to_chat(user, "You can barely make out a form floating in [src].")
|
|
||||||
else
|
/obj/machinery/atmospherics/components/unary/cryo_cell/container_resist(mob/living/user)
|
||||||
to_chat(user, "[src] seems empty.")
|
to_chat(user, "<span class='notice'>You struggle inside the cryotube, kicking the release with your foot... (This will take around 30 seconds.)</span>")
|
||||||
|
audible_message("<span class='notice'>You hear a thump from [src].</span>")
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/MouseDrop_T(mob/target, mob/user)
|
if(do_after(user, 300))
|
||||||
if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser())
|
if(occupant == user) // Check they're still here.
|
||||||
return
|
open_machine()
|
||||||
close_machine(target)
|
|
||||||
|
/obj/machinery/atmospherics/components/unary/cryo_cell/examine(mob/user)
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/attackby(obj/item/I, mob/user, params)
|
..()
|
||||||
if(istype(I, /obj/item/weapon/reagent_containers/glass))
|
if(occupant)
|
||||||
. = 1 //no afterattack
|
if(on)
|
||||||
if(beaker)
|
to_chat(user, "Someone's inside [src]!")
|
||||||
to_chat(user, "<span class='warning'>A beaker is already loaded into [src]!</span>")
|
else
|
||||||
return
|
to_chat(user, "You can barely make out a form floating in [src].")
|
||||||
if(!user.drop_item())
|
else
|
||||||
return
|
to_chat(user, "[src] seems empty.")
|
||||||
beaker = I
|
|
||||||
I.loc = src
|
/obj/machinery/atmospherics/components/unary/cryo_cell/MouseDrop_T(mob/target, mob/user)
|
||||||
user.visible_message("[user] places [I] in [src].", \
|
if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser())
|
||||||
"<span class='notice'>You place [I] in [src].</span>")
|
return
|
||||||
var/reagentlist = pretty_string_from_reagent_list(I.reagents.reagent_list)
|
close_machine(target)
|
||||||
log_game("[key_name(user)] added an [I] to cyro containing [reagentlist]")
|
|
||||||
|
/obj/machinery/atmospherics/components/unary/cryo_cell/attackby(obj/item/I, mob/user, params)
|
||||||
return
|
if(istype(I, /obj/item/weapon/reagent_containers/glass))
|
||||||
if(!on && !occupant && !state_open)
|
. = 1 //no afterattack
|
||||||
if(default_deconstruction_screwdriver(user, "pod0-o", "pod0", I))
|
if(beaker)
|
||||||
return
|
to_chat(user, "<span class='warning'>A beaker is already loaded into [src]!</span>")
|
||||||
if(exchange_parts(user, I))
|
return
|
||||||
return
|
if(!user.drop_item())
|
||||||
if(default_change_direction_wrench(user, I))
|
return
|
||||||
return
|
beaker = I
|
||||||
if(default_pry_open(I))
|
I.loc = src
|
||||||
return
|
user.visible_message("[user] places [I] in [src].", \
|
||||||
if(default_deconstruction_crowbar(I))
|
"<span class='notice'>You place [I] in [src].</span>")
|
||||||
return
|
var/reagentlist = pretty_string_from_reagent_list(I.reagents.reagent_list)
|
||||||
return ..()
|
log_game("[key_name(user)] added an [I] to cyro containing [reagentlist]")
|
||||||
|
return
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
|
if(!on && !occupant && !state_open)
|
||||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.notcontained_state)
|
if(default_deconstruction_screwdriver(user, "cell-o", "cell-off", I))
|
||||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
return
|
||||||
if(!ui)
|
if(exchange_parts(user, I))
|
||||||
ui = new(user, src, ui_key, "cryo", name, 400, 550, master_ui, state)
|
return
|
||||||
ui.open()
|
if(default_change_direction_wrench(user, I))
|
||||||
|
return
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/ui_data()
|
if(default_pry_open(I))
|
||||||
var/list/data = list()
|
return
|
||||||
data["isOperating"] = on
|
if(default_deconstruction_crowbar(I))
|
||||||
data["hasOccupant"] = occupant ? 1 : 0
|
return
|
||||||
data["isOpen"] = state_open
|
return ..()
|
||||||
data["autoEject"] = autoeject
|
|
||||||
|
/obj/machinery/atmospherics/components/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
|
||||||
var/list/occupantData = list()
|
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.notcontained_state)
|
||||||
if(occupant)
|
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||||
var/mob/living/mob_occupant = occupant
|
if(!ui)
|
||||||
occupantData["name"] = mob_occupant.name
|
ui = new(user, src, ui_key, "cryo", name, 400, 550, master_ui, state)
|
||||||
occupantData["stat"] = mob_occupant.stat
|
ui.open()
|
||||||
occupantData["health"] = mob_occupant.health
|
|
||||||
occupantData["maxHealth"] = mob_occupant.maxHealth
|
/obj/machinery/atmospherics/components/unary/cryo_cell/ui_data()
|
||||||
occupantData["minHealth"] = HEALTH_THRESHOLD_DEAD
|
var/list/data = list()
|
||||||
occupantData["bruteLoss"] = mob_occupant.getBruteLoss()
|
data["isOperating"] = on
|
||||||
occupantData["oxyLoss"] = mob_occupant.getOxyLoss()
|
data["hasOccupant"] = occupant ? 1 : 0
|
||||||
occupantData["toxLoss"] = mob_occupant.getToxLoss()
|
data["isOpen"] = state_open
|
||||||
occupantData["fireLoss"] = mob_occupant.getFireLoss()
|
data["autoEject"] = autoeject
|
||||||
occupantData["bodyTemperature"] = mob_occupant.bodytemperature
|
|
||||||
data["occupant"] = occupantData
|
var/list/occupantData = list()
|
||||||
|
if(occupant)
|
||||||
|
var/mob/living/mob_occupant = occupant
|
||||||
var/datum/gas_mixture/air1 = AIR1
|
occupantData["name"] = mob_occupant.name
|
||||||
data["cellTemperature"] = round(air1.temperature)
|
occupantData["stat"] = mob_occupant.stat
|
||||||
|
occupantData["health"] = mob_occupant.health
|
||||||
data["isBeakerLoaded"] = beaker ? 1 : 0
|
occupantData["maxHealth"] = mob_occupant.maxHealth
|
||||||
var beakerContents = list()
|
occupantData["minHealth"] = HEALTH_THRESHOLD_DEAD
|
||||||
if(beaker && beaker.reagents && beaker.reagents.reagent_list.len)
|
occupantData["bruteLoss"] = mob_occupant.getBruteLoss()
|
||||||
for(var/datum/reagent/R in beaker.reagents.reagent_list)
|
occupantData["oxyLoss"] = mob_occupant.getOxyLoss()
|
||||||
beakerContents += list(list("name" = R.name, "volume" = R.volume))
|
occupantData["toxLoss"] = mob_occupant.getToxLoss()
|
||||||
data["beakerContents"] = beakerContents
|
occupantData["fireLoss"] = mob_occupant.getFireLoss()
|
||||||
return data
|
occupantData["bodyTemperature"] = mob_occupant.bodytemperature
|
||||||
|
data["occupant"] = occupantData
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/ui_act(action, params)
|
|
||||||
if(..())
|
|
||||||
return
|
var/datum/gas_mixture/air1 = AIR1
|
||||||
switch(action)
|
data["cellTemperature"] = round(air1.temperature)
|
||||||
if("power")
|
|
||||||
if(on)
|
data["isBeakerLoaded"] = beaker ? 1 : 0
|
||||||
on = FALSE
|
var beakerContents = list()
|
||||||
else if(!state_open)
|
if(beaker && beaker.reagents && beaker.reagents.reagent_list.len)
|
||||||
on = TRUE
|
for(var/datum/reagent/R in beaker.reagents.reagent_list)
|
||||||
. = TRUE
|
beakerContents += list(list("name" = R.name, "volume" = R.volume))
|
||||||
if("door")
|
data["beakerContents"] = beakerContents
|
||||||
if(state_open)
|
return data
|
||||||
close_machine()
|
|
||||||
else
|
/obj/machinery/atmospherics/components/unary/cryo_cell/ui_act(action, params)
|
||||||
open_machine()
|
if(..())
|
||||||
. = TRUE
|
return
|
||||||
if("autoeject")
|
switch(action)
|
||||||
autoeject = !autoeject
|
if("power")
|
||||||
. = TRUE
|
if(on)
|
||||||
if("ejectbeaker")
|
on = FALSE
|
||||||
if(beaker)
|
else if(!state_open)
|
||||||
beaker.forceMove(loc)
|
on = TRUE
|
||||||
beaker = null
|
. = TRUE
|
||||||
. = TRUE
|
if("door")
|
||||||
update_icon()
|
if(state_open)
|
||||||
|
close_machine()
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/update_remote_sight(mob/living/user)
|
else
|
||||||
return //we don't see the pipe network while inside cryo.
|
open_machine()
|
||||||
|
. = TRUE
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/get_remote_view_fullscreens(mob/user)
|
if("autoeject")
|
||||||
user.overlay_fullscreen("remote_view", /obj/screen/fullscreen/impaired, 1)
|
autoeject = !autoeject
|
||||||
|
. = TRUE
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/can_crawl_through()
|
if("ejectbeaker")
|
||||||
return //can't ventcrawl in or out of cryo.
|
if(beaker)
|
||||||
|
beaker.forceMove(loc)
|
||||||
/obj/machinery/atmospherics/components/unary/cryo_cell/can_see_pipes()
|
beaker = null
|
||||||
return 0 //you can't see the pipe network when inside a cryo cell.
|
. = TRUE
|
||||||
|
update_icon()
|
||||||
|
|
||||||
|
/obj/machinery/atmospherics/components/unary/cryo_cell/update_remote_sight(mob/living/user)
|
||||||
|
return //we don't see the pipe network while inside cryo.
|
||||||
|
|
||||||
|
/obj/machinery/atmospherics/components/unary/cryo_cell/get_remote_view_fullscreens(mob/user)
|
||||||
|
user.overlay_fullscreen("remote_view", /obj/screen/fullscreen/impaired, 1)
|
||||||
|
|
||||||
|
/obj/machinery/atmospherics/components/unary/cryo_cell/can_crawl_through()
|
||||||
|
return //can't ventcrawl in or out of cryo.
|
||||||
|
|
||||||
|
/obj/machinery/atmospherics/components/unary/cryo_cell/can_see_pipes()
|
||||||
|
return 0 //you can't see the pipe network when inside a cryo cell.
|
||||||
|
|
||||||
|
#undef CRYOMOBS
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 34 KiB |
Reference in New Issue
Block a user