From 823f8c328c762b95d79d1cc075d5a20b46d20ba2 Mon Sep 17 00:00:00 2001 From: Gboster-0 <82319946+Gboster-0@users.noreply.github.com> Date: Thu, 31 Oct 2024 11:35:11 +0100 Subject: [PATCH] Reworks how the possession blacklist is handled, Admins can now disable possessing on individual abnormalities. (#2461) * boop * adds a FALSE to muh return --- ModularTegustation/misc_procs.dm | 1 - code/modules/mob/dead/observer/observer.dm | 45 ++++++++++--------- .../simple_animal/abnormality/_abnormality.dm | 3 ++ .../abnormality/teth/punishing_bird.dm | 2 + 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/ModularTegustation/misc_procs.dm b/ModularTegustation/misc_procs.dm index 68c73248df35..ac770c2576b8 100644 --- a/ModularTegustation/misc_procs.dm +++ b/ModularTegustation/misc_procs.dm @@ -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 diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 2b406be32c31..78134dd79575 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -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! @@ -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 @@ -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 @@ -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 diff --git a/code/modules/mob/living/simple_animal/abnormality/_abnormality.dm b/code/modules/mob/living/simple_animal/abnormality/_abnormality.dm index 9e1581b03051..98dc5ac09b60 100644 --- a/code/modules/mob/living/simple_animal/abnormality/_abnormality.dm +++ b/code/modules/mob/living/simple_animal/abnormality/_abnormality.dm @@ -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 diff --git a/code/modules/mob/living/simple_animal/abnormality/teth/punishing_bird.dm b/code/modules/mob/living/simple_animal/abnormality/teth/punishing_bird.dm index 5270a740540c..5f51ef413e14 100644 --- a/code/modules/mob/living/simple_animal/abnormality/teth/punishing_bird.dm +++ b/code/modules/mob/living/simple_animal/abnormality/teth/punishing_bird.dm @@ -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()