From f5e8a7e4e46a7b71b2238d884b6ecfca6210028d Mon Sep 17 00:00:00 2001 From: LetterJay Date: Fri, 12 May 2017 23:57:11 -0500 Subject: [PATCH] rej merges --- code/game/machinery/cloning.dm | 110 +++++++++--------- .../components/unary_devices/cryo.dm | 110 ++++++------------ 2 files changed, 92 insertions(+), 128 deletions(-) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 38b2cf1705..5adc892bd9 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -121,12 +121,12 @@ /obj/machinery/clonepod/examine(mob/user) ..() - var/mob/living/mob_occupant = occupant + 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() && mob_occupant) - if(mob_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 @@ -138,10 +138,10 @@ return GM /obj/machinery/clonepod/proc/get_completion() - . = FALSE - var/mob/living/mob_occupant = occupant - if(mob_occupant) - . = (100 * ((mob_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) @@ -177,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) @@ -209,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 @@ -228,26 +228,26 @@ //Grow clones to maturity then kick them out. FREELOADERS /obj/machinery/clonepod/process() - var/mob/living/mob_occupant = occupant + var/mob/living/mob_occupant = occupant if(!is_operational()) //Autoeject if power is lost - if(mob_occupant) + if(mob_occupant) go_out() connected_message("Clone Ejected: Loss of power.") - else if(mob_occupant && (mob_occupant.loc == src)) - if((mob_occupant.stat == DEAD) || (mob_occupant.suiciding) || mob_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 [mob_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(mob_occupant.cloneloss > (100 - heal_level)) - mob_occupant.Paralyse(4) + else if(mob_occupant.cloneloss > (100 - heal_level)) + mob_occupant.Paralyse(4) //Slowly get that clone healed and finished. - mob_occupant.adjustCloneLoss(-((speed_coeff/2) * config.damage_multiplier)) - var/progress = CLONE_INITIAL_DAMAGE - mob_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 @@ -258,24 +258,24 @@ var/obj/item/I = pick_n_take(unattached_flesh) if(isorgan(I)) var/obj/item/organ/O = I - O.Insert(mob_occupant) + O.Insert(mob_occupant) else if(isbodypart(I)) var/obj/item/bodypart/BP = I - BP.attach_limb(mob_occupant) + BP.attach_limb(mob_occupant) //Premature clones may have brain damage. - mob_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((mob_occupant.cloneloss <= (100 - heal_level))) + else if((mob_occupant.cloneloss <= (100 - heal_level))) connected_message("Cloning Process Complete.") - SPEAK("The cloning cycle of [mob_occupant.real_name] is complete.") + SPEAK("The cloning cycle of [mob_occupant.real_name] is complete.") go_out() - else if (!mob_occupant || mob_occupant.loc != src) + else if (!mob_occupant || mob_occupant.loc != src) occupant = null if (!mess && !panel_open) icon_state = "pod_0" @@ -311,16 +311,17 @@ 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 [occupant.real_name] has occurred.") + SPEAK("An authorized ejection of [clonemind.name] has occurred.") to_chat(user, "You force an emergency ejection. ") go_out() else @@ -345,7 +346,7 @@ /obj/machinery/clonepod/proc/go_out() countdown.stop() - var/mob/living/mob_occupant = occupant + var/mob/living/mob_occupant = occupant if(mess) //Clean that mess and dump those gibs! mess = FALSE @@ -354,47 +355,50 @@ icon_state = "pod_0" return - if(!mob_occupant) + if(!mob_occupant) return - + if(grab_ghost_when == CLONER_MATURE_CLONE) - mob_occupant.grab_ghost() + mob_occupant.grab_ghost() to_chat(occupant, "There is a bright flash!
You feel like a new being.
") - mob_occupant.flash_act() + mob_occupant.flash_act() var/turf/T = get_turf(src) occupant.forceMove(T) icon_state = "pod_0" - mob_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() - var/mob/living/mob_occupant = occupant - if(mob_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) 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(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 [occupant.real_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/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index 3a76a03be8..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,21 +149,21 @@ on = FALSE update_icon() return - if(occupant) - var/mob/living/mob_occupant = 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 - mob_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) - mob_occupant.bodytemperature = max(mob_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. @@ -243,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 @@ -266,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 @@ -295,18 +255,18 @@ data["autoEject"] = autoeject var/list/occupantData = list() - if(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 + 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"] = mob_occupant.getBruteLoss() - occupantData["oxyLoss"] = mob_occupant.getOxyLoss() - occupantData["toxLoss"] = mob_occupant.getToxLoss() - occupantData["fireLoss"] = mob_occupant.getFireLoss() - occupantData["bodyTemperature"] = mob_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