From 2528be8bce28290fe01649f57d33810e8cdc5453 Mon Sep 17 00:00:00 2001 From: Cameron Lennox Date: Sat, 28 Dec 2024 05:33:47 -0500 Subject: [PATCH] Vision bugfixes (#16771) * Fixes see_invisible getting overridden - Fixes see_invisible from being overwritten if your see_invisible_default is > SEE_INVISIBLE_LEVEL_ONE. * Fixes ghost manifest() proc runtiming - Fixes a runtime of when manifest() was called on a ghost with no user. Allows admins to call manifest() without it runtiming. * Fixes the ghost 'Toggle Visibility' verb - Due to it being a variable on the proc itself, it wouldn't properly call and store the time.. * Fixes feysight - Feysight was trying to give vision into the 'see_invisible 60' layer but had forgotten to also give you the plane_holder for that layer. * fix span * More fixes - Allows ghosts to ACTUALLY USE the ghost whisper and become visible proc if their is_manifest is enabled via admins. - Allows admins to give any /mob verbs and procs instead of just /mob/living via admin add_verb topic * False --- code/modules/admin/view_variables/topic.dm | 12 ++++++--- code/modules/mob/_modifiers/feysight.dm | 2 ++ code/modules/mob/dead/observer/observer.dm | 26 ++++++++++++++------ code/modules/mob/living/carbon/human/life.dm | 14 ++++++++--- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/code/modules/admin/view_variables/topic.dm b/code/modules/admin/view_variables/topic.dm index a21d95c14e..de3e6da4af 100644 --- a/code/modules/admin/view_variables/topic.dm +++ b/code/modules/admin/view_variables/topic.dm @@ -411,14 +411,18 @@ else if(href_list["addverb"]) if(!check_rights(R_DEBUG)) return - var/mob/living/H = locate(href_list["addverb"]) + var/mob/H = locate(href_list["addverb"]) - if(!istype(H)) - to_chat(usr, "This can only be done to instances of type /mob/living") + if(!ismob(H)) + to_chat(usr, "This can only be done to instances of type /mob") return var/list/possibleverbs = list() possibleverbs += "Cancel" // One for the top... - possibleverbs += typesof(/mob/proc,/mob/verb,/mob/living/proc,/mob/living/verb) + possibleverbs += typesof(/mob/proc, /mob/verb) + if(istype(H,/mob/observer/dead)) + possibleverbs += typesof(/mob/observer/dead/proc,/mob/observer/dead/verb) + if(istype(H,/mob/living)) + possibleverbs += typesof(/mob/living/proc,/mob/living/verb) if(istype(H,/mob/living/carbon/human)) possibleverbs += typesof(/mob/living/carbon/proc,/mob/living/carbon/verb,/mob/living/carbon/human/verb,/mob/living/carbon/human/proc) if(istype(H,/mob/living/silicon/robot)) diff --git a/code/modules/mob/_modifiers/feysight.dm b/code/modules/mob/_modifiers/feysight.dm index 5ff99307b9..0cf07c935f 100644 --- a/code/modules/mob/_modifiers/feysight.dm +++ b/code/modules/mob/_modifiers/feysight.dm @@ -13,10 +13,12 @@ /datum/modifier/feysight/on_applied() holder.see_invisible = 60 holder.see_invisible_default = 60 + holder.plane_holder.set_vis(VIS_GHOSTS,TRUE) /datum/modifier/feysight/on_expire() holder.see_invisible_default = initial(holder.see_invisible_default) holder.see_invisible = holder.see_invisible_default + holder.plane_holder.set_vis(VIS_GHOSTS,FALSE) /datum/modifier/feysight/can_apply(var/mob/living/L) if(L.stat) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 6f09acb4d7..51694096e2 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -36,6 +36,7 @@ incorporeal_move = 1 var/is_manifest = 0 //If set to 1, the ghost is able to whisper. Usually only set if a cultist drags them through the veil. + var/toggled_invisible = 0 var/ghost_sprite = null var/global/list/possible_ghost_sprites = list( "Clear" = "blank", @@ -841,15 +842,19 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/observer/dead/proc/manifest(mob/user) is_manifest = TRUE - add_verb(src, /mob/observer/dead/proc/toggle_visibility) - add_verb(src, /mob/observer/dead/proc/ghost_whisper) + // Allows them to use the 'toggle_visibility' verb add_verb(src, /mob/observer/dead/verb/toggle_visibility) + // Allows them to use the 'ghost whisper' verb add_verb(src, /mob/observer/dead/verb/ghost_whisper) to_chat(src, span_filter_notice(span_purple("As you are now in the realm of the living, you can whisper to the living with the " + span_bold("Spectral Whisper") + " verb, inside the IC tab."))) + if(!user) + visible_message(span_deadsay("The ghost of \the [src] is dragged back in to our plane of reality!")) + toggle_ghost_visibility(TRUE) + return if(plane != PLANE_WORLD) user.visible_message( \ span_warning("\The [user] drags ghost, [src], to our plane of reality!"), \ span_warning("You drag [src] to our plane of reality!") \ ) - toggle_visibility(TRUE) + toggle_ghost_visibility(TRUE) else var/datum/gender/T = gender_datums[user.get_visible_gender()] user.visible_message ( \ @@ -871,12 +876,17 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/image/J = image('icons/mob/mob.dmi', loc = src, icon_state = icon) client.images += J -/mob/observer/dead/proc/toggle_visibility(var/forced = 0) - set category = "Ghost.Settings" +/mob/observer/dead/verb/toggle_visibility() + set name = "Toggle Visibility" set desc = "Allows you to turn (in)visible (almost) at will." + set category = "Ghost.Settings" + toggle_ghost_visibility() - var/toggled_invisible +/mob/observer/dead/proc/toggle_ghost_visibility(var/forced = FALSE) + if(!is_manifest) + to_chat(src, span_filter_notice("You are not strong enough to pierce the veil...")) + return if(!forced && plane == PLANE_GHOSTS && world.time < toggled_invisible + 600) to_chat(src, span_filter_notice("You must gather strength before you can turn visible again...")) return @@ -972,7 +982,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp //Culted Ghosts -/mob/observer/dead/proc/ghost_whisper() +/mob/observer/dead/verb/ghost_whisper() set name = "Spectral Whisper" set category = "IC.Subtle" @@ -992,7 +1002,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp return return 1 else - to_chat(src, span_danger("You have not been pulled past the veil!")) + to_chat(src, span_danger("You have not been pulled past the veil! You can not whisper to the living.")) /mob/observer/dead/verb/choose_ghost_sprite() set category = "Ghost.Settings" diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index d23aa3d781..bd97cc2e0c 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1631,7 +1631,11 @@ else //We aren't dead sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS) - see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : see_invisible_default + + if(see_invisible_default > SEE_INVISIBLE_LEVEL_ONE) + see_invisible = see_invisible_default + else + see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : see_invisible_default // Do this early so certain stuff gets turned off before vision is assigned. var/area/A = get_area(src) @@ -1659,7 +1663,10 @@ else sight = species.get_vision_flags(src) see_in_dark = species.darksight - see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : see_invisible_default + if(see_invisible_default > SEE_INVISIBLE_LEVEL_ONE) + see_invisible = see_invisible_default + else + see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : see_invisible_default var/glasses_processed = 0 var/obj/item/rig/rig = get_rig() @@ -1673,7 +1680,8 @@ if(XRAY in mutations) sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS see_in_dark = 8 - if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO + if(!druggy) + see_invisible = SEE_INVISIBLE_LEVEL_TWO for(var/datum/modifier/M in modifiers) if(!isnull(M.vision_flags))