Changes /obj/machinery to have atom/movable occupants

This commit is contained in:
CitadelStationBot
2017-05-01 15:58:52 -05:00
parent 315f2b7738
commit cc0a9b87fb
14 changed files with 193 additions and 103 deletions

View File

@@ -116,12 +116,13 @@
else else
dat += "<h3>Subject Status : </h3>" dat += "<h3>Subject Status : </h3>"
dat += "[occupant.name] => " dat += "[occupant.name] => "
switch(occupant.stat) var/mob/living/mob_occupant = occupant
if(0) switch(mob_occupant.stat)
if(CONSCIOUS)
dat += "<span class='good'>Conscious</span>" dat += "<span class='good'>Conscious</span>"
if(1) if(UNCONSCIOUS)
dat += "<span class='average'>Unconscious</span>" dat += "<span class='average'>Unconscious</span>"
else else // DEAD
dat += "<span class='bad'>Deceased</span>" dat += "<span class='bad'>Deceased</span>"
dat += "<br>" dat += "<br>"
dat += "[flash]" dat += "[flash]"
@@ -146,9 +147,11 @@
if(href_list["close"]) if(href_list["close"])
close_machine() close_machine()
return return
if(occupant && occupant.stat != DEAD) if(occupant)
if(href_list["experiment"]) var/mob/living/mob_occupant = occupant
flash = Experiment(occupant,href_list["experiment"]) if(mob_occupant.stat != DEAD)
if(href_list["experiment"])
flash = Experiment(occupant,href_list["experiment"])
updateUsrDialog() updateUsrDialog()
add_fingerprint(usr) add_fingerprint(usr)

View File

@@ -79,7 +79,8 @@
/obj/machinery/sleeper/close_machine(mob/user) /obj/machinery/sleeper/close_machine(mob/user)
if((isnull(user) || istype(user)) && state_open && !panel_open) if((isnull(user) || istype(user)) && state_open && !panel_open)
..(user) ..(user)
if(occupant && occupant.stat != DEAD) var/mob/living/mob_occupant = occupant
if(mob_occupant && mob_occupant.stat != DEAD)
to_chat(occupant, "<span class='notice'><b>You feel cool air surround you. You go numb as your senses turn inward.</b></span>") to_chat(occupant, "<span class='notice'><b>You feel cool air surround you. You go numb as your senses turn inward.</b></span>")
/obj/machinery/sleeper/emp_act(severity) /obj/machinery/sleeper/emp_act(severity)
@@ -128,27 +129,30 @@
data["chems"] += list(list("name" = R.name, "id" = R.id, "allowed" = chem_allowed(chem))) data["chems"] += list(list("name" = R.name, "id" = R.id, "allowed" = chem_allowed(chem)))
data["occupant"] = list() data["occupant"] = list()
if(occupant) var/mob/living/mob_occupant = occupant
data["occupant"]["name"] = occupant.name if(mob_occupant)
data["occupant"]["stat"] = occupant.stat data["occupant"]["name"] = mob_occupant.name
data["occupant"]["health"] = occupant.health data["occupant"]["stat"] = mob_occupant.stat
data["occupant"]["maxHealth"] = occupant.maxHealth data["occupant"]["health"] = mob_occupant.health
data["occupant"]["maxHealth"] = mob_occupant.maxHealth
data["occupant"]["minHealth"] = HEALTH_THRESHOLD_DEAD data["occupant"]["minHealth"] = HEALTH_THRESHOLD_DEAD
data["occupant"]["bruteLoss"] = occupant.getBruteLoss() data["occupant"]["bruteLoss"] = mob_occupant.getBruteLoss()
data["occupant"]["oxyLoss"] = occupant.getOxyLoss() data["occupant"]["oxyLoss"] = mob_occupant.getOxyLoss()
data["occupant"]["toxLoss"] = occupant.getToxLoss() data["occupant"]["toxLoss"] = mob_occupant.getToxLoss()
data["occupant"]["fireLoss"] = occupant.getFireLoss() data["occupant"]["fireLoss"] = mob_occupant.getFireLoss()
data["occupant"]["cloneLoss"] = occupant.getCloneLoss() data["occupant"]["cloneLoss"] = mob_occupant.getCloneLoss()
data["occupant"]["brainLoss"] = occupant.getBrainLoss() data["occupant"]["brainLoss"] = mob_occupant.getBrainLoss()
data["occupant"]["reagents"] = list() data["occupant"]["reagents"] = list()
if(occupant.reagents.reagent_list.len) if(occupant.reagents.reagent_list.len)
for(var/datum/reagent/R in occupant.reagents.reagent_list) for(var/datum/reagent/R in mob_occupant.reagents.reagent_list)
data["occupant"]["reagents"] += list(list("name" = R.name, "volume" = R.volume)) data["occupant"]["reagents"] += list(list("name" = R.name, "volume" = R.volume))
return data return data
/obj/machinery/sleeper/ui_act(action, params) /obj/machinery/sleeper/ui_act(action, params)
if(..()) if(..())
return return
var/mob/living/mob_occupant = occupant
switch(action) switch(action)
if("door") if("door")
if(state_open) if(state_open)
@@ -158,9 +162,9 @@
. = TRUE . = TRUE
if("inject") if("inject")
var/chem = params["chem"] var/chem = params["chem"]
if(!is_operational() || !occupant) if(!is_operational() || mob_occupant)
return return
if(occupant.health < min_health && chem != "epinephrine") if(mob_occupant.health < min_health && chem != "epinephrine")
return return
if(inject_chem(chem)) if(inject_chem(chem))
. = TRUE . = TRUE
@@ -177,10 +181,11 @@
return TRUE return TRUE
/obj/machinery/sleeper/proc/chem_allowed(chem) /obj/machinery/sleeper/proc/chem_allowed(chem)
if(!occupant) var/mob/living/mob_occupant = occupant
return if(!mob_occupant)
var/amount = occupant.reagents.get_reagent_amount(chem) + 10 <= 20 * efficiency return
var/occ_health = occupant.health > min_health || chem == "epinephrine" var/amount = mob_occupant.reagents.get_reagent_amount(chem) + 10 <= 20 * efficiency
var/occ_health = mob_occupant.health > min_health || chem == "epinephrine"
return amount && occ_health return amount && occ_health
/obj/machinery/sleeper/proc/reset_chem_buttons() /obj/machinery/sleeper/proc/reset_chem_buttons()

