From e4c5f005a0072fb356c6ac97f7893d7376a78d23 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Fri, 15 Mar 2019 16:26:17 -0400 Subject: [PATCH] makes DNR apply properly to ghost roles and midround antags --- code/__HELPERS/game.dm | 3 ++- code/modules/awaymissions/corpse.dm | 5 +++++ code/modules/client/verbs/suicide.dm | 10 ++++++---- code/modules/mob/dead/observer/observer.dm | 14 +++++++++++--- modular_citadel/code/game/machinery/cryopod.dm | 6 ++---- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 7d578337bc..ad29125d95 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -413,7 +413,8 @@ var/list/candidates = list() for(var/mob/dead/observer/G in GLOB.player_list) - candidates += G + if(G.can_reenter_round) + candidates += G return pollCandidates(Question, jobbanType, gametypeCheck, be_special_flag, poll_time, ignore_category, flashwindow, candidates) diff --git a/code/modules/awaymissions/corpse.dm b/code/modules/awaymissions/corpse.dm index 276c488bce..7274f73965 100644 --- a/code/modules/awaymissions/corpse.dm +++ b/code/modules/awaymissions/corpse.dm @@ -41,6 +41,11 @@ return if(QDELETED(src) || QDELETED(user)) return + if(isobserver(user)) + var/mob/dead/observer/O = user + if(!O.can_reenter_round) + to_chat(user, "You are unable to reenter the round.") + return var/ghost_role = alert(latejoinercalling ? "Latejoin as [mob_name]? (This is a ghost role, and as such, it's very likely to be off-station.)" : "Become [mob_name]? (Warning, You can no longer be cloned!)",,"Yes","No") if(ghost_role == "No" || !loc) return diff --git a/code/modules/client/verbs/suicide.dm b/code/modules/client/verbs/suicide.dm index 64d58cd40b..2e643cc05d 100644 --- a/code/modules/client/verbs/suicide.dm +++ b/code/modules/client/verbs/suicide.dm @@ -198,11 +198,13 @@ death(0) -/mob/living/proc/suicide_log() - log_game("[key_name(src)] committed suicide at [AREACOORD(src)] as [src.type].") +/mob/living/proc/suicide_log(ghosting) + log_game("[key_name(src)] [ghosting ? "ghosted" : "committed suicide"] at [AREACOORD(src)] as [src.type].") + message_admins("[key_name(src)] [ghosting ? "ghosted" : "committed suicide"] at [AREACOORD(src)].") -/mob/living/carbon/human/suicide_log() - log_game("[key_name(src)] (job: [src.job ? "[src.job]" : "None"]) committed suicide at [AREACOORD(src)].") +/mob/living/carbon/human/suicide_log(ghosting) + log_game("[key_name(src)] (job: [src.job ? "[src.job]" : "None"]) [is_special_character(src) ? "(ANTAG!) " : ""][ghosting ? "ghosted" : "committed suicide"] at [AREACOORD(src)].") + message_admins("[key_name(src)] (job: [src.job ? "[src.job]" : "None"]) [is_special_character(src) ? "(ANTAG!) " : ""][ghosting ? "ghosted" : "committed suicide"] at [AREACOORD(src)].") /mob/living/proc/canSuicide() switch(stat) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 12fe984d6f..ad074e1f39 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -18,6 +18,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) invisibility = INVISIBILITY_OBSERVER hud_type = /datum/hud/ghost var/can_reenter_corpse + var/can_reenter_round = TRUE var/datum/hud/living/carbon/hud = null // hud var/bootime = 0 var/started_as_observer //This variable is set to 1 when you enter the game as an observer. @@ -266,6 +267,7 @@ Works together with spawning an observer, noted above. var/mob/dead/observer/ghost = new(src) // Transfer safety to observer spawning proc. SStgui.on_transfer(src, ghost) // Transfer NanoUIs. ghost.can_reenter_corpse = can_reenter_corpse + ghost.can_reenter_round = (can_reenter_corpse && !suiciding) ghost.key = key return ghost @@ -280,7 +282,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp // CITADEL EDIT if(istype(loc, /obj/machinery/cryopod)) - var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you may not play again this round! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") + var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you won't be able to re-enter this round! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") if(response != "Ghost")//darn copypaste return var/obj/machinery/cryopod/C = loc @@ -293,20 +295,22 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(stat == DEAD) ghostize(1) else - var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you may not play again this round! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") + var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you won't be able to re-enter this round! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") if(response != "Ghost") return //didn't want to ghost after-all ghostize(0) //0 parameter is so we can never re-enter our body, "Charlie, you can never come baaaack~" :3 + suicide_log(TRUE) /mob/camera/verb/ghost() set category = "OOC" set name = "Ghost" set desc = "Relinquish your life and enter the land of the dead." - var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you may not play again this round! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") + var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you won't be able to re-enter this round! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") if(response != "Ghost") return ghostize(0) + suicide_log(TRUE) /mob/dead/observer/Move(NewLoc, direct) if(updatedir) @@ -617,6 +621,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp to_chat(src, "This isn't really a creature, now is it!") return 0 + if(!can_reenter_round) + to_chat(src, "You are unable to re-enter the round.") + return FALSE + if(can_reenter_corpse && mind && mind.current) if(alert(src, "Your soul is still tied to your former life as [mind.current.name], if you go forward there is no going back to that life. Are you sure you wish to continue?", "Move On", "Yes", "No") == "No") return 0 diff --git a/modular_citadel/code/game/machinery/cryopod.dm b/modular_citadel/code/game/machinery/cryopod.dm index 9369fa7677..1ff628bfbd 100644 --- a/modular_citadel/code/game/machinery/cryopod.dm +++ b/modular_citadel/code/game/machinery/cryopod.dm @@ -365,10 +365,8 @@ // Ghost and delete the mob. if(!mob_occupant.get_ghost(1)) - if(world.time < 30 * 600)//before the 30 minute mark - mob_occupant.ghostize(0) // Players despawned too early may not re-enter the game - else - mob_occupant.ghostize(1) + mob_occupant.ghostize(0) // Players who cryo out may not re-enter the round + QDEL_NULL(occupant) open_machine() name = initial(name)