Skip to content

Commit

Permalink
[MIRROR] Reworks invisimin variable to a trait [MDB IGNORE] (#25440)
Browse files Browse the repository at this point in the history
* Reworks `invisimin` variable to a trait (#80121)

## About The Pull Request

This was a variable that existed on the `/mob` level despite only ever
being altered in one place. Perfect to just make a trait since it's all
managed in one spot anyways (and no other code is really reliant on this
flag being flipped, it's just for the code to know to add/remove
invisimin status).

I also tweaked some messages so they could be more consistent, lmk if
that should be changed
## Why It's Good For The Game

Less not-useful stuff to scroll through in View Variables, better
scoping of a variable to an intended location.
## Changelog
Not necessary

* Reworks `invisimin` variable to a trait

---------

Co-authored-by: san7890 <[email protected]>
  • Loading branch information
2 people authored and FFMirrorBot committed Dec 5, 2023
1 parent b10d720 commit e9bd814
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1003,4 +1003,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai

/// Trait given to foam darts that have an insert in them
#define TRAIT_DART_HAS_INSERT "dart_has_insert"

/// Trait given when a mob is currently in invisimin mode
#define TRAIT_INVISIMIN "invisimin"

// END TRAIT DEFINES
1 change: 1 addition & 0 deletions code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_INCAPACITATED" = TRAIT_INCAPACITATED,
"TRAIT_INTROVERT" = TRAIT_INTROVERT,
"TRAIT_INVISIBLE_MAN" = TRAIT_INVISIBLE_MAN,
"TRAIT_INVISIMIN" = TRAIT_INVISIMIN,
"TRAIT_IWASBATONED" = TRAIT_IWASBATONED,
"TRAIT_JOLLY" = TRAIT_JOLLY,
"TRAIT_KISS_OF_DEATH" = TRAIT_KISS_OF_DEATH,
Expand Down
19 changes: 11 additions & 8 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -395,18 +395,21 @@ GLOBAL_PROTECT(admin_verbs_poll)
set name = "Invisimin"
set category = "Admin.Game"
set desc = "Toggles ghost-like invisibility (Don't abuse this)"

if(isnull(holder) || isnull(mob))
return
if(mob.invisimin)

if(HAS_TRAIT(mob, TRAIT_INVISIMIN))
REMOVE_TRAIT(mob, TRAIT_INVISIMIN, ADMIN_TRAIT)
mob.add_to_all_human_data_huds()
mob.invisimin = FALSE
mob.RemoveInvisibility(INVISIBILITY_SOURCE_INVISIMIN)
to_chat(mob, span_boldannounce("Invisimin off. Invisibility reset."), confidential = TRUE)
else
mob.remove_from_all_data_huds()
mob.invisimin = TRUE
mob.SetInvisibility(INVISIBILITY_OBSERVER, INVISIBILITY_SOURCE_INVISIMIN, INVISIBILITY_PRIORITY_ADMIN)
to_chat(mob, span_adminnotice("<b>Invisimin on. You are now as invisible as a ghost.</b>"), confidential = TRUE)
to_chat(mob, span_adminnotice(span_bold("Invisimin off. Invisibility reset.")), confidential = TRUE)
return

ADD_TRAIT(mob, TRAIT_INVISIMIN, ADMIN_TRAIT)
mob.remove_from_all_data_huds()
mob.SetInvisibility(INVISIBILITY_OBSERVER, INVISIBILITY_SOURCE_INVISIMIN, INVISIBILITY_PRIORITY_ADMIN)
to_chat(mob, span_adminnotice(span_bold("Invisimin on. You are now as invisible as a ghost.")), confidential = TRUE)

/client/proc/check_antagonists()
set name = "Check Antagonists"
Expand Down
2 changes: 0 additions & 2 deletions code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,3 @@
/// User is thinking in character. Used to revert to thinking state after stop_typing
var/thinking_IC = FALSE

/// Whether invisimin is enabled on this mob
var/invisimin = FALSE

0 comments on commit e9bd814

Please sign in to comment.