View File

@@ -121,10 +121,12 @@
/obj/machinery/clonepod/examine(mob/user) /obj/machinery/clonepod/examine(mob/user)
..() ..()
var/mob/living/mob_occupant = occupant
if(mess) if(mess)
to_chat(user, "It's filled with blood and viscera. You swear you can see it moving...") to_chat(user, "It's filled with blood and viscera. You swear you can see it moving...")
if (is_operational() && (!isnull(occupant)) && (occupant.stat != DEAD)) if(is_operational() && mob_occupant)
to_chat(user, "Current clone cycle is [round(get_completion())]% complete.") if(mob_occupant.stat != DEAD)
to_chat(user, "Current clone cycle is [round(get_completion())]% complete.")
/obj/machinery/clonepod/return_air() /obj/machinery/clonepod/return_air()
// We want to simulate the clone not being in contact with // We want to simulate the clone not being in contact with
@@ -136,7 +138,10 @@
return GM return GM
/obj/machinery/clonepod/proc/get_completion() /obj/machinery/clonepod/proc/get_completion()
. = (100 * ((occupant.health + 100) / (heal_level + 100))) . = FALSE
var/mob/living/mob_occupant = occupant
if(mob_occupant)
. = (100 * ((mob_occupant.health + 100) / (heal_level + 100)))
/obj/machinery/clonepod/attack_ai(mob/user) /obj/machinery/clonepod/attack_ai(mob/user)
return examine(user) return examine(user)
@@ -223,25 +228,26 @@
//Grow clones to maturity then kick them out. FREELOADERS //Grow clones to maturity then kick them out. FREELOADERS
/obj/machinery/clonepod/process() /obj/machinery/clonepod/process()
var/mob/living/mob_occupant = occupant
if(!is_operational()) //Autoeject if power is lost if(!is_operational()) //Autoeject if power is lost
if (occupant) if(mob_occupant)
go_out() go_out()
connected_message("Clone Ejected: Loss of power.") connected_message("Clone Ejected: Loss of power.")
else if((occupant) && (occupant.loc == src)) else if(mob_occupant && (mob_occupant.loc == src))
if((occupant.stat == DEAD) || (occupant.suiciding) || occupant.hellbound) //Autoeject corpses and suiciding dudes. if((mob_occupant.stat == DEAD) || (mob_occupant.suiciding) || mob_occupant.hellbound) //Autoeject corpses and suiciding dudes.
connected_message("Clone Rejected: Deceased.") connected_message("Clone Rejected: Deceased.")
SPEAK("The cloning of [occupant.real_name] has been \ SPEAK("The cloning of [mob_occupant.real_name] has been \
aborted due to unrecoverable tissue failure.") aborted due to unrecoverable tissue failure.")
go_out() go_out()
else if(occupant.cloneloss > (100 - heal_level)) else if(mob_occupant.cloneloss > (100 - heal_level))
occupant.Paralyse(4) mob_occupant.Paralyse(4)
//Slowly get that clone healed and finished. //Slowly get that clone healed and finished.
occupant.adjustCloneLoss(-((speed_coeff/2) * config.damage_multiplier)) mob_occupant.adjustCloneLoss(-((speed_coeff/2) * config.damage_multiplier))
var/progress = CLONE_INITIAL_DAMAGE - occupant.getCloneLoss() var/progress = CLONE_INITIAL_DAMAGE - mob_occupant.getCloneLoss()
// To avoid the default cloner making incomplete clones // To avoid the default cloner making incomplete clones
progress += (100 - MINIMUM_HEAL_LEVEL) progress += (100 - MINIMUM_HEAL_LEVEL)
var/milestone = CLONE_INITIAL_DAMAGE / flesh_number var/milestone = CLONE_INITIAL_DAMAGE / flesh_number
@@ -252,24 +258,24 @@
var/obj/item/I = pick_n_take(unattached_flesh) var/obj/item/I = pick_n_take(unattached_flesh)
if(isorgan(I)) if(isorgan(I))
var/obj/item/organ/O = I var/obj/item/organ/O = I
O.Insert(occupant) O.Insert(mob_occupant)
else if(isbodypart(I)) else if(isbodypart(I))
var/obj/item/bodypart/BP = I var/obj/item/bodypart/BP = I
BP.attach_limb(occupant) BP.attach_limb(mob_occupant)
//Premature clones may have brain damage. //Premature clones may have brain damage.
occupant.adjustBrainLoss(-((speed_coeff/2) * config.damage_multiplier)) mob_occupant.adjustBrainLoss(-((speed_coeff/2) * config.damage_multiplier))
check_brine() check_brine()
use_power(7500) //This might need tweaking. use_power(7500) //This might need tweaking.
else if((occupant.cloneloss <= (100 - heal_level))) else if((mob_occupant.cloneloss <= (100 - heal_level)))
connected_message("Cloning Process Complete.") connected_message("Cloning Process Complete.")
SPEAK("The cloning cycle of [occupant.real_name] is complete.") SPEAK("The cloning cycle of [mob_occupant.real_name] is complete.")
go_out() go_out()
else if ((!occupant) || (occupant.loc != src)) else if (!mob_occupant || mob_occupant.loc != src)
occupant = null occupant = null
if (!mess && !panel_open) if (!mess && !panel_open)
icon_state = "pod_0" icon_state = "pod_0"
@@ -339,6 +345,7 @@
/obj/machinery/clonepod/proc/go_out() /obj/machinery/clonepod/proc/go_out()
countdown.stop() countdown.stop()
var/mob/living/mob_occupant = occupant
if(mess) //Clean that mess and dump those gibs! if(mess) //Clean that mess and dump those gibs!
mess = FALSE mess = FALSE
@@ -347,22 +354,25 @@
icon_state = "pod_0" icon_state = "pod_0"
return return
if(!occupant) if(!mob_occupant)
return return
if(grab_ghost_when == CLONER_MATURE_CLONE) if(grab_ghost_when == CLONER_MATURE_CLONE)
occupant.grab_ghost() mob_occupant.grab_ghost()
to_chat(occupant, "<span class='notice'><b>There is a bright flash!</b><br><i>You feel like a new being.</i></span>") to_chat(occupant, "<span class='notice'><b>There is a bright flash!</b><br><i>You feel like a new being.</i></span>")
occupant.flash_act() mob_occupant.flash_act()
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
occupant.forceMove(T) occupant.forceMove(T)
icon_state = "pod_0" icon_state = "pod_0"
occupant.domutcheck(1) //Waiting until they're out before possible monkeyizing. The 1 argument forces powers to manifest. mob_occupant.domutcheck(1) //Waiting until they're out before possible monkeyizing. The 1 argument forces powers to manifest.
occupant = null occupant = null
/obj/machinery/clonepod/proc/malfunction() /obj/machinery/clonepod/proc/malfunction()
if(occupant) var/mob/living/mob_occupant = occupant
if(mob_occupant)
connected_message("Critical Error!") connected_message("Critical Error!")
SPEAK("Critical error! Please contact a Thinktronic Systems \ SPEAK("Critical error! Please contact a Thinktronic Systems \
technician, as your warranty may be affected.") technician, as your warranty may be affected.")

