Merge pull request #703 from Citadel-Station-13/upstream-merge-26140

[MIRROR] Changes /obj/machinery to have atom/movable occupants
This commit is contained in:
LetterJay
2017-05-13 04:27:29 -04:00
committed by GitHub
14 changed files with 248 additions and 190 deletions
@@ -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)
+24 -19
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()
+67 -49
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)
@@ -172,11 +177,11 @@
var/mob/living/carbon/human/H = new /mob/living/carbon/human(src) var/mob/living/carbon/human/H = new /mob/living/carbon/human(src)
if(clonemind.changeling) if(clonemind.changeling)
var/obj/item/organ/brain/B = H.getorganslot("brain") var/obj/item/organ/brain/B = H.getorganslot("brain")
B.vital = FALSE B.vital = FALSE
B.decoy_override = TRUE B.decoy_override = TRUE
H.hardset_dna(ui, se, H.real_name, null, mrace, features) H.hardset_dna(ui, se, H.real_name, null, mrace, features)
if(efficiency > 2) if(efficiency > 2)
@@ -204,13 +209,13 @@
clonemind.transfer_to(H) clonemind.transfer_to(H)
if(grab_ghost_when == CLONER_FRESH_CLONE) if(grab_ghost_when == CLONER_FRESH_CLONE)
H.grab_ghost() H.grab_ghost()
to_chat(H, "<span class='notice'><b>Consciousness slowly creeps over you as your body regenerates.</b><br><i>So this is what cloning feels like?</i></span>") to_chat(H, "<span class='notice'><b>Consciousness slowly creeps over you as your body regenerates.</b><br><i>So this is what cloning feels like?</i></span>")
if(grab_ghost_when == CLONER_MATURE_CLONE) 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 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), "<span class='notice'>Your body is beginning to regenerate in a cloning pod. You will become conscious when it is complete.</span>") to_chat(H.get_ghost(TRUE), "<span class='notice'>Your body is beginning to regenerate in a cloning pod. You will become conscious when it is complete.</span>")
if(H) if(H)
H.faction |= factions H.faction |= factions
@@ -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"
@@ -305,16 +311,19 @@
to_chat(user, "<font color = #666633>-% Successfully stored \ref[P.buffer] [P.buffer.name] in buffer %-</font color>") to_chat(user, "<font color = #666633>-% Successfully stored \ref[P.buffer] [P.buffer.name] in buffer %-</font color>")
return return
var/mob/living/mob_occupant = occupant
if(W.GetID()) if(W.GetID())
if(!check_access(W)) if(!check_access(W))
to_chat(user, "<span class='danger'>Access Denied.</span>") to_chat(user, "<span class='danger'>Access Denied.</span>")
return return
if(!(occupant || mess)) if(!(mob_occupant || mess))
to_chat(user, "<span class='danger'>Error: Pod has no occupant.</span>") to_chat(user, "<span class='danger'>Error: Pod has no occupant.</span>")
return return
else else
connected_message("Authorized Ejection") 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, "<span class='notice'>You force an emergency ejection. </span>") to_chat(user, "<span class='notice'>You force an emergency ejection. </span>")
go_out() go_out()
else else
@@ -339,54 +348,63 @@
/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
new /obj/effect/gibspawner/generic(loc) new /obj/effect/gibspawner/generic(loc)
audible_message("<span class='italics'>You hear a splat.</span>") audible_message("<span class='italics'>You hear a splat.</span>")
icon_state = "pod_0" icon_state = "pod_0"
return return
if(!occupant) if(!mob_occupant)
return return
if(grab_ghost_when == CLONER_MATURE_CLONE)
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>")
occupant.flash_act()
var/turf/T = get_turf(src) if(grab_ghost_when == CLONER_MATURE_CLONE)
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>")
mob_occupant.flash_act()
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.")
mess = TRUE 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" icon_state = "pod_g"
if(occupant.mind != clonemind) if(mob_occupant.mind != clonemind)
clonemind.transfer_to(occupant) clonemind.transfer_to(mob_occupant)
occupant.grab_ghost() // We really just want to make you suffer. mob_occupant.grab_ghost() // We really just want to make you suffer.
flash_color(occupant, flash_color="#960000", flash_time=100) flash_color(mob_occupant, flash_color="#960000", flash_time=100)
to_chat(occupant, "<span class='warning'><b>Agony blazes across your consciousness as your body is torn apart.</b><br><i>Is this what dying is like? Yes it is.</i></span>") to_chat(mob_occupant, "<span class='warning'><b>Agony blazes across your consciousness as your body is torn apart.</b><br><i>Is this what dying is like? Yes it is.</i></span>")
playsound(src.loc, 'sound/machines/warning-buzzer.ogg', 50, 0) playsound(src.loc, 'sound/machines/warning-buzzer.ogg', 50, 0)
occupant << sound('sound/hallucinations/veryfar_noise.ogg',0,1,50) mob_occupant << sound('sound/hallucinations/veryfar_noise.ogg',0,1,50)
QDEL_IN(occupant, 40) QDEL_IN(mob_occupant, 40)
/obj/machinery/clonepod/relaymove(mob/user) /obj/machinery/clonepod/relaymove(mob/user)
if(user.stat == CONSCIOUS) if(user.stat == CONSCIOUS)
go_out() go_out()
/obj/machinery/clonepod/emp_act(severity) /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)) 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() go_out()
..() ..()
+38
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()
..()
+8 -6
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
+5 -4
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)
+4 -3
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
+22 -11
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()
+9 -8
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)
@@ -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
+4 -2
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)
@@ -1,7 +1,7 @@
/obj/machinery/atmospherics/components/unary/cryo_cell /obj/machinery/atmospherics/components/unary/cryo_cell
name = "cryo cell" name = "cryo cell"
icon = 'icons/obj/cryogenics.dmi' icon = 'icons/obj/cryogenics.dmi'
icon_state = "pod0" icon_state = "cell-off"
density = 1 density = 1
anchored = 1 anchored = 1
obj_integrity = 350 obj_integrity = 350
@@ -12,7 +12,6 @@
state_open = FALSE state_open = FALSE
var/autoeject = FALSE var/autoeject = FALSE
var/volume = 100 var/volume = 100
var/running_bob_animation = FALSE
var/efficiency = 1 var/efficiency = 1
var/sleep_factor = 750 var/sleep_factor = 750
@@ -88,59 +87,17 @@
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()
/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) if(panel_open)
icon_state = "pod0-o" icon_state = "cell-o"
else if(state_open) else if(state_open)
icon_state = "pod0" icon_state = "cell-open"
else if(on && is_operational()) else if(on && is_operational())
if(occupant) if(occupant)
var/image/pickle = image(occupant.icon, occupant.icon_state) icon_state = "cell-occupied"
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
else else
icon_state = "pod1" icon_state = "cell-on"
overlays += "lid0" //have to remove the overlays first, to force an update- remove cloning pod overlay
else else
icon_state = "pod0" icon_state = "cell-off"
overlays += "lid0" //if no occupant, just put the lid overlay on, and ignore the rest
/obj/machinery/atmospherics/components/unary/cryo_cell/process() /obj/machinery/atmospherics/components/unary/cryo_cell/process()
..() ..()
@@ -153,25 +110,26 @@
return return
var/datum/gas_mixture/air1 = AIR1 var/datum/gas_mixture/air1 = AIR1
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
if(occupant) if(isliving(occupant))
if(occupant.health >= 100) // Don't bother with fully healed people. var/mob/living/mob_occupant
if(mob_occupant.health >= 100) // Don't bother with fully healed people.
on = FALSE on = FALSE
update_icon() update_icon()
playsound(T, 'sound/machines/cryo_warning.ogg', volume, 1) // Bug the doctors. playsound(T, 'sound/machines/cryo_warning.ogg', volume) // Bug the doctors.
radio.talk_into(src, "Patient fully restored", radio_channel) radio.talk_into(src, "Patient fully restored", radio_channel, get_spans(), get_default_language())
if(autoeject) // Eject if configured. 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() open_machine()
return 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 return
if(autoeject) // Eject if configured. if(autoeject) // Eject if configured.
open_machine() open_machine()
return return
if(air1.gases.len) if(air1.gases.len)
if(occupant.bodytemperature < T0C) // Sleepytime. Why? More cryo magic. if(mob_occupant.bodytemperature < T0C) // Sleepytime. Why? More cryo magic.
occupant.Sleeping((occupant.bodytemperature / sleep_factor) * 100) mob_occupant.Sleeping((mob_occupant.bodytemperature / sleep_factor) * 100)
occupant.Paralyse((occupant.bodytemperature / paralyze_factor) * 100) mob_occupant.Paralyse((mob_occupant.bodytemperature / paralyze_factor) * 100)
if(beaker) if(beaker)
if(reagent_transfer == 0) // Magically transfer reagents. Because cryo magic. if(reagent_transfer == 0) // Magically transfer reagents. Because cryo magic.
@@ -191,20 +149,21 @@
on = FALSE on = FALSE
update_icon() update_icon()
return return
if(occupant) if(isliving(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.
@@ -242,7 +201,7 @@
..() ..()
if(occupant) if(occupant)
if(on) if(on)
to_chat(user, "[occupant] is inside [src]!") to_chat(user, "Someone's inside [src]!")
else else
to_chat(user, "You can barely make out a form floating in [src].") to_chat(user, "You can barely make out a form floating in [src].")
else else
@@ -265,9 +224,11 @@
I.loc = src I.loc = src
user.visible_message("[user] places [I] in [src].", \ user.visible_message("[user] places [I] in [src].", \
"<span class='notice'>You place [I] in [src].</span>") "<span class='notice'>You place [I] in [src].</span>")
var/reagentlist = pretty_string_from_reagent_list(I.reagents.reagent_list)
log_game("[key_name(user)] added an [I] to cyro containing [reagentlist]")
return return
if(!on && !occupant && !state_open) 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 return
if(exchange_parts(user, I)) if(exchange_parts(user, I))
return return
@@ -294,17 +255,18 @@
data["autoEject"] = autoeject data["autoEject"] = autoeject
var/list/occupantData = list() var/list/occupantData = list()
if(occupant) if(isliving(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
@@ -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()
@@ -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)