]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Reorder priorities in `MeleeCombatCompound` (#30066)
authorosjarw <62134478+osjarw@users.noreply.github.com>
Sun, 11 Aug 2024 09:22:46 +0000 (12:22 +0300)
committerGitHub <noreply@github.com>
Sun, 11 Aug 2024 09:22:46 +0000 (19:22 +1000)
Reordered MeleeCombatCompound to improve unpulling

Resources/Prototypes/NPCs/Combat/melee.yml

index b0746e5679393b8a33373050f89f6ec37e2d65d1..9cbfbe7ca09cdf74314ca3df0d62c2ef6fde5d08 100644 (file)
@@ -3,48 +3,55 @@
 - type: htnCompound
   id: MeleeCombatCompound
   branches:
-    # Pickup weapon if we don't have one.
+    - tasks:
+        - !type:HTNPrimitiveTask
+          operator: !type:UtilityOperator
+            proto: NearbyMeleeTargets
+        - !type:HTNCompoundTask
+          task: BeforeMeleeAttackTargetCompound
+
+- type: htnCompound
+  id: BeforeMeleeAttackTargetCompound
+  branches:
     - preconditions:
-       - !type:ActiveHandComponentPrecondition
-          components:
-          # Just serializer things
-          - type: MeleeWeapon
-            damage:
-              types:
-                Blunt: 0
-          invert: true
+        - !type:BuckledPrecondition
+          isBuckled: true
       tasks:
-        - !type:HTNCompoundTask
-          task: PickupMeleeCompound
+        - !type:HTNPrimitiveTask
+          operator: !type:UnbuckleOperator
+            shutdownState: TaskFinished
 
     - preconditions:
-      - !type:BuckledPrecondition
-        isBuckled: true
+        - !type:PulledPrecondition
+          isPulled: true
       tasks:
-      - !type:HTNPrimitiveTask
-        operator: !type:UnbuckleOperator
-          shutdownState: TaskFinished
+        - !type:HTNPrimitiveTask
+          operator: !type:UnPullOperator
+            shutdownState: TaskFinished
 
     - preconditions:
-      - !type:InContainerPrecondition
-        isInContainer: true
+        - !type:InContainerPrecondition
+          isInContainer: true
       tasks:
-      - !type:HTNCompoundTask
-        task: EscapeCompound
+        - !type:HTNCompoundTask
+          task: EscapeCompound
 
+    # Pickup weapon if we don't have one.
     - preconditions:
-      - !type:PulledPrecondition
-        isPulled: true
+        - !type:ActiveHandComponentPrecondition
+            components:
+              # Just serializer things
+              - type: MeleeWeapon
+                damage:
+                  types:
+                    Blunt: 0
+            invert: true
       tasks:
-      - !type:HTNPrimitiveTask
-        operator: !type:UnPullOperator
-          shutdownState: TaskFinished
+        - !type:HTNCompoundTask
+          task: PickupMeleeCompound
 
     # Melee combat (unarmed or otherwise)
     - tasks:
-        - !type:HTNPrimitiveTask
-          operator: !type:UtilityOperator
-            proto: NearbyMeleeTargets
         - !type:HTNCompoundTask
           task: MeleeAttackTargetCompound