From b33b19d141e213eccce70e7065130aecba2ff092 Mon Sep 17 00:00:00 2001 From: Kyep Date: Thu, 7 Mar 2019 00:04:28 -0800 Subject: [PATCH 1/8] Updates Ghost verb --- code/game/machinery/cryopod.dm | 9 +++++++++ code/modules/mob/dead/observer/observer.dm | 13 ++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) 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 7d396a7e7ea..a660012109f 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) @@ -185,8 +185,18 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp else if(GLOB.non_respawnable_keys[ckey]) warningmsg = "You have lost your right to respawn" + var/is_seen = FALSE + for(var/mob/living/L in oviewers(7, src)) + if(L.ckey && L.client && && L.stat != DEAD) + is_seen = TRUE + break + if(is_seen) + to_chat(src, "You cannot do this while observed by another player. Go somewhere more secluded first.") + return + if(!warningmsg) ghostize(1) + force_cryo_human(src) else 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!)" @@ -196,6 +206,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp 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. + force_cryo_human(src) var/obj/structure/morgue/Morgue = locate() in M.loc if(istype(M.loc, /obj/structure/morgue)) Morgue = M.loc From 67649281efe10c63e83dfe8a4d706c0b5933e88d Mon Sep 17 00:00:00 2001 From: Kyep Date: Thu, 7 Mar 2019 00:26:51 -0800 Subject: [PATCH 2/8] logic tweaks --- code/modules/mob/dead/observer/observer.dm | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index a660012109f..e67a80a25d1 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -185,16 +185,24 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp else if(GLOB.non_respawnable_keys[ckey]) warningmsg = "You have lost your right to respawn" - var/is_seen = FALSE + var/sees_someone = FALSE for(var/mob/living/L in oviewers(7, src)) - if(L.ckey && L.client && && L.stat != DEAD) - is_seen = TRUE - break - if(is_seen) - to_chat(src, "You cannot do this while observed by another player. Go somewhere more secluded first.") + if(!L.ckey) + continue + if(!L.client) + continue + if(L.stat == DEAD) + continue + if(L.invisibility >= see_invisible) + continue + sees_someone = TRUE + break + if(sees_someone) + to_chat(src, "You cannot do this while another player is nearby. Go somewhere more secluded first.") return if(!warningmsg) + cryo_ssd(src) ghostize(1) force_cryo_human(src) else @@ -203,7 +211,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp 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() + cryo_ssd(src) 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. force_cryo_human(src) From 5103e0e0669d4e8caac5f8a98147c35036a34935 Mon Sep 17 00:00:00 2001 From: Kyep Date: Thu, 7 Mar 2019 02:20:57 -0800 Subject: [PATCH 3/8] only move to cryo if ghosting while conscious --- code/modules/mob/dead/observer/observer.dm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index e67a80a25d1..8cf9907e75e 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -202,19 +202,23 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp return if(!warningmsg) - cryo_ssd(src) + if(stat == CONSCIOUS) + cryo_ssd(src) ghostize(1) - force_cryo_human(src) + if(stat == CONSCIOUS) + force_cryo_human(src) else 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 - cryo_ssd(src) + if(stat == CONSCIOUS) + cryo_ssd(src) 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. - force_cryo_human(src) + if(stat == CONSCIOUS) + force_cryo_human(src) var/obj/structure/morgue/Morgue = locate() in M.loc if(istype(M.loc, /obj/structure/morgue)) Morgue = M.loc From b0a85553164a2622464b209578633b546811fbac Mon Sep 17 00:00:00 2001 From: Kyep Date: Thu, 7 Mar 2019 02:23:08 -0800 Subject: [PATCH 4/8] allow free ghosting while dead/unconscious --- code/modules/mob/dead/observer/observer.dm | 31 +++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 8cf9907e75e..5bde99a5370 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -185,21 +185,22 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp else if(GLOB.non_respawnable_keys[ckey]) warningmsg = "You have lost your right to respawn" - var/sees_someone = FALSE - for(var/mob/living/L in oviewers(7, src)) - if(!L.ckey) - continue - if(!L.client) - continue - if(L.stat == DEAD) - continue - if(L.invisibility >= see_invisible) - continue - sees_someone = TRUE - break - if(sees_someone) - to_chat(src, "You cannot do this while another player is nearby. Go somewhere more secluded first.") - return + if(stat == CONSCIOUS) + var/sees_someone = FALSE + for(var/mob/living/L in oviewers(7, src)) + if(!L.ckey) + continue + if(!L.client) + continue + if(L.stat == DEAD) + continue + if(L.invisibility >= see_invisible) + continue + sees_someone = TRUE + break + if(sees_someone) + to_chat(src, "You cannot do this while another player is nearby. Go somewhere more secluded first.") + return if(!warningmsg) if(stat == CONSCIOUS) From 6c3fc730a88feed42fb13fc6dc78b1e145136fef Mon Sep 17 00:00:00 2001 From: Kyep Date: Sun, 10 Mar 2019 06:07:49 -0700 Subject: [PATCH 5/8] Shadeykins --- code/modules/mob/dead/observer/observer.dm | 72 +++++++++++++--------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 5bde99a5370..f4588074b39 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -177,7 +177,6 @@ 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) @@ -186,45 +185,49 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp warningmsg = "You have lost your right to respawn" if(stat == CONSCIOUS) - var/sees_someone = FALSE - for(var/mob/living/L in oviewers(7, src)) - if(!L.ckey) - continue - if(!L.client) - continue - if(L.stat == DEAD) - continue - if(L.invisibility >= see_invisible) - continue - sees_someone = TRUE - break - if(sees_someone) - to_chat(src, "You cannot do this while another player is nearby. Go somewhere more secluded first.") + + if(isAI(src)) + to_chat(src, "AIs cannot ghost while alive. If you must leave the round, use OOC -> Wipe Core instead.") return - if(!warningmsg) - if(stat == CONSCIOUS) - cryo_ssd(src) - ghostize(1) - if(stat == CONSCIOUS) - force_cryo_human(src) - else + if(sees_someone_nearby()) + to_chat(src, "You cannot ghost while alive with another player nearby. Go somewhere more secluded first.") + return + + 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 - if(stat == CONSCIOUS) - cryo_ssd(src) - 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. - if(stat == CONSCIOUS) - force_cryo_human(src) + return + + var/move_to_cryo = ishuman(src) && stat == CONSCIOUS && !P && !restrained() + if(move_to_cryo) + if(!do_after(src, 600, 0, target = src)) + return + if(restrained()) + move_to_cryo = FALSE + + if(move_to_cryo) + cryo_ssd(src) + 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(move_to_cryo) + force_cryo_human(src) + + // 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) @@ -232,6 +235,17 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp P.despawn_occupant() return +/mob/living/proc/sees_someone_nearby() + for(var/mob/living/L in oviewers(7, src)) + if(!L.ckey) + continue + if(!L.client) + continue + if(L.stat == DEAD) + continue + if(L.invisibility >= see_invisible) + continue + return TRUE /mob/dead/observer/Move(NewLoc, direct) following = null From db6484b027ba3765a9e313959994f4c85af04c99 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 12 Mar 2019 19:05:19 -0700 Subject: [PATCH 6/8] Fox update --- code/modules/mob/dead/observer/observer.dm | 24 ++++---------------- code/modules/mob/living/carbon/human/life.dm | 11 +++++++++ code/modules/mob/mob_defines.dm | 3 +++ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index f4588074b39..767d86df2a5 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -181,19 +181,11 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp 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(stat == CONSCIOUS) - - if(isAI(src)) - to_chat(src, "AIs cannot ghost while alive. If you must leave the round, use OOC -> Wipe Core instead.") - return - - if(sees_someone_nearby()) - to_chat(src, "You cannot ghost while alive with another player nearby. Go somewhere more secluded first.") - return - 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!)" @@ -201,15 +193,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(response != "Ghost") return - var/move_to_cryo = ishuman(src) && stat == CONSCIOUS && !P && !restrained() - if(move_to_cryo) - if(!do_after(src, 600, 0, target = src)) - return - if(restrained()) - move_to_cryo = FALSE + if(stat == CONSCIOUS) + player_ghosted = 1 - if(move_to_cryo) - cryo_ssd(src) if(warningmsg) // Not respawnable var/mob/dead/observer/ghost = ghostize(0) // 0 parameter stops them re-entering their body @@ -217,8 +203,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp else // Respawnable ghostize(1) - if(move_to_cryo) - force_cryo_human(src) // If mob in morgue tray, update tray var/obj/structure/morgue/Morgue = locate() in M.loc diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 8d0261528ed..84760146f8d 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -39,6 +39,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 && !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 From 1fb7a24dbcc44a044f3b1fd27c0091c8c5260a31 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 12 Mar 2019 19:26:00 -0700 Subject: [PATCH 7/8] cleanup --- code/modules/mob/dead/observer/observer.dm | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 767d86df2a5..925d47c45d3 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -219,18 +219,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp P.despawn_occupant() return -/mob/living/proc/sees_someone_nearby() - for(var/mob/living/L in oviewers(7, src)) - if(!L.ckey) - continue - if(!L.client) - continue - if(L.stat == DEAD) - continue - if(L.invisibility >= see_invisible) - continue - return TRUE - /mob/dead/observer/Move(NewLoc, direct) following = null dir = direct From 1978637be47bf892904c51443859ff4962d2056b Mon Sep 17 00:00:00 2001 From: Kyep Date: Wed, 13 Mar 2019 06:06:41 -0700 Subject: [PATCH 8/8] safety/is_admin_level, special_role alert, !job check --- code/modules/mob/dead/observer/observer.dm | 5 ++++- code/modules/mob/living/carbon/human/life.dm | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 925d47c45d3..37dd9d79167 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -194,7 +194,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp return if(stat == CONSCIOUS) - player_ghosted = 1 + 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 diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 84760146f8d..fc61557611f 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -42,7 +42,7 @@ handle_ghosted() /mob/living/carbon/human/proc/handle_ghosted() - if(player_ghosted > 0 && stat == CONSCIOUS && !restrained()) + if(player_ghosted > 0 && stat == CONSCIOUS && job && !restrained()) if(key) player_ghosted = 0 else