View File

@@ -0,0 +1,38 @@
diff a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm (rejected hunks)
@@ -311,15 +311,15 @@
to_chat(user, "<font color = #666633>-% Successfully stored \ref[P.buffer] [P.buffer.name] in buffer %-</font color>")
return
+ var/mob/living/mob_occupant = occupant
if(W.GetID())
if(!check_access(W))
to_chat(user, "<span class='danger'>Access Denied.</span>")
return
- if(!(occupant || mess))
+ if(!(mob_occupant || mess))
to_chat(user, "<span class='danger'>Error: Pod has no occupant.</span>")
return
else
- var/mob/living/mob_occupant
connected_message("Authorized Ejection")
SPEAK("An authorized ejection of [clonemind.name] has occurred.")
to_chat(user, "<span class='notice'>You force an emergency ejection. </span>")
@@ -395,16 +395,10 @@
go_out()
/obj/machinery/clonepod/emp_act(severity)
-<<<<<<< HEAD
- if((occupant || mess) && prob(100/(severity*efficiency)))
- connected_message(Gibberish("EMP-caused Accidental Ejection", 0))
- SPEAK(Gibberish("Exposure to electromagnetic fields has caused the ejection of [clonemind.name] prematurely." ,0))
-=======
- if(isliving(occupant) && prob(100/(severity*efficiency)))
- var/mob/living/mob_occupant = occupant
+ var/mob/living/mob_occupant = occupant
+ if(mob_occupant && prob(100/(severity*efficiency)))
connected_message(Gibberish("EMP-caused Accidental Ejection", 0))
SPEAK(Gibberish("Exposure to electromagnetic fields has caused the ejection of [mob_occupant.real_name] prematurely." ,0))
->>>>>>> Changes /obj/machinery to have atom/movable occupants
go_out()
..()

