From 93859e9652aed3f7117fdeeafeb41e95fca07da0 Mon Sep 17 00:00:00 2001 From: Amunak Date: Fri, 28 Nov 2014 13:05:26 +0100 Subject: [PATCH] Dead chat will get announcements when someone joins or leaves it. This is mainly for wizard and cult rounds, where it is important to know that a wizard/cultist is watching. The announcement was added for most other types of leaving/joining the ghost realm. Admin ghost doesn't get announced for obvious reasons. --- code/game/gamemodes/cult/runes.dm | 2 +- code/game/gamemodes/wizard/artifact.dm | 2 +- code/modules/admin/admin_verbs.dm | 3 +- code/modules/mob/dead/observer/observer.dm | 13 +++++--- .../mob/living/carbon/brain/posibrain.dm | 2 +- .../silicon/robot/drone/drone_manufacturer.dm | 1 + code/modules/mob/mob.dm | 2 ++ code/modules/mob/mob_helpers.dm | 32 +++++++++++++++++++ code/modules/mob/new_player/new_player.dm | 1 + 9 files changed, 50 insertions(+), 8 deletions(-) diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index fb6476bf07a..aeafddb0152 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -355,7 +355,7 @@ var/list/sacrificed = list() usr.visible_message("\red [usr]'s eyes glow blue as \he freezes in place, absolutely motionless.", \ "\red The shadow that is your spirit separates itself from your body. You are now in the realm beyond. While this is a great sight, being here strains your mind and body. Hurry...", \ "\red You hear only complete silence for a moment.") - usr.ghostize(1) + announce_ghost_joinleave(usr.ghostize(1), 1, "You feel that they had to use some [pick("dark", "black", "blood", "forgotten", "forbidden")] magic to [pick("invade","disturb","disrupt","infest","taint","spoil","blight")] this place!") L.ajourn = 1 while(L) if(L.key) diff --git a/code/game/gamemodes/wizard/artifact.dm b/code/game/gamemodes/wizard/artifact.dm index 2e846c5cc36..0ce1f94d12a 100644 --- a/code/game/gamemodes/wizard/artifact.dm +++ b/code/game/gamemodes/wizard/artifact.dm @@ -56,5 +56,5 @@ /obj/item/weapon/scrying/attack_self(mob/user as mob) user << "You can see... everything!" visible_message("[usr] stares into [src], their eyes glazing over.") - user.ghostize(1) + announce_ghost_joinleave(user.ghostize(1), 1, "You feel that they used a powerful artifact to [pick("invade","disturb","disrupt","infest","taint","spoil","blight")] this place with their presence.") return \ No newline at end of file diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 0920bdb1f4f..8e1c7cde225 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -377,7 +377,8 @@ var/list/admin_verbs_mentor = list( else //ghostize var/mob/body = mob - body.ghostize(1) + var/mob/dead/observer/ghost = body.ghostize(1) + ghost.admin_ghosted = 1 if(body && !body.key) body.key = "@[key]" //Haaaaaaaack. But the people have spoken. If it breaks; blame adminbus feedback_add_details("admin_verb","O") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 2927fd05b77..25a1b027946 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -21,6 +21,7 @@ var/antagHUD = 0 universal_speak = 1 var/atom/movable/following = null + var/admin_ghosted = 0 /mob/dead/observer/New(mob/body) sight |= SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF @@ -165,17 +166,18 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set desc = "Relinquish your life and enter the land of the dead." if(stat == DEAD) - ghostize(1) + announce_ghost_joinleave(ghostize(1)) else var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost, you won't be able to play this round for another 30 minutes! 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 + if(response != "Ghost") + return resting = 1 var/turf/location = get_turf(src) message_admins("[key_name_admin(usr)] has ghosted. (JMP)") log_game("[key_name_admin(usr)] has ghosted.") - 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 + 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 + announce_ghost_joinleave(ghost) /mob/dead/observer/Move(NewLoc, direct) @@ -237,6 +239,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp return mind.current.ajourn=0 mind.current.key = key + if(!admin_ghosted) + announce_ghost_joinleave(mind, 0, "They now occupy their body again.") return 1 /mob/dead/observer/verb/toggle_medHUD() @@ -460,6 +464,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp host.universal_understand = 0 host.ckey = src.ckey host << "You are now a mouse. Try to avoid interaction with players, and do not give hints away that you are more than a simple rodent." + announce_ghost_joinleave(host, 0, "They are now a mouse.") /mob/dead/observer/verb/view_manfiest() set name = "View Crew Manifest" diff --git a/code/modules/mob/living/carbon/brain/posibrain.dm b/code/modules/mob/living/carbon/brain/posibrain.dm index 4cafc219386..535952ace8d 100644 --- a/code/modules/mob/living/carbon/brain/posibrain.dm +++ b/code/modules/mob/living/carbon/brain/posibrain.dm @@ -67,7 +67,7 @@ return /obj/item/device/mmi/posibrain/proc/transfer_personality(var/mob/candidate) - + announce_ghost_joinleave(candidate, 0, "They are occupying a positronic brain now.") src.searching = 0 src.brainmob.mind = candidate.mind src.brainmob.ckey = candidate.ckey diff --git a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm index c13cd58e20c..d8009e6161c 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm @@ -66,6 +66,7 @@ if(!player || !istype(player.mob,/mob/dead)) return + announce_ghost_joinleave(player, 0, "They have taken control over a maintenance drone.") visible_message("\The [src] churns and grinds as it lurches into motion, disgorging a shiny new drone after a few moments.") flick("h_lathe_leave",src) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 2f1e8d512e4..01ec915f70d 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -437,6 +437,8 @@ var/list/slot_equipment_priority = list( \ log_game("[usr.key] AM failed due to disconnect.") return + announce_ghost_joinleave(client, 0) + var/mob/new_player/M = new /mob/new_player() if(!client) log_game("[usr.key] AM failed due to disconnect.") diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 444c8459214..daddf617f70 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -496,3 +496,35 @@ proc/is_blind(A) if(M.stat != DEAD && M.client.holder) follow = "(JMP) " M << "" + create_text_tag("dead", "DEAD:", M.client) + " [name][follow][message]" + +//Announces that a ghost has joined/left, mainly for use with wizards +/proc/announce_ghost_joinleave(O, var/joined_ghosts = 1, var/message = "") + var/client/C + //Accept any type, sort what we want here + if(istype(O, /mob)) + var/mob/M = O + if(M.client) + C = M.client + else if(istype(O, /client)) + C = O + else if(istype(O, /datum/mind)) + var/datum/mind/M = O + if(M.current && M.current.client) + C = M.current.client + else if(M.original && M.original.client) + C = M.original.client + + if(C) + var/name + if(C.mob) + var/mob/M = C.mob + if(M.mind && M.mind.name) + name = M.mind.name + if(M.real_name && M.real_name != name) + name += " ([M.real_name])" + if(!name) + name = (C.holder && C.holder.fakekey) ? C.holder.fakekey : C.key + if(joined_ghosts) + say_dead_direct("The ghost of [name] now [pick("skulks","lurks","prowls","creeps","stalks")] among the dead. [message]") + else + say_dead_direct("[name] no longer [pick("skulks","lurks","prowls","creeps","stalks")] in the realm of the dead. [message]") diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 0cb44a33584..363b1b9c41d 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -124,6 +124,7 @@ observer.loc = O.loc observer.timeofdeath = world.time // Set the time of death so that the respawn timer works correctly. + announce_ghost_joinleave(src) client.prefs.update_preview_icon() observer.icon = client.prefs.preview_icon observer.alpha = 127