#define GHOST_CAN_REENTER 1 #define GHOST_IS_OBSERVER 2 /mob/dead/observer name = "ghost" desc = "It's a g-g-g-g-ghooooost!" //jinkies! icon = 'icons/mob/mob.dmi' icon_state = "ghost" layer = 4 stat = DEAD density = 0 canmove = 0 blinded = 0 anchored = 1 // don't get pushed around invisibility = INVISIBILITY_OBSERVER var/can_reenter_corpse 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. //If you died in the game and are a ghsot - this will remain as null. //Note that this is not a reliable way to determine if admins started as observers, since they change mobs a lot. universal_speak = 1 var/atom/movable/following = null var/medHUD = 0 /mob/dead/observer/New(var/mob/body=null, var/flags=1) sight |= SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF see_invisible = SEE_INVISIBLE_OBSERVER see_in_dark = 100 verbs += /mob/dead/observer/proc/dead_tele // Our new boo spell. spell_list += new /obj/effect/proc_holder/spell/aoe_turf/boo(src) can_reenter_corpse = flags & GHOST_CAN_REENTER started_as_observer = flags & GHOST_IS_OBSERVER stat = DEAD var/turf/T if(ismob(body)) T = get_turf(body) //Where is the body located? attack_log = body.attack_log //preserve our attack logs by copying them to our ghost if (ishuman(body)) var/mob/living/carbon/human/H = body icon = H.stand_icon overlays = H.overlays_standing else icon = body.icon icon_state = body.icon_state overlays = body.overlays alpha = 127 gender = body.gender if(body.mind && body.mind.name) name = body.mind.name else if(body.real_name) name = body.real_name else if(gender == MALE) name = capitalize(pick(first_names_male)) + " " + capitalize(pick(last_names)) else name = capitalize(pick(first_names_female)) + " " + capitalize(pick(last_names)) mind = body.mind //we don't transfer the mind but we keep a reference to it. if(!T) T = pick(latejoin) //Safety in case we cannot find the body's position loc = T if(!name) //To prevent nameless ghosts name = capitalize(pick(first_names_male)) + " " + capitalize(pick(last_names)) real_name = name ..() /mob/dead/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) return 1 /* Transfer_mind is there to check if mob is being deleted/not going to have a body. Works together with spawning an observer, noted above. */ /mob/dead/observer/Life() ..() if(!loc) return if(!client) return 0 if(client.images.len) for(var/image/hud in client.images) if(copytext(hud.icon_state,1,4) == "hud") client.images.Remove(hud) if(antagHUD) var/list/target_list = list() for(var/mob/living/target in oview(src)) if( target.mind&&(target.mind.special_role||issilicon(target)) ) target_list += target if(target_list.len) assess_targets(target_list, src) if(medHUD) process_medHUD(src) // Direct copied from medical HUD glasses proc, used to determine what health bar to put over the targets head. /mob/dead/proc/RoundHealth(var/health) switch(health) if(100 to INFINITY) return "health100" if(70 to 100) return "health80" if(50 to 70) return "health60" if(30 to 50) return "health40" if(18 to 30) return "health25" if(5 to 18) return "health10" if(1 to 5) return "health1" if(-99 to 0) return "health0" else return "health-100" return "0" // Pretty much a direct copy of Medical HUD stuff, except will show ill if they are ill instead of also checking for known illnesses. /mob/dead/proc/process_medHUD(var/mob/M) var/client/C = M.client var/image/holder for(var/mob/living/carbon/human/patient in oview(M)) var/foundVirus = 0 if(patient.virus2.len) foundVirus = 1 if(!C) return holder = patient.hud_list[HEALTH_HUD] if(patient.stat == 2) holder.icon_state = "hudhealth-100" else holder.icon_state = "hud[RoundHealth(patient.health)]" C.images += holder holder = patient.hud_list[STATUS_HUD] if(patient.stat == 2) holder.icon_state = "huddead" else if(patient.status_flags & XENO_HOST) holder.icon_state = "hudxeno" else if(foundVirus) holder.icon_state = "hudill" else if(patient.has_brain_worms()) var/mob/living/simple_animal/borer/B = patient.has_brain_worms() if(B.controlling) holder.icon_state = "hudbrainworm" else holder.icon_state = "hudhealthy" else holder.icon_state = "hudhealthy" C.images += holder /mob/dead/proc/assess_targets(list/target_list, mob/dead/observer/U) var/icon/tempHud = 'icons/mob/hud.dmi' for(var/mob/living/target in target_list) if(iscarbon(target)) switch(target.mind.special_role) if("traitor","Syndicate") U.client.images += image(tempHud,target,"hudsyndicate") if("Revolutionary") U.client.images += image(tempHud,target,"hudrevolutionary") if("Head Revolutionary") U.client.images += image(tempHud,target,"hudheadrevolutionary") if("Cultist") U.client.images += image(tempHud,target,"hudcultist") if("Changeling") U.client.images += image(tempHud,target,"hudchangeling") if("Wizard","Fake Wizard") U.client.images += image(tempHud,target,"hudwizard") if("Hunter","Sentinel","Drone","Queen") U.client.images += image(tempHud,target,"hudalien") if("Death Commando") U.client.images += image(tempHud,target,"huddeathsquad") if("Ninja") U.client.images += image(tempHud,target,"hudninja") if("Vampire") U.client.images += image(tempHud,target,"vampire") if("VampThrall") U.client.images += image(tempHud,target,"vampthrall") else//If we don't know what role they have but they have one. U.client.images += image(tempHud,target,"hudunknown1") else//If the silicon mob has no law datum, no inherent laws, or a law zero, add them to the hud. var/mob/living/silicon/silicon_target = target if(!silicon_target.laws||(silicon_target.laws&&(silicon_target.laws.zeroth||!silicon_target.laws.inherent.len))||silicon_target.mind.special_role=="traitor") if(isrobot(silicon_target))//Different icons for robutts and AI. U.client.images += image(tempHud,silicon_target,"hudmalborg") else U.client.images += image(tempHud,silicon_target,"hudmalai") return 1 /mob/proc/ghostize(var/flags = GHOST_CAN_REENTER) if(key) var/mob/dead/observer/ghost = new(src, flags) //Transfer safety to observer spawning proc. ghost.timeofdeath = src.timeofdeath //BS12 EDIT respawnable_list -= src if(ghost.can_reenter_corpse) respawnable_list += ghost ghost.key = key if(!ghost.client.holder && !config.antag_hud_allowed) // For new ghosts we remove the verb from even showing up if it's not allowed. ghost.verbs -= /mob/dead/observer/verb/toggle_antagHUD // Poor guys, don't know what they are missing! return ghost /* This is the proc mobs get to turn into a ghost. Forked from ghostize due to compatibility issues. */ /mob/living/verb/ghost() set category = "OOC" set name = "Ghost" set desc = "Relinquish your life and enter the land of the dead." var/mob/M = src if(stat == DEAD) 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 resting = 1 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. var/obj/structure/morgue/Morgue = locate() in M.loc if(istype(M.loc,/obj/structure/morgue)) Morgue = M.loc if(Morgue) Morgue.update() return /mob/dead/observer/Move(NewLoc, direct) dir = direct if(NewLoc) loc = NewLoc for(var/obj/effect/step_trigger/S in NewLoc) S.Crossed(src) return loc = get_turf(src) //Get out of closets and such as a ghost if((direct & NORTH) && y < world.maxy) y++ else if((direct & SOUTH) && y > 1) y-- if((direct & EAST) && x < world.maxx) x++ else if((direct & WEST) && x > 1) x-- for(var/obj/effect/step_trigger/S in locate(x, y, z)) //<-- this is dumb S.Crossed(src) /mob/dead/observer/examine() if(usr) usr << desc /mob/dead/observer/can_use_hands() return 0 /mob/dead/observer/is_active() return 0 /mob/dead/observer/Stat() ..() statpanel("Status") if (client.statpanel == "Status") stat(null, "Station Time: [worldtime2text()]") if(ticker) if(ticker.mode) //world << "DEBUG: ticker not null" if(ticker.mode.name == "AI malfunction") //world << "DEBUG: malf mode ticker test" if(ticker.mode:malf_mode_declared) stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]") if(emergency_shuttle) if(emergency_shuttle.online && emergency_shuttle.location < 2) var/timeleft = emergency_shuttle.timeleft() if (timeleft) stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") /mob/dead/observer/verb/reenter_corpse() set category = "Ghost" set name = "Re-enter Corpse" if(!client) return if(!can_reenter_corpse) src << "You've given up your right to respawn!" return if(!(mind && mind.current && can_reenter_corpse)) src << "You have no body." return if(mind.current.key && copytext(mind.current.key,1,2)!="@") //makes sure we don't accidentally kick any clients usr << "Another consciousness is in your body...It is resisting you." return if(mind.current.ajourn && mind.current.stat != DEAD) //check if the corpse is astral-journeying (it's client ghosted using a cultist rune). var/obj/effect/rune/R = locate() in mind.current.loc //whilst corpse is alive, we can only reenter the body if it's on the rune if(!(R && R.word1 == cultwords["hell"] && R.word2 == cultwords["travel"] && R.word3 == cultwords["self"])) //astral journeying rune usr << "The astral cord that ties your body and your spirit has been severed. You are likely to wander the realm beyond until your body is finally dead and thus reunited with you." return mind.current.ajourn=0 mind.current.key = key var/obj/structure/morgue/Morgue = locate() in mind.current.loc if(istype(mind.current.loc,/obj/structure/morgue)) Morgue = mind.current.loc if(Morgue) Morgue.update() return 1 /mob/dead/observer/verb/toggle_medHUD() set category = "Ghost" set name = "Toggle MedicHUD" set desc = "Toggles Medical HUD allowing you to see how everyone is doing" if(!client) return if(medHUD) medHUD = 0 src << "\blue Medical HUD Disabled" else medHUD = 1 src << "\blue Medical HUD Enabled" /mob/dead/observer/verb/toggle_antagHUD() set category = "Ghost" set name = "Toggle AntagHUD" set desc = "Toggles AntagHUD allowing you to see who is the antagonist" if(!config.antag_hud_allowed && !client.holder) src << "\red Admins have disabled this for this round." return if(!client) return var/mob/dead/observer/M = src if(jobban_isbanned(M, "AntagHUD")) src << "\red You have been banned from using this feature" return if(config.antag_hud_restricted && !M.has_enabled_antagHUD &&!client.holder) var/response = alert(src, "If you turn this on, you will not be able to take any part in the round.","Are you sure you want to turn this feature on?","Yes","No") if(response == "No") return M.can_reenter_corpse = 0 if(M in respawnable_list) respawnable_list -= M if(!M.has_enabled_antagHUD && !client.holder) M.has_enabled_antagHUD = 1 if(M.antagHUD) M.antagHUD = 0 src << "\blue AntagHUD Disabled" else M.antagHUD = 1 src << "\blue AntagHUD Enabled" /mob/dead/observer/proc/dead_tele() set category = "Ghost" set name = "Teleport" set desc= "Teleport to a location" if(!istype(usr, /mob/dead/observer)) usr << "Not when you're not dead!" return usr.verbs -= /mob/dead/observer/proc/dead_tele spawn(30) usr.verbs += /mob/dead/observer/proc/dead_tele var/A A = input("Area to jump to", "BOOYEA", A) as null|anything in ghostteleportlocs var/area/thearea = ghostteleportlocs[A] if(!thearea) return var/list/L = list() for(var/turf/T in get_area_turfs(thearea.type)) L+=T if(!L || !L.len) usr << "No area available." usr.loc = pick(L) /mob/dead/observer/verb/follow() set category = "Ghost" set name = "Follow" // "Haunt" set desc = "Follow and haunt a mob." if(istype(usr, /mob/dead/observer)) var/list/mobs = getmobs() var/input = input("Please, select a mob!", "Haunt", null, null) as null|anything in mobs var/mob/target = mobs[input] if(target && target != usr) following = target spawn(0) var/turf/pos = get_turf(src) while(src.loc == pos) var/turf/T = get_turf(target) if(!T) break if(following != target) break if(!client) break src.loc = T pos = src.loc sleep(15) following = null /mob/dead/observer/verb/jumptomob() //Moves the ghost instead of just changing the ghosts's eye -Nodrak set category = "Ghost" set name = "Jump to Mob" set desc = "Teleport to a mob" if(istype(usr, /mob/dead/observer)) //Make sure they're an observer! var/list/dest = list() //List of possible destinations (mobs) var/target = null //Chosen target. dest += getmobs() //Fill list, prompt user with list target = input("Please, select a player!", "Jump to Mob", null, null) as null|anything in dest if (!target)//Make sure we actually have a target return else var/mob/M = dest[target] //Destination mob var/mob/A = src //Source mob var/turf/T = get_turf(M) //Turf of the destination mob if(T && isturf(T)) //Make sure the turf exists, then move the source to that destination. A.loc = T else A << "This mob is not located in the game world." /* Now a spell. See spells.dm /mob/dead/observer/verb/boo() set category = "Ghost" set name = "Boo!" set desc= "Scare your crew members because of boredom!" if(bootime > world.time) return bootime = world.time + 600 var/obj/machinery/light/L = locate(/obj/machinery/light) in view(1, src) if(L) L.flicker() //Maybe in the future we can add more spooky code here! return */ /mob/dead/observer/memory() set hidden = 1 src << "\red You are dead! You have no mind to store memory!" /mob/dead/observer/add_memory() set hidden = 1 src << "\red You are dead! You have no mind to store memory!" /mob/dead/observer/verb/analyze_air() set name = "Analyze Air" set category = "Ghost" if(!istype(usr, /mob/dead/observer)) return // Shamelessly copied from the Gas Analyzers if (!( istype(usr.loc, /turf) )) return var/datum/gas_mixture/environment = usr.loc.return_air() var/pressure = environment.return_pressure() var/total_moles = environment.total_moles() src << "\blue Results:" if(abs(pressure - ONE_ATMOSPHERE) < 10) src << "\blue Pressure: [round(pressure,0.1)] kPa" else src << "\red Pressure: [round(pressure,0.1)] kPa" if(total_moles) var/o2_concentration = environment.oxygen/total_moles var/n2_concentration = environment.nitrogen/total_moles var/co2_concentration = environment.carbon_dioxide/total_moles var/plasma_concentration = environment.toxins/total_moles var/unknown_concentration = 1-(o2_concentration+n2_concentration+co2_concentration+plasma_concentration) if(abs(n2_concentration - N2STANDARD) < 20) src << "\blue Nitrogen: [round(n2_concentration*100)]% ([round(environment.nitrogen,0.01)] moles)" else src << "\red Nitrogen: [round(n2_concentration*100)]% ([round(environment.nitrogen,0.01)] moles)" if(abs(o2_concentration - O2STANDARD) < 2) src << "\blue Oxygen: [round(o2_concentration*100)]% ([round(environment.oxygen,0.01)] moles)" else src << "\red Oxygen: [round(o2_concentration*100)]% ([round(environment.oxygen,0.01)] moles)" if(co2_concentration > 0.01) src << "\red CO2: [round(co2_concentration*100)]% ([round(environment.carbon_dioxide,0.01)] moles)" else src << "\blue CO2: [round(co2_concentration*100)]% ([round(environment.carbon_dioxide,0.01)] moles)" if(plasma_concentration > 0.01) src << "\red Plasma: [round(plasma_concentration*100)]% ([round(environment.toxins,0.01)] moles)" if(unknown_concentration > 0.01) src << "\red Unknown: [round(unknown_concentration*100)]% ([round(unknown_concentration*total_moles,0.01)] moles)" src << "\blue Temperature: [round(environment.temperature-T0C,0.1)]°C" src << "\blue Heat Capacity: [round(environment.heat_capacity(),0.1)]" /mob/dead/observer/verb/toggle_darkness() set name = "Toggle Darkness" set category = "Ghost" if (see_invisible == SEE_INVISIBLE_OBSERVER_NOLIGHTING) see_invisible = SEE_INVISIBLE_OBSERVER else see_invisible = SEE_INVISIBLE_OBSERVER_NOLIGHTING /mob/dead/observer/verb/view_manfiest() set name = "View Crew Manifest" set category = "Ghost" var/dat dat += "

Crew Manifest

" dat += data_core.get_manifest() src << browse(dat, "window=manifest;size=370x420;can_close=1") //BEGIN TELEPORT HREF CODE /mob/dead/observer/Topic(href, href_list) if(usr != src) return ..() if (href_list["follow"]) var/mob/target = locate(href_list["follow"]) in mob_list var/mob/A = usr; A << "You are now following [target]" //var/mob/living/silicon/ai/A = locate(href_list["track2"]) in mob_list if(target && target != usr) following = target spawn(0) var/turf/pos = get_turf(A) while(A.loc == pos) var/turf/T = get_turf(target) if(!T) break if(following != target) break if(!client) break A.loc = T pos = A.loc sleep(15) following = null ..() //END TELEPORT HREF CODE