NPC utility queries (#15843)
This commit is contained in:
@@ -786,6 +786,11 @@
|
||||
equippedPrefix: 0
|
||||
slots:
|
||||
- HEAD
|
||||
- type: Faction
|
||||
factions:
|
||||
- Mouse
|
||||
- type: HTN
|
||||
rootTask: MouseCompound
|
||||
- type: Physics
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
|
||||
@@ -107,6 +107,11 @@
|
||||
id: MobCatRuntime
|
||||
description: Professional mouse hunter. Escape artist.
|
||||
components:
|
||||
- type: Faction
|
||||
factions:
|
||||
- PetsNT
|
||||
- type: HTN
|
||||
rootTask: SimpleHostileCompound
|
||||
- type: Grammar
|
||||
attributes:
|
||||
gender: female
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickRangedTargetPrimitive
|
||||
operator: !type:PickRangedTargetOperator
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyRangedTargets
|
||||
|
||||
# Attacks the specified target if they're in LOS.
|
||||
- type: htnPrimitive
|
||||
@@ -53,6 +54,11 @@
|
||||
- !type:TargetInLOSPrecondition
|
||||
targetKey: CombatTarget
|
||||
rangeKey: RangedRange
|
||||
services:
|
||||
- !type:UtilityService
|
||||
id: RangedService
|
||||
proto: NearbyRangedTargets
|
||||
key: CombatTarget
|
||||
|
||||
|
||||
# -- Melee --
|
||||
@@ -84,7 +90,8 @@
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickMeleeTargetPrimitive
|
||||
operator: !type:PickMeleeTargetOperator
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyMeleeTargets
|
||||
|
||||
# Attacks the specified target if they're in range.
|
||||
- type: htnPrimitive
|
||||
@@ -97,6 +104,11 @@
|
||||
- !type:TargetInRangePrecondition
|
||||
targetKey: CombatTarget
|
||||
rangeKey: MeleeRange
|
||||
services:
|
||||
- !type:UtilityService
|
||||
id: MeleeService
|
||||
proto: NearbyMeleeTargets
|
||||
key: CombatTarget
|
||||
|
||||
# Moves the owner into range of the combat target.
|
||||
- type: htnPrimitive
|
||||
|
||||
@@ -7,6 +7,14 @@
|
||||
- tasks:
|
||||
- id: IdleCompound
|
||||
|
||||
- type: htnCompound
|
||||
id: MouseCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: FoodCompound
|
||||
- tasks:
|
||||
- id: IdleCompound
|
||||
|
||||
- type: htnCompound
|
||||
id: DragonCarpCompound
|
||||
branches:
|
||||
|
||||
21
Resources/Prototypes/NPCs/nutrition.yml
Normal file
21
Resources/Prototypes/NPCs/nutrition.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
- type: htnCompound
|
||||
id: FoodCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: PickFoodTargetPrimitive
|
||||
- id: MoveToCombatTargetPrimitive
|
||||
- id: EatPrimitive
|
||||
- id: WaitIdleTimePrimitive
|
||||
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickFoodTargetPrimitive
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyFood
|
||||
|
||||
- type: htnPrimitive
|
||||
id: EatPrimitive
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: CombatTarget
|
||||
operator: !type:AltInteractOperator
|
||||
71
Resources/Prototypes/NPCs/utility_queries.yml
Normal file
71
Resources/Prototypes/NPCs/utility_queries.yml
Normal file
@@ -0,0 +1,71 @@
|
||||
- type: utilityQuery
|
||||
id: NearbyFood
|
||||
query:
|
||||
- !type:ComponentQuery
|
||||
components:
|
||||
- type: Food
|
||||
considerations:
|
||||
- !type:TargetIsAliveCon
|
||||
curve: !type:InverseBoolCurve
|
||||
- !type:TargetDistanceCon
|
||||
curve: !type:PresetCurve
|
||||
preset: TargetDistance
|
||||
- !type:FoodValueCon
|
||||
curve: !type:QuadraticCurve
|
||||
slope: 1.0
|
||||
exponent: 0.4
|
||||
- !type:TargetAccessibleCon
|
||||
curve: !type:BoolCurve
|
||||
|
||||
- type: utilityQuery
|
||||
id: NearbyMeleeTargets
|
||||
query:
|
||||
- !type:NearbyHostilesQuery
|
||||
considerations:
|
||||
- !type:TargetIsAliveCon
|
||||
curve: !type:BoolCurve
|
||||
- !type:TargetDistanceCon
|
||||
curve: !type:PresetCurve
|
||||
preset: TargetDistance
|
||||
- !type:TargetHealthCon
|
||||
curve: !type:PresetCurve
|
||||
preset: TargetHealth
|
||||
- !type:TargetAccessibleCon
|
||||
curve: !type:BoolCurve
|
||||
- !type:TargetInLOSOrCurrentCon
|
||||
curve: !type:BoolCurve
|
||||
|
||||
- type: utilityQuery
|
||||
id: NearbyRangedTargets
|
||||
query:
|
||||
- !type:NearbyHostilesQuery
|
||||
considerations:
|
||||
- !type:TargetIsAliveCon
|
||||
curve: !type:BoolCurve
|
||||
- !type:TargetDistanceCon
|
||||
curve: !type:PresetCurve
|
||||
preset: TargetDistance
|
||||
- !type:TargetHealthCon
|
||||
curve: !type:PresetCurve
|
||||
preset: TargetHealth
|
||||
- !type:TargetAccessibleCon
|
||||
curve: !type:BoolCurve
|
||||
- !type:TargetInLOSOrCurrentCon
|
||||
curve: !type:BoolCurve
|
||||
|
||||
|
||||
# Presets
|
||||
- type: utilityCurvePreset
|
||||
id: TargetDistance
|
||||
curve: !type:QuadraticCurve
|
||||
slope: -1
|
||||
exponent: 1
|
||||
yOffset: 1
|
||||
xOffset: 0
|
||||
|
||||
- type: utilityCurvePreset
|
||||
id: TargetHealth
|
||||
curve: !type:QuadraticCurve
|
||||
slope: 1.0
|
||||
exponent: 0.4
|
||||
xOffset: -0.02
|
||||
@@ -12,9 +12,15 @@
|
||||
- Syndicate
|
||||
- Xeno
|
||||
|
||||
- type: faction
|
||||
id: Mouse
|
||||
hostile:
|
||||
- PetsNT
|
||||
|
||||
- type: faction
|
||||
id: PetsNT
|
||||
hostile:
|
||||
- Mouse
|
||||
- SimpleHostile
|
||||
- Xeno
|
||||
|
||||
|
||||
Reference in New Issue
Block a user