work
This commit is contained in:
		
							parent
							
								
									3d6b71bf01
								
							
						
					
					
						commit
						6088080257
					
				
							
								
								
									
										25
									
								
								docs/src/highlevel-design/chemisty/chemistrydesign.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								docs/src/highlevel-design/chemisty/chemistrydesign.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | |||||||
|  | @page chemistrydesign Chemistry System Design | ||||||
|  | 
 | ||||||
|  | Design notes for the chemistry system | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | Ideas for the chemistry system: | ||||||
|  |  - fire | ||||||
|  |  - water | ||||||
|  |  - electricity | ||||||
|  |  - ice | ||||||
|  |  - gravity | ||||||
|  |  - stabilization | ||||||
|  |  - metal parts / conductivity | ||||||
|  |  - light | ||||||
|  |  - mirrors | ||||||
|  |  - plants burning | ||||||
|  |  - plants growing really fast | ||||||
|  |  - flight | ||||||
|  |  - springiness/catapults (eg tree catapulting something) | ||||||
|  |  - spinning mechanisms and gears | ||||||
|  |  - weighing things down and measuring scales w/ weight | ||||||
|  |  - trampolines | ||||||
|  |  - Wind/fans | ||||||
|  |  - Weight | ||||||
|  |  - Music | ||||||
							
								
								
									
										6
									
								
								docs/src/highlevel-design/chemisty/chemistryindex.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								docs/src/highlevel-design/chemisty/chemistryindex.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | @page chemistryindex Chemistry | ||||||
|  | 
 | ||||||
|  | Pages on the chemistry system | ||||||
|  | 
 | ||||||
|  | [TOC] | ||||||
|  |  - @subpage chemistrydesign | ||||||
| @ -17,12 +17,6 @@ A list of all creatures that are targets for the game, and what their status of | |||||||
|  - [X] Data |  - [X] Data | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| ## Rat Man |  | ||||||
|  - [ ] 3d Model |  | ||||||
|  - [ ] Viewmodel |  | ||||||
|  - [ ] Data |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| ## Deer | ## Deer | ||||||
|  - [ ] 3d Model |  - [ ] 3d Model | ||||||
|  - [ ] Data |  - [ ] Data | ||||||
| @ -51,6 +45,11 @@ A list of all creatures that are targets for the game, and what their status of | |||||||
|  - [ ] Data |  - [ ] Data | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | ## Horse | ||||||
|  |  - [ ] 3d Model | ||||||
|  |  - [ ] Data | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| ## Elf | ## Elf | ||||||
|  - [X] Copy of Human |  - [X] Copy of Human | ||||||
|  - [ ] Attributes 0/? |  - [ ] Attributes 0/? | ||||||
| @ -63,6 +62,12 @@ A list of all creatures that are targets for the game, and what their status of | |||||||
|  - [ ] Data |  - [ ] Data | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  ## Rat Man | ||||||
|  |  - [ ] 3d Model | ||||||
|  |  - [ ] Viewmodel | ||||||
|  |  - [ ] Data | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| ## Frog Man | ## Frog Man | ||||||
|  - [ ] 3d Model |  - [ ] 3d Model | ||||||
|  - [ ] Viewmodel |  - [ ] Viewmodel | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| @page skeletonprogres Skeleton | @page skeletonprogress Skeleton | ||||||
| 
 | 
 | ||||||
| Progress on the skeleton creature | Progress on the skeleton creature | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -11,6 +11,7 @@ Discussion of, at a high game-design level, how everything should work and conne | |||||||
| - @subpage streamintegrationideas | - @subpage streamintegrationideas | ||||||
| - @subpage magicindex | - @subpage magicindex | ||||||
| - @subpage creaturesindex | - @subpage creaturesindex | ||||||
|  | - @subpage chemistryindex | ||||||
| - @subpage macrosimtimeline | - @subpage macrosimtimeline | ||||||
| - @subpage narrativemanager | - @subpage narrativemanager | ||||||
| - @subpage itemsindex | - @subpage itemsindex | ||||||
|  | |||||||
| @ -38,6 +38,7 @@ | |||||||
| 
 | 
 | ||||||
| + bug fixes | + bug fixes | ||||||
|   Fix skeleton right strafe |   Fix skeleton right strafe | ||||||
|  |   Fix block tree preventing initiating an attack | ||||||
|   Fix return to title menu synchronization bug |   Fix return to title menu synchronization bug | ||||||
| 
 | 
 | ||||||