View File

@@ -186,21 +186,23 @@
// Scanner // Scanner
if (!isnull(src.scanner)) if (!isnull(src.scanner))
var/mob/living/scanner_occupant = scanner.occupant
dat += "<h3>Scanner Functions</h3>" dat += "<h3>Scanner Functions</h3>"
dat += "<div class='statusDisplay'>" dat += "<div class='statusDisplay'>"
if (!src.scanner.occupant) if(!scanner_occupant)
dat += "Scanner Unoccupied" dat += "Scanner Unoccupied"
else if(loading) else if(loading)
dat += "[src.scanner.occupant] => Scanning..." dat += "[scanner_occupant] => Scanning..."
else else
if (src.scanner.occupant.ckey != scantemp_ckey) if(scanner_occupant.ckey != scantemp_ckey)
scantemp = "Ready to Scan" scantemp = "Ready to Scan"
scantemp_ckey = src.scanner.occupant.ckey scantemp_ckey = scanner_occupant.ckey
dat += "[src.scanner.occupant] => [scantemp]" dat += "[scanner_occupant] => [scantemp]"
dat += "</div>" dat += "</div>"
if (src.scanner.occupant) if(scanner_occupant)
dat += "<a href='byond://?src=\ref[src];scan=1'>Start Scan</a>" dat += "<a href='byond://?src=\ref[src];scan=1'>Start Scan</a>"
dat += "<br><a href='byond://?src=\ref[src];lock=1'>[src.scanner.locked ? "Unlock Scanner" : "Lock Scanner"]</a>" dat += "<br><a href='byond://?src=\ref[src];lock=1'>[src.scanner.locked ? "Unlock Scanner" : "Lock Scanner"]</a>"
else else

