From 80e22566f01d6bd2f9d933b0f8e164af30eeead4 Mon Sep 17 00:00:00 2001 From: Halonexus Date: Wed, 8 May 2024 21:38:51 +0300 Subject: [PATCH] Pino ai fix (#2068) * pino ai fix * fixes the spawn abno verb logging --- code/datums/ai/sanity/sanityloss_behaviors.dm | 15 +------ code/modules/admin/admin_verbs.dm | 8 ++-- .../simple_animal/abnormality/he/pinocchio.dm | 41 +++++++++++++++++++ 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/code/datums/ai/sanity/sanityloss_behaviors.dm b/code/datums/ai/sanity/sanityloss_behaviors.dm index f0c8322831f7..23ae12d0e773 100644 --- a/code/datums/ai/sanity/sanityloss_behaviors.dm +++ b/code/datums/ai/sanity/sanityloss_behaviors.dm @@ -424,9 +424,6 @@ controller.pathing_attempts = 0 controller.current_path.Cut() finish_action(controller, TRUE) - if(istype(controller, /datum/ai_controller/insane/murder)) - var/datum/ai_controller/insane/murder/M = controller - M.FindEnemies() return FALSE // Movement if(LAZYLEN(controller.current_path)) @@ -490,17 +487,7 @@ // Same as the above insanity, but they look for a target between moves. /datum/ai_behavior/insanity_wander/murder_wander/PreMoveCheck(datum/ai_controller/insane/murder/controller, mob/living/living_pawn) - for(var/mob/living/L in livinginview(9, living_pawn)) - if(L == living_pawn) - continue - if(L.status_flags & GODMODE) - continue - if(L.stat == DEAD) - continue - if(!isturf(L.loc) && !ismecha(L.loc)) - continue - if(living_pawn.see_invisible < L.invisibility) - continue + if(controller.FindEnemies()) return FALSE return ..() diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 5ff87e310211..3abb4bb1cc02 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -794,19 +794,21 @@ GLOBAL_PROTECT(admin_verbs_hideable) set name = "Spawn Abnormality Cell" if(!check_rights(R_ADMIN)) return - + if(!LAZYLEN(GLOB.abnormality_room_spawners)) + to_chat(src, span_interface("Failed to spawn abno. The facility is already full!")) + return var/confirm = alert(src, "Choose Abnormality?", "Choose abnormality type?", "No", "Yes") if(confirm == "Yes") var/datum/abno_type = pick_closest_path(FALSE, make_types_fancy(subtypesof(/mob/living/simple_animal/hostile/abnormality))) if(ispath(abno_type)) SSabnormality_queue.queued_abnormality = abno_type - SSabnormality_queue.SpawnAbno() log_admin("[key_name(usr)] has spawned [SSabnormality_queue.queued_abnormality].") message_admins("[key_name(usr)] has spawned [SSabnormality_queue.queued_abnormality].") - SSblackbox.record_feedback("nested tally", "admin_spawn_abnormality", 1, list("Initiated Spawn Abnormality", "[SSabnormality_queue.queued_abnormality]")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + SSabnormality_queue.SpawnAbno() + // Suppresses all LC13 abnormalities /client/proc/ClearAbno() set category = "Admin.Game" diff --git a/code/modules/mob/living/simple_animal/abnormality/he/pinocchio.dm b/code/modules/mob/living/simple_animal/abnormality/he/pinocchio.dm index 3ba126434c61..e3fa1f85b51d 100644 --- a/code/modules/mob/living/simple_animal/abnormality/he/pinocchio.dm +++ b/code/modules/mob/living/simple_animal/abnormality/he/pinocchio.dm @@ -232,6 +232,47 @@ lines_type = /datum/ai_behavior/say_line/insanity_murder/puppet continue_processing_when_client = FALSE //Prevents playable pinocchio from going around murdering everyone. +/datum/ai_controller/insane/murder/puppet/FindEnemies() + . = FALSE + var/mob/living/living_pawn = pawn + var/list/potential_enemies = livinginview(9, living_pawn) + + if(!LAZYLEN(potential_enemies)) + return + + var/list/weighted_list = list() + for(var/mob/living/L in potential_enemies) + if(L == living_pawn) + continue + if(L.status_flags & GODMODE) + continue + if(L.stat == DEAD) + continue + if(living_pawn.see_invisible < L.invisibility) + continue + if(!isturf(L.loc) && !ismecha(L.loc)) + continue + if(living_pawn.faction_check_mob(L)) + continue + weighted_list += L + for(var/i in weighted_list) + if(istype(i, /mob/living/simple_animal/hostile)) + weighted_list[i] = 3 + else if(ishuman(i)) + var/mob/living/carbon/human/H = i + if(H.sanity_lost) + weighted_list[i] = 2 + else if(ismecha(H.loc)) + weighted_list[i] = 3 + else + weighted_list[i] = 5 + else + weighted_list[i] = 1 + if(weighted_list.len > 0) + blackboard[BB_INSANE_CURRENT_ATTACK_TARGET] = pickweight(weighted_list) + return TRUE + return FALSE + /datum/status_effect/panicked_type/puppet icon = null