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:
metalgearsloth
2023-08-02 10:48:56 +10:00
committed by GitHub
parent 018e465fad
commit c31c848afd
103 changed files with 2089 additions and 810 deletions

View File

@@ -133,7 +133,8 @@
- type: InputMover
- type: MobMover
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: NpcFactionMember
factions:
- SimpleHostile
@@ -470,7 +471,8 @@
- type: Body
prototype: AnimalRuminant
- type: HTN
rootTask: RuminantCompound
rootTask:
task: RuminantCompound
- type: GuideHelp
guides:
- Chef
@@ -588,7 +590,8 @@
- type: Body
prototype: AnimalRuminant
- type: HTN
rootTask: RuminantCompound
rootTask:
task: RuminantCompound
# Note that we gotta make this bitch vomit someday when you feed it anthrax or sumthin. Needs to be a small item thief too and aggressive if attacked.
- type: entity
@@ -763,7 +766,8 @@
- type: Loadout
prototypes: [ BoxingKangarooGear ]
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: NpcFactionMember
factions:
- SimpleHostile
@@ -906,7 +910,8 @@
factions:
- Mouse
- type: HTN
rootTask: MouseCompound
rootTask:
task: MouseCompound
- type: Physics
- type: Fixtures
fixtures:
@@ -1286,7 +1291,8 @@
- type: InputMover
- type: MobMover
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: NpcFactionMember
factions:
- Syndicate
@@ -1562,7 +1568,8 @@
- type: InputMover
- type: MobMover
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: GhostRole
makeSentient: true
name: ghost-role-information-giant-spider-name
@@ -1866,7 +1873,8 @@
- type: InputMover
- type: MobMover
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: NpcFactionMember
factions:
- SimpleHostile

View File

@@ -12,7 +12,8 @@
description: ghost-role-information-behonker-description
- type: GhostTakeoverAvailable
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: NpcFactionMember
factions:
- SimpleHostile

View File

@@ -8,7 +8,8 @@
- type: InputMover
- type: MobMover
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
blackboard:
NavSmash: !type:Bool
true
@@ -20,7 +21,7 @@
sprite: Mobs/Aliens/Carps/space.rsi
layers:
- map: [ "enum.DamageStateVisualLayers.Base" ]
state: base
state: alive
- type: CombatMode
- type: Physics
- type: Fixtures
@@ -45,10 +46,10 @@
- type: DamageStateVisuals
states:
Alive:
Base: base
Base: alive
BaseUnshaded: mouth
Dead:
Base: base_dead
Base: dead
BaseUnshaded: dead_mouth
- type: Butcherable
spawned:
@@ -82,14 +83,14 @@
- type: Sprite
layers:
- map: [ "enum.DamageStateVisualLayers.Base" ]
state: base
state: alive
- map: [ "enum.DamageStateVisualLayers.BaseUnshaded" ]
state: mouth
shader: unshaded
- type: RandomSprite
available:
- enum.DamageStateVisualLayers.Base:
base: Rainbow
alive: Rainbow
enum.DamageStateVisualLayers.BaseUnshaded:
mouth: ""
@@ -145,7 +146,7 @@
name: space carp
id: MobCarpDragon
suffix: DragonBrood
parent: BaseMobCarp
parent: MobCarp
components:
- type: GhostRole
allowMovement: true
@@ -155,7 +156,8 @@
description: ghost-role-information-sentient-carp-description
- type: GhostTakeoverAvailable
- type: HTN
rootTask: DragonCarpCompound
rootTask:
task: DragonCarpCompound
- type: entity
id: MobCarpDungeon

View File

@@ -6,7 +6,8 @@
abstract: true
components:
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
blackboard:
NavSmash: !type:Bool
true

View File

@@ -12,6 +12,23 @@
factions:
- NanoTrasen
- type: entity
name: Salvager
parent: BaseMobHuman
id: MobSalvager
components:
- type: NpcFactionMember
factions:
- Syndicate
- type: Loadout
prototypes:
- SalvageSpecialistGear
- type: InputMover
- type: MobMover
- type: HTN
rootTask:
task: SimpleHumanoidHostileCompound
- type: entity
name: Spirate
parent: BaseMobHuman
@@ -21,10 +38,14 @@
- type: NpcFactionMember
factions:
- Syndicate
- type: Loadout
prototypes:
- PirateGear
- type: InputMover
- type: MobMover
- type: HTN
rootTask: RangedCombatCompound
rootTask:
task: SimpleHumanoidHostileCompound
- type: entity
parent: BaseMobHuman

View File

@@ -90,7 +90,8 @@
factions:
- PetsNT
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: Grammar
attributes:
gender: female
@@ -487,7 +488,8 @@
state: shiva
sprite: Mobs/Pets/shiva.rsi
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: Physics
- type: Fixtures
fixtures:

