diff --git a/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm b/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm
index 193aecd9ce..8f3dfb7ac3 100644
--- a/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm
+++ b/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm
@@ -116,12 +116,13 @@
else
dat += "
Subject Status :
"
dat += "[occupant.name] => "
- switch(occupant.stat)
- if(0)
+ var/mob/living/mob_occupant = occupant
+ switch(mob_occupant.stat)
+ if(CONSCIOUS)
dat += "Conscious"
- if(1)
+ if(UNCONSCIOUS)
dat += "Unconscious"
- else
+ else // DEAD
dat += "Deceased"
dat += "
"
dat += "[flash]"
@@ -146,9 +147,11 @@
if(href_list["close"])
close_machine()
return
- if(occupant && occupant.stat != DEAD)
- if(href_list["experiment"])
- flash = Experiment(occupant,href_list["experiment"])
+ if(occupant)
+ var/mob/living/mob_occupant = occupant
+ if(mob_occupant.stat != DEAD)
+ if(href_list["experiment"])
+ flash = Experiment(occupant,href_list["experiment"])
updateUsrDialog()
add_fingerprint(usr)
diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm
index 5dc8ea3f20..e8533f6acb 100644
--- a/code/game/machinery/Sleeper.dm
+++ b/code/game/machinery/Sleeper.dm
@@ -79,7 +79,8 @@
/obj/machinery/sleeper/close_machine(mob/user)
if((isnull(user) || istype(user)) && state_open && !panel_open)
..(user)
- if(occupant && occupant.stat != DEAD)
+ var/mob/living/mob_occupant = occupant
+ if(mob_occupant && mob_occupant.stat != DEAD)
to_chat(occupant, "You feel cool air surround you. You go numb as your senses turn inward.")
/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["occupant"] = list()
- if(occupant)
- data["occupant"]["name"] = occupant.name
- data["occupant"]["stat"] = occupant.stat
- data["occupant"]["health"] = occupant.health
- data["occupant"]["maxHealth"] = occupant.maxHealth
+ var/mob/living/mob_occupant = occupant
+ if(mob_occupant)
+ data["occupant"]["name"] = mob_occupant.name
+ data["occupant"]["stat"] = mob_occupant.stat
+ data["occupant"]["health"] = mob_occupant.health
+ data["occupant"]["maxHealth"] = mob_occupant.maxHealth
data["occupant"]["minHealth"] = HEALTH_THRESHOLD_DEAD
- data["occupant"]["bruteLoss"] = occupant.getBruteLoss()
- data["occupant"]["oxyLoss"] = occupant.getOxyLoss()
- data["occupant"]["toxLoss"] = occupant.getToxLoss()
- data["occupant"]["fireLoss"] = occupant.getFireLoss()
- data["occupant"]["cloneLoss"] = occupant.getCloneLoss()
- data["occupant"]["brainLoss"] = occupant.getBrainLoss()
+ data["occupant"]["bruteLoss"] = mob_occupant.getBruteLoss()
+ data["occupant"]["oxyLoss"] = mob_occupant.getOxyLoss()
+ data["occupant"]["toxLoss"] = mob_occupant.getToxLoss()
+ data["occupant"]["fireLoss"] = mob_occupant.getFireLoss()
+ data["occupant"]["cloneLoss"] = mob_occupant.getCloneLoss()
+ data["occupant"]["brainLoss"] = mob_occupant.getBrainLoss()
data["occupant"]["reagents"] = list()
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))
return data
/obj/machinery/sleeper/ui_act(action, params)
if(..())
return
+ var/mob/living/mob_occupant = occupant
+
switch(action)
if("door")
if(state_open)
@@ -158,9 +162,9 @@
. = TRUE
if("inject")
var/chem = params["chem"]
- if(!is_operational() || !occupant)
+ if(!is_operational() || mob_occupant)
return
- if(occupant.health < min_health && chem != "epinephrine")
+ if(mob_occupant.health < min_health && chem != "epinephrine")
return
if(inject_chem(chem))
. = TRUE
@@ -177,10 +181,11 @@
return TRUE
/obj/machinery/sleeper/proc/chem_allowed(chem)
- if(!occupant)
- return
- var/amount = occupant.reagents.get_reagent_amount(chem) + 10 <= 20 * efficiency
- var/occ_health = occupant.health > min_health || chem == "epinephrine"
+ var/mob/living/mob_occupant = occupant
+ if(!mob_occupant)
+ return
+ 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
/obj/machinery/sleeper/proc/reset_chem_buttons()
diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm
index 824b50b168..0e5b78af7c 100644
--- a/code/game/machinery/cloning.dm
+++ b/code/game/machinery/cloning.dm
@@ -121,10 +121,12 @@
/obj/machinery/clonepod/examine(mob/user)
..()
+ var/mob/living/mob_occupant = occupant
if(mess)
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))
- to_chat(user, "Current clone cycle is [round(get_completion())]% complete.")
+ if(is_operational() && mob_occupant)
+ if(mob_occupant.stat != DEAD)
+ to_chat(user, "Current clone cycle is [round(get_completion())]% complete.")
/obj/machinery/clonepod/return_air()
// We want to simulate the clone not being in contact with
@@ -136,7 +138,10 @@
return GM
/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)
return examine(user)
@@ -172,11 +177,11 @@
var/mob/living/carbon/human/H = new /mob/living/carbon/human(src)
- if(clonemind.changeling)
- var/obj/item/organ/brain/B = H.getorganslot("brain")
- B.vital = FALSE
- B.decoy_override = TRUE
-
+ if(clonemind.changeling)
+ var/obj/item/organ/brain/B = H.getorganslot("brain")
+ B.vital = FALSE
+ B.decoy_override = TRUE
+
H.hardset_dna(ui, se, H.real_name, null, mrace, features)
if(efficiency > 2)
@@ -204,13 +209,13 @@
clonemind.transfer_to(H)
- if(grab_ghost_when == CLONER_FRESH_CLONE)
- H.grab_ghost()
- to_chat(H, "Consciousness slowly creeps over you as your body regenerates.
So this is what cloning feels like?")
+ if(grab_ghost_when == CLONER_FRESH_CLONE)
+ H.grab_ghost()
+ to_chat(H, "Consciousness slowly creeps over you as your body regenerates.
So this is what cloning feels like?")
if(grab_ghost_when == CLONER_MATURE_CLONE)
- H.ghostize(TRUE) //Only does anything if they were still in their old body and not already a ghost
- to_chat(H.get_ghost(TRUE), "Your body is beginning to regenerate in a cloning pod. You will become conscious when it is complete.")
+ H.ghostize(TRUE) //Only does anything if they were still in their old body and not already a ghost
+ to_chat(H.get_ghost(TRUE), "Your body is beginning to regenerate in a cloning pod. You will become conscious when it is complete.")
if(H)
H.faction |= factions
@@ -223,25 +228,26 @@
//Grow clones to maturity then kick them out. FREELOADERS
/obj/machinery/clonepod/process()
+ var/mob/living/mob_occupant = occupant
if(!is_operational()) //Autoeject if power is lost
- if (occupant)
+ if(mob_occupant)
go_out()
connected_message("Clone Ejected: Loss of power.")
- else if((occupant) && (occupant.loc == src))
- if((occupant.stat == DEAD) || (occupant.suiciding) || occupant.hellbound) //Autoeject corpses and suiciding dudes.
+ else if(mob_occupant && (mob_occupant.loc == src))
+ if((mob_occupant.stat == DEAD) || (mob_occupant.suiciding) || mob_occupant.hellbound) //Autoeject corpses and suiciding dudes.
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.")
go_out()
- else if(occupant.cloneloss > (100 - heal_level))
- occupant.Paralyse(4)
+ else if(mob_occupant.cloneloss > (100 - heal_level))
+ mob_occupant.Paralyse(4)
//Slowly get that clone healed and finished.
- occupant.adjustCloneLoss(-((speed_coeff/2) * config.damage_multiplier))
- var/progress = CLONE_INITIAL_DAMAGE - occupant.getCloneLoss()
+ mob_occupant.adjustCloneLoss(-((speed_coeff/2) * config.damage_multiplier))
+ var/progress = CLONE_INITIAL_DAMAGE - mob_occupant.getCloneLoss()
// To avoid the default cloner making incomplete clones
progress += (100 - MINIMUM_HEAL_LEVEL)
var/milestone = CLONE_INITIAL_DAMAGE / flesh_number
@@ -252,24 +258,24 @@
var/obj/item/I = pick_n_take(unattached_flesh)
if(isorgan(I))
var/obj/item/organ/O = I
- O.Insert(occupant)
+ O.Insert(mob_occupant)
else if(isbodypart(I))
var/obj/item/bodypart/BP = I
- BP.attach_limb(occupant)
+ BP.attach_limb(mob_occupant)
//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()
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.")
- SPEAK("The cloning cycle of [occupant.real_name] is complete.")
+ SPEAK("The cloning cycle of [mob_occupant.real_name] is complete.")
go_out()
- else if ((!occupant) || (occupant.loc != src))
+ else if (!mob_occupant || mob_occupant.loc != src)
occupant = null
if (!mess && !panel_open)
icon_state = "pod_0"
@@ -305,16 +311,19 @@
to_chat(user, "-% Successfully stored \ref[P.buffer] [P.buffer.name] in buffer %-")
return
+ var/mob/living/mob_occupant = occupant
if(W.GetID())
if(!check_access(W))
to_chat(user, "Access Denied.")
return
- if(!(occupant || mess))
+ if(!(mob_occupant || mess))
to_chat(user, "Error: Pod has no occupant.")
return
else
connected_message("Authorized Ejection")
- SPEAK("An authorized ejection of [clonemind.name] has occurred.")
+
+ SPEAK("An authorized ejection of [clonemind.name] has occurred.")
+
to_chat(user, "You force an emergency ejection. ")
go_out()
else
@@ -339,54 +348,63 @@
/obj/machinery/clonepod/proc/go_out()
countdown.stop()
+ var/mob/living/mob_occupant = occupant
if(mess) //Clean that mess and dump those gibs!
mess = FALSE
- new /obj/effect/gibspawner/generic(loc)
+ new /obj/effect/gibspawner/generic(loc)
audible_message("You hear a splat.")
icon_state = "pod_0"
return
- if(!occupant)
+ if(!mob_occupant)
return
- if(grab_ghost_when == CLONER_MATURE_CLONE)
- occupant.grab_ghost()
- to_chat(occupant, "There is a bright flash!
You feel like a new being.")
- occupant.flash_act()
- var/turf/T = get_turf(src)
+ if(grab_ghost_when == CLONER_MATURE_CLONE)
+ mob_occupant.grab_ghost()
+ to_chat(occupant, "There is a bright flash!
You feel like a new being.")
+ mob_occupant.flash_act()
+
+ var/turf/T = get_turf(src)
occupant.forceMove(T)
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
/obj/machinery/clonepod/proc/malfunction()
- if(occupant)
+ var/mob/living/mob_occupant = occupant
+ if(mob_occupant)
connected_message("Critical Error!")
SPEAK("Critical error! Please contact a Thinktronic Systems \
technician, as your warranty may be affected.")
mess = TRUE
- for(var/obj/item/O in unattached_flesh)
- qdel(O)
+
+ for(var/obj/item/O in unattached_flesh)
+ qdel(O)
+
icon_state = "pod_g"
- if(occupant.mind != clonemind)
- clonemind.transfer_to(occupant)
- occupant.grab_ghost() // We really just want to make you suffer.
- flash_color(occupant, flash_color="#960000", flash_time=100)
- to_chat(occupant, "Agony blazes across your consciousness as your body is torn apart.
Is this what dying is like? Yes it is.")
+ if(mob_occupant.mind != clonemind)
+ clonemind.transfer_to(mob_occupant)
+ mob_occupant.grab_ghost() // We really just want to make you suffer.
+ flash_color(mob_occupant, flash_color="#960000", flash_time=100)
+ to_chat(mob_occupant, "Agony blazes across your consciousness as your body is torn apart.
Is this what dying is like? Yes it is.")
playsound(src.loc, 'sound/machines/warning-buzzer.ogg', 50, 0)
- occupant << sound('sound/hallucinations/veryfar_noise.ogg',0,1,50)
- QDEL_IN(occupant, 40)
+ mob_occupant << sound('sound/hallucinations/veryfar_noise.ogg',0,1,50)
+ QDEL_IN(mob_occupant, 40)
/obj/machinery/clonepod/relaymove(mob/user)
if(user.stat == CONSCIOUS)
go_out()
/obj/machinery/clonepod/emp_act(severity)
- if((occupant || mess) && prob(100/(severity*efficiency)))
+
+ 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 [clonemind.name] prematurely." ,0))
+ SPEAK(Gibberish("Exposure to electromagnetic fields has caused the ejection of [mob_occupant.real_name] prematurely." ,0))
+
go_out()
..()
diff --git a/code/game/machinery/cloning.dm.rej b/code/game/machinery/cloning.dm.rej
new file mode 100644
index 0000000000..74ef688700
--- /dev/null
+++ b/code/game/machinery/cloning.dm.rej
@@ -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, "-% Successfully stored \ref[P.buffer] [P.buffer.name] in buffer %-")
+ return
+
++ var/mob/living/mob_occupant = occupant
+ if(W.GetID())
+ if(!check_access(W))
+ to_chat(user, "Access Denied.")
+ return
+- if(!(occupant || mess))
++ if(!(mob_occupant || mess))
+ to_chat(user, "Error: Pod has no occupant.")
+ return
+ else
+- var/mob/living/mob_occupant
+ connected_message("Authorized Ejection")
+ SPEAK("An authorized ejection of [clonemind.name] has occurred.")
+ to_chat(user, "You force an emergency ejection. ")
+@@ -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()
+ ..()
+
diff --git a/code/game/machinery/computer/cloning.dm b/code/game/machinery/computer/cloning.dm
index afa054428a..48819f91e2 100644
--- a/code/game/machinery/computer/cloning.dm
+++ b/code/game/machinery/computer/cloning.dm
@@ -186,21 +186,23 @@
// Scanner
if (!isnull(src.scanner))
+ var/mob/living/scanner_occupant = scanner.occupant
+
dat += "Scanner Functions
"
dat += ""
- if (!src.scanner.occupant)
+ if(!scanner_occupant)
dat += "Scanner Unoccupied"
else if(loading)
- dat += "[src.scanner.occupant] => Scanning..."
+ dat += "[scanner_occupant] => Scanning..."
else
- if (src.scanner.occupant.ckey != scantemp_ckey)
+ if(scanner_occupant.ckey != scantemp_ckey)
scantemp = "Ready to Scan"
- scantemp_ckey = src.scanner.occupant.ckey
- dat += "[src.scanner.occupant] => [scantemp]"
+ scantemp_ckey = scanner_occupant.ckey
+ dat += "[scanner_occupant] => [scantemp]"
dat += "
"
- if (src.scanner.occupant)
+ if(scanner_occupant)
dat += "Start Scan"
dat += "
[src.scanner.locked ? "Unlock Scanner" : "Lock Scanner"]"
else
diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm
index af59f63888..d572b3e9dc 100644
--- a/code/game/machinery/dna_scanner.dm
+++ b/code/game/machinery/dna_scanner.dm
@@ -105,13 +105,14 @@
..()
// 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)) \
|| 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, WEST)))
- if(!occupant.suiciding && !(occupant.disabilities & NOCLONE) && !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)
+ if(!mob_occupant.suiciding && !(mob_occupant.disabilities & NOCLONE) && !mob_occupant.hellbound)
+ 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
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
return
- toggle_open(user)
\ No newline at end of file
+ toggle_open(user)
diff --git a/code/game/machinery/gulag_teleporter.dm b/code/game/machinery/gulag_teleporter.dm
index 92a550b17c..5979abdc29 100644
--- a/code/game/machinery/gulag_teleporter.dm
+++ b/code/game/machinery/gulag_teleporter.dm
@@ -136,13 +136,14 @@ The console is located at computer/gulag_teleporter.dm
/obj/machinery/gulag_teleporter/proc/strip_occupant()
if(linked_reclaimer)
linked_reclaimer.stored_items[occupant] = list()
- for(var/obj/item/W in occupant)
- if(!is_type_in_typecache(W, required_items) && occupant.temporarilyRemoveItemFromInventory(W))
+ var/mob/living/mob_occupant = occupant
+ 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))
W.forceMove(get_turf(src))
continue
if(linked_reclaimer)
- linked_reclaimer.stored_items[occupant] += W
+ linked_reclaimer.stored_items[mob_occupant] += W
linked_reclaimer.contents += W
W.forceMove(linked_reclaimer)
else
diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm
index 6cd8e75798..96b0029134 100644
--- a/code/game/machinery/machinery.dm
+++ b/code/game/machinery/machinery.dm
@@ -1,8 +1,8 @@
/*
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
- of 'Del' removes reference to src machine in global 'machines list'.
+ of 'Destroy' removes reference to src machine in global 'machines list'.
Class Variables:
use_power (num)
@@ -44,7 +44,7 @@ Class Variables:
EMPED:16 -- temporary broken by EMP pulse
Class Procs:
- New() 'game/machinery/machine.dm'
+ Initialize() 'game/machinery/machine.dm'
Destroy() 'game/machinery/machine.dm'
@@ -118,14 +118,15 @@ Class Procs:
var/panel_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/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/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/speed_process = 0 // Process as fast as possible?
/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)
. = ..()
GLOB.machines += src
@@ -135,6 +136,8 @@ Class Procs:
START_PROCESSING(SSfastprocess, src)
power_change()
+ occupant_typecache = typecacheof(occupant_typecache)
+
/obj/machinery/Destroy()
GLOB.machines.Remove(src)
if(!speed_process)
@@ -176,16 +179,24 @@ Class Procs:
L.update_canmove()
occupant = null
-/obj/machinery/proc/close_machine(mob/living/target = null)
+/obj/machinery/proc/close_machine(atom/movable/target = null)
state_open = 0
density = 1
if(!target)
- for(var/mob/living/carbon/C in loc)
- if(C.buckled || C.has_buckled_mobs())
+ for(var/am in loc)
+ if(!is_type_in_typecache(am, occupant_typecache))
continue
- else
- target = C
- if(target && !target.buckled && !target.has_buckled_mobs())
+ var/atom/movable/AM = am
+ if(AM.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
target.forceMove(src)
updateUsrDialog()
diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm
index 7fc0f98b1c..e81774e147 100644
--- a/code/game/machinery/suit_storage_unit.dm
+++ b/code/game/machinery/suit_storage_unit.dm
@@ -211,13 +211,13 @@
uv = TRUE
locked = TRUE
update_icon()
- if(occupant)
+ if(occupant)
+ var/mob/living/mob_occupant = occupant
if(uv_super)
- occupant.adjustFireLoss(rand(20, 36))
+ mob_occupant.adjustFireLoss(rand(20, 36))
else
- occupant.adjustFireLoss(rand(10, 16))
- if(iscarbon(occupant))
- occupant.emote("scream")
+ mob_occupant.adjustFireLoss(rand(10, 16))
+ mob_occupant.emote("scream")
addtimer(CALLBACK(src, .proc/cook), 50)
else
uv_cycles = initial(uv_cycles)
@@ -368,14 +368,15 @@
else if(!helmet && !mask && !suit && !storage && !occupant)
return
else
- if(occupant)
- to_chat(occupant, "[src]'s confines grow warm, then hot, then scorching. You're being burned [!occupant.stat ? "alive" : "away"]!")
+ if(occupant)
+ var/mob/living/mob_occupant = occupant
+ to_chat(mob_occupant, "[src]'s confines grow warm, then hot, then scorching. You're being burned [!mob_occupant.stat ? "alive" : "away"]!")
cook()
. = TRUE
if("dispense")
if(!state_open)
return
-
+
var/static/list/valid_items = list("helmet", "suit", "mask", "storage")
var/item_name = params["item"]
if(item_name in valid_items)
diff --git a/code/game/objects/items/weapons/implants/implantchair.dm b/code/game/objects/items/weapons/implants/implantchair.dm
index 6f1a43a93a..a3b72d55bd 100644
--- a/code/game/objects/items/weapons/implants/implantchair.dm
+++ b/code/game/objects/items/weapons/implants/implantchair.dm
@@ -41,9 +41,10 @@
data["open"] = state_open
data["occupant"] = list()
- if(occupant)
- data["occupant"]["name"] = occupant.name
- data["occupant"]["stat"] = occupant.stat
+ if(occupant)
+ var/mob/living/mob_occupant = occupant
+ data["occupant"]["name"] = mob_occupant.name
+ data["occupant"]["stat"] = mob_occupant.stat
data["special_name"] = special ? special_name : null
data["ready_implants"] = ready_implants
diff --git a/code/modules/VR/vr_sleeper.dm b/code/modules/VR/vr_sleeper.dm
index 9411917c39..bba253a9da 100644
--- a/code/modules/VR/vr_sleeper.dm
+++ b/code/modules/VR/vr_sleeper.dm
@@ -9,6 +9,7 @@
icon_state = "sleeper"
state_open = 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/datum/effect_system/spark_spread/sparks
var/mob/living/carbon/human/virtual_reality/vr_human
@@ -92,11 +93,12 @@
return
switch(action)
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, "Transfering to virtual reality...")
if(vr_human)
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
to_chat(vr_human, "Transfer successful! you are now playing as [vr_human] in VR!")
SStgui.close_user_uis(vr_human, src)
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
index 2a67b5fe13..3a9eb1a028 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
@@ -1,7 +1,7 @@
/obj/machinery/atmospherics/components/unary/cryo_cell
name = "cryo cell"
icon = 'icons/obj/cryogenics.dmi'
- icon_state = "pod0"
+ icon_state = "cell-off"
density = 1
anchored = 1
obj_integrity = 350
@@ -12,7 +12,6 @@
state_open = FALSE
var/autoeject = FALSE
var/volume = 100
- var/running_bob_animation = FALSE
var/efficiency = 1
var/sleep_factor = 750
@@ -88,59 +87,17 @@
beaker = null
/obj/machinery/atmospherics/components/unary/cryo_cell/update_icon()
- handle_update_icon()
-
-/obj/machinery/atmospherics/components/unary/cryo_cell/proc/handle_update_icon() //making another proc to avoid spam in update_icon
- overlays.Cut() //empty the overlay proc, just in case
-
if(panel_open)
- icon_state = "pod0-o"
+ icon_state = "cell-o"
else if(state_open)
- icon_state = "pod0"
+ icon_state = "cell-open"
else if(on && is_operational())
if(occupant)
- var/image/pickle = image(occupant.icon, occupant.icon_state)
- pickle.overlays = occupant.overlays
- pickle.pixel_y = 22
- overlays += pickle
- icon_state = "pod1"
- var/up = 0 //used to see if we are going up or down, 1 is down, 2 is up
- spawn(0) // Without this, the icon update will block. The new thread will die once the occupant leaves.
- running_bob_animation = TRUE
- while(occupant)
- overlays -= "lid1" //have to remove the overlays first, to force an update- remove cloning pod overlay
- overlays -= pickle //remove mob overlay
-
- switch(pickle.pixel_y) //this looks messy as fuck but it works, switch won't call itself twice
-
- if(23) //inbetween state, for smoothness
- switch(up) //this is set later in the switch, to keep track of where the mob is supposed to go
- if(2) //2 is up
- pickle.pixel_y = 24 //set to highest
-
- if(1) //1 is down
- pickle.pixel_y = 22 //set to lowest
-
- if(22) //mob is at it's lowest
- pickle.pixel_y = 23 //set to inbetween
- up = 2 //have to go up
-
- if(24) //mob is at it's highest
- pickle.pixel_y = 23 //set to inbetween
- up = 1 //have to go down
-
- overlays += pickle //re-add the mob to the icon
- overlays += "lid1" //re-add the overlay of the pod, they are inside it, not floating
-
- sleep(7) //don't want to jiggle violently, just slowly bob
- return
- running_bob_animation = FALSE
+ icon_state = "cell-occupied"
else
- icon_state = "pod1"
- overlays += "lid0" //have to remove the overlays first, to force an update- remove cloning pod overlay
+ icon_state = "cell-on"
else
- icon_state = "pod0"
- overlays += "lid0" //if no occupant, just put the lid overlay on, and ignore the rest
+ icon_state = "cell-off"
/obj/machinery/atmospherics/components/unary/cryo_cell/process()
..()
@@ -153,25 +110,26 @@
return
var/datum/gas_mixture/air1 = AIR1
var/turf/T = get_turf(src)
- if(occupant)
- if(occupant.health >= 100) // Don't bother with fully healed people.
+ if(isliving(occupant))
+ var/mob/living/mob_occupant
+ if(mob_occupant.health >= 100) // Don't bother with fully healed people.
on = FALSE
update_icon()
- playsound(T, 'sound/machines/cryo_warning.ogg', volume, 1) // Bug the doctors.
- radio.talk_into(src, "Patient fully restored", radio_channel)
+ playsound(T, 'sound/machines/cryo_warning.ogg', volume) // Bug the doctors.
+ radio.talk_into(src, "Patient fully restored", radio_channel, get_spans(), get_default_language())
if(autoeject) // Eject if configured.
- radio.talk_into(src, "Auto ejecting patient now", radio_channel,get_spans(), get_default_language())
+ radio.talk_into(src, "Auto ejecting patient now", radio_channel, get_spans(), get_default_language())
open_machine()
return
- else if(occupant.stat == DEAD) // We don't bother with dead people.
+ else if(mob_occupant.stat == DEAD) // We don't bother with dead people.
return
if(autoeject) // Eject if configured.
open_machine()
return
if(air1.gases.len)
- if(occupant.bodytemperature < T0C) // Sleepytime. Why? More cryo magic.
- occupant.Sleeping((occupant.bodytemperature / sleep_factor) * 100)
- occupant.Paralyse((occupant.bodytemperature / paralyze_factor) * 100)
+ if(mob_occupant.bodytemperature < T0C) // Sleepytime. Why? More cryo magic.
+ mob_occupant.Sleeping((mob_occupant.bodytemperature / sleep_factor) * 100)
+ mob_occupant.Paralyse((mob_occupant.bodytemperature / paralyze_factor) * 100)
if(beaker)
if(reagent_transfer == 0) // Magically transfer reagents. Because cryo magic.
@@ -191,20 +149,21 @@
on = FALSE
update_icon()
return
- if(occupant)
+ if(isliving(occupant))
+ var/mob/living/mob_occupant = occupant
var/cold_protection = 0
var/mob/living/carbon/human/H = occupant
if(istype(H))
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)
var/air_heat_capacity = air1.heat_capacity()
var/heat = ((1 - cold_protection) / 10 + conduction_coefficient) \
* temperature_delta * \
(air_heat_capacity * heat_capacity / (air_heat_capacity + heat_capacity))
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.
@@ -242,7 +201,7 @@
..()
if(occupant)
if(on)
- to_chat(user, "[occupant] is inside [src]!")
+ to_chat(user, "Someone's inside [src]!")
else
to_chat(user, "You can barely make out a form floating in [src].")
else
@@ -265,9 +224,11 @@
I.loc = src
user.visible_message("[user] places [I] in [src].", \
"You place [I] in [src].")
+ var/reagentlist = pretty_string_from_reagent_list(I.reagents.reagent_list)
+ log_game("[key_name(user)] added an [I] to cyro containing [reagentlist]")
return
if(!on && !occupant && !state_open)
- if(default_deconstruction_screwdriver(user, "pod0-o", "pod0", I))
+ if(default_deconstruction_screwdriver(user, "cell-o", "cell-off", I))
return
if(exchange_parts(user, I))
return
@@ -294,17 +255,18 @@
data["autoEject"] = autoeject
var/list/occupantData = list()
- if(occupant)
- occupantData["name"] = occupant.name
- occupantData["stat"] = occupant.stat
- occupantData["health"] = occupant.health
- occupantData["maxHealth"] = occupant.maxHealth
+ if(isliving(occupant))
+ var/mob/living/mob_occupant = occupant
+ occupantData["name"] = mob_occupant.name
+ occupantData["stat"] = mob_occupant.stat
+ occupantData["health"] = mob_occupant.health
+ occupantData["maxHealth"] = mob_occupant.maxHealth
occupantData["minHealth"] = HEALTH_THRESHOLD_DEAD
- occupantData["bruteLoss"] = occupant.getBruteLoss()
- occupantData["oxyLoss"] = occupant.getOxyLoss()
- occupantData["toxLoss"] = occupant.getToxLoss()
- occupantData["fireLoss"] = occupant.getFireLoss()
- occupantData["bodyTemperature"] = occupant.bodytemperature
+ occupantData["bruteLoss"] = mob_occupant.getBruteLoss()
+ occupantData["oxyLoss"] = mob_occupant.getOxyLoss()
+ occupantData["toxLoss"] = mob_occupant.getToxLoss()
+ occupantData["fireLoss"] = mob_occupant.getFireLoss()
+ occupantData["bodyTemperature"] = mob_occupant.bodytemperature
data["occupant"] = occupantData
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm.rej b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm.rej
new file mode 100644
index 0000000000..ef4176d273
--- /dev/null
+++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm.rej
@@ -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()
diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm
index 9ff92839d1..43cf70bbe2 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm
@@ -168,13 +168,14 @@
var/offset = prob(50) ? -2 : 2
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
if(ishuman(occupant))
var/mob/living/carbon/human/gibee = occupant
sourcejob = gibee.job
- var/sourcenutriment = src.occupant.nutrition / 15
- var/sourcetotalreagents = src.occupant.reagents.total_volume
+ var/sourcenutriment = mob_occupant.nutrition / 15
+ var/sourcetotalreagents = mob_occupant.reagents.total_volume
var/gibtype = /obj/effect/decal/cleanable/blood/gibs
var/typeofmeat = /obj/item/weapon/reagent_containers/food/snacks/meat/slab/human
var/typeofskin = /obj/item/stack/sheet/animalhide/human
@@ -212,8 +213,8 @@
allskin = newskin
add_logs(user, occupant, "gibbed")
- src.occupant.death(1)
- src.occupant.ghostize()
+ mob_occupant.death(1)
+ mob_occupant.ghostize()
qdel(src.occupant)
spawn(src.gibtime)
playsound(src.loc, 'sound/effects/splat.ogg', 50, 1)