From 7e1efca13ae438e3a32b3cb30f8049ab26f5c3d7 Mon Sep 17 00:00:00 2001 From: phil235 Date: Tue, 16 Feb 2016 23:27:08 +0100 Subject: [PATCH 1/2] Created two new procs to handle reviving mobs more easily: - can_be_revived(), used so we don't revive a mob who would immediately die again (lack of brain organ for carbons). - fully_heal(), called by revive when we want to completely heal a mob before trying to ressuscitate it. I gave some arguments to revive() so the proc can be used by more than just the admin healing code (ai revived by the AI fixer console, drone revived by another drone clicking it, strange reagent ressuscitating you, borg revived by restart circuitboard, changeling using his revive ability, etc) This fixes borg revival not updating its vision correctly and not updating the diagnostic HUD. Same fix for changeling revival. --- .../gamemodes/changeling/powers/fleshmend.dm | 7 +- .../gamemodes/changeling/powers/revive.dm | 21 +---- .../shadowling/shadowling_abilities.dm | 10 +-- code/game/gamemodes/wizard/artefact.dm | 2 +- code/game/machinery/computer/aifixer.dm | 34 ++++---- code/game/objects/effects/mines.dm | 4 +- .../objects/items/robot/robot_upgrades.dm | 10 +-- code/game/objects/items/weapons/defib.dm | 7 +- code/modules/admin/topic.dm | 2 +- code/modules/admin/verbs/randomverbs.dm | 2 +- .../awaymissions/mission_code/Academy.dm | 2 +- .../awaymissions/mission_code/wildwest.dm | 2 +- code/modules/mining/equipment_locker.dm | 2 +- code/modules/mob/living/carbon/brain/MMI.dm | 2 +- code/modules/mob/living/carbon/brain/brain.dm | 5 ++ .../mob/living/carbon/brain/posibrain.dm | 8 +- code/modules/mob/living/carbon/carbon.dm | 82 +++++++------------ code/modules/mob/living/carbon/human/human.dm | 5 ++ code/modules/mob/living/living.dm | 64 +++++++++------ code/modules/mob/living/silicon/ai/ai.dm | 17 +--- code/modules/mob/living/silicon/ai/life.dm | 4 +- code/modules/mob/living/silicon/death.dm | 6 ++ .../modules/mob/living/silicon/robot/robot.dm | 34 +++----- .../mob/living/simple_animal/bot/bot.dm | 7 +- .../mob/living/simple_animal/friendly/dog.dm | 4 - .../simple_animal/friendly/drone/_drone.dm | 11 +-- .../friendly/drone/interaction.dm | 2 +- .../mob/living/simple_animal/friendly/pet.dm | 7 +- .../simple_animal/hostile/mining_mobs.dm | 9 +- .../living/simple_animal/hostile/mushroom.dm | 11 +-- .../living/simple_animal/hostile/zombie.dm | 4 +- .../mob/living/simple_animal/simple_animal.dm | 19 +++-- .../mob/living/simple_animal/slime/death.dm | 2 +- code/modules/projectiles/guns/magic/wand.dm | 2 +- code/modules/projectiles/projectile/magic.dm | 19 ++--- .../chemistry/reagents/medicine_reagents.dm | 11 +-- 36 files changed, 191 insertions(+), 249 deletions(-) diff --git a/code/game/gamemodes/changeling/powers/fleshmend.dm b/code/game/gamemodes/changeling/powers/fleshmend.dm index 04ccfbf429c..2b07ab71265 100644 --- a/code/game/gamemodes/changeling/powers/fleshmend.dm +++ b/code/game/gamemodes/changeling/powers/fleshmend.dm @@ -33,9 +33,10 @@ for(var/i = 0, i < 10, i++) //The healing itself - doesn't heal toxin damage (that's anatomic panacea) and effectiveness decreases with each use in a short timespan if(user) - user.adjustBruteLoss(-10 / recent_uses) - user.adjustOxyLoss(-10 / recent_uses) - user.adjustFireLoss(-10 / recent_uses) + user.adjustBruteLoss(-10 / recent_uses, 0) + user.adjustOxyLoss(-10 / recent_uses, 0) + user.adjustFireLoss(-10 / recent_uses, 0) + user.updatehealth() sleep(10) feedback_add_details("changeling_powers","RR") diff --git a/code/game/gamemodes/changeling/powers/revive.dm b/code/game/gamemodes/changeling/powers/revive.dm index 36e171ec8be..a68f62a4747 100644 --- a/code/game/gamemodes/changeling/powers/revive.dm +++ b/code/game/gamemodes/changeling/powers/revive.dm @@ -5,31 +5,12 @@ //Revive from revival stasis /obj/effect/proc_holder/changeling/revive/sting_action(mob/living/carbon/user) - if(user.stat == DEAD) - dead_mob_list -= user - living_mob_list += user user.status_flags &= ~(FAKEDEATH) - user.stat = UNCONSCIOUS user.tod = null - user.toxloss = 0 - user.oxyloss = 0 - user.cloneloss = 0 - user.paralysis = 0 - user.stunned = 0 - user.weakened = 0 - user.radiation = 0 - user.sleeping = 0 - user.clear_alert("asleep") - user.heal_overall_damage(user.getBruteLoss(), user.getFireLoss(), 0) //not updating health & stat - user.reagents.clear_reagents() - if(ishuman(user)) - var/mob/living/carbon/human/H = user - H.restore_blood() - H.remove_all_embedded_objects() + user.revive(full_heal = 1) user << "We have regenerated." user.mind.changeling.purchasedpowers -= src feedback_add_details("changeling_powers","CR") - user.updatehealth() return 1 /obj/effect/proc_holder/changeling/revive/can_be_used_by(mob/user) diff --git a/code/game/gamemodes/shadowling/shadowling_abilities.dm b/code/game/gamemodes/shadowling/shadowling_abilities.dm index 7372a184a72..355b9d5bebf 100644 --- a/code/game/gamemodes/shadowling/shadowling_abilities.dm +++ b/code/game/gamemodes/shadowling/shadowling_abilities.dm @@ -607,12 +607,12 @@ datum/reagent/shadowling_blindness_smoke //Reagent used for above spell playsound(thrallToRevive, 'sound/machines/defib_zap.ogg', 50, 1) user.Beam(thrallToRevive,icon_state="red_lightning",icon='icons/effects/effects.dmi',time=1) sleep(10) - thrallToRevive.revive() - thrallToRevive.visible_message("[thrallToRevive] heaves in breath, dim red light shining in their eyes.", \ + if(thrallToRevive.revive(full_heal = 1)) + thrallToRevive.visible_message("[thrallToRevive] heaves in breath, dim red light shining in their eyes.", \ "You have returned. One of your masters has brought you from the darkness beyond.") - thrallToRevive.Weaken(4) - thrallToRevive.emote("gasp") - playsound(thrallToRevive, "bodyfall", 50, 1) + thrallToRevive.Weaken(4) + thrallToRevive.emote("gasp") + playsound(thrallToRevive, "bodyfall", 50, 1) else revert_cast() return diff --git a/code/game/gamemodes/wizard/artefact.dm b/code/game/gamemodes/wizard/artefact.dm index aa361870a3d..4df4d7d146d 100644 --- a/code/game/gamemodes/wizard/artefact.dm +++ b/code/game/gamemodes/wizard/artefact.dm @@ -158,7 +158,7 @@ return M.set_species(/datum/species/skeleton, icon_update=0) - M.revive() + M.revive(full_heal = 1, admin_revive = 1) spooky_scaries |= M M << "You have been revived by [user.real_name]!" M << "They are your master now, assist them even if it costs you your new life!" diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm index 607f4ea040d..0ea426b4aee 100644 --- a/code/game/machinery/computer/aifixer.dm +++ b/code/game/machinery/computer/aifixer.dm @@ -82,27 +82,23 @@ /obj/machinery/computer/aifixer/Topic(href, href_list) if(..()) return - if (href_list["fix"]) - src.active = 1 - while (src.occupier.health < 100) - src.occupier.adjustOxyLoss(-1) - src.occupier.adjustFireLoss(-1) - src.occupier.adjustToxLoss(-1) - src.occupier.adjustBruteLoss(-1) - src.occupier.updatehealth() - if (src.occupier.health >= 0 && src.occupier.stat == 2) - src.occupier.stat = 0 - src.occupier.lying = 0 - dead_mob_list -= src.occupier - living_mob_list += src.occupier - src.updateUsrDialog() + if(href_list["fix"]) + active = 1 + while (occupier.health < 100) + occupier.adjustOxyLoss(-1, 0) + occupier.adjustFireLoss(-1, 0) + occupier.adjustToxLoss(-1, 0) + occupier.adjustBruteLoss(-1, 0) + occupier.updatehealth() + if(occupier.health >= 0 && occupier.stat == DEAD) + occupier.revive() + updateUsrDialog() update_icon() sleep(10) - src.active = 0 - src.add_fingerprint(usr) - src.updateUsrDialog() + active = 0 + add_fingerprint(usr) + updateUsrDialog() update_icon() - return /obj/machinery/computer/aifixer/update_icon() @@ -129,7 +125,7 @@ if(stat & (NOPOWER|BROKEN)) user << "[src] is offline and cannot take an AI at this time!" return - AI.loc = src + AI.forceMove(src) occupier = AI AI.control_disabled = 1 AI.radio_enabled = 0 diff --git a/code/game/objects/effects/mines.dm b/code/game/objects/effects/mines.dm index fe31b39395a..20254a8318b 100644 --- a/code/game/objects/effects/mines.dm +++ b/code/game/objects/effects/mines.dm @@ -133,7 +133,7 @@ victim.drop_r_hand() victim.drop_l_hand() victim.put_in_hands(chainsaw) - + victim.reagents.add_reagent("adminordrazine",25) victim.client.color = pure_red @@ -154,7 +154,7 @@ if(!victim.client || !istype(victim)) return victim << "You feel great!" - victim.revive() + victim.revive(full_heal = 1, admin_revive = 1) /obj/effect/mine/pickup/speed name = "Yellow Orb" diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index a891a8c9350..0739c9a8b6d 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -87,15 +87,7 @@ if(ghost.mind && ghost.mind.current == R) R.key = ghost.key - R.notify_ai(1) - - R.stat = UNCONSCIOUS - R.update_stat() - if(R.camera && !R.wires.is_cut(WIRE_CAMERA)) - R.camera.toggle_cam(R,0) - - dead_mob_list -= R //please never forget this ever kthx - living_mob_list += R + R.revive() return 1 diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index 1ade32a2a99..dce70f51d29 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -511,12 +511,7 @@ H.adjustBruteLoss((mobhealth - halfwaycritdeath) * (total_brute / overall_damage), 0) user.visible_message("[req_defib ? "[defib]" : "[src]"] pings: Resuscitation successful.") playsound(get_turf(src), 'sound/machines/defib_success.ogg', 50, 0) - H.stat = UNCONSCIOUS - H.updatehealth() - H.update_sight() - H.reload_fullscreen() - dead_mob_list -= H - living_mob_list |= list(H) + H.revive() H.emote("gasp") if(tplus > tloss) H.setBrainLoss( max(0, min(99, ((tlimit - tplus) / tlimit * 100)))) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 32615dd8fdc..324543903fb 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1487,7 +1487,7 @@ usr << "This can only be used on instances of type /mob/living" return - L.revive() + L.revive(full_heal = 1, admin_revive = 1) message_admins("Admin [key_name_admin(usr)] healed / revived [key_name_admin(L)]!") log_admin("[key_name(usr)] healed / Revived [key_name(L)]") diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 25d3d42a9cd..a20b103316c 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -454,7 +454,7 @@ Traitors and the like can also be revived with the previous role mostly intact. if(!istype(M)) alert("Cannot revive a ghost") return - M.revive() + M.revive(full_heal = 1, admin_revive = 1) log_admin("[key_name(usr)] healed / revived [key_name(M)]") message_admins("Admin [key_name_admin(usr)] healed / revived [key_name_admin(M)]!") diff --git a/code/modules/awaymissions/mission_code/Academy.dm b/code/modules/awaymissions/mission_code/Academy.dm index 4a57dd26480..0bd443f1233 100644 --- a/code/modules/awaymissions/mission_code/Academy.dm +++ b/code/modules/awaymissions/mission_code/Academy.dm @@ -234,7 +234,7 @@ C.name = "Cookie of Fate" if(12) //Healing - user.revive() + user.revive(full_heal = 1, admin_revive = 1) if(13) //Mad Dosh var/turf/Start = get_turf(src) diff --git a/code/modules/awaymissions/mission_code/wildwest.dm b/code/modules/awaymissions/mission_code/wildwest.dm index 6b9c7b55932..4a744ef7100 100644 --- a/code/modules/awaymissions/mission_code/wildwest.dm +++ b/code/modules/awaymissions/mission_code/wildwest.dm @@ -160,7 +160,7 @@ C << "Death is not your end!" spawn(rand(80,120)) - C.revive() + C.revive(full_heal = 1, admin_revive = 1) C << "You have regenerated." C.visible_message("[usr] appears to wake from the dead, having healed all wounds.") C.update_canmove() diff --git a/code/modules/mining/equipment_locker.dm b/code/modules/mining/equipment_locker.dm index fb398e88f45..58d7bc80aa7 100644 --- a/code/modules/mining/equipment_locker.dm +++ b/code/modules/mining/equipment_locker.dm @@ -771,7 +771,7 @@ var/mob/living/simple_animal/M = target if(M.stat == DEAD) M.faction = list("neutral") - M.revive() + M.revive(full_heal = 1, admin_revive = 1) if(istype(target, /mob/living/simple_animal/hostile)) var/mob/living/simple_animal/hostile/H = M if(malfunctioning) diff --git a/code/modules/mob/living/carbon/brain/MMI.dm b/code/modules/mob/living/carbon/brain/MMI.dm index 912c000ebba..a9ef5f416b0 100644 --- a/code/modules/mob/living/carbon/brain/MMI.dm +++ b/code/modules/mob/living/carbon/brain/MMI.dm @@ -61,7 +61,7 @@ newbrain.brainmob = null brainmob.loc = src brainmob.container = src - if(!newbrain.damaged_brain) // the brain organ hasn't beaten to death. + if(!newbrain.damaged_brain) // the brain organ hasn't been beaten to death. brainmob.stat = CONSCIOUS //we manually revive the brain mob dead_mob_list -= brainmob living_mob_list += brainmob diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm index 2878b8d755f..f9bad528026 100644 --- a/code/modules/mob/living/carbon/brain/brain.dm +++ b/code/modules/mob/living/carbon/brain/brain.dm @@ -51,3 +51,8 @@ /mob/living/carbon/brain/update_damage_hud() return //no red circles for brain + +/mob/living/carbon/brain/can_be_revived() + . = 1 + if(!container || health <= config.health_threshold_dead) + return 0 diff --git a/code/modules/mob/living/carbon/brain/posibrain.dm b/code/modules/mob/living/carbon/brain/posibrain.dm index 73b041187be..3dbb25fd26f 100644 --- a/code/modules/mob/living/carbon/brain/posibrain.dm +++ b/code/modules/mob/living/carbon/brain/posibrain.dm @@ -39,7 +39,7 @@ var/global/posibrain_notif_cooldown = 0 spawn(askDelay) //Seperate from the global cooldown. notified = 0 update_icon() - if(brainmob.stat == CONSCIOUS && brainmob.client) + if(brainmob.client) visible_message("The positronic brain pings, and its lights start flashing. Success!") else visible_message("The positronic brain buzzes quietly, and the golden lights fade away. Perhaps you could try again?") @@ -99,6 +99,9 @@ var/global/posibrain_notif_cooldown = 0 brainmob << "As a synthetic intelligence, you answer to all crewmembers, as well as the AI." brainmob << "Remember, the purpose of your existence is to serve the crew and the station. Above all else, do no harm." brainmob.mind.assigned_role = "Positronic Brain" + brainmob.stat = CONSCIOUS + dead_mob_list -= brainmob + living_mob_list += brainmob visible_message("The positronic brain chimes quietly.") update_icon() @@ -123,8 +126,6 @@ var/global/posibrain_notif_cooldown = 0 if(CONSCIOUS) if(!src.brainmob.client) msg += "It appears to be in stand-by mode.\n" //afk - if(UNCONSCIOUS) - msg += "It doesn't seem to be responsive.\n" if(DEAD) msg += "It appears to be completely inactive.\n" else @@ -139,7 +140,6 @@ var/global/posibrain_notif_cooldown = 0 brainmob.real_name = brainmob.name brainmob.loc = src brainmob.container = src - dead_mob_list -= brainmob ping_ghosts("created") ..() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index f4a47adc483..519878c5556 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -14,7 +14,6 @@ /mob/living/carbon/updatehealth() ..() med_hud_set_health() - med_hud_set_status() /mob/living/carbon/Destroy() for(var/atom/movable/guts in internal_organs) @@ -677,59 +676,6 @@ var/const/GALOSHES_DONT_HELP = 4 if(wear_mask) . += wear_mask.tint -/mob/living/carbon/revive() - setToxLoss(0) - setOxyLoss(0) - setCloneLoss(0) - setBrainLoss(0) - setStaminaLoss(0) - SetParalysis(0) - SetStunned(0) - SetWeakened(0) - SetSleeping(0) - radiation = 0 - nutrition = NUTRITION_LEVEL_FED + 50 - bodytemperature = 310 - eye_damage = 0 - disabilities = 0 - eye_blind = 0 - eye_blurry = 0 - ear_deaf = 0 - ear_damage = 0 - hallucination = 0 - heal_overall_damage(1000, 1000) - ExtinguishMob() - fire_stacks = 0 - suiciding = 0 - handcuffed = initial(handcuffed) - for(var/obj/item/weapon/restraints/R in contents) //actually remove cuffs from inventory - qdel(R) - update_handcuffed() - if(reagents) - for(var/datum/reagent/R in reagents.reagent_list) - reagents.clear_reagents() - reagents.addiction_list = list() - for(var/datum/disease/D in viruses) - D.cure(0) - if(stat == DEAD) - dead_mob_list -= src - living_mob_list += src - stat = CONSCIOUS - if(ishuman(src)) - var/mob/living/carbon/human/human_mob = src - human_mob.restore_blood() - human_mob.remove_all_embedded_objects() - updatehealth() - update_fire() - if(dna) - for(var/datum/mutation/human/HM in dna.mutations) - if(HM.quality != POSITIVE) - dna.remove_mutation(HM.name) - update_sight() - reload_fullscreen() - update_canmove() - - //this handles hud updates /mob/living/carbon/update_damage_hud() @@ -830,6 +776,7 @@ var/const/GALOSHES_DONT_HELP = 4 update_canmove() update_damage_hud() update_health_hud() + med_hud_set_status() //called when we get cuffed/uncuffed /mob/living/carbon/proc/update_handcuffed() @@ -842,3 +789,30 @@ var/const/GALOSHES_DONT_HELP = 4 clear_alert("handcuffed") update_inv_handcuffed() update_hud_handcuffed() + +/mob/living/carbon/fully_heal(admin_revive = 0) + if(reagents) + reagents.clear_reagents() + var/obj/item/organ/internal/brain/B = getorgan(/obj/item/organ/internal/brain) + if(B) + B.damaged_brain = 0 + if(admin_revive) + handcuffed = initial(handcuffed) + for(var/obj/item/weapon/restraints/R in contents) //actually remove cuffs from inventory + qdel(R) + update_handcuffed() + if(reagents) + reagents.addiction_list = list() + + for(var/datum/disease/D in viruses) + D.cure(0) + if(dna) + for(var/datum/mutation/human/HM in dna.mutations) + if(HM.quality != POSITIVE) + dna.remove_mutation(HM.name) + ..() + +/mob/living/carbon/can_be_revived() + . = ..() + if(!getorgan(/obj/item/organ/internal/brain)) + return 0 diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index c6ac0aa338b..837bd6ff71f 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -939,3 +939,8 @@ hud_used.healthdoll.overlays += image('icons/mob/screen_gen.dmi',"[L.name][icon_num]") else hud_used.healthdoll.icon_state = "healthdoll_DEAD" + +/mob/living/carbon/human/fully_heal(admin_revive = 0) + restore_blood() + remove_all_embedded_objects() + ..() \ No newline at end of file diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 8235f9b02a7..6812628a6e3 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -456,38 +456,54 @@ Sorry Giacom. Please don't be mad :( if(updating_health) updatehealth() -/mob/living/proc/revive() - setToxLoss(0) - setOxyLoss(0) - setCloneLoss(0) +//proc used to ressuscitate a mob +/mob/living/proc/revive(full_heal = 0, admin_revive = 0) + if(full_heal) + fully_heal(admin_revive) + if(stat == DEAD && can_be_revived()) //in some cases you can't revive (e.g. no brain) + dead_mob_list -= src + living_mob_list += src + suiciding = 0 + stat = UNCONSCIOUS //the mob starts unconscious, + blind_eyes(1) + updatehealth() //then we check if the mob should wake up. + update_canmove() + update_sight() + reload_fullscreen() + . = 1 + +//proc used to completely heal a mob. +/mob/living/proc/fully_heal(admin_revive = 0) + setToxLoss(0, 0) + setOxyLoss(0, 0) + setCloneLoss(0, 0) setBrainLoss(0) - setStaminaLoss(0) - SetParalysis(0) - SetStunned(0) - SetWeakened(0) - SetSleeping(0) + setStaminaLoss(0, 0) + SetParalysis(0, 0) + SetStunned(0, 0) + SetWeakened(0, 0) + SetSleeping(0, 0) radiation = 0 nutrition = NUTRITION_LEVEL_FED + 50 bodytemperature = 310 - eye_damage = 0 disabilities = 0 - eye_blind = 0 - eye_blurry = 0 + set_blindness(0) + set_blurriness(0) + set_eye_damage(0) ear_deaf = 0 ear_damage = 0 hallucination = 0 heal_overall_damage(1000, 1000) ExtinguishMob() fire_stacks = 0 - suiciding = 0 - if(stat == DEAD) - dead_mob_list -= src - living_mob_list += src - stat = CONSCIOUS updatehealth() - update_fire() - regenerate_icons() - reload_fullscreen() + + +//proc called by revive(), to check if we can actually ressuscitate the mob (we don't want to revive him and have him instantly die again) +/mob/living/proc/can_be_revived() + . = 1 + if(health <= config.health_threshold_dead) + return 0 /mob/living/proc/update_damage_overlays() return @@ -984,7 +1000,7 @@ Sorry Giacom. Please don't be mad :( overlay_fullscreen("blind", /obj/screen/fullscreen/blind) else if(eye_blind) var/blind_minimum = 0 - if(stat == UNCONSCIOUS || (disabilities & BLIND)) + if(stat != CONSCIOUS || (disabilities & BLIND)) blind_minimum = 1 eye_blind = max(eye_blind+amount, blind_minimum) if(!eye_blind) @@ -1000,7 +1016,7 @@ Sorry Giacom. Please don't be mad :( overlay_fullscreen("blind", /obj/screen/fullscreen/blind) else if(eye_blind) var/blind_minimum = 0 - if(stat == UNCONSCIOUS || (disabilities & BLIND)) + if(stat != CONSCIOUS || (disabilities & BLIND)) blind_minimum = 1 eye_blind = blind_minimum if(!eye_blind) @@ -1102,10 +1118,6 @@ Sorry Giacom. Please don't be mad :( clear_fullscreen("high") clear_alert("high") - -/mob/proc/update_vision_overlays() - return - /mob/proc/cure_blind() //when we want to cure the BLIND disability only. return diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 7674171a8ae..8acc7f79de7 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -891,16 +891,7 @@ var/list/ai_list = list() else clear_fullscreen("remote_view", 0) - -/mob/living/silicon/ai/update_vision_overlays() - if(!client) - return - - if(stat == DEAD) //if dead we just remove all vision impairments - clear_fullscreens() - return - - if(eye_blind) - overlay_fullscreen("blind", /obj/screen/fullscreen/blind) - else - clear_fullscreen("blind") \ No newline at end of file +/mob/living/silicon/ai/revive(full_heal = 0, admin_revive = 0) + if(..()) //successfully ressuscitated from death + icon_state = "ai" + . = 1 \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 75cf9b3816a..9eb76d2c9a0 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -64,7 +64,6 @@ if(!fire_res_on_core) health -= getFireLoss() update_stat() - diag_hud_set_status() diag_hud_set_health() /mob/living/silicon/ai/update_stat() @@ -74,6 +73,9 @@ if(health <= config.health_threshold_dead) death() return + else + stat = CONSCIOUS + diag_hud_set_status() /mob/living/silicon/ai/update_sight() see_invisible = initial(see_invisible) diff --git a/code/modules/mob/living/silicon/death.dm b/code/modules/mob/living/silicon/death.dm index f9c7e78231d..4c01e8724d5 100644 --- a/code/modules/mob/living/silicon/death.dm +++ b/code/modules/mob/living/silicon/death.dm @@ -6,3 +6,9 @@ /mob/living/silicon/spawn_dust() new /obj/effect/decal/remains/robot(loc) + +/mob/living/silicon/death(gibbed) + diag_hud_set_status() + diag_hud_set_health() + update_health_hud() + ..() \ No newline at end of file diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index a81da477f77..fb2e6646e18 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1188,9 +1188,6 @@ if(health < -maxHealth*0.5) if(uneq_module(module_state_1)) src << "CRITICAL ERROR: All modules OFFLINE." - diag_hud_set_health() - diag_hud_set_status() - update_health_hud() /mob/living/silicon/robot/update_sight() if(!client) @@ -1247,25 +1244,9 @@ adjust_blindness(-1) update_canmove() update_headlamp() - -/mob/living/silicon/robot/update_vision_overlays() - if(!client) - return - - if(stat == DEAD) //if dead we just remove all vision impairments - clear_fullscreens() - return - - if(eye_blind) - overlay_fullscreen("blind", /obj/screen/fullscreen/blind) - else - clear_fullscreen("blind") - - if(client.eye != src) - var/atom/A = client.eye - A.get_remote_view_fullscreens(src) - else - clear_fullscreen("remote_view", 0) + diag_hud_set_status() + diag_hud_set_health() + update_health_hud() /mob/living/silicon/robot/fully_replace_character_name(oldname, newname) ..() @@ -1283,3 +1264,12 @@ Stun(3) ..() +/mob/living/silicon/robot/revive(full_heal = 0, admin_revive = 0) + if(..()) //successfully ressuscitated from death + if(camera && !wires.is_cut(WIRE_CAMERA)) + camera.toggle_cam(src,0) + update_headlamp() + if(admin_revive) + locked = 1 + notify_ai(1) + . = 1 \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 0406f09bb77..586236927e5 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -876,9 +876,10 @@ Pass a positive integer as an argument to override a bot's default speed. . = ..() bot_reset() -/mob/living/simple_animal/bot/revive() - ..() - update_icon() +/mob/living/simple_animal/bot/revive(full_heal = 0, admin_revive = 0) + if(..()) + update_icon() + . = 1 /mob/living/simple_animal/bot/ghost() if(stat != DEAD) // Only ghost if we're doing this while alive, the pAI probably isn't dead yet. diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 88af1143648..7011ce950e2 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -51,10 +51,6 @@ ..(gibbed) regenerate_icons() -/mob/living/simple_animal/pet/dog/corgi/revive() - ..() - regenerate_icons() - /mob/living/simple_animal/pet/dog/corgi/show_inv(mob/user) user.set_machine(src) if(user.stat) return diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm index 88f079e76ee..58c5c241ccd 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm @@ -240,16 +240,7 @@ /mob/living/simple_animal/drone/experience_pressure_difference(pressure_difference, direction) return -/mob/living/simple_animal/drone/revive() +/mob/living/simple_animal/drone/fully_heal(admin_revive = 0) adjustBruteLoss(-getBruteLoss()) //Heal all brute damage - stat = CONSCIOUS - updatehealth() - icon_state = icon_living - if(stat == DEAD) - dead_mob_list -= src - living_mob_list += src - update_sight() - reload_fullscreen() - update_canmove() diff --git a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm index a8dbdc217f3..a68dcf7516c 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm @@ -34,7 +34,7 @@ return D.visible_message("[D] begins to reactivate [src].", "You begin to reactivate [src]...") if(do_after(user,30, 1, target = src)) - revive() + revive(full_heal = 1) D.visible_message("[D] reactivates [src]!", "You reactivate [src].") alert_drones(DRONE_NET_CONNECT) if(G) diff --git a/code/modules/mob/living/simple_animal/friendly/pet.dm b/code/modules/mob/living/simple_animal/friendly/pet.dm index cf69255362c..dd6bbd56bc5 100644 --- a/code/modules/mob/living/simple_animal/friendly/pet.dm +++ b/code/modules/mob/living/simple_animal/friendly/pet.dm @@ -34,9 +34,10 @@ pcollar = new(src) regenerate_icons() -/mob/living/simple_animal/pet/revive() - ..() - regenerate_icons() +/mob/living/simple_animal/pet/revive(full_heal = 0, admin_revive = 0) + if(..()) + regenerate_icons() + . = 1 /mob/living/simple_animal/pet/death(gibbed) ..(gibbed) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm index 5425ae179f9..42764c0d352 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm @@ -280,7 +280,7 @@ H.visible_message("[user] forces [H] to apply [src]... they quickly regenerate all injuries!") else user << "You start to smear [src] on yourself. It feels and smells disgusting, but you feel amazingly refreshed in mere moments." - H.revive() + H.revive(fully_heal = 1) qdel(src) ..() @@ -364,9 +364,10 @@ return icon_state = "Goliath_preattack" -/mob/living/simple_animal/hostile/asteroid/goliath/revive() - anchored = 1 - ..() +/mob/living/simple_animal/hostile/asteroid/goliath/revive(full_heal = 0, admin_revive = 0) + if(..()) + anchored = 1 + . = 1 /mob/living/simple_animal/hostile/asteroid/goliath/death(gibbed) anchored = 0 diff --git a/code/modules/mob/living/simple_animal/hostile/mushroom.dm b/code/modules/mob/living/simple_animal/hostile/mushroom.dm index deeaa327f70..258b60e91a4 100644 --- a/code/modules/mob/living/simple_animal/hostile/mushroom.dm +++ b/code/modules/mob/living/simple_animal/hostile/mushroom.dm @@ -85,10 +85,11 @@ qdel(src) ..() -/mob/living/simple_animal/hostile/mushroom/revive() - ..() - icon_state = "mushroom_color" - UpdateMushroomCap() +/mob/living/simple_animal/hostile/mushroom/revive(full_heal = 0, admin_revive = 0) + if(..()) + icon_state = "mushroom_color" + UpdateMushroomCap() + . = 1 /mob/living/simple_animal/hostile/mushroom/death(gibbed) ..(gibbed) @@ -104,7 +105,7 @@ /mob/living/simple_animal/hostile/mushroom/proc/Recover() visible_message("[src] slowly begins to recover.") faint_ticker = 0 - revive() + revive(full_heal = 1) UpdateMushroomCap() recovery_cooldown = 1 spawn(300) diff --git a/code/modules/mob/living/simple_animal/hostile/zombie.dm b/code/modules/mob/living/simple_animal/hostile/zombie.dm index 482c1f7934e..9d0f091fa37 100644 --- a/code/modules/mob/living/simple_animal/hostile/zombie.dm +++ b/code/modules/mob/living/simple_animal/hostile/zombie.dm @@ -50,7 +50,7 @@ L.gib() visible_message("[src] tears [L] to pieces!") src << "You feast on [L], restoring your health!" - src.revive() + revive(full_heal = 1) /mob/living/simple_animal/hostile/zombie/death() ..() @@ -67,7 +67,7 @@ spawn(rand(800,1200)) if(src) visible_message("[src] staggers to their feet!") - src.revive() + revive(full_heal = 1) /mob/living/simple_animal/hostile/zombie/proc/Zombify(mob/living/carbon/human/H) H.set_species(/datum/species/zombie) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 88cda5f4ca9..8dbf0beae1b 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -104,8 +104,10 @@ if(status_flags & GODMODE) return if(stat != DEAD) - if(health < 1) + if(health <= 0) death() + else + stat = CONSCIOUS /mob/living/simple_animal/blind_eyes() return @@ -466,17 +468,22 @@ /mob/living/simple_animal/update_fire() return + /mob/living/simple_animal/IgniteMob() return + /mob/living/simple_animal/ExtinguishMob() return -/mob/living/simple_animal/revive() +/mob/living/simple_animal/revive(full_heal = 0, admin_revive = 0) + if(..()) //successfully ressuscitated from death + icon = initial(icon) + icon_state = icon_living + density = initial(density) + . = 1 + +/mob/living/simple_animal/fully_heal(admin_revive = 0) health = maxHealth - icon = initial(icon) - icon_state = icon_living - density = initial(density) - update_canmove() ..() /mob/living/simple_animal/proc/make_babies() // <3 <3 <3 diff --git a/code/modules/mob/living/simple_animal/slime/death.dm b/code/modules/mob/living/simple_animal/slime/death.dm index 0a20862a574..dca7d56c4e3 100644 --- a/code/modules/mob/living/simple_animal/slime/death.dm +++ b/code/modules/mob/living/simple_animal/slime/death.dm @@ -11,7 +11,7 @@ maxHealth = 150 var/datum/action/innate/slime/evolve/E = new E.Grant(src) - revive() + revive(full_heal = 1) regenerate_icons() number = rand(1, 1000) name = "[colour] [is_adult ? "adult" : "baby"] slime ([number])" diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index e1e88439f09..ec6f2fee6d9 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -86,7 +86,7 @@ max_charges = 10 //10, 5, 5, 4 /obj/item/weapon/gun/magic/wand/resurrection/zap_self(mob/living/user) - user.revive() + user.revive(full_heal = 1) user << "You feel great!" charges-- ..() diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 03859abea55..1b4e21363d5 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -49,18 +49,15 @@ /obj/item/projectile/magic/resurrection/on_hit(mob/living/carbon/target) . = ..() if(ismob(target)) - var/old_stat = target.stat - target.revive() - target.suiciding = 0 - if(!target.ckey) - for(var/mob/dead/observer/ghost in player_list) - if(target.real_name == ghost.real_name) - ghost.reenter_corpse() - break - if(old_stat != DEAD) - target << "You feel great!" - else + if(target.revive(full_heal = 1)) + if(!target.ckey) + for(var/mob/dead/observer/ghost in player_list) + if(target.real_name == ghost.real_name) + ghost.reenter_corpse() + break target << "You rise with a start, you're alive!!!" + else if(stat != DEAD) + target << "You feel great!" /obj/item/projectile/magic/teleport name = "bolt of teleportation" diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 62a15602716..f00e7eb4062 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -707,13 +707,10 @@ spawn (100) //so the ghost has time to re-enter return else - M.adjustOxyLoss(-20) - M.adjustToxLoss(-20) - if(M.health > config.health_threshold_dead && M.getorgan(/obj/item/organ/internal/brain)) - M.stat = UNCONSCIOUS - M.blind_eyes(1) - dead_mob_list -= M - living_mob_list |= list(M) + M.adjustOxyLoss(-20, 0) + M.adjustToxLoss(-20, 0) + M.updatehealth() + if(M.revive()) M.emote("gasp") add_logs(M, M, "revived", src) ..() From 2dd476f13e048e410c03a10f3a68d82f7248851e Mon Sep 17 00:00:00 2001 From: phil235 Date: Wed, 17 Feb 2016 01:23:36 +0100 Subject: [PATCH 2/2] Fixes shaking someone resting not making them stand up. Fixes shaking someone not reducing the sleeping var if the mob asleep is buckled to stand up. Fixes merge conflict issues. Fixes my revive code leaving the revived AI blind. --- code/modules/mob/living/carbon/carbon.dm | 6 ++++-- code/modules/mob/living/living.dm | 2 +- code/modules/mob/living/silicon/ai/life.dm | 3 ++- code/modules/projectiles/projectile/magic.dm | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 519878c5556..90a165abc9a 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -153,16 +153,18 @@ if(health >= 0) if(lying) - AdjustSleeping(-5) M.visible_message("[M] shakes [src] trying to get \him up!", \ "You shake [src] trying to get \him up!") else M.visible_message("[M] hugs [src] to make \him feel better!", \ "You hug [src] to make \him feel better!") - + AdjustSleeping(-5) AdjustParalysis(-3) AdjustStunned(-3) AdjustWeakened(-3) + if(resting) + resting = 0 + update_canmove() playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 6812628a6e3..9db435ddfc8 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -978,7 +978,7 @@ Sorry Giacom. Please don't be mad :( src << "You're too exhausted to keep going..." Weaken(5) setStaminaLoss(health - 2) - update_health_hud() + update_health_hud() /mob/proc/update_sight() return diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 9eb76d2c9a0..842842a37bf 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -73,8 +73,9 @@ if(health <= config.health_threshold_dead) death() return - else + else if(stat == UNCONSCIOUS) stat = CONSCIOUS + adjust_blindness(-1) diag_hud_set_status() /mob/living/silicon/ai/update_sight() diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 0acd30491e8..1a3dd84e13c 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -62,7 +62,7 @@ ghost.reenter_corpse() break target << "You rise with a start, you're alive!!!" - else if(stat != DEAD) + else if(target.stat != DEAD) target << "You feel great!" /obj/item/projectile/magic/teleport