Skip to content

Commit

Permalink
Pino ai fix (#2068)
Browse files Browse the repository at this point in the history
* pino ai fix

* fixes the spawn abno verb logging
  • Loading branch information
Halonexus authored May 8, 2024
1 parent d02f8d6 commit 80e2256
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 17 deletions.
15 changes: 1 addition & 14 deletions code/datums/ai/sanity/sanityloss_behaviors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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 ..()

Expand Down
8 changes: 5 additions & 3 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
41 changes: 41 additions & 0 deletions code/modules/mob/living/simple_animal/abnormality/he/pinocchio.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 80e2256

Please sign in to comment.