From c8e3a251d5c9164284e1575e5a5346eb6a233241 Mon Sep 17 00:00:00 2001 From: austin Date: Mon, 21 Oct 2024 11:01:16 -0400 Subject: [PATCH] add unarmed combat --- assets/Data/entity/creatures/human.json | 35 ++++++++++++++++++ assets/Data/entity/creatures/skeleton.json | 35 ++++++++++++++++++ docs/src/progress/currenttarget.md | 37 +++++++++---------- docs/src/progress/renderertodo.md | 2 + .../entity/EntityDataStrings.java | 1 + .../entity/state/attack/ClientAttackTree.java | 15 ++++++++ .../entity/state/attack/ServerAttackTree.java | 11 ++++++ .../types/common/CommonEntityUtils.java | 3 -- 8 files changed, 116 insertions(+), 23 deletions(-) diff --git a/assets/Data/entity/creatures/human.json b/assets/Data/entity/creatures/human.json index 250c42e4..f6d5a337 100644 --- a/assets/Data/entity/creatures/human.json +++ b/assets/Data/entity/creatures/human.json @@ -389,6 +389,41 @@ "angularlyStatic" : true }, "attackMoves" : [ + { + "attackMoveId" : "Unarmed1", + "type" : "ATTACK_MOVE_UNARMED", + "firesProjectile" : false, + "nextMoveId" : "Unarmed2", + "nextAttackMoveWindowStart" : 0, + "nextAttackMoveWindowEnd" : 1, + "moveChainWindowStart" : 12, + "moveChainWindowEnd" : 18, + "initialMove" : true, + "attackState" : { + "animation" : { + "nameFirstPerson" : "AttackUnarmed1", + "nameThirdPerson" : "AttackUnarmed1", + "priorityCategory" : "MOVEMENT_MODIFIER" + } + } + }, + { + "attackMoveId" : "Unarmed2", + "type" : "ATTACK_MOVE_UNARMED", + "firesProjectile" : false, + "nextAttackMoveWindowStart" : 0, + "nextAttackMoveWindowEnd" : 1, + "moveChainWindowStart" : 12, + "moveChainWindowEnd" : 18, + "initialMove" : false, + "attackState" : { + "animation" : { + "nameFirstPerson" : "AttackUnarmed2", + "nameThirdPerson" : "AttackUnarmed2", + "priorityCategory" : "MOVEMENT_MODIFIER" + } + } + }, { "attackMoveId" : "Sword1HSlash1", "type" : "MELEE_WEAPON_SWING_ONE_HAND", diff --git a/assets/Data/entity/creatures/skeleton.json b/assets/Data/entity/creatures/skeleton.json index b6ec70b7..ba2b8a71 100644 --- a/assets/Data/entity/creatures/skeleton.json +++ b/assets/Data/entity/creatures/skeleton.json @@ -273,6 +273,41 @@ "angularlyStatic" : true }, "attackMoves" : [ + { + "attackMoveId" : "Unarmed1", + "type" : "ATTACK_MOVE_UNARMED", + "firesProjectile" : false, + "nextMoveId" : "Unarmed2", + "nextAttackMoveWindowStart" : 0, + "nextAttackMoveWindowEnd" : 1, + "moveChainWindowStart" : 12, + "moveChainWindowEnd" : 18, + "initialMove" : true, + "attackState" : { + "animation" : { + "nameFirstPerson" : "AttackUnarmed1", + "nameThirdPerson" : "AttackUnarmed1", + "priorityCategory" : "MOVEMENT_MODIFIER" + } + } + }, + { + "attackMoveId" : "Unarmed2", + "type" : "ATTACK_MOVE_UNARMED", + "firesProjectile" : false, + "nextAttackMoveWindowStart" : 0, + "nextAttackMoveWindowEnd" : 1, + "moveChainWindowStart" : 12, + "moveChainWindowEnd" : 18, + "initialMove" : false, + "attackState" : { + "animation" : { + "nameFirstPerson" : "AttackUnarmed2", + "nameThirdPerson" : "AttackUnarmed2", + "priorityCategory" : "MOVEMENT_MODIFIER" + } + } + }, { "attackMoveId" : "Sword1HSlash1", "type" : "MELEE_WEAPON_SWING_ONE_HAND", diff --git a/docs/src/progress/currenttarget.md b/docs/src/progress/currenttarget.md index 958314c0..cfc653a4 100644 --- a/docs/src/progress/currenttarget.md +++ b/docs/src/progress/currenttarget.md @@ -14,26 +14,24 @@ Ticketed randomizer node for BTs to more heavily weight attacking and waiting + feedback driven requirements - Add punching/unarmed combat - - Weapon raised/lowered component Implement gadgets - - Chemistry System - - Emitters - - Subscribers - - Dedicated collision engine on server - - Trap - - Bear - - Freeze - - Flame - - Bomb (to be thrown) - - Regular (Deals damage, ignites) - - Air (high push coeff) - - Flash (dazes) - - Sleep (puts enemies to sleep) - - Smoke (creates LOS blockers) - - Decoy (creates a decoy) - - Torch - - Throwable potions + - Chemistry System + - Emitters + - Subscribers + - Dedicated collision engine on server + - Trap + - Bear + - Freeze + - Flame + - Bomb (to be thrown) + - Regular (Deals damage, ignites) + - Air (high push coeff) + - Flash (dazes) + - Sleep (puts enemies to sleep) + - Smoke (creates LOS blockers) + - Decoy (creates a decoy) + - Torch + - Throwable potions Crouching Model clothing, hair for the human particles, light on sword collision @@ -48,7 +46,6 @@ Fix lights not being deleted - Not sending a "light count" var to light calculations, so the data stays in buffer even though it is not being updated Fix block tree preventing initiating an attack - Fix equipping sword on toolbar Fix return to title menu synchronization bug Fix particles not spawning in correct positions diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 3253f168..4e02ba45 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -881,6 +881,8 @@ Fix inventory null pointer check on virtualaudiomanager Fix inventory message for undefined id on client Fix movement audio service when audio engine disabled Fix idle animations (for katana) +Fix equipping sword on toolbar +Add punching/unarmed combat diff --git a/src/main/java/electrosphere/entity/EntityDataStrings.java b/src/main/java/electrosphere/entity/EntityDataStrings.java index d6ae0dfb..2c186de5 100644 --- a/src/main/java/electrosphere/entity/EntityDataStrings.java +++ b/src/main/java/electrosphere/entity/EntityDataStrings.java @@ -211,6 +211,7 @@ public class EntityDataStrings { public static final String ATTACK_MOVE_TYPE_MELEE_SWING_ONE_HAND = "MELEE_WEAPON_SWING_ONE_HAND"; public static final String ATTACK_MOVE_TYPE_MELEE_SWING_TWO_HAND = "MELEE_WEAPON_SWING_TWO_HAND"; public static final String ATTACK_MOVE_TYPE_BOW_TWO_HAND = "RANGED_WEAPON_BOW_TWO_HAND"; + public static final String ATTACK_MOVE_UNARMED = "ATTACK_MOVE_UNARMED"; /** * Ambient audio diff --git a/src/main/java/electrosphere/entity/state/attack/ClientAttackTree.java b/src/main/java/electrosphere/entity/state/attack/ClientAttackTree.java index 7e1bbb1a..2beae0a0 100644 --- a/src/main/java/electrosphere/entity/state/attack/ClientAttackTree.java +++ b/src/main/java/electrosphere/entity/state/attack/ClientAttackTree.java @@ -420,6 +420,9 @@ public class ClientAttackTree implements BehaviorTree { } } } + if(rVal == null && this.getMoveset(EntityDataStrings.ATTACK_MOVE_UNARMED) != null){ + return EntityDataStrings.ATTACK_MOVE_UNARMED; + } return rVal; } @@ -555,6 +558,7 @@ public class ClientAttackTree implements BehaviorTree { public void setState(AttackTreeState state){ this.state = state; } + /** *

Automatically generated

*

@@ -564,6 +568,7 @@ public class ClientAttackTree implements BehaviorTree { public AttackTreeDriftState getDriftState(){ return driftState; } + /** *

Automatically generated

*

@@ -574,6 +579,7 @@ public class ClientAttackTree implements BehaviorTree { public void setDriftState(AttackTreeDriftState driftState){ this.driftState = driftState; } + /** *

(initially) Automatically generated

*

@@ -592,6 +598,7 @@ public class ClientAttackTree implements BehaviorTree { Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTATTACKTREE_ID); return rVal; } + /** *

Automatically generated

*

@@ -603,6 +610,7 @@ public class ClientAttackTree implements BehaviorTree { public static void detachTree(Entity entity, BehaviorTree tree){ Globals.entityValueTrackingService.detatchTreeFromEntity(entity, BehaviorTreeIdEnums.BTREE_CLIENTATTACKTREE_ID); } + /** *

* Gets the ClientAttackTree of the entity @@ -613,6 +621,7 @@ public class ClientAttackTree implements BehaviorTree { public static ClientAttackTree getClientAttackTree(Entity entity){ return (ClientAttackTree)entity.getData(EntityDataStrings.TREE_CLIENTATTACKTREE); } + /** *

Automatically generated

*

@@ -639,6 +648,7 @@ public class ClientAttackTree implements BehaviorTree { return 0; } } + /** *

Automatically generated

*

@@ -665,6 +675,7 @@ public class ClientAttackTree implements BehaviorTree { return AttackTreeState.WINDUP; } } + /** *

Automatically generated

*

@@ -683,6 +694,7 @@ public class ClientAttackTree implements BehaviorTree { return 0; } } + /** *

Automatically generated

*

@@ -701,6 +713,7 @@ public class ClientAttackTree implements BehaviorTree { return AttackTreeDriftState.DRIFT; } } + /** *

Automatically generated

*

@@ -710,6 +723,7 @@ public class ClientAttackTree implements BehaviorTree { public String getCurrentMoveId(){ return currentMoveId; } + /** *

Automatically generated

*

@@ -720,6 +734,7 @@ public class ClientAttackTree implements BehaviorTree { public void setCurrentMoveId(String currentMoveId){ this.currentMoveId = currentMoveId; } + /** *

(Initially) Automatically Generated

*

diff --git a/src/main/java/electrosphere/entity/state/attack/ServerAttackTree.java b/src/main/java/electrosphere/entity/state/attack/ServerAttackTree.java index 33aeea0d..81fb1c04 100644 --- a/src/main/java/electrosphere/entity/state/attack/ServerAttackTree.java +++ b/src/main/java/electrosphere/entity/state/attack/ServerAttackTree.java @@ -494,6 +494,9 @@ public class ServerAttackTree implements BehaviorTree { } } } + if(rVal == null && this.getMoveset(EntityDataStrings.ATTACK_MOVE_UNARMED) != null){ + return EntityDataStrings.ATTACK_MOVE_UNARMED; + } return rVal; } @@ -632,6 +635,7 @@ public class ServerAttackTree implements BehaviorTree { DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(SynchronizationMessage.constructServerNotifyBTreeTransitionMessage(parent.getId(), BehaviorTreeIdEnums.BTREE_SERVERATTACKTREE_ID, FieldIdEnums.TREE_SERVERATTACKTREE_SYNCEDFIELD_STATE_ID, value)); } } + /** *

Automatically generated

*

@@ -641,6 +645,7 @@ public class ServerAttackTree implements BehaviorTree { public AttackTreeDriftState getDriftState(){ return driftState; } + /** *

Automatically generated

*

@@ -655,6 +660,7 @@ public class ServerAttackTree implements BehaviorTree { DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(SynchronizationMessage.constructUpdateClientStateMessage(parent.getId(), BehaviorTreeIdEnums.BTREE_SERVERATTACKTREE_ID, FieldIdEnums.TREE_SERVERATTACKTREE_SYNCEDFIELD_DRIFTSTATE_ID, value)); } } + /** *

(initially) Automatically generated

*

@@ -673,6 +679,7 @@ public class ServerAttackTree implements BehaviorTree { Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_SERVERATTACKTREE_ID); return rVal; } + /** *

Automatically generated

*

@@ -684,6 +691,7 @@ public class ServerAttackTree implements BehaviorTree { public static void detachTree(Entity entity, BehaviorTree tree){ Globals.entityValueTrackingService.detatchTreeFromEntity(entity, BehaviorTreeIdEnums.BTREE_SERVERATTACKTREE_ID); } + /** *

* Gets the ServerAttackTree of the entity @@ -694,6 +702,7 @@ public class ServerAttackTree implements BehaviorTree { public static ServerAttackTree getServerAttackTree(Entity entity){ return (ServerAttackTree)entity.getData(EntityDataStrings.TREE_SERVERATTACKTREE); } + /** *

Automatically generated

*

@@ -703,6 +712,7 @@ public class ServerAttackTree implements BehaviorTree { public String getCurrentMoveId(){ return currentMoveId; } + /** *

Automatically generated

*

@@ -716,4 +726,5 @@ public class ServerAttackTree implements BehaviorTree { DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(SynchronizationMessage.constructUpdateClientStringStateMessage(parent.getId(), BehaviorTreeIdEnums.BTREE_SERVERATTACKTREE_ID, FieldIdEnums.TREE_SERVERATTACKTREE_SYNCEDFIELD_CURRENTMOVEID_ID, currentMoveId)); } } + } diff --git a/src/main/java/electrosphere/entity/types/common/CommonEntityUtils.java b/src/main/java/electrosphere/entity/types/common/CommonEntityUtils.java index c9591b48..a1343258 100644 --- a/src/main/java/electrosphere/entity/types/common/CommonEntityUtils.java +++ b/src/main/java/electrosphere/entity/types/common/CommonEntityUtils.java @@ -153,9 +153,6 @@ public class CommonEntityUtils { //idle tree & generic stuff all creatures have if(graphicsTemplate.getModel() != null && graphicsTemplate.getModel().getIdleData() != null){ ClientIdleTree.attachTree(entity, graphicsTemplate.getModel().getIdleData()); - // ClientIdleTree idleTree = new ClientIdleTree(entity); - // entity.putData(EntityDataStrings.TREE_IDLE, idleTree); - // Globals.clientScene.registerBehaviorTree(idleTree); } } Actor creatureActor = EntityUtils.getActor(entity);