Basic Mob Carp Part VIII: Basic Mob Carp (#72073)

## About The Pull Request

Wow we're finally here. This turns carp into Basic Mobs instead of
Simple Animals.
They use a variety of behaviours added in previous PRs to act in a
marginally more interesting way than they used to.
But don't worry there's still 2 or 3 PRs to follow this one until I'm
done with space fish.

Changes in this PR:
Carp will try to run away if they get below 50% health, to make use of
their "regenerate if not attacked" component.
Magicarp have different targetting behaviour for spells depending on
their spell;
- Ressurecting Carp will try to ressurect allied mobs.
- Animating Carp will try to animate nearby objects.
- Door-creating Carp will try to turn nearby walls into doors.

You can order Magicarp to cast their spell on something if you happen to
manage to tame one.
The eating element now has support for "getting hurt" when you eat
something. Carp eating can rings and hating it was too soulful not to
continue supporting.

## Why It's Good For The Game

Carp are iconic beasts and I think they should be more interesting.
Also we just want to turn mobs into basic mobs anyway.

## Changelog

🆑
add: Carp will now run away if their health gets low, meaning they may
have a chance to regenerate.
add: Lia will now fight back if attacked instead of letting herself get
killed, watch out!
balance: Magicarp will now aim their spells more intelligently.
add: Tame Magicarp can be ordered to use their spells on things.
refactor: Carp are now "Basic Mobs" instead of "Simple Mobs"
fix: Dehydrated carp no longer give you a bad feeling when they're your
friend and a good feeling when they're going to attack you.
balance: Tamed carp are now friendly only to their tamer rather than
their whole faction, which should make dehydrated carp more active.
Order them to stay or follow you if you want them to behave around your
friends.
/🆑
This commit is contained in:
Jacquerel
2022-12-26 02:24:18 +00:00
committed by GitHub
parent 57755aa276
commit b174af7661
55 changed files with 815 additions and 488 deletions
@@ -0,0 +1,26 @@
/// Attempts to use a mob ability on a target
/datum/ai_planning_subtree/targetted_mob_ability
/// Blackboard key for the ability
var/ability_key
/// Blackboard key for where the target ref is stored
var/target_key = BB_BASIC_MOB_CURRENT_TARGET
/// Behaviour to perform using ability
var/use_ability_behaviour = /datum/ai_behavior/try_mob_ability
/datum/ai_planning_subtree/targetted_mob_ability/SelectBehaviors(datum/ai_controller/controller, delta_time)
if (!ability_key)
CRASH("You forgot to tell this mob where to find its ability")
var/datum/weakref/weak_target = controller.blackboard[target_key]
var/mob/living/target = weak_target?.resolve()
if (QDELETED(target))
return
var/datum/action/cooldown/using_action = controller.blackboard[ability_key]
if (QDELETED(using_action))
return
if (!using_action.IsAvailable())
return
controller.queue_behavior(use_ability_behaviour, ability_key, target_key)
return SUBTREE_RETURN_FINISH_PLANNING