Files
Paradise/code/datums/ai/monkey/monkey_subtrees.dm
PollardTheDragon a590870d00 Monke Business - Ports monkey AI from TG (#31067)
* Monke Mode

* Punch

* Some comment stuff

* Linters, excess

* Linters

* Emote stuff

* Pause monkey AI during do afters

* Small improvements

* Oops

* Fixes monkeys trying to drink forever from a glass

* Knockdowns and stamcrit fixes

* Removes eating/drinking from Pun Pun

* Monkey controller improvement, bug fix

* Fixes monkey item giving

* Fixes brain swaps

* Fixes

* Update code/datums/ai/monkey/monkey_controller.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>

* Addresses code review

* Oops

* Oops round 2

* Fixes monkeys staying in trip mode when evolved

---------

Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
2025-12-26 22:44:52 +00:00

80 lines
3.4 KiB
Plaintext

/datum/ai_planning_subtree/monkey_shenanigans/select_behaviors(datum/ai_controller/monkey/controller, seconds_per_tick)
var/mob/living/living_pawn = controller.pawn
if(living_pawn.incapacitated()) // We're restrained or stunned - what are we gonna do?
return SUBTREE_RETURN_FINISH_PLANNING
if(prob(5))
controller.queue_behavior(/datum/ai_behavior/use_in_hand)
if(!SPT_PROB(MONKEY_SHENANIGAN_PROB, seconds_per_tick))
return
if(!controller.blackboard[BB_MONKEY_CURRENT_PRESS_TARGET])
controller.queue_behavior(/datum/ai_behavior/find_nearby, BB_MONKEY_CURRENT_PRESS_TARGET)
return
if(prob(50))
controller.queue_behavior(/datum/ai_behavior/use_on_object, BB_MONKEY_CURRENT_PRESS_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING
if(!controller.blackboard[BB_MONKEY_CURRENT_GIVE_TARGET])
controller.queue_behavior(/datum/ai_behavior/find_and_set/pawn_must_hold_item, BB_MONKEY_CURRENT_GIVE_TARGET, /mob/living, 2)
else
if(prob(5))
controller.queue_behavior(/datum/ai_behavior/give, BB_MONKEY_CURRENT_GIVE_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING
controller.TryFindWeapon()
/// monkey combat subtree.
/datum/ai_planning_subtree/monkey_combat/select_behaviors(datum/ai_controller/monkey/controller, seconds_per_tick)
var/mob/living/living_pawn = controller.pawn
var/list/enemies = controller.blackboard[BB_MONKEY_ENEMIES]
if(living_pawn.incapacitated()) // We're restrained or stunned - what are we gonna do?
return SUBTREE_RETURN_FINISH_PLANNING
if((HAS_TRAIT(controller.pawn, TRAIT_PACIFISM)) || (!length(enemies) && !controller.blackboard[BB_MONKEY_AGGRESSIVE])) // Pacifist, or we have no enemies and we're not pissed
living_pawn.a_intent = INTENT_HELP
return
if(!controller.blackboard[BB_MONKEY_CURRENT_ATTACK_TARGET])
controller.queue_behavior(/datum/ai_behavior/monkey_set_combat_target, BB_MONKEY_CURRENT_ATTACK_TARGET, BB_MONKEY_ENEMIES)
living_pawn.a_intent = INTENT_HELP
return SUBTREE_RETURN_FINISH_PLANNING
var/mob/living/selected_enemy = controller.blackboard[BB_MONKEY_CURRENT_ATTACK_TARGET]
if(QDELETED(selected_enemy))
living_pawn.a_intent = INTENT_HELP
return
if(!selected_enemy.stat) // He's up, get him!
living_pawn.a_intent = INTENT_HARM
if(living_pawn.health < MONKEY_FLEE_HEALTH) // Time to skeddadle
controller.queue_behavior(/datum/ai_behavior/monkey_flee)
return SUBTREE_RETURN_FINISH_PLANNING // I'm running fuck you guys
if(controller.TryFindWeapon()) // Getting a weapon is higher priority if im not fleeing.
return SUBTREE_RETURN_FINISH_PLANNING
if(controller.blackboard[BB_MONKEY_RECRUIT_COOLDOWN] < world.time)
controller.queue_behavior(/datum/ai_behavior/recruit_monkeys, BB_MONKEY_CURRENT_ATTACK_TARGET)
return
if(controller.blackboard[BB_BATTLE_CRY_COOLDOWN] < world.time)
controller.queue_behavior(/datum/ai_behavior/battle_screech/monkey)
controller.queue_behavior(/datum/ai_behavior/monkey_attack_mob, BB_MONKEY_CURRENT_ATTACK_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING
// by this point we have a target but they're down, let's try dumpstering this loser
living_pawn.a_intent = INTENT_HELP
if(!controller.blackboard[BB_MONKEY_TARGET_DISPOSAL])
controller.queue_behavior(/datum/ai_behavior/find_and_set, BB_MONKEY_TARGET_DISPOSAL, /obj/machinery/disposal, MONKEY_ENEMY_VISION)
return
controller.queue_behavior(/datum/ai_behavior/disposal_mob, BB_MONKEY_CURRENT_ATTACK_TARGET, BB_MONKEY_TARGET_DISPOSAL)
return SUBTREE_RETURN_FINISH_PLANNING