[MIRROR] Invisibility refactor [MDB IGNORE] (#24405)

* Invisibility refactor (#78908)

This adds a tracker for sources of invisibility and a priority system. I
needed this for another thing so I'm doing this first since it touches a
lot of code. As for the bugs fixed in the changelog, it's only what I
noticed while going through everything and there's likely a few more
things fixed with this. This should be testmerged for a while, I'll
bring this out of draft when it feels safe.

🆑
admin: Invisimin can now be used on mobs that are already invisible,
whether through temporary or permanent effects.
fix: Monkeyize/Humanize mob transformations no longer permanently reveal
invisible mobs if they had effects making them invisible otherwise.
fix: Objects with the undertile element that have been made invisible
through other means are no longer revealed by being uncovered.
/🆑

* Invisibility refactor

---------

Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
This commit is contained in:
SkyratBot
2023-10-18 00:36:09 -04:00
committed by GitHub
co-authored by Emmett Gaines
parent 2aafba9975
commit 6e677a2bbd
40 changed files with 195 additions and 89 deletions
@@ -651,7 +651,7 @@
/obj/item/melee/ghost_sword/Destroy()
for(var/mob/dead/observer/G in spirits)
G.invisibility = GLOB.observer_default_invisibility
G.RemoveInvisibility(type)
spirits.Cut()
STOP_PROCESSING(SSobj, src)
. = ..()
@@ -690,10 +690,10 @@
continue
var/mob/dead/observer/G = i
ghost_counter++
G.invisibility = 0
G.SetInvisibility(INVISIBILITY_NONE, id=type, priority=INVISIBILITY_PRIORITY_BASIC_ANTI_INVISIBILITY)
current_spirits |= G
for(var/mob/dead/observer/G in spirits - current_spirits)
G.invisibility = GLOB.observer_default_invisibility
G.RemoveInvisibility(type)
spirits = current_spirits
return ghost_counter
+2 -2
View File
@@ -1052,7 +1052,7 @@
/obj/item/cursed_katana/proc/cloak(mob/living/target, mob/user)
user.alpha = 150
user.invisibility = INVISIBILITY_OBSERVER // so hostile mobs cant see us or target us
user.SetInvisibility(INVISIBILITY_OBSERVER, id=type) // so hostile mobs cant see us or target us
user.add_sight(SEE_SELF) // so we can see us
user.visible_message(span_warning("[user] vanishes into thin air!"),
span_notice("You enter the dark cloak."))
@@ -1066,7 +1066,7 @@
/obj/item/cursed_katana/proc/uncloak(mob/user)
user.alpha = 255
user.invisibility = 0
user.RemoveInvisibility(type)
user.clear_sight(SEE_SELF)
user.visible_message(span_warning("[user] appears from thin air!"),
span_notice("You exit the dark cloak."))