View File

@@ -105,13 +105,14 @@
..() ..()
// search for ghosts, if the corpse is empty and the scanner is connected to a cloner // search for ghosts, if the corpse is empty and the scanner is connected to a cloner
if(occupant) var/mob/living/mob_occupant = occupant
if(mob_occupant)
if(locate(/obj/machinery/computer/cloning, get_step(src, NORTH)) \ if(locate(/obj/machinery/computer/cloning, get_step(src, NORTH)) \
|| locate(/obj/machinery/computer/cloning, get_step(src, SOUTH)) \ || locate(/obj/machinery/computer/cloning, get_step(src, SOUTH)) \
|| locate(/obj/machinery/computer/cloning, get_step(src, EAST)) \ || locate(/obj/machinery/computer/cloning, get_step(src, EAST)) \
|| locate(/obj/machinery/computer/cloning, get_step(src, WEST))) || locate(/obj/machinery/computer/cloning, get_step(src, WEST)))
if(!occupant.suiciding && !(occupant.disabilities & NOCLONE) && !occupant.hellbound) if(!mob_occupant.suiciding && !(mob_occupant.disabilities & NOCLONE) && !mob_occupant.hellbound)
occupant.notify_ghost_cloning("Your corpse has been placed into a cloning scanner. Re-enter your corpse if you want to be cloned!", source = src) mob_occupant.notify_ghost_cloning("Your corpse has been placed into a cloning scanner. Re-enter your corpse if you want to be cloned!", source = src)
var/obj/machinery/computer/scan_consolenew/console var/obj/machinery/computer/scan_consolenew/console
for(dir in list(NORTH,EAST,SOUTH,WEST)) for(dir in list(NORTH,EAST,SOUTH,WEST))
@@ -157,4 +158,4 @@
if(..(user,1,0)) //don't set the machine, since there's no dialog if(..(user,1,0)) //don't set the machine, since there's no dialog
return return
toggle_open(user) toggle_open(user)

View File

@@ -136,13 +136,14 @@ The console is located at computer/gulag_teleporter.dm
/obj/machinery/gulag_teleporter/proc/strip_occupant() /obj/machinery/gulag_teleporter/proc/strip_occupant()
if(linked_reclaimer) if(linked_reclaimer)
linked_reclaimer.stored_items[occupant] = list() linked_reclaimer.stored_items[occupant] = list()
for(var/obj/item/W in occupant) var/mob/living/mob_occupant = occupant
if(!is_type_in_typecache(W, required_items) && occupant.temporarilyRemoveItemFromInventory(W)) for(var/obj/item/W in mob_occupant)
if(!is_type_in_typecache(W, required_items) && mob_occupant.temporarilyRemoveItemFromInventory(W))
if(istype(W, /obj/item/weapon/restraints/handcuffs)) if(istype(W, /obj/item/weapon/restraints/handcuffs))
W.forceMove(get_turf(src)) W.forceMove(get_turf(src))
continue continue
if(linked_reclaimer) if(linked_reclaimer)
linked_reclaimer.stored_items[occupant] += W linked_reclaimer.stored_items[mob_occupant] += W
linked_reclaimer.contents += W linked_reclaimer.contents += W
W.forceMove(linked_reclaimer) W.forceMove(linked_reclaimer)
else else

View File

