diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index a1bdff99d56..9c39f84ffda 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -769,3 +769,12 @@ target_cryopod.take_occupant(person_to_cryo, 1) return 1 return 0 + +/proc/force_cryo_human(var/mob/living/carbon/person_to_cryo) + if(!istype(person_to_cryo)) + return + if(!istype(person_to_cryo.loc, /obj/machinery/cryopod)) + cryo_ssd(person_to_cryo) + if(istype(person_to_cryo.loc, /obj/machinery/cryopod)) + var/obj/machinery/cryopod/P = person_to_cryo.loc + P.despawn_occupant() diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 3a65bcabd2c..923c81c53b1 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -49,7 +49,7 @@ var/list/image/ghost_darkness_images = list() //this is a list of images for thi T = get_turf(body) //Where is the body located? attack_log = body.attack_log //preserve our attack logs by copying them to our ghost - var/mutable_appearance/MA = copy_appearance(body) + var/mutable_appearance/MA = copy_appearance(body) if(body.mind && body.mind.name) MA.name = body.mind.name else if(body.real_name) @@ -179,30 +179,44 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(P) if(TOO_EARLY_TO_GHOST) warningmsg = "It's too early in the shift to enter cryo" - // If it's not too early, we'll skip straight to ghosting out without penalty else if(suiciding && TOO_EARLY_TO_GHOST) warningmsg = "You have committed suicide too early in the round" else if(stat != DEAD) warningmsg = "You are alive" + if(isAI(src)) + warningmsg = "You are a living AI! You should probably use OOC -> Wipe Core instead." else if(GLOB.non_respawnable_keys[ckey]) warningmsg = "You have lost your right to respawn" - if(!warningmsg) - ghostize(1) - else + if(warningmsg) var/response var/alertmsg = "Are you -sure- you want to ghost?\n([warningmsg]. If you ghost now, you probably won't be able to rejoin the round! You can't change your mind, so choose wisely!)" response = alert(src, alertmsg,"Are you sure you want to ghost?","Stay in body","Ghost") if(response != "Ghost") - return //didn't want to ghost after-all - StartResting() - var/mob/dead/observer/ghost = ghostize(0) //0 parameter is so we can never re-enter our body, "Charlie, you can never come baaaack~" :3 - ghost.timeofdeath = world.time // Because the living mob won't have a time of death and we want the respawn timer to work properly. + return + + if(stat == CONSCIOUS) + if(!is_admin_level(z)) + player_ghosted = 1 + if(mind && mind.special_role) + message_admins("[key_name_admin(src)] has ghosted while alive, with special_role: [mind.special_role]") + + if(warningmsg) + // Not respawnable + var/mob/dead/observer/ghost = ghostize(0) // 0 parameter stops them re-entering their body + ghost.timeofdeath = world.time // Because the living mob won't have a time of death and we want the respawn timer to work properly. + else + // Respawnable + ghostize(1) + + // If mob in morgue tray, update tray var/obj/structure/morgue/Morgue = locate() in M.loc if(istype(M.loc, /obj/structure/morgue)) Morgue = M.loc if(Morgue) Morgue.update() + + // If mob in cryopod, despawn mob if(P) if(!P.control_computer) P.find_control_computer(urgent=1) @@ -210,7 +224,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp P.despawn_occupant() return - /mob/dead/observer/Move(NewLoc, direct) following = null dir = direct diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 81e4fe703d5..3571deb392a 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -37,6 +37,17 @@ if(life_tick == 1) regenerate_icons() // Make sure the inventory updates + handle_ghosted() + +/mob/living/carbon/human/proc/handle_ghosted() + if(player_ghosted > 0 && stat == CONSCIOUS && job && !restrained()) + if(key) + player_ghosted = 0 + else + player_ghosted++ + if(player_ghosted % 150 == 0) + force_cryo_human(src) + /mob/living/carbon/human/calculate_affecting_pressure(var/pressure) ..() var/pressure_difference = abs( pressure - ONE_ATMOSPHERE ) diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 77c74c4396e..3e9ff0b7ba6 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -173,6 +173,9 @@ //SSD var, changed it up some so people can have special things happen for different mobs when SSD. var/player_logged = 0 + //Ghosted var, set only if a player has manually ghosted out of this mob. + var/player_ghosted = 0 + var/turf/listed_turf = null //the current turf being examined in the stat panel var/list/shouldnt_see = list(/atom/movable/lighting_overlay) //list of objects that this mob shouldn't see in the stat panel. this silliness is needed because of AI alt+click and cult blood runes