From 1f5de7f64f5293dbbfe1b7c75c8618ff9bcbf77f Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Thu, 19 Mar 2015 16:14:02 +0100 Subject: [PATCH] Ports /tg/ & Paradise ghost sight. Ghosts can now toggle darkness and seeing ghostly things independently. Includes some extra work to allow observers to see AI eyes while (mostly) preventing cultists from doing the same. --- baystation12.dme | 1 + code/game/gamemodes/cult/runes.dm | 22 +++--- code/modules/mob/dead/observer/login.dm | 5 +- code/modules/mob/dead/observer/observer.dm | 76 ++++++++++++++----- code/modules/mob/living/carbon/human/life.dm | 4 +- .../mob/living/silicon/ai/freelook/eye.dm | 21 ++++- code/setup.dm | 9 +-- 7 files changed, 99 insertions(+), 39 deletions(-) diff --git a/baystation12.dme b/baystation12.dme index 7405112d30..d8f9ea384c 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1072,6 +1072,7 @@ #include "code\modules\mob\typing_indicator.dm" #include "code\modules\mob\update_icons.dm" #include "code\modules\mob\dead\death.dm" +#include "code\modules\mob\dead\observer\login.dm" #include "code\modules\mob\dead\observer\logout.dm" #include "code\modules\mob\dead\observer\observer.dm" #include "code\modules\mob\dead\observer\say.dm" diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index 21c0b8e78b..51d1605e52 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -104,16 +104,16 @@ var/list/sacrificed = list() if(!iscultist(M) && M.stat < DEAD && !(M in converting)) target = M break - + if(!target) //didn't find any new targets if(!converting.len) fizzle() else usr << "You sense that the power of the dark one is already working away at them." return - + usr.say("Mah[pick("'","`")]weyh pleggh at e'ntrath!") - + converting |= target var/list/waiting_for_input = list(target = 0) //need to box this up in order to be able to reset it again from inside spawn, apparently var/initial_message = 0 @@ -123,7 +123,7 @@ var/list/sacrificed = list() if(target.getFireLoss() < 100) target.hallucination = min(target.hallucination, 500) return 0 - + target.take_overall_damage(0, rand(5, 20)) // You dirty resister cannot handle the damage to your mind. Easily. - even cultists who accept right away should experience some effects // Resist messages go! if(initial_message) //don't do this stuff right away, only if they resist or hesitate. @@ -139,7 +139,7 @@ var/list/sacrificed = list() target << "Your mind turns to ash as the burning flames engulf your very soul and images of an unspeakable horror begin to bombard the last remnants of mental resistance." //broken mind - 5000 may seem like a lot I wanted the effect to really stand out for maxiumum losing-your-mind-spooky //hallucination is reduced when the step off as well, provided they haven't hit the last stage... - target.hallucination += 5000 + target.hallucination += 5000 target.apply_effect(10, STUTTER) target.adjustBrainLoss(1) if(100 to INFINITY) @@ -156,12 +156,12 @@ var/list/sacrificed = list() if(!waiting_for_input[target]) //so we don't spam them with dialogs if they hesitate waiting_for_input[target] = 1 - + if(!is_convertable_to_cult(target.mind) || jobban_isbanned(target, "cultist"))//putting jobban check here because is_convertable uses mind as argument //waiting_for_input ensures this is only shown once, so they basically auto-resist from here on out. They still need to find a way to get off the freaking rune if they don't want to burn to death, though. target << "Your blood pulses. Your head throbs. The world goes red. All at once you are aware of a horrible, horrible truth. The veil of reality has been ripped away and in the festering wound left behind something sinister takes root." - target << "And you were able to force it out of your mind. You now know the truth, there's something horrible out there, stop it and its minions at all costs." - + target << "And you were able to force it out of your mind. You now know the truth, there's something horrible out there, stop it and its minions at all costs." + else spawn() var/choice = alert(target,"Do you want to join the cult?","Submit to Nar'Sie","Resist","Submit") waiting_for_input[target] = 0 @@ -172,7 +172,7 @@ var/list/sacrificed = list() target << "Assist your new compatriots in their dark dealings. Their goal is yours, and yours is theirs. You serve the Dark One above all else. Bring It back." converting -= target target.hallucination = 0 //sudden clarity - + sleep(100) //proc once every 10 seconds return 1 @@ -263,12 +263,12 @@ var/list/sacrificed = list() usr.seer = 0 else if(usr.see_invisible!=SEE_INVISIBLE_LIVING) usr << "\red The world beyond flashes your eyes but disappears quickly, as if something is disrupting your vision." - usr.see_invisible = SEE_INVISIBLE_OBSERVER + usr.see_invisible = SEE_INVISIBLE_CULT usr.seer = 0 else usr.say("Rash'tla sektath mal[pick("'","`")]zua. Zasan therium vivira. Itonis al'ra matum!") usr << "\red The world beyond opens to your eyes." - usr.see_invisible = SEE_INVISIBLE_OBSERVER + usr.see_invisible = SEE_INVISIBLE_CULT usr.seer = 1 return return fizzle() diff --git a/code/modules/mob/dead/observer/login.dm b/code/modules/mob/dead/observer/login.dm index ce0dbe3d57..bf9b607a38 100644 --- a/code/modules/mob/dead/observer/login.dm +++ b/code/modules/mob/dead/observer/login.dm @@ -1,2 +1,5 @@ /mob/dead/observer/Login() - ..() \ No newline at end of file + ..() + if (ghostimage) + ghostimage.icon_state = src.icon_state + updateghostimages() diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 058f5d6044..7022954c6c 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -1,3 +1,6 @@ +var/global/list/image/ghost_darkness_images = list() //this is a list of images for things ghosts should still be able to see when they toggle darkness +var/global/list/image/ghost_sightless_images = list() //this is a list of images for things ghosts should still be able to see even without ghost sight + /mob/dead/observer name = "ghost" desc = "It's a g-g-g-g-ghooooost!" //jinkies! @@ -23,15 +26,22 @@ var/atom/movable/following = null var/admin_ghosted = 0 var/anonsay = 0 + var/image/ghostimage = null //this mobs ghost image, for deleting and stuff + var/ghostvision = 1 //is the ghost able to see things humans can't? + var/seedarkness = 1 /mob/dead/observer/New(mob/body) sight |= SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF - see_invisible = SEE_INVISIBLE_OBSERVER_AI_EYE + see_invisible = SEE_INVISIBLE_OBSERVER see_in_dark = 100 verbs += /mob/dead/observer/proc/dead_tele stat = DEAD + ghostimage = image(src.icon,src,src.icon_state) + ghost_darkness_images |= ghostimage + updateallghostimages() + var/turf/T if(ismob(body)) T = get_turf(body) //Where is the body located? @@ -70,7 +80,13 @@ real_name = name ..() - +/mob/dead/observer/Del() + if (ghostimage) + ghost_darkness_images -= ghostimage + del(ghostimage) + ghostimage = null + updateallghostimages() + ..() /mob/dead/observer/Topic(href, href_list) if (href_list["track"]) @@ -403,22 +419,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp src << "\blue Temperature: [round(environment.temperature-T0C,0.1)]°C ([round(environment.temperature,0.1)]K)" src << "\blue Heat Capacity: [round(environment.heat_capacity(),0.1)]" - -/mob/dead/observer/verb/toggle_sight() - set name = "Toggle Sight" - set category = "Ghost" - - switch(see_invisible) - if(SEE_INVISIBLE_OBSERVER_AI_EYE) - see_invisible = SEE_INVISIBLE_OBSERVER_NOOBSERVERS - usr << "You no longer see other observers or the AI eye." - if(SEE_INVISIBLE_OBSERVER_NOOBSERVERS) - see_invisible = SEE_INVISIBLE_OBSERVER_NOLIGHTING - usr << "You no longer see darkness." - else - see_invisible = SEE_INVISIBLE_OBSERVER_AI_EYE - usr << "You again see everything." - /mob/dead/observer/verb/become_mouse() set name = "Become mouse" set category = "Ghost" @@ -620,3 +620,43 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/canface() return 1 + +/mob/dead/observer/verb/toggle_ghostsee() + set name = "Toggle Ghost Vision" + set desc = "Toggles your ability to see things only ghosts can see, like other ghosts" + set category = "Ghost" + ghostvision = !(ghostvision) + updateghostsight() + usr << "You [(ghostvision?"now":"no longer")] have ghost vision." + +/mob/dead/observer/verb/toggle_darkness() + set name = "Toggle Darkness" + set category = "Ghost" + seedarkness = !(seedarkness) + updateghostsight() + +/mob/dead/observer/proc/updateghostsight() + if (!seedarkness) + see_invisible = SEE_INVISIBLE_OBSERVER_NOLIGHTING + else + see_invisible = SEE_INVISIBLE_OBSERVER + if (!ghostvision) + see_invisible = SEE_INVISIBLE_LIVING; + updateghostimages() + +/proc/updateallghostimages() + for (var/mob/dead/observer/O in player_list) + O.updateghostimages() + +/mob/dead/observer/proc/updateghostimages() + if (!client) + return + if (seedarkness || !ghostvision) + client.images -= ghost_darkness_images + client.images |= ghost_sightless_images + else + //add images for the 60inv things ghosts can normally see when darkness is enabled so they can see them now + client.images -= ghost_sightless_images + client.images |= ghost_darkness_images + if (ghostimage) + client.images -= ghostimage //remove ourself diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 98f59f36cb..33c036a0ce 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -324,7 +324,7 @@ if(istype(O)) O.add_autopsy_data("Radiation Poisoning", damage) /** breathing **/ - + handle_chemical_smoke(var/datum/gas_mixture/environment) if(wear_mask && (wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)) return @@ -1201,7 +1201,7 @@ if(seer==1) var/obj/effect/rune/R = locate() in loc if(R && R.word1 == cultwords["see"] && R.word2 == cultwords["hell"] && R.word3 == cultwords["join"]) - see_invisible = SEE_INVISIBLE_OBSERVER + see_invisible = SEE_INVISIBLE_CULT else see_invisible = SEE_INVISIBLE_LIVING seer = 0 diff --git a/code/modules/mob/living/silicon/ai/freelook/eye.dm b/code/modules/mob/living/silicon/ai/freelook/eye.dm index c9dbfe39dd..7bfaf6eac6 100644 --- a/code/modules/mob/living/silicon/ai/freelook/eye.dm +++ b/code/modules/mob/living/silicon/ai/freelook/eye.dm @@ -14,17 +14,34 @@ status_flags = GODMODE // You can't damage it. see_in_dark = 7 invisibility = INVISIBILITY_AI_EYE + var/ghostimage = null + +/mob/aiEye/New() + ghostimage = image(src.icon,src,src.icon_state) + ghost_darkness_images |= ghostimage //so ghosts can see the AI eye when they disable darkness + ghost_sightless_images |= ghostimage //so ghosts can see the AI eye when they disable ghost sight + updateallghostimages() + ..() + +mob/aiEye/Del() + if (ghostimage) + ghost_darkness_images -= ghostimage + ghost_sightless_images -= ghostimage + del(ghostimage) + ghostimage = null; + updateallghostimages() + ..() // Movement code. Returns 0 to stop air movement from moving it. /mob/aiEye/Move() return 0 -/mob/aiEye/examinate(atom/A as mob|obj|turf in view()) +/mob/aiEye/examinate() set popup_menu = 0 set src = usr.contents return 0 -/mob/aiEye/pointed(atom/A as mob|obj|turf in view()) +/mob/aiEye/pointed() set popup_menu = 0 set src = usr.contents return 0 diff --git a/code/setup.dm b/code/setup.dm index 141734a030..8f1cc54cf5 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -457,18 +457,17 @@ #define INVISIBILITY_LEVEL_ONE 35 #define INVISIBILITY_LEVEL_TWO 45 #define INVISIBILITY_OBSERVER 60 -#define INVISIBILITY_AI_EYE 61 +#define INVISIBILITY_AI_EYE 61 #define SEE_INVISIBLE_LIVING 25 #define SEE_INVISIBLE_OBSERVER_NOLIGHTING 15 #define SEE_INVISIBLE_LEVEL_ONE 35 #define SEE_INVISIBLE_LEVEL_TWO 45 -#define SEE_INVISIBLE_OBSERVER_NOOBSERVERS 59 -#define SEE_INVISIBLE_OBSERVER 60 -#define SEE_INVISIBLE_OBSERVER_AI_EYE 61 +#define SEE_INVISIBLE_CULT 60 +#define SEE_INVISIBLE_OBSERVER 61 #define SEE_INVISIBLE_MINIMUM 5 -#define INVISIBILITY_MAXIMUM 100 +#define INVISIBILITY_MAXIMUM 100 // Object specific defines. #define CANDLE_LUM 3 // For how bright candles are.