Skip to content

Commit

Permalink
Reworks how the possession blacklist is handled, Admins can now disab…
Browse files Browse the repository at this point in the history
…le possessing on individual abnormalities. (#2461)

* boop

* adds a FALSE to muh return
  • Loading branch information
Gboster-0 authored Oct 31, 2024
1 parent a7a6045 commit 823f8c3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
1 change: 0 additions & 1 deletion ModularTegustation/misc_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/datum/proc/try_take_abnormality(mob/dead/observer/possessing_player, mob/abnormality)
if(!SSlobotomy_corp.enable_possession) // uhhhh, how did you even access this proc?
to_chat(usr, span_userdanger("Abnormality possession is not enabled!"))
message_admins(span_adminnotice("[possessing_player.key] has accessed the try_take_abnormality proc whilst possession is disabled."))
return

if(!possessing_player.ckey) // safety check
Expand Down
45 changes: 23 additions & 22 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ GLOBAL_LIST_EMPTY(ghost_images_simple) //this is a list of all ghost images as t

GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)

GLOBAL_LIST_INIT(unpossessable_mobs, list( // LOBOTOMYCORPORATION ADDITION -- abnormality blacklist
/mob/living/simple_animal/hostile/abnormality/punishing_bird,
))

/mob/dead/observer
name = "ghost"
desc = "It's a g-g-g-g-ghooooost!" //jinkies!
Expand Down Expand Up @@ -638,17 +634,28 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
set name = "Possess!"
set desc= "Take over the body of a mindless creature!"

// LOBOTOMYCORPORATION ADDITION START
if(!SSlobotomy_corp.enable_possession)
to_chat(usr, span_userdanger("Abnormality possession is not enabled!"))
return FALSE

if(possession_cooldown >= world.time)
to_chat(src, span_userdanger("You are under a cooldown for possessing for [(possession_cooldown - world.time) / 10] more seconds!"))
return FALSE
// LOBOTOMYCORPORATION ADDITION END

var/list/possessible = list()
for(var/mob/living/L in GLOB.alive_mob_list)
if(istype(L,/mob/living/carbon/human/dummy) || !get_turf(L)) //Haha no.
continue
// LOBOTOMYCORPORATION ADDITION START
if(!SSlobotomy_corp.enable_possession)
message_admins(span_adminnotice("[src.key] has accessed the mob/dead/observer/verb/possess() whilst abnormality possession is not enabled!"))
return
if(is_type_in_list(L, GLOB.unpossessable_mobs))
if(isabnormalitymob(L))
var/mob/living/simple_animal/hostile/abnormality/abnormality = L
if(abnormality.do_not_possess)
continue

if(istype(L, /mob/living/carbon/human/dummy) || !get_turf(L)) //Haha no.
continue
// LOBOTOMYCORPORATION ADDITION END

if(!(L in GLOB.player_list) && !L.mind)
possessible += L

Expand All @@ -657,10 +664,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(!target)
return FALSE

if(possession_cooldown >= world.time)
to_chat(src, span_userdanger("You are under a cooldown for possessing for [(possession_cooldown - world.time) * 10] more seconds!"))
return FALSE

if(ismegafauna(target))
to_chat(src, span_warning("This creature is too powerful for you to possess!"))
return FALSE
Expand Down Expand Up @@ -721,16 +724,14 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
to_chat(usr, span_userdanger("Abnormality possession is not enabled!"))
return ..()

if(is_type_in_list(over, GLOB.unpossessable_mobs))
to_chat(usr, span_userdanger("This abnormality is blacklisted from being possessed!"))
return ..()
if(isabnormalitymob(over))
var/mob/living/simple_animal/hostile/abnormality/abnormality = over
if(abnormality.do_not_possess)
to_chat(usr, span_userdanger("This abnormality is blacklisted from being possessed!"))
return ..()

if(possession_cooldown >= world.time)
to_chat(src, span_userdanger("You are under a cooldown for possessing for [(possession_cooldown - world.time) * 10] more seconds!"))
return ..()

if(!isobserver(usr)) // safety check
to_chat(usr, span_userdanger("you are not an observer despite being an observer, silly. You cant possess abnormalities!"))
to_chat(src, span_userdanger("You are under a cooldown for possessing for [(possession_cooldown - world.time) / 10] more seconds!"))
return ..()

if(!usr.client) // who are we talking to again...? whatever
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
var/core_icon = ""
var/core_enabled = TRUE

/// If an abnormality should not be possessed even if possessibles are enabled, mainly for admins.
var/do_not_possess = FALSE

// secret skin variables ahead

/// Toggles if the abnormality has a secret form and can spawn naturally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
correct_choices = list("Little bird", "Punishing bird")
observation_success_message = "The small bird accepts whatever name you decide to give it. Its nature can never change now."

do_not_possess = TRUE

var/list/enemies = list()
var/list/pecking_targets = list()
var/list/already_punished = list()
Expand Down

0 comments on commit 823f8c3

Please sign in to comment.