@@ -1,8 +1,8 @@
/* /*
Overview: Overview:
Used to create objects that need a per step proc call. Default definition of 'New()' Used to create objects that need a per step proc call. Default definition of 'Initialize()'
stores a reference to src machine in global 'machines list'. Default definition stores a reference to src machine in global 'machines list'. Default definition
of 'Del' removes reference to src machine in global 'machines list'. of 'Destroy' removes reference to src machine in global 'machines list'.
Class Variables: Class Variables:
use_power (num) use_power (num)
@@ -44,7 +44,7 @@ Class Variables:
EMPED:16 -- temporary broken by EMP pulse EMPED:16 -- temporary broken by EMP pulse
Class Procs: Class Procs:
New() 'game/machinery/machine.dm' Initialize() 'game/machinery/machine.dm'
Destroy() 'game/machinery/machine.dm' Destroy() 'game/machinery/machine.dm'
@@ -118,14 +118,15 @@ Class Procs:
var/panel_open = 0 var/panel_open = 0
var/state_open = 0 var/state_open = 0
var/critical_machine = FALSE //If this machine is critical to station operation and should have the area be excempted from power failures. var/critical_machine = FALSE //If this machine is critical to station operation and should have the area be excempted from power failures.
var/mob/living/occupant = null var/list/occupant_typecache = list(/mob/living) // turned into typecache in Initialize
var/atom/movable/occupant = null
var/unsecuring_tool = /obj/item/weapon/wrench var/unsecuring_tool = /obj/item/weapon/wrench
var/interact_open = 0 // Can the machine be interacted with when in maint/when the panel is open. var/interact_open = 0 // Can the machine be interacted with when in maint/when the panel is open.
var/interact_offline = 0 // Can the machine be interacted with while de-powered. var/interact_offline = 0 // Can the machine be interacted with while de-powered.
var/speed_process = 0 // Process as fast as possible? var/speed_process = 0 // Process as fast as possible?
/obj/machinery/Initialize() /obj/machinery/Initialize()
if (!armor) if(!armor)
armor = list(melee = 25, bullet = 10, laser = 10, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 50, acid = 70) armor = list(melee = 25, bullet = 10, laser = 10, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 50, acid = 70)
. = ..() . = ..()
GLOB.machines += src GLOB.machines += src
@@ -135,6 +136,8 @@ Class Procs:
START_PROCESSING(SSfastprocess, src) START_PROCESSING(SSfastprocess, src)
power_change() power_change()
occupant_typecache = typecacheof(occupant_typecache)
/obj/machinery/Destroy() /obj/machinery/Destroy()
GLOB.machines.Remove(src) GLOB.machines.Remove(src)
if(!speed_process) if(!speed_process)
@@ -176,16 +179,24 @@ Class Procs:
L.update_canmove() L.update_canmove()
occupant = null occupant = null
/obj/machinery/proc/close_machine(mob/living/target = null) /obj/machinery/proc/close_machine(atom/movable/target = null)
state_open = 0 state_open = 0
density = 1 density = 1
if(!target) if(!target)
for(var/mob/living/carbon/C in loc) for(var/am in loc)
if(C.buckled || C.has_buckled_mobs()) if(!is_type_in_typecache(am, occupant_typecache))
continue continue
else var/atom/movable/AM = am
target = C if(AM.has_buckled_mobs())
if(target && !target.buckled && !target.has_buckled_mobs()) continue
if(isliving(AM))
var/mob/living/L = am
if(L.buckled)
continue
target = am
var/mob/living/mobtarget = target
if(target && !target.has_buckled_mobs() && (!isliving(target) || !mobtarget.buckled))
occupant = target occupant = target
target.forceMove(src) target.forceMove(src)
updateUsrDialog() updateUsrDialog()

View File

@@ -211,13 +211,13 @@
uv = TRUE uv = TRUE
locked = TRUE locked = TRUE
update_icon() update_icon()
if(occupant) if(occupant)
var/mob/living/mob_occupant = occupant
if(uv_super) if(uv_super)
occupant.adjustFireLoss(rand(20, 36)) mob_occupant.adjustFireLoss(rand(20, 36))
else else
occupant.adjustFireLoss(rand(10, 16)) mob_occupant.adjustFireLoss(rand(10, 16))
if(iscarbon(occupant)) mob_occupant.emote("scream")
occupant.emote("scream")
addtimer(CALLBACK(src, .proc/cook), 50) addtimer(CALLBACK(src, .proc/cook), 50)
else else
uv_cycles = initial(uv_cycles) uv_cycles = initial(uv_cycles)
@@ -368,14 +368,15 @@
else if(!helmet && !mask && !suit && !storage && !occupant) else if(!helmet && !mask && !suit && !storage && !occupant)
return return
else else
if(occupant) if(occupant)
to_chat(occupant, "<span class='userdanger'>[src]'s confines grow warm, then hot, then scorching. You're being burned [!occupant.stat ? "alive" : "away"]!</span>") var/mob/living/mob_occupant = occupant
to_chat(mob_occupant, "<span class='userdanger'>[src]'s confines grow warm, then hot, then scorching. You're being burned [!mob_occupant.stat ? "alive" : "away"]!</span>")
cook() cook()
. = TRUE . = TRUE
if("dispense") if("dispense")
if(!state_open) if(!state_open)
return return
var/static/list/valid_items = list("helmet", "suit", "mask", "storage") var/static/list/valid_items = list("helmet", "suit", "mask", "storage")
var/item_name = params["item"] var/item_name = params["item"]
if(item_name in valid_items) if(item_name in valid_items)

View File

@@ -41,9 +41,10 @@
data["open"] = state_open data["open"] = state_open
data["occupant"] = list() data["occupant"] = list()
if(occupant) if(occupant)
data["occupant"]["name"] = occupant.name var/mob/living/mob_occupant = occupant
data["occupant"]["stat"] = occupant.stat data["occupant"]["name"] = mob_occupant.name
data["occupant"]["stat"] = mob_occupant.stat
data["special_name"] = special ? special_name : null data["special_name"] = special ? special_name : null
data["ready_implants"] = ready_implants data["ready_implants"] = ready_implants

View File

@@ -9,6 +9,7 @@
icon_state = "sleeper" icon_state = "sleeper"
state_open = TRUE state_open = TRUE
anchored = TRUE anchored = TRUE
occupant_typecache = list(/mob/living/carbon/human) // turned into typecache in Initialize
var/you_die_in_the_game_you_die_for_real = FALSE var/you_die_in_the_game_you_die_for_real = FALSE
var/datum/effect_system/spark_spread/sparks var/datum/effect_system/spark_spread/sparks
var/mob/living/carbon/human/virtual_reality/vr_human var/mob/living/carbon/human/virtual_reality/vr_human
@@ -92,11 +93,12 @@
return return
switch(action) switch(action)
if("vr_connect") if("vr_connect")
if(ishuman(occupant) && occupant.mind) var/mob/living/carbon/human/human_occupant = occupant
if(human_occupant && human_occupant.mind)
to_chat(occupant, "<span class='warning'>Transfering to virtual reality...</span>") to_chat(occupant, "<span class='warning'>Transfering to virtual reality...</span>")
if(vr_human) if(vr_human)
vr_human.revert_to_reality(FALSE, FALSE) vr_human.revert_to_reality(FALSE, FALSE)
occupant.mind.transfer_to(vr_human) human_occupant.mind.transfer_to(vr_human)
vr_human.real_me = occupant vr_human.real_me = occupant
to_chat(vr_human, "<span class='notice'>Transfer successful! you are now playing as [vr_human] in VR!</span>") to_chat(vr_human, "<span class='notice'>Transfer successful! you are now playing as [vr_human] in VR!</span>")
SStgui.close_user_uis(vr_human, src) SStgui.close_user_uis(vr_human, src)

View File

@@ -191,20 +191,21 @@
on = FALSE on = FALSE
update_icon() update_icon()
return return
if(occupant) if(occupant)
var/mob/living/mob_occupant = occupant
var/cold_protection = 0 var/cold_protection = 0
var/mob/living/carbon/human/H = occupant var/mob/living/carbon/human/H = occupant
if(istype(H)) if(istype(H))
cold_protection = H.get_cold_protection(air1.temperature) cold_protection = H.get_cold_protection(air1.temperature)
var/temperature_delta = air1.temperature - occupant.bodytemperature // The only semi-realistic thing here: share temperature between the cell and the occupant. 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) if(abs(temperature_delta) > 1)
var/air_heat_capacity = air1.heat_capacity() var/air_heat_capacity = air1.heat_capacity()
var/heat = ((1 - cold_protection) / 10 + conduction_coefficient) \ var/heat = ((1 - cold_protection) / 10 + conduction_coefficient) \
* temperature_delta * \ * temperature_delta * \
(air_heat_capacity * heat_capacity / (air_heat_capacity + heat_capacity)) (air_heat_capacity * heat_capacity / (air_heat_capacity + heat_capacity))
air1.temperature = max(air1.temperature - heat / air_heat_capacity, TCMB) air1.temperature = max(air1.temperature - heat / air_heat_capacity, TCMB)
occupant.bodytemperature = max(occupant.bodytemperature + heat / heat_capacity, TCMB) mob_occupant.bodytemperature = max(mob_occupant.bodytemperature + heat / heat_capacity, TCMB)
air1.gases["o2"][MOLES] -= 0.5 / efficiency // Magically consume gas? Why not, we run on cryo magic. air1.gases["o2"][MOLES] -= 0.5 / efficiency // Magically consume gas? Why not, we run on cryo magic.
@@ -294,17 +295,18 @@
data["autoEject"] = autoeject data["autoEject"] = autoeject
var/list/occupantData = list() var/list/occupantData = list()
if(occupant) if(occupant)
occupantData["name"] = occupant.name var/mob/living/mob_occupant = occupant
occupantData["stat"] = occupant.stat occupantData["name"] = mob_occupant.name
occupantData["health"] = occupant.health occupantData["stat"] = mob_occupant.stat
occupantData["maxHealth"] = occupant.maxHealth occupantData["health"] = mob_occupant.health
occupantData["maxHealth"] = mob_occupant.maxHealth
occupantData["minHealth"] = HEALTH_THRESHOLD_DEAD occupantData["minHealth"] = HEALTH_THRESHOLD_DEAD
occupantData["bruteLoss"] = occupant.getBruteLoss() occupantData["bruteLoss"] = mob_occupant.getBruteLoss()
occupantData["oxyLoss"] = occupant.getOxyLoss() occupantData["oxyLoss"] = mob_occupant.getOxyLoss()
occupantData["toxLoss"] = occupant.getToxLoss() occupantData["toxLoss"] = mob_occupant.getToxLoss()
occupantData["fireLoss"] = occupant.getFireLoss() occupantData["fireLoss"] = mob_occupant.getFireLoss()
occupantData["bodyTemperature"] = occupant.bodytemperature occupantData["bodyTemperature"] = mob_occupant.bodytemperature
data["occupant"] = occupantData data["occupant"] = occupantData

View File

@@ -0,0 +1,12 @@
diff a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm (rejected hunks)
@@ -110,8 +110,8 @@
return
var/datum/gas_mixture/air1 = AIR1
var/turf/T = get_turf(src)
- if(isliving(occupant))
- var/mob/living/mob_occupant
+ if(occupant)
+ var/mob/living/mob_occupant = occupant
if(mob_occupant.health >= 100) // Don't bother with fully healed people.
on = FALSE
update_icon()

View File

@@ -168,13 +168,14 @@
var/offset = prob(50) ? -2 : 2 var/offset = prob(50) ? -2 : 2
animate(src, pixel_x = pixel_x + offset, time = 0.2, loop = 200) //start shaking animate(src, pixel_x = pixel_x + offset, time = 0.2, loop = 200) //start shaking
var/sourcename = src.occupant.real_name var/mob/living/mob_occupant = occupant
var/sourcename = mob_occupant.real_name
var/sourcejob var/sourcejob
if(ishuman(occupant)) if(ishuman(occupant))
var/mob/living/carbon/human/gibee = occupant var/mob/living/carbon/human/gibee = occupant
sourcejob = gibee.job sourcejob = gibee.job
var/sourcenutriment = src.occupant.nutrition / 15 var/sourcenutriment = mob_occupant.nutrition / 15
var/sourcetotalreagents = src.occupant.reagents.total_volume var/sourcetotalreagents = mob_occupant.reagents.total_volume
var/gibtype = /obj/effect/decal/cleanable/blood/gibs var/gibtype = /obj/effect/decal/cleanable/blood/gibs
var/typeofmeat = /obj/item/weapon/reagent_containers/food/snacks/meat/slab/human var/typeofmeat = /obj/item/weapon/reagent_containers/food/snacks/meat/slab/human
var/typeofskin = /obj/item/stack/sheet/animalhide/human var/typeofskin = /obj/item/stack/sheet/animalhide/human
@@ -212,8 +213,8 @@
allskin = newskin allskin = newskin
add_logs(user, occupant, "gibbed") add_logs(user, occupant, "gibbed")
src.occupant.death(1) mob_occupant.death(1)
src.occupant.ghostize() mob_occupant.ghostize()
qdel(src.occupant) qdel(src.occupant)
spawn(src.gibtime) spawn(src.gibtime)
playsound(src.loc, 'sound/effects/splat.ogg', 50, 1) playsound(src.loc, 'sound/effects/splat.ogg', 50, 1)