Predator dynamic interaction events and AI fixes + Option for mid-animation eating #259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds new animation events and tweaks some of the predator AI to make predators able to perform certain dynamic interactions. Due to the changes being intertwined, this PR also adds support for eating to occur mid-animation via new animation events.
Overall, this PR includes five new animation events:
AE_PREDATOR_EAT
— Triggers an eat attack and feeds the predator. (equivalent to what happens at the end of an eating animation)AE_PREDATOR_EAT_NOATTACK
— Instantly feeds the predator without performing an eat attack.AE_PREDATOR_GIB_INTERACTION_PARTNER
— Gibs the predator's dynamic interaction partner and feeds the predator.AE_PREDATOR_SWALLOW_INTERACTION_PARTNER
— Removes the predator's dynamic interaction partner and feeds the predator.AE_BULLSQUID_EAT_HEADCRAB_OFF_ZOMBIE
— A bullsquid-only event which kills and removes the headcrab from a dynamic interaction partner derived fromCNPC_BaseZombie
, also feeding the predator.When one of the eating events is used during an eating animation, it will override the "eat attack" normally used at the end of it. Currently, I've only set up this animation event on the gonome, so all other predators will retain the default behavior.
The "AI fixes" mainly entail fixing issues with predators running
scripted_sequence
s in general (or attacking other NPCs running them), as certain parts of their code overrode or interfered with the scripted state. There is, however, one liberty taken to encourage their use.Normally, predators pull NPCs towards them after melee attacks. With this PR, they check if there's any dynamic interactions they can perform on the enemy. If there is one, they will push the enemy towards the dynamic interaction's ideal position instead. For predators attacking other predators, this will also work in reverse: If the attacked predator has their own dynamic interactions on the attacker, then the attacked predator will be pushed to where they can perform it on the attacker.