space-station-14
space-station-14 copied to clipboard
Added new HTN operations and preconditions
About the PR
At the code level (These operators are not used in prototypes), new prototypes have been added for various mathematical operations with float and bool, as well as playing music.
Why / Balance
When designing complex monster behavior, I was faced with the need to create various state falsies, creating random delays that would act as an ability cooldown rather than a wait for the monster. Various distance checks, as well as sound effects.
Technical details
Just new HTN operators, and moving some old ones to the new namespace "Math"
Media
https://github.com/space-wizards/space-station-14/assets/54727692/0a6570ad-59f2-4a20-9692-7214980c9047
- [x] I have added screenshots/videos to this PR showcasing its changes ingame, or this PR does not require an ingame showcase
Breaking changes
Move SetFloatOperator
from Content.Server.NPC.HTN.PrimitiveTasks.Operators
-> Content.Server.NPC.HTN.PrimitiveTasks.Operators.Math
Example to use:
- type: htnCompound
id: TestCompound
branches:
- tasks:
- !type:HTNPrimitiveTask
operator: !type:UnPullOperator
preconditions:
- !type:PulledPrecondition
isPulled: true
- tasks:
- !type:HTNPrimitiveTask
preconditions:
- !type:KeyBoolEqualsPrecondition
key: AbilityIsReady
value: true
operator: !type:PlaySoundOperator
sound: # some example sound path
- !type:HTNPrimitiveTask
operator: !type:SetBoolOperator
targetKey: AbilityIsReady
value: false
- tasks:
- !type:HTNCompoundTask
task: MeleeAttackTargetCompound
- tasks:
- !type:HTNPrimitiveTask
preconditions:
- !type:KeyBoolEqualsPrecondition
key: AbilityIsReady
value: false
operator: !type:SetBoolOperator
targetKey: AbilityIsReady
value: true
- !type:HTNCompoundTask
task: IdleCompound
Looks okay. Checked, the tasks work correctly. It may be worth removing these talking dummies in the future.