sync btree constructor refactor
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-07-31 16:50:01 -04:00
parent 236c7f0c51
commit 6cf8edf9f2
16 changed files with 98 additions and 101 deletions

View File

@ -94,7 +94,7 @@ public class ClientAttackTree implements BehaviorTree {
String projectileToFire = null;
String attackingPoint = null;
public ClientAttackTree(Entity e){
private ClientAttackTree(Entity e, Object ... params){
setState(AttackTreeState.IDLE);
setDriftState(AttackTreeDriftState.NO_DRIFT);
parent = e;
@ -461,16 +461,14 @@ public class ClientAttackTree implements BehaviorTree {
* </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 ClientAttackTree attachTree(Entity parent){
ClientAttackTree rVal = new ClientAttackTree(parent);
//put manual code here (setting params, etc)
public static ClientAttackTree attachTree(Entity parent, Object ... params){
ClientAttackTree rVal = new ClientAttackTree(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_CLIENTATTACKTREE, rVal);
Globals.clientScene.registerBehaviorTree(rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTATTACKTREE_ID);
return rVal;
}

View File

@ -80,7 +80,7 @@ public class ServerAttackTree implements BehaviorTree {
String projectileToFire = null;
String attackingPoint = null;
public ServerAttackTree(Entity e){
private ServerAttackTree(Entity e, Object ... params){
state = AttackTreeState.IDLE;
driftState = AttackTreeDriftState.NO_DRIFT;
parent = e;
@ -517,9 +517,10 @@ public class ServerAttackTree implements BehaviorTree {
* </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 ServerAttackTree attachTree(Entity parent){
ServerAttackTree rVal = new ServerAttackTree(parent);
public static ServerAttackTree attachTree(Entity parent, Object ... params){
ServerAttackTree rVal = new ServerAttackTree(parent,params);
//put manual code here (setting params, etc)

View File

@ -49,9 +49,9 @@ public class ClientBlockTree implements BehaviorTree {
/**
* Constructor
*/
private ClientBlockTree(Entity parent, BlockSystem blockSystem){
private ClientBlockTree(Entity parent, Object ... params){
this.parent = parent;
this.blockSystem = blockSystem;
this.blockSystem = (BlockSystem)params[0];
this.stateTransitionUtil = StateTransitionUtil.create(parent, false, new StateTransitionUtilItem[]{
StateTransitionUtilItem.create(
BlockState.WIND_UP,
@ -129,12 +129,10 @@ public class ClientBlockTree implements BehaviorTree {
* </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 ClientBlockTree attachTree(Entity parent, BlockSystem blockSystem){
ClientBlockTree rVal = new ClientBlockTree(parent, blockSystem);
//put manual code here (setting params, etc)
public static ClientBlockTree attachTree(Entity parent, Object ... params){
ClientBlockTree rVal = new ClientBlockTree(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_CLIENTBLOCKTREE, rVal);

View File

@ -44,9 +44,9 @@ public class ServerBlockTree implements BehaviorTree {
/**
* Constructor
*/
private ServerBlockTree(Entity parent, BlockSystem blockSystem){
private ServerBlockTree(Entity parent, Object ... params){
this.parent = parent;
this.blockSystem = blockSystem;
this.blockSystem = (BlockSystem)params[0];
this.stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{
StateTransitionUtilItem.create(
BlockState.WIND_UP,
@ -156,9 +156,10 @@ public class ServerBlockTree implements BehaviorTree {
* </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 ServerBlockTree attachTree(Entity parent, BlockSystem blockSystem){
ServerBlockTree rVal = new ServerBlockTree(parent, blockSystem);
public static ServerBlockTree attachTree(Entity parent, Object ... params){
ServerBlockTree rVal = new ServerBlockTree(parent,params);
//put manual code here (setting params, etc)

View File

@ -49,7 +49,8 @@ public class ClientEquipState implements BehaviorTree {
* @param parent the entity this is attached to
* @param equipPoints the list of available points
*/
private ClientEquipState(Entity parent, List<EquipPoint> equipPoints){
private ClientEquipState(Entity parent, Object ... params){
List<EquipPoint> equipPoints = (List)params[0];
this.parent = parent;
for(EquipPoint point : equipPoints){
this.equipPoints.add(point);
@ -418,16 +419,14 @@ public class ClientEquipState implements BehaviorTree {
* </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 ClientEquipState attachTree(Entity parent, List<EquipPoint> equipPoints){
ClientEquipState rVal = new ClientEquipState(parent, equipPoints);
//put manual code here (setting params, etc)
public static ClientEquipState attachTree(Entity parent, Object ... params){
ClientEquipState rVal = new ClientEquipState(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_CLIENTEQUIPSTATE, rVal);
Globals.clientScene.registerBehaviorTree(rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTEQUIPSTATE_ID);
return rVal;
}

View File

@ -58,7 +58,8 @@ public class ServerEquipState implements BehaviorTree {
//the map of equip point id -> entity equipped at said point
Map<String,Entity> equipMap = new HashMap<String,Entity>();
public ServerEquipState(Entity parent, List<EquipPoint> equipPoints){
public ServerEquipState(Entity parent, Object ... params){
List<EquipPoint> equipPoints = (List)params[0];
this.parent = parent;
for(EquipPoint point : equipPoints){
this.equipPoints.add(point);
@ -430,9 +431,10 @@ public class ServerEquipState implements BehaviorTree {
* </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 ServerEquipState attachTree(Entity parent, List<EquipPoint> equipPoints){
ServerEquipState rVal = new ServerEquipState(parent, equipPoints);
public static ServerEquipState attachTree(Entity parent, Object ... params){
ServerEquipState rVal = new ServerEquipState(parent,params);
//put manual code here (setting params, etc)

View File

@ -51,12 +51,13 @@ public class ClientGravityTree implements BehaviorTree {
List<EntityMessage> networkMessageQueue = new CopyOnWriteArrayList<EntityMessage>();
private ClientGravityTree(Entity e, Collidable collidable, DBody body, int fallFrame){
private ClientGravityTree(Entity e, Object ... params){
//Collidable collidable, DBody body, int fallFrame
state = GravityTreeState.ACTIVE;
parent = e;
this.body = body;
this.collidable = collidable;
this.fallFrame = fallFrame;
this.collidable = (Collidable)params[0];
this.body = (DBody)params[1];
this.fallFrame = (int)params[2];
}
// public void setCollisionObject(CollisionObject body, Collidable collidable){
@ -197,16 +198,14 @@ public class ClientGravityTree implements BehaviorTree {
* </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 ClientGravityTree attachTree(Entity parent, Collidable collidable, DBody body, int fallFrame){
ClientGravityTree rVal = new ClientGravityTree(parent, collidable, body, fallFrame);
//put manual code here (setting params, etc)
public static ClientGravityTree attachTree(Entity parent, Object ... params){
ClientGravityTree rVal = new ClientGravityTree(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_CLIENTGRAVITY, rVal);
Globals.clientScene.registerBehaviorTree(rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTGRAVITY_ID);
return rVal;
}

View File

@ -50,12 +50,13 @@ public class ServerGravityTree implements BehaviorTree {
List<EntityMessage> networkMessageQueue = new CopyOnWriteArrayList<EntityMessage>();
private ServerGravityTree(Entity e, Collidable collidable, DBody body, int fallFrame){
private ServerGravityTree(Entity e, Object ... params){
//Collidable collidable, DBody body, int fallFrame
state = GravityTreeState.ACTIVE;
parent = e;
this.body = body;
this.collidable = collidable;
this.fallFrame = fallFrame;
this.collidable = (Collidable)params[0];
this.body = (DBody)params[1];
this.fallFrame = (int)params[2];
}
// public void setCollisionObject(CollisionObject body, Collidable collidable){
@ -224,9 +225,10 @@ public class ServerGravityTree implements BehaviorTree {
* </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 ServerGravityTree attachTree(Entity parent, Collidable collidable, DBody body, int fallFrame){
ServerGravityTree rVal = new ServerGravityTree(parent,collidable,body,fallFrame);
public static ServerGravityTree attachTree(Entity parent, Object ... params){
ServerGravityTree rVal = new ServerGravityTree(parent,params);
//put manual code here (setting params, etc)

View File

@ -42,7 +42,7 @@ public class ClientIdleTree implements BehaviorTree {
* Creates an idle tree
* @param e the entity to attach the tree to
*/
public ClientIdleTree(Entity e){
public ClientIdleTree(Entity e, Object ... params){
state = IdleTreeState.IDLE;
parent = e;
//check if this is a creature, if so add its idle data
@ -134,16 +134,14 @@ public class ClientIdleTree implements BehaviorTree {
* </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 ClientIdleTree attachTree(Entity parent){
ClientIdleTree rVal = new ClientIdleTree(parent);
//put manual code here (setting params, etc)
public static ClientIdleTree attachTree(Entity parent, Object ... params){
ClientIdleTree rVal = new ClientIdleTree(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_IDLE, rVal);
Globals.clientScene.registerBehaviorTree(rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_IDLE_ID);
return rVal;
}

View File

@ -46,10 +46,10 @@ public class ServerIdleTree implements BehaviorTree {
* Creates a server idle tree
* @param e The entity to attach it to
*/
public ServerIdleTree(Entity e, IdleData idleData){
public ServerIdleTree(Entity e, Object ... params){
state = IdleTreeState.IDLE;
parent = e;
this.idleData = idleData;
this.idleData = (IdleData)params[0];
}
/**
@ -166,9 +166,10 @@ public class ServerIdleTree implements BehaviorTree {
* </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 ServerIdleTree attachTree(Entity parent, IdleData idleData){
ServerIdleTree rVal = new ServerIdleTree(parent, idleData);
public static ServerIdleTree attachTree(Entity parent, Object ... params){
ServerIdleTree rVal = new ServerIdleTree(parent,params);
//put manual code here (setting params, etc)

View File

@ -79,12 +79,10 @@ public class ClientLifeTree implements BehaviorTree {
* </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 ClientLifeTree attachTree(Entity parent, HealthSystem healthSystem){
ClientLifeTree rVal = new ClientLifeTree(parent,healthSystem);
//put manual code here (setting params, etc)
public static ClientLifeTree attachTree(Entity parent, Object ... params){
ClientLifeTree rVal = new ClientLifeTree(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_CLIENTLIFETREE, rVal);
@ -113,9 +111,9 @@ public class ClientLifeTree implements BehaviorTree {
* </p>
* @param parent The parent entity of this tree
*/
public ClientLifeTree(Entity parent, HealthSystem healthSystem){
public ClientLifeTree(Entity parent, Object ... params){
this.parent = parent;
this.healthSystem = healthSystem;
this.healthSystem = (HealthSystem)params[0];
stateTransitionUtil = StateTransitionUtil.create(parent, false, new StateTransitionUtilItem[]{
StateTransitionUtilItem.create(
LifeStateEnum.DYING,

View File

@ -132,9 +132,10 @@ public class ServerLifeTree implements BehaviorTree {
* </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 ServerLifeTree attachTree(Entity parent, HealthSystem healthSystem){
ServerLifeTree rVal = new ServerLifeTree(parent, healthSystem);
public static ServerLifeTree attachTree(Entity parent, Object ... params){
ServerLifeTree rVal = new ServerLifeTree(parent,params);
//put manual code here (setting params, etc)
@ -166,13 +167,13 @@ public class ServerLifeTree implements BehaviorTree {
* </p>
* @param parent The parent entity of this tree
*/
public ServerLifeTree(Entity parent, HealthSystem healthSystem){
public ServerLifeTree(Entity parent, Object ... params){
this.parent = parent;
this.lifeMax = healthSystem.getMaxHealth();
this.healthSystem = (HealthSystem)params[0];
this.lifeMax = this.healthSystem.getMaxHealth();
this.lifeCurrent = this.lifeMax;
this.iFrameMaxCount = healthSystem.getOnDamageIFrames();
this.iFrameMaxCount = this.healthSystem.getOnDamageIFrames();
this.iFrameCurrent = 0;
this.healthSystem = healthSystem;
stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{
StateTransitionUtilItem.create(
LifeStateEnum.DYING,

View File

@ -110,9 +110,12 @@ public class ClientGroundMovementTree implements BehaviorTree {
* Constructor
* @param e The parent entity
*/
private ClientGroundMovementTree(Entity e){
private ClientGroundMovementTree(Entity e, Object ... params){
//Collidable collidable, GroundMovementSystem groundMovementData
state = MovementTreeState.IDLE;
parent = e;
this.collidable = (Collidable)params[0];
this.groundMovementData = (GroundMovementSystem)params[1];
}
/**
@ -673,18 +676,14 @@ public class ClientGroundMovementTree implements BehaviorTree {
* </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 ClientGroundMovementTree attachTree(Entity parent, Collidable collidable, GroundMovementSystem groundMovementData){
ClientGroundMovementTree rVal = new ClientGroundMovementTree(parent);
//put manual code here (setting params, etc)
rVal.collidable = collidable;
rVal.groundMovementData = groundMovementData;
public static ClientGroundMovementTree attachTree(Entity parent, Object ... params){
ClientGroundMovementTree rVal = new ClientGroundMovementTree(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_CLIENTGROUNDMOVEMENTTREE, rVal);
Globals.clientScene.registerBehaviorTree(rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTGROUNDMOVEMENTTREE_ID);
return rVal;
}

View File

@ -77,10 +77,12 @@ public class ServerGroundMovementTree implements BehaviorTree {
Vector3d movementVector = new Vector3d(1,0,0);
private ServerGroundMovementTree(Entity e){
private ServerGroundMovementTree(Entity e, Object ... params){
//Collidable collidable
state = MovementTreeState.IDLE;
facing = MovementRelativeFacing.FORWARD;
parent = e;
this.collidable = (Collidable)params[0];
}
public MovementTreeState getState(){
@ -700,18 +702,17 @@ public class ServerGroundMovementTree implements BehaviorTree {
* </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 ServerGroundMovementTree attachTree(Entity parent, Collidable collidable){
ServerGroundMovementTree rVal = new ServerGroundMovementTree(parent);
public static ServerGroundMovementTree attachTree(Entity parent, Object ... params){
ServerGroundMovementTree rVal = new ServerGroundMovementTree(parent,params);
//put manual code here (setting params, etc)
rVal.collidable = collidable;
//!!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_SERVERGROUNDMOVEMENTTREE, rVal);
Globals.clientScene.registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID);
return rVal;
}

View File

@ -56,11 +56,11 @@ public class ClientJumpTree implements BehaviorTree {
static final float jumpFalloff = 0.99f;
public ClientJumpTree(Entity parent, JumpMovementSystem jumpData){
public ClientJumpTree(Entity parent, Object ... params){
this.parent = parent;
this.jumpFrames = jumpData.getJumpFrames();
this.jumpForce = jumpData.getJumpForce();
this.jumpData = jumpData;
this.jumpData = (JumpMovementSystem)params[0];
this.jumpFrames = this.jumpData.getJumpFrames();
this.jumpForce = this.jumpData.getJumpForce();
}
public void start(){
@ -163,12 +163,10 @@ public class ClientJumpTree implements BehaviorTree {
* </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 ClientJumpTree attachTree(Entity parent, JumpMovementSystem jumpData){
ClientJumpTree rVal = new ClientJumpTree(parent, jumpData);
//put manual code here (setting params, etc)
public static ClientJumpTree attachTree(Entity parent, Object ... params){
ClientJumpTree rVal = new ClientJumpTree(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_CLIENTJUMPTREE, rVal);

View File

@ -48,11 +48,11 @@ public class ServerJumpTree implements BehaviorTree {
static final float jumpFalloff = 0.99f;
public ServerJumpTree(Entity parent, JumpMovementSystem jumpData){
public ServerJumpTree(Entity parent, Object ... params){
this.parent = parent;
this.jumpFrames = jumpData.getJumpFrames();
this.jumpForce = jumpData.getJumpForce();
this.jumpData = jumpData;
this.jumpData = (JumpMovementSystem)params[0];
this.jumpFrames = this.jumpData.getJumpFrames();
this.jumpForce = this.jumpData.getJumpForce();
}
public void start(){
@ -157,9 +157,10 @@ public class ServerJumpTree implements BehaviorTree {
* </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 ServerJumpTree attachTree(Entity parent, JumpMovementSystem jumpData){
ServerJumpTree rVal = new ServerJumpTree(parent, jumpData);
public static ServerJumpTree attachTree(Entity parent, Object ... params){
ServerJumpTree rVal = new ServerJumpTree(parent,params);
//put manual code here (setting params, etc)