| + unreproducible bugs | + unreproducible bugs | ||||||
|  | |||||||
| @ -796,6 +796,10 @@ New katana icon | |||||||
| UI fix | UI fix | ||||||
| Initial hitstun implementation | Initial hitstun implementation | ||||||
| 
 | 
 | ||||||
|  | (09/18/2024) | ||||||
|  | Migrate documentation | ||||||
|  | Netcode generator qol fixes | ||||||
|  | Combat Stances Component | ||||||
| 
 | 
 | ||||||
| # TODO | # TODO | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -317,6 +317,12 @@ public class EntityDataStrings { | |||||||
|     public static final String TREE_CLIENTWALKTREE = "treeClientWalkTree"; |     public static final String TREE_CLIENTWALKTREE = "treeClientWalkTree"; | ||||||
|     public static final String TREE_SERVERWALKTREE = "treeServerWalkTree"; |     public static final String TREE_SERVERWALKTREE = "treeServerWalkTree"; | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Weapon stance | ||||||
|  |      */ | ||||||
|  |     public static final String TREE_CLIENTSTANCECOMPONENT = "treeClientStanceComponent"; | ||||||
|  |     public static final String TREE_SERVERSTANCECOMPONENT = "treeServerStanceComponent"; | ||||||
|  |      | ||||||
|     /* |     /* | ||||||
|     Entity categories |     Entity categories | ||||||
|     */ |     */ | ||||||
|  | |||||||
| @ -45,8 +45,10 @@ public class ClientSprintTree implements BehaviorTree { | |||||||
|     Entity parent; |     Entity parent; | ||||||
|      |      | ||||||
|     /** |     /** | ||||||
|      * Gets the state of the tree |      * <p> Automatically generated </p> | ||||||
|      * @return The state |      * <p> | ||||||
|  |      * Gets state. | ||||||
|  |      * </p> | ||||||
|      */ |      */ | ||||||
|     public SprintTreeState getState(){ |     public SprintTreeState getState(){ | ||||||
|         return state; |         return state; | ||||||
|  | |||||||
| @ -51,8 +51,10 @@ public class ServerSprintTree implements BehaviorTree { | |||||||
|     int staminaCurrent = 0; |     int staminaCurrent = 0; | ||||||
|      |      | ||||||
|     /** |     /** | ||||||
|      * Gets the state of the tree |      * <p> Automatically generated </p> | ||||||
|      * @return The state of the tree |      * <p> | ||||||
|  |      * Gets state. | ||||||
|  |      * </p> | ||||||
|      */ |      */ | ||||||
|     public SprintTreeState getState(){ |     public SprintTreeState getState(){ | ||||||
|         return state; |         return state; | ||||||
|  | |||||||
| @ -217,4 +217,14 @@ public class ClientWalkTree implements BehaviorTree { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Gets state. | ||||||
|  |      * </p> | ||||||
|  |      */ | ||||||
|  |     public WalkState getState(){ | ||||||
|  |         return state; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -83,11 +83,13 @@ public class ServerWalkTree implements BehaviorTree { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Gets the state |      * <p> Automatically generated </p> | ||||||
|      * @return The state |      * <p> | ||||||
|  |      * Gets state. | ||||||
|  |      * </p> | ||||||
|      */ |      */ | ||||||
|     public WalkState getState(){ |     public WalkState getState(){ | ||||||
|         return this.state; |         return state; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -0,0 +1,206 @@ | |||||||
|  | package electrosphere.entity.state.stance; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import electrosphere.entity.btree.BehaviorTree; | ||||||
|  | import electrosphere.engine.Globals; | ||||||
|  | import electrosphere.entity.EntityDataStrings; | ||||||
|  | import electrosphere.net.synchronization.server.ServerSynchronizationManager; | ||||||
|  | import electrosphere.net.parser.net.message.SynchronizationMessage; | ||||||
|  | import electrosphere.net.synchronization.enums.BehaviorTreeIdEnums; | ||||||
|  | import electrosphere.entity.Entity; | ||||||
|  | import electrosphere.net.synchronization.annotation.SyncedField; | ||||||
|  | import electrosphere.net.synchronization.annotation.SynchronizableEnum; | ||||||
|  | import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Tracks the weapon/combat stance of the entity | ||||||
|  |  */ | ||||||
|  | @SynchronizedBehaviorTree( | ||||||
|  |     name = "clientStanceComponent", | ||||||
|  |     isServer = false, | ||||||
|  |     correspondingTree = "serverStanceComponent", | ||||||
|  |     genStartInt = true | ||||||
|  | ) | ||||||
|  | public class ClientStanceComponent implements BehaviorTree { | ||||||
|  |      | ||||||
|  |     @SynchronizableEnum | ||||||
|  |     public static enum CombatStance { | ||||||
|  |         /** | ||||||
|  |          * Not in attacking stance | ||||||
|  |          */ | ||||||
|  |         IDLE, | ||||||
|  |         /** | ||||||
|  |          * No weapon equipped, in attacking stance | ||||||
|  |          */ | ||||||
|  |         UNARMED, | ||||||
|  |         /** | ||||||
|  |          * Weapon equipped, in attacking stance | ||||||
|  |          */ | ||||||
|  |         ARMED, | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @SyncedField | ||||||
|  |     CombatStance state = CombatStance.IDLE; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * The parent entity | ||||||
|  |      */ | ||||||
|  |     Entity parent; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> (initially) Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Attaches this tree to the entity. | ||||||
|  |      * </p> | ||||||
|  |      * @param entity The entity to attach to | ||||||
|  |      * @param tree The behavior tree to attach | ||||||
|  |      * @param params Optional parameters that will be provided to the constructor | ||||||
|  |      */ | ||||||
|  |     public static ClientStanceComponent attachTree(Entity parent, Object ... params){ | ||||||
|  |         ClientStanceComponent rVal = new ClientStanceComponent(parent,params); | ||||||
|  |         //!!WARNING!! from here below should not be touched | ||||||
|  |         //This was generated automatically to properly alert various systems that the btree exists and should be tracked | ||||||
|  |         parent.putData(EntityDataStrings.TREE_CLIENTSTANCECOMPONENT, rVal); | ||||||
|  |         Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal); | ||||||
|  |         Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID); | ||||||
|  |         return rVal; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Detatches this tree from the entity. | ||||||
|  |      * </p> | ||||||
|  |      * @param entity The entity to detach to | ||||||
|  |      * @param tree The behavior tree to detach | ||||||
|  |      */ | ||||||
|  |     public static void detachTree(Entity entity, BehaviorTree tree){ | ||||||
|  |         Globals.entityValueTrackingService.detatchTreeFromEntity(entity, BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> (initially) Automatically generated </p> | ||||||
|  |      * <p> Private constructor to enforce using the attach methods </p> | ||||||
|  |      * <p> | ||||||
|  |      * Constructor | ||||||
|  |      * </p> | ||||||
|  |      * @param parent The parent entity of this tree | ||||||
|  |      * @param params Optional parameters that can be provided when attaching the tree. All custom data required for creating this tree should be passed in this varargs. | ||||||
|  |      */ | ||||||
|  |     public ClientStanceComponent(Entity parent, Object ... params){ | ||||||
|  |         this.parent = parent; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> | ||||||
|  |      * Gets the ClientStanceComponent of the entity | ||||||
|  |      * </p> | ||||||
|  |      * @param entity the entity | ||||||
|  |      * @return The ClientStanceComponent | ||||||
|  |      */ | ||||||
|  |     public static ClientStanceComponent getClientStanceComponent(Entity entity){ | ||||||
|  |         return (ClientStanceComponent)entity.getData(EntityDataStrings.TREE_CLIENTSTANCECOMPONENT); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Requests that the server start this btree | ||||||
|  |      * </p> | ||||||
|  |      */ | ||||||
|  |     public void start(){ | ||||||
|  |         Globals.clientConnection.queueOutgoingMessage( | ||||||
|  |             SynchronizationMessage.constructClientRequestBTreeActionMessage( | ||||||
|  |                 Globals.clientSceneWrapper.mapClientToServerId(parent.getId()), | ||||||
|  |                 BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID, | ||||||
|  |                 ServerSynchronizationManager.SERVER_SYNC_START | ||||||
|  |             ) | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Requests that the server start this btree | ||||||
|  |      * </p> | ||||||
|  |      */ | ||||||
|  |     public void interrupt(){ | ||||||
|  |         Globals.clientConnection.queueOutgoingMessage( | ||||||
|  |             SynchronizationMessage.constructClientRequestBTreeActionMessage( | ||||||
|  |                 Globals.clientSceneWrapper.mapClientToServerId(parent.getId()), | ||||||
|  |                 BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID, | ||||||
|  |                 ServerSynchronizationManager.SERVER_SYNC_INTERRUPT | ||||||
|  |             ) | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Sets state and handles the synchronization logic for it. | ||||||
|  |      * </p> | ||||||
|  |      * @param state The value to set state to. | ||||||
|  |      */ | ||||||
|  |     public void setState(CombatStance state){ | ||||||
|  |         this.state = state; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Converts a short to the equivalent enum value | ||||||
|  |      * </p> | ||||||
|  |      * @param shortVal The short value | ||||||
|  |      * @return The enum value | ||||||
|  |      */ | ||||||
|  |     public static CombatStance getCombatStanceShortAsEnum(short shortVal){ | ||||||
|  |         switch(shortVal){ | ||||||
|  |             case 0: | ||||||
|  |                 return CombatStance.IDLE; | ||||||
|  |             case 1: | ||||||
|  |                 return CombatStance.UNARMED; | ||||||
|  |             case 2: | ||||||
|  |                 return CombatStance.ARMED; | ||||||
|  |             default: | ||||||
|  |                 return CombatStance.IDLE; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Converts this enum type to an equivalent short value | ||||||
|  |      * </p> | ||||||
|  |      * @param enumVal The enum value | ||||||
|  |      * @return The short value | ||||||
|  |      */ | ||||||
|  |     public static short getCombatStanceEnumAsShort(CombatStance enumVal){ | ||||||
|  |         switch(enumVal){ | ||||||
|  |             case IDLE: | ||||||
|  |                 return 0; | ||||||
|  |             case UNARMED: | ||||||
|  |                 return 1; | ||||||
|  |             case ARMED: | ||||||
|  |                 return 2; | ||||||
|  |             default: | ||||||
|  |                 return 0; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void simulate(float deltaTime) { | ||||||
|  |         // TODO Auto-generated method stub | ||||||
|  |         throw new UnsupportedOperationException("Unimplemented method 'simulate'"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Gets state. | ||||||
|  |      * </p> | ||||||
|  |      */ | ||||||
|  |     public CombatStance getState(){ | ||||||
|  |         return state; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,129 @@ | |||||||
|  | package electrosphere.entity.state.stance; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import electrosphere.entity.btree.BehaviorTree; | ||||||
|  | import electrosphere.engine.Globals; | ||||||
|  | import electrosphere.entity.EntityDataStrings; | ||||||
|  | import electrosphere.net.synchronization.enums.FieldIdEnums; | ||||||
|  | import electrosphere.server.datacell.utils.DataCellSearchUtils; | ||||||
|  | import electrosphere.net.parser.net.message.SynchronizationMessage; | ||||||
|  | import electrosphere.net.synchronization.enums.BehaviorTreeIdEnums; | ||||||
|  | import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils; | ||||||
|  | import electrosphere.entity.Entity; | ||||||
|  | import electrosphere.entity.state.stance.ClientStanceComponent.CombatStance; | ||||||
|  | import electrosphere.net.synchronization.annotation.SyncedField; | ||||||
|  | import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Tracks the weapon/combat stance of the entity | ||||||
|  |  */ | ||||||
|  | @SynchronizedBehaviorTree( | ||||||
|  |     name = "serverStanceComponent", | ||||||
|  |     isServer = true, | ||||||
|  |     correspondingTree = "clientStanceComponent" | ||||||
|  | ) | ||||||
|  | public class ServerStanceComponent implements BehaviorTree { | ||||||
|  |      | ||||||
|  |     @SyncedField | ||||||
|  |     CombatStance state = CombatStance.IDLE; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * The parent entity of this component | ||||||
|  |      */ | ||||||
|  |     Entity parent; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> (initially) Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Attaches this tree to the entity. | ||||||
|  |      * </p> | ||||||
|  |      * @param entity The entity to attach to | ||||||
|  |      * @param tree The behavior tree to attach | ||||||
|  |      * @param params Optional parameters that will be provided to the constructor | ||||||
|  |      */ | ||||||
|  |     public static ServerStanceComponent attachTree(Entity parent, Object ... params){ | ||||||
|  |         ServerStanceComponent rVal = new ServerStanceComponent(parent,params); | ||||||
|  |         //!!WARNING!! from here below should not be touched | ||||||
|  |         //This was generated automatically to properly alert various systems that the btree exists and should be tracked | ||||||
|  |         ServerBehaviorTreeUtils.attachBTreeToEntity(parent, rVal); | ||||||
|  |         parent.putData(EntityDataStrings.TREE_SERVERSTANCECOMPONENT, rVal); | ||||||
|  |         Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID); | ||||||
|  |         return rVal; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Detatches this tree from the entity. | ||||||
|  |      * </p> | ||||||
|  |      * @param entity The entity to detach to | ||||||
|  |      * @param tree The behavior tree to detach | ||||||
|  |      */ | ||||||
|  |     public static void detachTree(Entity entity, BehaviorTree tree){ | ||||||
|  |         Globals.entityValueTrackingService.detatchTreeFromEntity(entity, BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> (initially) Automatically generated </p> | ||||||
|  |      * <p> Private constructor to enforce using the attach methods </p> | ||||||
|  |      * <p> | ||||||
|  |      * Constructor | ||||||
|  |      * </p> | ||||||
|  |      * @param parent The parent entity of this tree | ||||||
|  |      * @param params Optional parameters that can be provided when attaching the tree. All custom data required for creating this tree should be passed in this varargs. | ||||||
|  |      */ | ||||||
|  |     public ServerStanceComponent(Entity parent, Object ... params){ | ||||||
|  |         this.parent = parent; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> | ||||||
|  |      * Gets the ServerStanceComponent of the entity | ||||||
|  |      * </p> | ||||||
|  |      * @param entity the entity | ||||||
|  |      * @return The ServerStanceComponent | ||||||
|  |      */ | ||||||
|  |     public static ServerStanceComponent getServerStanceComponent(Entity entity){ | ||||||
|  |         return (ServerStanceComponent)entity.getData(EntityDataStrings.TREE_SERVERSTANCECOMPONENT); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Sets state and handles the synchronization logic for it. | ||||||
|  |      * </p> | ||||||
|  |      * @param state The value to set state to. | ||||||
|  |      */ | ||||||
|  |     public void setState(CombatStance state){ | ||||||
|  |         this.state = state; | ||||||
|  |         int value = ClientStanceComponent.getCombatStanceEnumAsShort(state); | ||||||
|  |         if(DataCellSearchUtils.getEntityDataCell(parent) != null){ | ||||||
|  |             DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(SynchronizationMessage.constructUpdateClientStateMessage(parent.getId(), BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID, FieldIdEnums.TREE_SERVERSTANCECOMPONENT_SYNCEDFIELD_STATE_ID, value)); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void simulate(float deltaTime) { | ||||||
|  |         // TODO Auto-generated method stub | ||||||
|  |         throw new UnsupportedOperationException("Unimplemented method 'simulate'"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void start(){ | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void interrupt(){ | ||||||
|  |          | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * <p> Automatically generated </p> | ||||||
|  |      * <p> | ||||||
|  |      * Gets state. | ||||||
|  |      * </p> | ||||||
|  |      */ | ||||||
|  |     public CombatStance getState(){ | ||||||
|  |         return state; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -1,8 +1,8 @@ | |||||||
| package electrosphere.net.synchronization.client; | package electrosphere.net.synchronization.client; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | import electrosphere.entity.state.stance.ClientStanceComponent; | ||||||
| import electrosphere.entity.state.movement.sprint.ClientSprintTree; | import electrosphere.entity.state.movement.sprint.ClientSprintTree; | ||||||
| import electrosphere.entity.state.equip.ClientEquipState; |  | ||||||
| import electrosphere.entity.state.movement.jump.ClientJumpTree; | import electrosphere.entity.state.movement.jump.ClientJumpTree; | ||||||
| import electrosphere.entity.state.movement.walk.ClientWalkTree; | import electrosphere.entity.state.movement.walk.ClientWalkTree; | ||||||
| import electrosphere.entity.state.life.ClientLifeTree; | import electrosphere.entity.state.life.ClientLifeTree; | ||||||
| @ -203,6 +203,14 @@ public class ClientSynchronizationManager { | |||||||
|                     } break; |                     } break; | ||||||
|                 } |                 } | ||||||
|             } break; |             } break; | ||||||
|  |             case BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID: { | ||||||
|  |                 switch(message.getfieldId()){ | ||||||
|  |                     case FieldIdEnums.TREE_SERVERSTANCECOMPONENT_SYNCEDFIELD_STATE_ID:{ | ||||||
|  |                         ClientStanceComponent tree = ClientStanceComponent.getClientStanceComponent(entity); | ||||||
|  |                         tree.setState(ClientStanceComponent.getCombatStanceShortAsEnum((short)message.getbTreeValue())); | ||||||
|  |                     } break; | ||||||
|  |                 } | ||||||
|  |             } break; | ||||||
|             case BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID: { |             case BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID: { | ||||||
|                 switch(message.getfieldId()){ |                 switch(message.getfieldId()){ | ||||||
|                     case FieldIdEnums.TREE_SERVERGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID:{ |                     case FieldIdEnums.TREE_SERVERGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID:{ | ||||||
|  | |||||||
| @ -17,6 +17,8 @@ public class BehaviorTreeIdEnums { | |||||||
|     public static final int BTREE_SERVERIDLE_ID = 9; |     public static final int BTREE_SERVERIDLE_ID = 9; | ||||||
|     public static final int BTREE_CLIENTLIFETREE_ID = 6; |     public static final int BTREE_CLIENTLIFETREE_ID = 6; | ||||||
|     public static final int BTREE_SERVERLIFETREE_ID = 13; |     public static final int BTREE_SERVERLIFETREE_ID = 13; | ||||||
|  |     public static final int BTREE_CLIENTSTANCECOMPONENT_ID = 20; | ||||||
|  |     public static final int BTREE_SERVERSTANCECOMPONENT_ID = 21; | ||||||
|     public static final int BTREE_CLIENTGROUNDMOVEMENTTREE_ID = 10; |     public static final int BTREE_CLIENTGROUNDMOVEMENTTREE_ID = 10; | ||||||
|     public static final int BTREE_SERVERGROUNDMOVEMENTTREE_ID = 11; |     public static final int BTREE_SERVERGROUNDMOVEMENTTREE_ID = 11; | ||||||
|     public static final int BTREE_CLIENTJUMPTREE_ID = 14; |     public static final int BTREE_CLIENTJUMPTREE_ID = 14; | ||||||
|  | |||||||
| @ -21,6 +21,8 @@ public class FieldIdEnums { | |||||||
|     public static final int TREE_SERVERIDLE_SYNCEDFIELD_STATE_ID = 13; |     public static final int TREE_SERVERIDLE_SYNCEDFIELD_STATE_ID = 13; | ||||||
|     public static final int TREE_CLIENTLIFETREE_SYNCEDFIELD_STATE_ID = 10; |     public static final int TREE_CLIENTLIFETREE_SYNCEDFIELD_STATE_ID = 10; | ||||||
|     public static final int TREE_SERVERLIFETREE_SYNCEDFIELD_STATE_ID = 17; |     public static final int TREE_SERVERLIFETREE_SYNCEDFIELD_STATE_ID = 17; | ||||||
|  |     public static final int TREE_CLIENTSTANCECOMPONENT_SYNCEDFIELD_STATE_ID = 28; | ||||||
|  |     public static final int TREE_SERVERSTANCECOMPONENT_SYNCEDFIELD_STATE_ID = 29; | ||||||
|     public static final int TREE_CLIENTGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID = 14; |     public static final int TREE_CLIENTGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID = 14; | ||||||
|     public static final int TREE_SERVERGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID = 15; |     public static final int TREE_SERVERGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID = 15; | ||||||
|     public static final int TREE_CLIENTJUMPTREE_SYNCEDFIELD_STATE_ID = 18; |     public static final int TREE_CLIENTJUMPTREE_SYNCEDFIELD_STATE_ID = 18; | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| package electrosphere.net.synchronization.server; | package electrosphere.net.synchronization.server; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | import electrosphere.entity.state.stance.ServerStanceComponent; | ||||||
| import electrosphere.entity.state.movement.sprint.ServerSprintTree; | import electrosphere.entity.state.movement.sprint.ServerSprintTree; | ||||||
| import electrosphere.logger.LoggerInterface; | import electrosphere.logger.LoggerInterface; | ||||||
| 
 | 
 | ||||||
| @ -89,6 +90,17 @@ public class ServerSynchronizationManager { | |||||||
|      */ |      */ | ||||||
|     private void updateEntityState(Entity entity, int bTreeId, SynchronizationMessage message){ |     private void updateEntityState(Entity entity, int bTreeId, SynchronizationMessage message){ | ||||||
|         switch(bTreeId){ |         switch(bTreeId){ | ||||||
|  |             case BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID: { | ||||||
|  |                 ServerStanceComponent tree = ServerStanceComponent.getServerStanceComponent(entity); | ||||||
|  |                 switch(message.getbTreeValue()){ | ||||||
|  |                     case ServerSynchronizationManager.SERVER_SYNC_START: { | ||||||
|  |                        tree.start(); | ||||||
|  |                     } break; | ||||||
|  |                     case ServerSynchronizationManager.SERVER_SYNC_INTERRUPT: { | ||||||
|  |                        tree.interrupt(); | ||||||
|  |                     } break; | ||||||
|  |                 } | ||||||
|  |             } break; | ||||||
|             case BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID: { |             case BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID: { | ||||||
|                 ServerJumpTree tree = ServerJumpTree.getServerJumpTree(entity); |                 ServerJumpTree tree = ServerJumpTree.getServerJumpTree(entity); | ||||||
|                 switch(message.getbTreeValue()){ |                 switch(message.getbTreeValue()){ | ||||||
|  | |||||||
| @ -1,9 +1,10 @@ | |||||||
| package electrosphere.net.synchronization.transport; | package electrosphere.net.synchronization.transport; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | import electrosphere.entity.state.stance.ServerStanceComponent; | ||||||
|  | import electrosphere.entity.state.stance.ClientStanceComponent; | ||||||
| import electrosphere.entity.state.movement.sprint.ServerSprintTree; | import electrosphere.entity.state.movement.sprint.ServerSprintTree; | ||||||
| import electrosphere.entity.state.movement.sprint.ClientSprintTree; | import electrosphere.entity.state.movement.sprint.ClientSprintTree; | ||||||
| import electrosphere.entity.state.equip.ClientEquipState; |  | ||||||
| import java.util.LinkedList; | import java.util.LinkedList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| @ -13,7 +14,6 @@ import electrosphere.entity.state.attack.ClientAttackTree; | |||||||
| import electrosphere.entity.state.attack.ServerAttackTree; | import electrosphere.entity.state.attack.ServerAttackTree; | ||||||
| import electrosphere.entity.state.block.ClientBlockTree; | import electrosphere.entity.state.block.ClientBlockTree; | ||||||
| import electrosphere.entity.state.block.ServerBlockTree; | import electrosphere.entity.state.block.ServerBlockTree; | ||||||
| import electrosphere.entity.state.equip.ServerEquipState; |  | ||||||
| import electrosphere.entity.state.gravity.ClientGravityTree; | import electrosphere.entity.state.gravity.ClientGravityTree; | ||||||
| import electrosphere.entity.state.gravity.ServerGravityTree; | import electrosphere.entity.state.gravity.ServerGravityTree; | ||||||
| import electrosphere.entity.state.idle.ClientIdleTree; | import electrosphere.entity.state.idle.ClientIdleTree; | ||||||
| @ -79,9 +79,6 @@ public class StateCollection { | |||||||
|                     collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERBLOCKTREE_ID,FieldIdEnums.TREE_SERVERBLOCKTREE_SYNCEDFIELD_STATE_ID,ClientBlockTree.getBlockStateEnumAsShort(tree.getState()))); |                     collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERBLOCKTREE_ID,FieldIdEnums.TREE_SERVERBLOCKTREE_SYNCEDFIELD_STATE_ID,ClientBlockTree.getBlockStateEnumAsShort(tree.getState()))); | ||||||
|                     collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERBLOCKTREE_ID,FieldIdEnums.TREE_SERVERBLOCKTREE_SYNCEDFIELD_CURRENTBLOCKVARIANT_ID,tree.getCurrentBlockVariant())); |                     collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERBLOCKTREE_ID,FieldIdEnums.TREE_SERVERBLOCKTREE_SYNCEDFIELD_CURRENTBLOCKVARIANT_ID,tree.getCurrentBlockVariant())); | ||||||
|                 } break; |                 } break; | ||||||
|                 case BehaviorTreeIdEnums.BTREE_SERVEREQUIPSTATE_ID: { |  | ||||||
|                     ServerEquipState tree = ServerEquipState.getServerEquipState(entity); |  | ||||||
|                 } break; |  | ||||||
|                 case BehaviorTreeIdEnums.BTREE_SERVERGRAVITY_ID: { |                 case BehaviorTreeIdEnums.BTREE_SERVERGRAVITY_ID: { | ||||||
|                     ServerGravityTree tree = ServerGravityTree.getServerGravityTree(entity); |                     ServerGravityTree tree = ServerGravityTree.getServerGravityTree(entity); | ||||||
|                     collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERGRAVITY_ID,FieldIdEnums.TREE_SERVERGRAVITY_SYNCEDFIELD_STATE_ID,ClientGravityTree.getGravityTreeStateEnumAsShort(tree.getState()))); |                     collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERGRAVITY_ID,FieldIdEnums.TREE_SERVERGRAVITY_SYNCEDFIELD_STATE_ID,ClientGravityTree.getGravityTreeStateEnumAsShort(tree.getState()))); | ||||||
| @ -94,6 +91,10 @@ public class StateCollection { | |||||||
|                     ServerLifeTree tree = ServerLifeTree.getServerLifeTree(entity); |                     ServerLifeTree tree = ServerLifeTree.getServerLifeTree(entity); | ||||||
|                     collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERLIFETREE_ID,FieldIdEnums.TREE_SERVERLIFETREE_SYNCEDFIELD_STATE_ID,ClientLifeTree.getLifeStateEnumEnumAsShort(tree.getState()))); |                     collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERLIFETREE_ID,FieldIdEnums.TREE_SERVERLIFETREE_SYNCEDFIELD_STATE_ID,ClientLifeTree.getLifeStateEnumEnumAsShort(tree.getState()))); | ||||||
|                 } break; |                 } break; | ||||||
|  |                 case BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID: { | ||||||
|  |                     ServerStanceComponent tree = ServerStanceComponent.getServerStanceComponent(entity); | ||||||
|  |                     collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID,FieldIdEnums.TREE_SERVERSTANCECOMPONENT_SYNCEDFIELD_STATE_ID,ClientStanceComponent.getCombatStanceEnumAsShort(tree.getState()))); | ||||||
|  |                 } break; | ||||||
|                 case BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID: { |                 case BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID: { | ||||||
|                     ServerGroundMovementTree tree = ServerGroundMovementTree.getServerGroundMovementTree(entity); |                     ServerGroundMovementTree tree = ServerGroundMovementTree.getServerGroundMovementTree(entity); | ||||||
|                     collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID,FieldIdEnums.TREE_SERVERGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID,ClientGroundMovementTree.getMovementRelativeFacingEnumAsShort(tree.getFacing()))); |                     collection.setValue(new SynchronizedFieldValue(BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID,FieldIdEnums.TREE_SERVERGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID,ClientGroundMovementTree.getMovementRelativeFacingEnumAsShort(tree.getFacing()))); | ||||||
| @ -154,11 +155,6 @@ public class StateCollection { | |||||||
|                         } break; |                         } break; | ||||||
|                     } |                     } | ||||||
|                 } break; |                 } break; | ||||||
|                 case BehaviorTreeIdEnums.BTREE_SERVEREQUIPSTATE_ID: { |  | ||||||
|                     ClientEquipState tree = ClientEquipState.getClientEquipState(entity); |  | ||||||
|                     switch(syncedValue.getFieldId()){ |  | ||||||
|                     } |  | ||||||
|                 } break; |  | ||||||
|                 case BehaviorTreeIdEnums.BTREE_SERVERGRAVITY_ID: { |                 case BehaviorTreeIdEnums.BTREE_SERVERGRAVITY_ID: { | ||||||
|                     ClientGravityTree tree = ClientGravityTree.getClientGravityTree(entity); |                     ClientGravityTree tree = ClientGravityTree.getClientGravityTree(entity); | ||||||
|                     switch(syncedValue.getFieldId()){ |                     switch(syncedValue.getFieldId()){ | ||||||
| @ -183,6 +179,14 @@ public class StateCollection { | |||||||
|                         } break; |                         } break; | ||||||
|                     } |                     } | ||||||
|                 } break; |                 } break; | ||||||
|  |                 case BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID: { | ||||||
|  |                     ClientStanceComponent tree = ClientStanceComponent.getClientStanceComponent(entity); | ||||||
|  |                     switch(syncedValue.getFieldId()){ | ||||||
|  |                         case(FieldIdEnums.TREE_SERVERSTANCECOMPONENT_SYNCEDFIELD_STATE_ID): { | ||||||
|  |                             tree.setState(ClientStanceComponent.getCombatStanceShortAsEnum(((Double)syncedValue.getValue()).shortValue())); | ||||||
|  |                         } break; | ||||||
|  |                     } | ||||||
|  |                 } break; | ||||||
|                 case BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID: { |                 case BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID: { | ||||||
|                     ClientGroundMovementTree tree = ClientGroundMovementTree.getClientGroundMovementTree(entity); |                     ClientGroundMovementTree tree = ClientGroundMovementTree.getClientGroundMovementTree(entity); | ||||||
|                     switch(syncedValue.getFieldId()){ |                     switch(syncedValue.getFieldId()){ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user