Shooting NPCs and more (#18042)
* Add pirate shooting * Shooting working * Basics working * Refactor time * More conversion * Update primitives * Update yml * weh * Building again * Draft * weh * b * Start shutdown * Starting to take form * Code side done * is it worky * Fix prototypes * stuff * Shitty working * Juke events working * Even more cleanup * RTX * Fix interaction combat mode and compquery * GetAmmoCount relays * Fix rotation speed * Juke fixes * fixes * weh * The collision avoidance never ends * Fixes * Pause support * framework * lazy * Fix idling * Fix drip * goobed * Fix takeover shutdown bug * Merge fixes * shitter * Fix carpos
This commit is contained in:
158
Resources/Prototypes/NPCs/Combat/gun.yml
Normal file
158
Resources/Prototypes/NPCs/Combat/gun.yml
Normal file
@@ -0,0 +1,158 @@
|
||||
# Tries to shoot a target at range.
|
||||
- type: htnCompound
|
||||
id: GunCombatCompound
|
||||
branches:
|
||||
# Pick target, then move into range and shoot them.
|
||||
- tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyGunTargets
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
shutdownState: PlanFinished
|
||||
pathfindInPlanning: true
|
||||
removeKeyOnFinish: false
|
||||
targetKey: TargetCoordinates
|
||||
pathfindKey: TargetPathfind
|
||||
stopOnLineOfSight: true
|
||||
rangeKey: MeleeRange
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:JukeOperator
|
||||
jukeType: AdjacentTile
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: Target
|
||||
operator: !type:GunOperator
|
||||
targetKey: Target
|
||||
services:
|
||||
- !type:UtilityService
|
||||
id: RangedService
|
||||
proto: NearbyGunTargets
|
||||
key: Target
|
||||
|
||||
# Selects ammo in range, then moves to it and picks it up
|
||||
- type: htnCompound
|
||||
id: PickupAmmoCompound
|
||||
branches:
|
||||
# Find ammo then pick it up.
|
||||
- tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyAmmo
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:TargetInRangePrecondition
|
||||
targetKey: Target
|
||||
rangeKey: InteractRange
|
||||
operator: !type:InteractWithOperator
|
||||
targetKey: Target
|
||||
# TODO: Prioritise ammo for weapon we have equipped, otherwise grab anything if we don't have any.
|
||||
# TODO: Only works on ballistic
|
||||
|
||||
# Selects a gun in range, then moves to it and picks it up.
|
||||
- type: htnCompound
|
||||
id: PickupGunCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyGuns
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:TargetInRangePrecondition
|
||||
targetKey: Target
|
||||
rangeKey: InteractRange
|
||||
operator: !type:InteractWithOperator
|
||||
targetKey: Target
|
||||
|
||||
# TODO: Need a thing to recharge a laser gun
|
||||
# TODO: When selecting pickup guns also add chargers or easy container grabs.
|
||||
|
||||
# Shorted version of RangedCombatCompound for entities that are guns themselves.
|
||||
- type: htnCompound
|
||||
id: InnateRangedCombatCompound
|
||||
branches:
|
||||
- preconditions:
|
||||
- !type:GunAmmoPrecondition
|
||||
minPercent: 0.001
|
||||
tasks:
|
||||
- !type:HTNCompoundTask
|
||||
task: GunCombatCompound
|
||||
|
||||
|
||||
- type: htnCompound
|
||||
id: RangedCombatCompound
|
||||
branches:
|
||||
# Move to target and shoot them if ammo
|
||||
- preconditions:
|
||||
- !type:GunAmmoPrecondition
|
||||
minPercent: 0.001
|
||||
tasks:
|
||||
- !type:HTNCompoundTask
|
||||
task: GunCombatCompound
|
||||
|
||||
# Reload gun
|
||||
# TODO
|
||||
|
||||
# Equip a gun from inventory if one found, preferring over pickup.
|
||||
# TODO: Doing inventory cleanly will be a PITA so deferring to later
|
||||
# The issue is recursively checking items but also ignoring some recursive entities
|
||||
# i.e. we need to recursively go into storage containers.
|
||||
#- tasks:
|
||||
# - !type:HTNCompoundTask
|
||||
# task: ClearActiveHandCompound
|
||||
#
|
||||
# - !type:HTNPrimitiveTask
|
||||
# operator: !type:UtilityOperator
|
||||
# proto: InventoryGuns
|
||||
#
|
||||
# - !type:HTNPrimitiveTask
|
||||
# operator: !type:EquipOperator
|
||||
|
||||
# Pickup ammo if any nearby
|
||||
#- preconditions:
|
||||
# - !type:GunAmmoPrecondition
|
||||
# maxPercent: 0.0
|
||||
# tasks:
|
||||
# - !type:HTNCompoundTask
|
||||
# task: ClearActiveHandCompound
|
||||
#
|
||||
# - !type:HTNCompoundTask
|
||||
# task: PickupAmmoCompound
|
||||
|
||||
# Pickup gun with ammo if we have no ammo
|
||||
- preconditions:
|
||||
- !type:ActiveHandComponentPrecondition
|
||||
components:
|
||||
- type: Gun
|
||||
invert: true
|
||||
tasks:
|
||||
- !type:HTNCompoundTask
|
||||
task: PickupGunCompound
|
||||
|
||||
# Discard gun if no ammo
|
||||
- preconditions:
|
||||
- !type:ActiveHandComponentPrecondition
|
||||
components:
|
||||
- type: Gun
|
||||
- !type:GunAmmoPrecondition
|
||||
maxPercent: 0.001
|
||||
tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:ActiveHandEntityPrecondition
|
||||
operator: !type:DropOperator
|
||||
|
||||
# TODO: Reload a nearby gun
|
||||
80
Resources/Prototypes/NPCs/Combat/melee.yml
Normal file
80
Resources/Prototypes/NPCs/Combat/melee.yml
Normal file
@@ -0,0 +1,80 @@
|
||||
# -- Melee --
|
||||
# Selects a target in melee and tries to attack it.
|
||||
- type: htnCompound
|
||||
id: MeleeCombatCompound
|
||||
branches:
|
||||
# Pickup weapon if we don't have one.
|
||||
- preconditions:
|
||||
- !type:ActiveHandComponentPrecondition
|
||||
components:
|
||||
# Just serializer things
|
||||
- type: MeleeWeapon
|
||||
damage:
|
||||
types:
|
||||
Brute: 0
|
||||
invert: true
|
||||
tasks:
|
||||
- !type:HTNCompoundTask
|
||||
task: PickupMeleeCompound
|
||||
|
||||
# Melee combat (unarmed or otherwise)
|
||||
- tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyMeleeTargets
|
||||
- !type:HTNCompoundTask
|
||||
task: MeleeAttackTargetCompound
|
||||
|
||||
- type: htnCompound
|
||||
id: PickupMeleeCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyMeleeWeapons
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:TargetInRangePrecondition
|
||||
targetKey: Target
|
||||
rangeKey: InteractRange
|
||||
operator: !type:InteractWithOperator
|
||||
targetKey: Target
|
||||
|
||||
# Tries to melee attack our target.
|
||||
- type: htnCompound
|
||||
id: MeleeAttackTargetCompound
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: Target
|
||||
branches:
|
||||
# Move to melee range and hit them
|
||||
- tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
shutdownState: PlanFinished
|
||||
pathfindInPlanning: true
|
||||
removeKeyOnFinish: false
|
||||
targetKey: TargetCoordinates
|
||||
pathfindKey: TargetPathfind
|
||||
rangeKey: MeleeRange
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:JukeOperator
|
||||
jukeType: Away
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MeleeOperator
|
||||
targetKey: Target
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: Target
|
||||
- !type:TargetInRangePrecondition
|
||||
targetKey: Target
|
||||
rangeKey: MeleeRange
|
||||
services:
|
||||
- !type:UtilityService
|
||||
id: MeleeService
|
||||
proto: NearbyMeleeTargets
|
||||
key: Target
|
||||
@@ -1,121 +0,0 @@
|
||||
# -- Ranged --
|
||||
# Tries to shoot a target in LOS in range.
|
||||
- type: htnCompound
|
||||
id: TurretCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: PickRangedTargetPrimitive
|
||||
- id: RangedAttackTargetPrimitive
|
||||
- tasks:
|
||||
- id: IdleSpinCompound
|
||||
|
||||
# Tries to shoot a target at range.
|
||||
- type: htnCompound
|
||||
id: RangedCombatCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: PickRangedTargetPrimitive
|
||||
- id: RangedAttackTargetCompound
|
||||
|
||||
# Tries to ranged attack our target.
|
||||
- type: htnCompound
|
||||
id: RangedAttackTargetCompound
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: CombatTarget
|
||||
branches:
|
||||
# Keep hitting them if they're in LOS
|
||||
- tasks:
|
||||
- id: RangedAttackTargetPrimitive
|
||||
|
||||
# Move to range and hit them
|
||||
- tasks:
|
||||
- id: MoveToCombatTargetPrimitive
|
||||
- id: RangedAttackTargetPrimitive
|
||||
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickRangedTargetPrimitive
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyRangedTargets
|
||||
|
||||
# Attacks the specified target if they're in LOS.
|
||||
- type: htnPrimitive
|
||||
id: RangedAttackTargetPrimitive
|
||||
operator: !type:RangedOperator
|
||||
targetKey: CombatTarget
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: CombatTarget
|
||||
- !type:TargetInRangePrecondition
|
||||
targetKey: CombatTarget
|
||||
# TODO: Non-scuffed
|
||||
rangeKey: RangedRange
|
||||
- !type:TargetInLOSPrecondition
|
||||
targetKey: CombatTarget
|
||||
rangeKey: RangedRange
|
||||
services:
|
||||
- !type:UtilityService
|
||||
id: RangedService
|
||||
proto: NearbyRangedTargets
|
||||
key: CombatTarget
|
||||
|
||||
|
||||
# -- Melee --
|
||||
# Selects a target in melee and tries to attack it.
|
||||
- type: htnCompound
|
||||
id: MeleeCombatCompound
|
||||
branches:
|
||||
# Unarmed combat
|
||||
- tasks:
|
||||
- id: PickMeleeTargetPrimitive
|
||||
- id: MeleeAttackTargetCompound
|
||||
|
||||
# Tries to melee attack our target.
|
||||
- type: htnCompound
|
||||
id: MeleeAttackTargetCompound
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: CombatTarget
|
||||
branches:
|
||||
# Keep hitting them if they're in range
|
||||
- tasks:
|
||||
- id: MeleeAttackTargetPrimitive
|
||||
|
||||
# Move to melee range and hit them
|
||||
- tasks:
|
||||
- id: MoveToCombatTargetPrimitive
|
||||
- id: MeleeAttackTargetPrimitive
|
||||
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickMeleeTargetPrimitive
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyMeleeTargets
|
||||
|
||||
# Attacks the specified target if they're in range.
|
||||
- type: htnPrimitive
|
||||
id: MeleeAttackTargetPrimitive
|
||||
operator: !type:MeleeOperator
|
||||
targetKey: CombatTarget
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: CombatTarget
|
||||
- !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
|
||||
id: MoveToCombatTargetPrimitive
|
||||
operator: !type:MoveToOperator
|
||||
pathfindInPlanning: true
|
||||
removeKeyOnFinish: false
|
||||
targetKey: CombatTargetCoordinates
|
||||
pathfindKey: CombatTargetPathfind
|
||||
rangeKey: MeleeRange
|
||||
@@ -2,40 +2,37 @@
|
||||
id: CleanbotCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: BufferNearbyPuddlesCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: BufferNearbyPuddlesCompound
|
||||
- tasks:
|
||||
- id: IdleCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: IdleCompound
|
||||
|
||||
# Picks a random puddle in range to move to and idle
|
||||
- type: htnCompound
|
||||
id: BufferNearbyPuddlesCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: PickPuddlePrimitive
|
||||
- id: MoveToCombatTargetPrimitive
|
||||
- id: MopPrimitive
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyPuddles
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickPuddlePrimitive
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyPuddles
|
||||
|
||||
- type: htnPrimitive
|
||||
id: SetIdleTimePrimitive
|
||||
operator: !type:SetFloatOperator
|
||||
targetKey: IdleTime
|
||||
amount: 3
|
||||
|
||||
- type: htnPrimitive
|
||||
id: MopPrimitive
|
||||
preconditions:
|
||||
- !type:TargetInRangePrecondition
|
||||
targetKey: CombatTarget
|
||||
rangeKey: InteractRange
|
||||
operator: !type:InteractWithOperator
|
||||
targetKey: CombatTarget
|
||||
services:
|
||||
- !type:UtilityService
|
||||
id: PuddleService
|
||||
proto: NearbyPuddles
|
||||
key: CombatTarget
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
pathfindInPlanning: true
|
||||
removeKeyOnFinish: false
|
||||
targetKey: TargetCoordinates
|
||||
pathfindKey: TargetPathfind
|
||||
rangeKey: MeleeRange
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:TargetInRangePrecondition
|
||||
targetKey: Target
|
||||
rangeKey: InteractRange
|
||||
operator: !type:InteractWithOperator
|
||||
targetKey: Target
|
||||
services:
|
||||
- !type:UtilityService
|
||||
id: PuddleService
|
||||
proto: NearbyPuddles
|
||||
key: Target
|
||||
|
||||
5
Resources/Prototypes/NPCs/clothing.yml
Normal file
5
Resources/Prototypes/NPCs/clothing.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
# Generic pickups to not be naked.
|
||||
# TODO: Armor / Pressure pickups.
|
||||
# TODO: Preferred slots
|
||||
#- type: htnCompound
|
||||
# id:
|
||||
@@ -7,49 +7,53 @@
|
||||
branches:
|
||||
# Head to follow target
|
||||
- tasks:
|
||||
- id: FollowPrimitive
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:CoordinatesNotInRangePrecondition
|
||||
targetKey: FollowTarget
|
||||
rangeKey: FollowRange
|
||||
operator: !type:MoveToOperator
|
||||
pathfindInPlanning: true
|
||||
targetKey: FollowTarget
|
||||
rangeKey: FollowCloseRange
|
||||
removeKeyOnFinish: false
|
||||
|
||||
# Keep idling near follow target
|
||||
- tasks:
|
||||
- id: WaitFollowPrimitive
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: IdleTime
|
||||
- !type:CoordinatesInRangePrecondition
|
||||
targetKey: FollowTarget
|
||||
rangeKey: FollowRange
|
||||
operator: !type:WaitOperator
|
||||
key: IdleTime
|
||||
|
||||
# Pick a new idle spot near the follow target
|
||||
- tasks:
|
||||
- id: PickAccessibleNearFollowPrimitive
|
||||
- id: IdleNearFollowPrimitive
|
||||
- id: RandomIdleTimePrimitive
|
||||
- id: WaitFollowPrimitive
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:PickAccessibleOperator
|
||||
# originKey: FollowTarget
|
||||
rangeKey: FollowCloseRange
|
||||
targetCoordinates: FollowIdleTarget
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
targetKey: FollowIdleTarget
|
||||
|
||||
- type: htnPrimitive
|
||||
id: WaitFollowPrimitive
|
||||
operator: !type:WaitOperator
|
||||
key: IdleTime
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: IdleTime
|
||||
- !type:CoordinatesInRangePrecondition
|
||||
targetKey: FollowTarget
|
||||
rangeKey: FollowRange
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:RandomOperator
|
||||
targetKey: IdleTime
|
||||
minKey: MinimumIdleTime
|
||||
maxKey: MaximumIdleTime
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickAccessibleNearFollowPrimitive
|
||||
operator: !type:PickAccessibleOperator
|
||||
# originKey: FollowTarget
|
||||
rangeKey: FollowCloseRange
|
||||
targetKey: FollowIdleTarget
|
||||
|
||||
- type: htnPrimitive
|
||||
id: IdleNearFollowPrimitive
|
||||
operator: !type:MoveToOperator
|
||||
targetKey: FollowIdleTarget
|
||||
|
||||
- type: htnPrimitive
|
||||
id: FollowPrimitive
|
||||
operator: !type:MoveToOperator
|
||||
pathfindInPlanning: true
|
||||
targetKey: FollowTarget
|
||||
rangeKey: FollowCloseRange
|
||||
removeKeyOnFinish: false
|
||||
preconditions:
|
||||
- !type:CoordinatesNotInRangePrecondition
|
||||
targetKey: FollowTarget
|
||||
rangeKey: FollowRange
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: IdleTime
|
||||
- !type:CoordinatesInRangePrecondition
|
||||
targetKey: FollowTarget
|
||||
rangeKey: FollowRange
|
||||
operator: !type:WaitOperator
|
||||
key: IdleTime
|
||||
|
||||
25
Resources/Prototypes/NPCs/generic.yml
Normal file
25
Resources/Prototypes/NPCs/generic.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
- type: htnCompound
|
||||
id: ClearActiveHandCompound
|
||||
branches:
|
||||
# Do nothing
|
||||
- preconditions:
|
||||
- !type:ActiveHandFreePrecondition
|
||||
tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:NoOperator
|
||||
|
||||
# Swap to another free hand
|
||||
- tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:SwapToFreeHandOperator
|
||||
|
||||
# TODO: Need to make sure this works with blackboard and handles storage + pockets + inventory slots
|
||||
# Put active hand into storage
|
||||
#- tasks:
|
||||
# - !type:HTNPrimitiveTask
|
||||
# operator: !type:StashActiveHandOperator
|
||||
|
||||
# Drop active hand
|
||||
- tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:DropOperator
|
||||
@@ -2,76 +2,65 @@
|
||||
- type: htnCompound
|
||||
id: IdleCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: WaitIdleTimePrimitive
|
||||
# Pick a new spot and wait there.
|
||||
- tasks:
|
||||
- id: PickAccessiblePrimitive
|
||||
- id: MoveToAccessiblePrimitive
|
||||
- id: RandomIdleTimePrimitive
|
||||
- id: WaitIdleTimePrimitive
|
||||
preconditions:
|
||||
- preconditions:
|
||||
- !type:BuckledPrecondition
|
||||
isBuckled: false
|
||||
- !type:PulledPrecondition
|
||||
isPulled: false
|
||||
tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:PickAccessibleOperator
|
||||
rangeKey: IdleRange
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
pathfindInPlanning: false
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:RandomOperator
|
||||
targetKey: IdleTime
|
||||
minKey: MinimumIdleTime
|
||||
maxKey: MaximumIdleTime
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:WaitOperator
|
||||
key: IdleTime
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: IdleTime
|
||||
|
||||
# Spin to a random rotation and idle.
|
||||
- type: htnCompound
|
||||
id: IdleSpinCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: WaitIdleTimePrimitive
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:WaitOperator
|
||||
key: IdleTime
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: IdleTime
|
||||
|
||||
# Pick a new angle and spin there
|
||||
- tasks:
|
||||
- id: PickRandomRotationPrimitive
|
||||
- id: RotateToTargetPrimitive
|
||||
- id: RandomIdleTimePrimitive
|
||||
- id: WaitIdleTimePrimitive
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:PickRandomRotationOperator
|
||||
targetKey: RotateTarget
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:RotateToTargetOperator
|
||||
targetKey: RotateTarget
|
||||
|
||||
# Primitives
|
||||
- type: htnPrimitive
|
||||
id: InteractWithPrimitive
|
||||
preconditions:
|
||||
- !type:TargetInRangePrecondition
|
||||
targetKey: Target
|
||||
rangeKey: InteractRange
|
||||
operator: !type:InteractWithOperator
|
||||
targetKey: Target
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:RandomOperator
|
||||
targetKey: IdleTime
|
||||
minKey: MinimumIdleTime
|
||||
maxKey: MaximumIdleTime
|
||||
|
||||
- type: htnPrimitive
|
||||
id: MoveToAccessiblePrimitive
|
||||
operator: !type:MoveToOperator
|
||||
pathfindInPlanning: false
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickAccessiblePrimitive
|
||||
operator: !type:PickAccessibleOperator
|
||||
rangeKey: IdleRange
|
||||
targetKey: MovementTarget
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickRandomRotationPrimitive
|
||||
operator: !type:PickRandomRotationOperator
|
||||
targetKey: RotateTarget
|
||||
|
||||
- type: htnPrimitive
|
||||
id: RotateToTargetPrimitive
|
||||
operator: !type:RotateToTargetOperator
|
||||
targetKey: RotateTarget
|
||||
|
||||
- type: htnPrimitive
|
||||
id: RandomIdleTimePrimitive
|
||||
operator: !type:RandomOperator
|
||||
targetKey: IdleTime
|
||||
minKey: MinimumIdleTime
|
||||
maxKey: MaximumIdleTime
|
||||
|
||||
- type: htnPrimitive
|
||||
id: WaitIdleTimePrimitive
|
||||
operator: !type:WaitOperator
|
||||
key: IdleTime
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: IdleTime
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:WaitOperator
|
||||
key: IdleTime
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: IdleTime
|
||||
|
||||
@@ -2,33 +2,42 @@
|
||||
id: MedibotCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: InjectNearbyCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: InjectNearbyCompound
|
||||
- tasks:
|
||||
- id: IdleCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: IdleCompound
|
||||
|
||||
- type: htnCompound
|
||||
id: InjectNearbyCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: PickNearbyInjectablePrimitive
|
||||
- id: MoveToAccessiblePrimitive
|
||||
- id: MedibotSpeakPrimitive
|
||||
- id: SetIdleTimePrimitive
|
||||
- id: WaitIdleTimePrimitive
|
||||
- id: MedibotInjectPrimitive
|
||||
# TODO: Kill this shit
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:PickNearbyInjectableOperator
|
||||
targetKey: InjectTarget
|
||||
targetMoveKey: MovementTarget
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:SpeakOperator
|
||||
speech: medibot-start-inject
|
||||
|
||||
- type: htnPrimitive
|
||||
id: MedibotSpeakPrimitive
|
||||
operator: !type:SpeakOperator
|
||||
speech: medibot-start-inject
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
pathfindInPlanning: false
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickNearbyInjectablePrimitive
|
||||
operator: !type:PickNearbyInjectableOperator
|
||||
targetKey: InjectTarget
|
||||
targetMoveKey: MovementTarget
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:SetFloatOperator
|
||||
targetKey: IdleTime
|
||||
amount: 3
|
||||
|
||||
- type: htnPrimitive
|
||||
id: MedibotInjectPrimitive
|
||||
operator: !type:MedibotInjectOperator
|
||||
targetKey: InjectTarget
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:WaitOperator
|
||||
key: IdleTime
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: IdleTime
|
||||
|
||||
# TODO: Kill this
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MedibotInjectOperator
|
||||
targetKey: InjectTarget
|
||||
|
||||
@@ -3,32 +3,41 @@
|
||||
id: SimpleHostileCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: MeleeCombatCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: MeleeCombatCompound
|
||||
- tasks:
|
||||
- id: IdleCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: IdleCompound
|
||||
|
||||
- type: htnCompound
|
||||
id: MouseCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: FoodCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: FoodCompound
|
||||
- tasks:
|
||||
- id: IdleCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: IdleCompound
|
||||
|
||||
- type: htnCompound
|
||||
id: RuminantCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: FoodCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: FoodCompound
|
||||
- tasks:
|
||||
- id: IdleCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: IdleCompound
|
||||
|
||||
- type: htnCompound
|
||||
id: DragonCarpCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: MeleeCombatCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: MeleeCombatCompound
|
||||
- tasks:
|
||||
- id: FollowCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: FollowCompound
|
||||
- tasks:
|
||||
- id: IdleCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: IdleCompound
|
||||
|
||||
@@ -1,31 +1,56 @@
|
||||
- type: htnCompound
|
||||
id: FoodCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: PickFoodTargetPrimitive
|
||||
- id: MoveToCombatTargetPrimitive
|
||||
- id: EatPrimitive
|
||||
- id: WaitIdleTimePrimitive
|
||||
- tasks:
|
||||
- id: PickDrinkTargetPrimitive
|
||||
- id: MoveToCombatTargetPrimitive
|
||||
- id: EatPrimitive
|
||||
- id: WaitIdleTimePrimitive
|
||||
# Picks a nearby food, moves into range, then eats it and waits the idle time.
|
||||
- tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyFood
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
pathfindInPlanning: true
|
||||
removeKeyOnFinish: false
|
||||
targetKey: TargetCoordinates
|
||||
pathfindKey: TargetPathfind
|
||||
rangeKey: MeleeRange
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickFoodTargetPrimitive
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyFood
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: Target
|
||||
operator: !type:AltInteractOperator
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickDrinkTargetPrimitive
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyDrink
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: IdleTime
|
||||
operator: !type:WaitOperator
|
||||
key: IdleTime
|
||||
|
||||
- type: htnPrimitive
|
||||
id: EatPrimitive
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: CombatTarget
|
||||
operator: !type:AltInteractOperator
|
||||
# Picks nearby drink then consumes it and waits idle time
|
||||
- tasks:
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:UtilityOperator
|
||||
proto: NearbyDrink
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
pathfindInPlanning: true
|
||||
removeKeyOnFinish: false
|
||||
targetKey: TargetCoordinates
|
||||
pathfindKey: TargetPathfind
|
||||
rangeKey: MeleeRange
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: Target
|
||||
operator: !type:AltInteractOperator
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: IdleTime
|
||||
operator: !type:WaitOperator
|
||||
key: IdleTime
|
||||
|
||||
57
Resources/Prototypes/NPCs/root.yml
Normal file
57
Resources/Prototypes/NPCs/root.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
# Specific Root compound tasks being used for NPCs.
|
||||
|
||||
# Tries to shoot a target in LOS in range.
|
||||
- type: htnCompound
|
||||
id: TurretCompound
|
||||
branches:
|
||||
- tasks:
|
||||
# Shoot target if in range
|
||||
- !type:HTNPrimitiveTask
|
||||
preconditions:
|
||||
- !type:KeyExistsPrecondition
|
||||
key: Target
|
||||
- !type:TargetInRangePrecondition
|
||||
targetKey: Target
|
||||
# TODO: Non-scuffed
|
||||
rangeKey: RangedRange
|
||||
- !type:TargetInLOSPrecondition
|
||||
targetKey: Target
|
||||
rangeKey: RangedRange
|
||||
operator: !type:GunOperator
|
||||
targetKey: Target
|
||||
requireLOS: true
|
||||
services:
|
||||
- !type:UtilityService
|
||||
id: RangedService
|
||||
proto: NearbyGunTargets
|
||||
key: Target
|
||||
|
||||
- tasks:
|
||||
- !type:HTNCompoundTask
|
||||
task: IdleSpinCompound
|
||||
|
||||
- type: htnCompound
|
||||
id: SimpleRangedHostileCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- !type:HTNCompoundTask
|
||||
task: InnateRangedCombatCompound
|
||||
- tasks:
|
||||
- !type:HTNCompoundTask
|
||||
task: MeleeCombatCompound
|
||||
- tasks:
|
||||
- !type:HTNCompoundTask
|
||||
task: IdleCompound
|
||||
|
||||
- type: htnCompound
|
||||
id: SimpleHumanoidHostileCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- !type:HTNCompoundTask
|
||||
task: RangedCombatCompound
|
||||
- tasks:
|
||||
- !type:HTNCompoundTask
|
||||
task: MeleeCombatCompound
|
||||
- tasks:
|
||||
- !type:HTNCompoundTask
|
||||
task: IdleCompound
|
||||
@@ -3,13 +3,13 @@
|
||||
id: MoveToPathfindPointCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: PickPathfindPointPrimitive
|
||||
- id: MoveToAccessiblePrimitive
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:PickPathfindPointOperator
|
||||
|
||||
- !type:HTNPrimitiveTask
|
||||
operator: !type:MoveToOperator
|
||||
pathfindInPlanning: false
|
||||
|
||||
- type: htnPrimitive
|
||||
id: PickPathfindPointPrimitive
|
||||
operator: !type:PickPathfindPointOperator
|
||||
|
||||
- type: entity
|
||||
id: MobPathfindDummy
|
||||
@@ -18,4 +18,5 @@
|
||||
parent: MobXenoRouny
|
||||
components:
|
||||
- type: HTN
|
||||
rootTask: MoveToPathfindPointCompound
|
||||
rootTask:
|
||||
task: MoveToPathfindPointCompound
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
- type: utilityQuery
|
||||
id: InventoryGuns
|
||||
query:
|
||||
- !type:InventoryQuery
|
||||
- !type:ComponentFilter
|
||||
components:
|
||||
- type: Gun
|
||||
considerations:
|
||||
- !type:TargetAmmoCon
|
||||
curve: !type:QuadraticCurve
|
||||
|
||||
- type: utilityQuery
|
||||
id: NearbyAmmo
|
||||
query:
|
||||
- !type:ComponentQuery
|
||||
components:
|
||||
- type: Ammo
|
||||
- type: Item
|
||||
considerations:
|
||||
- !type:TargetAmmoMatchesCon
|
||||
curve: !type:BoolCurve
|
||||
- !type:TargetDistanceCon
|
||||
curve: !type:PresetCurve
|
||||
preset: TargetDistance
|
||||
# TODO: Get ammo count.
|
||||
- !type:TargetAccessibleCon
|
||||
curve: !type:BoolCurve
|
||||
|
||||
- type: utilityQuery
|
||||
id: NearbyFood
|
||||
query:
|
||||
@@ -36,6 +64,23 @@
|
||||
- !type:TargetAccessibleCon
|
||||
curve: !type:BoolCurve
|
||||
|
||||
- type: utilityQuery
|
||||
id: NearbyGuns
|
||||
query:
|
||||
- !type:ComponentQuery
|
||||
components:
|
||||
- type: Gun
|
||||
- type: Item
|
||||
considerations:
|
||||
# TODO: Prefer highest DPC probably?
|
||||
- !type:TargetAmmoCon
|
||||
curve: !type:BoolCurve
|
||||
- !type:TargetDistanceCon
|
||||
curve: !type:PresetCurve
|
||||
preset: TargetDistance
|
||||
- !type:TargetAccessibleCon
|
||||
curve: !type:BoolCurve
|
||||
|
||||
- type: utilityQuery
|
||||
id: NearbyMeleeTargets
|
||||
query:
|
||||
@@ -54,6 +99,29 @@
|
||||
- !type:TargetInLOSOrCurrentCon
|
||||
curve: !type:BoolCurve
|
||||
|
||||
- type: utilityQuery
|
||||
id: NearbyMeleeWeapons
|
||||
query:
|
||||
- !type:ComponentQuery
|
||||
components:
|
||||
# Just serializer things
|
||||
- type: MeleeWeapon
|
||||
damage:
|
||||
types:
|
||||
Brute: 0
|
||||
- type: Item
|
||||
considerations:
|
||||
- !type:TargetMeleeCon
|
||||
curve: !type:QuadraticCurve
|
||||
slope: 0.5
|
||||
exponent: 0.5
|
||||
yOffset: 0
|
||||
- !type:TargetDistanceCon
|
||||
curve: !type:PresetCurve
|
||||
preset: TargetDistance
|
||||
- !type:TargetAccessibleCon
|
||||
curve: !type:BoolCurve
|
||||
|
||||
- type: utilityQuery
|
||||
id: NearbyPuddles
|
||||
query:
|
||||
@@ -71,7 +139,7 @@
|
||||
curve: !type:BoolCurve
|
||||
|
||||
- type: utilityQuery
|
||||
id: NearbyRangedTargets
|
||||
id: NearbyGunTargets
|
||||
query:
|
||||
- !type:NearbyHostilesQuery
|
||||
considerations:
|
||||
@@ -88,6 +156,21 @@
|
||||
- !type:TargetInLOSOrCurrentCon
|
||||
curve: !type:BoolCurve
|
||||
|
||||
#- type: utilityQuery
|
||||
# id: NearbyShoes
|
||||
# query:
|
||||
# - !type:ComponentQuery
|
||||
# components:
|
||||
# - type: Clothing
|
||||
# - !type:ClothingSlotFilter
|
||||
# slotFlags: Feet
|
||||
# considerations:
|
||||
# - !type:TargetDistanceCon
|
||||
# curve: !type:PresetCurve
|
||||
# preset: TargetDistance
|
||||
# - !type:TargetAccessibleCon
|
||||
# curve: !type:BoolCurve
|
||||
|
||||
|
||||
# Presets
|
||||
- type: utilityCurvePreset
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
id: XenoCompound
|
||||
branches:
|
||||
- tasks:
|
||||
- id: MeleeCombatCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: MeleeCombatCompound
|
||||
- tasks:
|
||||
- id: IdleCompound
|
||||
- !type:HTNCompoundTask
|
||||
task: IdleCompound
|
||||
|
||||
Reference in New Issue
Block a user