View File

@@ -11,7 +11,8 @@
- type: InputMover
- type: MobMover
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: Reactive
groups:
Flammable: [Touch]
@@ -176,7 +177,8 @@
- type: InputMover
- type: MobMover
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: Reactive
groups:
Flammable: [Touch]

View File

@@ -227,7 +227,8 @@
baseSprintSpeed: 3
- type: NoSlip
- type: HTN
rootTask: CleanbotCompound
rootTask:
task: CleanbotCompound
- type: DrainableSolution
solution: drainBuffer
- type: InteractionPopup
@@ -256,7 +257,8 @@
state: medibot
- type: Speech
- type: HTN
rootTask: MedibotCompound
rootTask:
task: MedibotCompound
- type: Construction
graph: MediBot
node: bot

View File

@@ -16,7 +16,8 @@
- type: InputMover
- type: MobMover
- type: HTN
rootTask: IdleCompound
rootTask:
task: IdleCompound
- type: Input
context: "human"
- type: NpcFactionMember

View File

@@ -9,7 +9,8 @@
factions:
- SimpleNeutral
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: Sprite
drawdepth: Mobs
sprite: Mobs/Aliens/slimes.rsi

View File

@@ -6,7 +6,8 @@
description: It looks friendly. Why don't you give it a hug?
components:
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: NpcFactionMember
factions:
- SimpleHostile

View File

@@ -7,7 +7,8 @@
- type: InputMover
- type: MobMover
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: NpcFactionMember
factions:
- SimpleHostile

View File

@@ -10,7 +10,8 @@
- type: InputMover
- type: MobMover
- type: HTN
rootTask: XenoCompound
rootTask:
task: XenoCompound
blackboard:
NavInteract: !type:Bool
true
@@ -330,8 +331,24 @@
thresholds:
0: Alive
75: Dead
- type: HTN
rootTask:
task: SimpleRangedHostileCompound
- type: Stamina
excess: 300
- type: RechargeBasicEntityAmmo
rechargeCooldown: 0.75
- type: BasicEntityAmmoProvider
proto: BulletAcid
capacity: 1
count: 1
- type: Gun
fireRate: 0.75
useKey: false
selectedMode: FullAuto
availableModes:
- FullAuto
soundGunshot: /Audio/Weapons/Xeno/alien_spitacid.ogg
- type: SlowOnDamage
speedModifierThresholds:
50: 0.4
@@ -374,7 +391,8 @@
- type: InputMover
- type: MobMover
- type: HTN
rootTask: SimpleHostileCompound
rootTask:
task: SimpleHostileCompound
- type: NpcFactionMember
factions:
- Xeno

View File

@@ -14,7 +14,8 @@
description: ghost-role-information-space-dragon-description
- type: GhostTakeoverAvailable
- type: HTN
rootTask: XenoCompound
rootTask:
task: XenoCompound
blackboard:
NavInteract: !type:Bool
true

View File

@@ -94,9 +94,6 @@
- type: InventorySlots
- type: Clickable
- type: InteractionOutline
- type: Icon
sprite: Mobs/Species/Human/parts.rsi
state: full
- type: Sprite
noRot: true
drawdepth: Mobs

View File

@@ -106,7 +106,8 @@
proto: CartridgeCaselessRifle
capacity: 500
- type: HTN
rootTask: TurretCompound
rootTask:
task: TurretCompound
blackboard:
SoundTargetInLOS: !type:SoundPathSpecifier
path: /Audio/Effects/double_beep.ogg
@@ -211,7 +212,8 @@
selectedMode: FullAuto
soundGunshot: /Audio/Weapons/Xeno/alien_spitacid.ogg
- type: HTN
rootTask: TurretCompound
rootTask:
task: TurretCompound
blackboard:
SoundTargetInLOS: !type:SoundPathSpecifier
path: /Audio/Animals/snake_hiss.ogg

View 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

View 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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,5 @@
# Generic pickups to not be naked.
# TODO: Armor / Pressure pickups.
# TODO: Preferred slots
#- type: htnCompound
# id:

View File

@@ -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

View 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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View 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

View File

@@ -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

View File

@@ -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

View File

@@ -2,6 +2,8 @@
id: XenoCompound
branches:
- tasks:
- id: MeleeCombatCompound
- !type:HTNCompoundTask
task: MeleeCombatCompound
- tasks:
- id: IdleCompound
- !type:HTNCompoundTask
task: IdleCompound

View File

@@ -21,6 +21,10 @@
- id: WeaponTurretXeno
amount: 3
prob: 0.25
- entries:
- id: MobXenoSpitter
amount: 2
prob: 0.25
- entries:
- id: MobXenoRavager
amount: 1