remove airplane movement system
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
e6fc720299
commit
6ea1daa747
@ -473,6 +473,7 @@ Partially fix first person attachment to viewmodel
|
|||||||
Creature data validation
|
Creature data validation
|
||||||
Unify animation format data on disk
|
Unify animation format data on disk
|
||||||
Leverage animation masks to block while moving
|
Leverage animation masks to block while moving
|
||||||
|
Remove Airplane movement system
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import electrosphere.net.parser.net.message.SynchronizationMessage;
|
|||||||
import electrosphere.server.datacell.utils.DataCellSearchUtils;
|
import electrosphere.server.datacell.utils.DataCellSearchUtils;
|
||||||
import electrosphere.entity.state.block.ClientBlockTree.BlockState;
|
import electrosphere.entity.state.block.ClientBlockTree.BlockState;
|
||||||
import electrosphere.game.data.creature.type.block.BlockSystem;
|
import electrosphere.game.data.creature.type.block.BlockSystem;
|
||||||
|
import electrosphere.game.data.creature.type.block.BlockVariant;
|
||||||
import electrosphere.net.synchronization.annotation.SyncedField;
|
import electrosphere.net.synchronization.annotation.SyncedField;
|
||||||
import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree;
|
import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree;
|
||||||
|
|
||||||
@ -61,7 +62,13 @@ public class ServerBlockTree implements BehaviorTree {
|
|||||||
),
|
),
|
||||||
StateTransitionUtilItem.create(
|
StateTransitionUtilItem.create(
|
||||||
BlockState.COOLDOWN,
|
BlockState.COOLDOWN,
|
||||||
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();},
|
() -> {
|
||||||
|
BlockVariant variant = this.blockSystem.getBlockVariant(this.currentBlockVariant);
|
||||||
|
if(variant != null){
|
||||||
|
return variant.getCooldownAnimation();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
null,
|
null,
|
||||||
() -> {this.setState(BlockState.NOT_BLOCKING);}
|
() -> {this.setState(BlockState.NOT_BLOCKING);}
|
||||||
),
|
),
|
||||||
|
|||||||
@ -2,9 +2,7 @@ package electrosphere.entity.state.idle;
|
|||||||
|
|
||||||
|
|
||||||
import electrosphere.net.synchronization.BehaviorTreeIdEnums;
|
import electrosphere.net.synchronization.BehaviorTreeIdEnums;
|
||||||
import electrosphere.entity.state.attack.ClientAttackTree;
|
|
||||||
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
|
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
|
||||||
import electrosphere.entity.state.movement.AirplaneMovementTree;
|
|
||||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree;
|
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree;
|
||||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementTreeState;
|
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementTreeState;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
@ -78,15 +76,6 @@ public class ClientIdleTree implements BehaviorTree {
|
|||||||
public void simulate(float deltaTime){
|
public void simulate(float deltaTime){
|
||||||
Actor entityActor = EntityUtils.getActor(parent);
|
Actor entityActor = EntityUtils.getActor(parent);
|
||||||
|
|
||||||
boolean movementTreeIsIdle = movementTreeIsIdle();
|
|
||||||
|
|
||||||
boolean hasAttackTree = parent.containsKey(EntityDataStrings.TREE_CLIENTATTACKTREE);
|
|
||||||
ClientAttackTree attackTree = null;
|
|
||||||
if(hasAttackTree){
|
|
||||||
attackTree = CreatureUtils.clientGetAttackTree(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//state machine
|
//state machine
|
||||||
switch(state){
|
switch(state){
|
||||||
case IDLE:
|
case IDLE:
|
||||||
@ -120,8 +109,6 @@ public class ClientIdleTree implements BehaviorTree {
|
|||||||
if(((ClientGroundMovementTree)movementTree).getState() == MovementTreeState.IDLE){
|
if(((ClientGroundMovementTree)movementTree).getState() == MovementTreeState.IDLE){
|
||||||
rVal = true;
|
rVal = true;
|
||||||
}
|
}
|
||||||
} else if(movementTree instanceof AirplaneMovementTree){
|
|
||||||
rVal = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rVal;
|
return rVal;
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import electrosphere.net.synchronization.FieldIdEnums;
|
|||||||
import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState;
|
import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState;
|
||||||
import electrosphere.entity.state.attack.ServerAttackTree;
|
import electrosphere.entity.state.attack.ServerAttackTree;
|
||||||
import electrosphere.entity.state.idle.ClientIdleTree.IdleTreeState;
|
import electrosphere.entity.state.idle.ClientIdleTree.IdleTreeState;
|
||||||
import electrosphere.entity.state.movement.AirplaneMovementTree;
|
|
||||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementTreeState;
|
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementTreeState;
|
||||||
import electrosphere.entity.state.movement.groundmove.ServerGroundMovementTree;
|
import electrosphere.entity.state.movement.groundmove.ServerGroundMovementTree;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
@ -150,8 +149,6 @@ public class ServerIdleTree implements BehaviorTree {
|
|||||||
if(((ServerGroundMovementTree)movementTree).getState() == MovementTreeState.IDLE){
|
if(((ServerGroundMovementTree)movementTree).getState() == MovementTreeState.IDLE){
|
||||||
rVal = true;
|
rVal = true;
|
||||||
}
|
}
|
||||||
} else if(movementTree instanceof AirplaneMovementTree){
|
|
||||||
rVal = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rVal;
|
return rVal;
|
||||||
|
|||||||
@ -1,306 +0,0 @@
|
|||||||
package electrosphere.entity.state.movement;
|
|
||||||
|
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
|
|
||||||
import org.joml.Quaterniond;
|
|
||||||
import org.joml.Vector3d;
|
|
||||||
import org.joml.Vector3f;
|
|
||||||
|
|
||||||
import electrosphere.collision.collidable.Collidable;
|
|
||||||
import electrosphere.engine.Globals;
|
|
||||||
import electrosphere.entity.Entity;
|
|
||||||
import electrosphere.entity.EntityUtils;
|
|
||||||
import electrosphere.entity.btree.BehaviorTree;
|
|
||||||
import electrosphere.entity.state.collidable.Impulse;
|
|
||||||
import electrosphere.entity.types.camera.CameraEntityUtils;
|
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
|
||||||
import electrosphere.net.parser.net.message.EntityMessage;
|
|
||||||
import electrosphere.renderer.actor.Actor;
|
|
||||||
import electrosphere.renderer.anim.Animation;
|
|
||||||
import electrosphere.server.datacell.utils.DataCellSearchUtils;
|
|
||||||
import electrosphere.util.MathUtils;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public class AirplaneMovementTree implements BehaviorTree {
|
|
||||||
|
|
||||||
public static enum AirplaneMovementTreeState {
|
|
||||||
ACCELERATING,
|
|
||||||
DECELERATING,
|
|
||||||
}
|
|
||||||
|
|
||||||
float minVelocity = 0;
|
|
||||||
float maxRotationSpeed = 1.0f;
|
|
||||||
|
|
||||||
//The yaw value last simulation frame
|
|
||||||
float previousYaw = 270;
|
|
||||||
//how much we're rolling currently
|
|
||||||
float rollVal = 0;
|
|
||||||
// the factor to increment rollVal by while swinging the camera around
|
|
||||||
float rollFactor = 0.05f;
|
|
||||||
|
|
||||||
|
|
||||||
static final double STATE_DIFFERENCE_HARD_UPDATE_THRESHOLD = 1.0;
|
|
||||||
static final double STATE_DIFFERENCE_SOFT_UPDATE_THRESHOLD = 0.2;
|
|
||||||
static final double SOFT_UPDATE_MULTIPLIER = 0.1;
|
|
||||||
|
|
||||||
AirplaneMovementTreeState state;
|
|
||||||
|
|
||||||
Entity parent;
|
|
||||||
|
|
||||||
Collidable collidable;
|
|
||||||
|
|
||||||
CopyOnWriteArrayList<EntityMessage> networkMessageQueue = new CopyOnWriteArrayList<EntityMessage>();
|
|
||||||
|
|
||||||
//when the latest network message for this tree was received
|
|
||||||
//used to filter out packets before the most recent one
|
|
||||||
long lastUpdateTime = 0;
|
|
||||||
|
|
||||||
float pitchCalculationTolerance = 0.99f;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs an airplane movement tree
|
|
||||||
* @param e The entity this tree will be attached to
|
|
||||||
* @param collidable The collidable of the entity that parents this tree
|
|
||||||
*/
|
|
||||||
public AirplaneMovementTree(Entity e, Collidable collidable){
|
|
||||||
state = AirplaneMovementTreeState.ACCELERATING;
|
|
||||||
parent = e;
|
|
||||||
this.collidable = collidable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simulates a step of the behavior tree
|
|
||||||
*/
|
|
||||||
public void simulate(float deltaTime){
|
|
||||||
//
|
|
||||||
//Get important initial values
|
|
||||||
//
|
|
||||||
float velocity = CreatureUtils.getVelocity(parent);
|
|
||||||
float acceleration = CreatureUtils.getAcceleration(parent);
|
|
||||||
float maxNaturalVelocity = CreatureUtils.getMaxNaturalVelocity(parent);
|
|
||||||
Actor entityActor = EntityUtils.getActor(parent);
|
|
||||||
Vector3d position = EntityUtils.getPosition(parent);
|
|
||||||
Vector3d facingVector = CreatureUtils.getFacingVector(parent);
|
|
||||||
Quaterniond movementQuaternion = new Quaterniond().rotationTo(MathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize();
|
|
||||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
|
||||||
//
|
|
||||||
//handle network messages
|
|
||||||
//
|
|
||||||
for(EntityMessage message : networkMessageQueue){
|
|
||||||
networkMessageQueue.remove(message);
|
|
||||||
long updateTime = message.gettime();
|
|
||||||
switch(message.getMessageSubtype()){
|
|
||||||
//received a message to update the tree
|
|
||||||
case MOVEUPDATE: {
|
|
||||||
if(updateTime > lastUpdateTime){
|
|
||||||
lastUpdateTime = updateTime;
|
|
||||||
//update the behavior tree state
|
|
||||||
switch(message.gettreeState()){
|
|
||||||
case 0:
|
|
||||||
state = AirplaneMovementTreeState.ACCELERATING;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
state = AirplaneMovementTreeState.DECELERATING;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//if we're the client snap to the reported position as appropriate
|
|
||||||
if(!Globals.RUN_SERVER){
|
|
||||||
if(position.distance(message.getpositionX(),message.getpositionY(),message.getpositionZ()) > STATE_DIFFERENCE_HARD_UPDATE_THRESHOLD){
|
|
||||||
EntityUtils.getPosition(parent).set(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
|
||||||
} else if(position.distance(message.getpositionX(),message.getpositionY(),message.getpositionZ()) > STATE_DIFFERENCE_SOFT_UPDATE_THRESHOLD){
|
|
||||||
EntityUtils.getPosition(parent).add(new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()).mul(SOFT_UPDATE_MULTIPLIER));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//we want to always update the server facing vector with where the client says they're facing
|
|
||||||
CreatureUtils.setFacingVector(parent, new Vector3d(message.getrotationX(),message.getrotationY(),message.getrotationZ()));
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
case ATTACHENTITYTOENTITY:
|
|
||||||
case ATTACKUPDATE:
|
|
||||||
case CREATE:
|
|
||||||
case DESTROY:
|
|
||||||
case KILL:
|
|
||||||
case SETPROPERTY:
|
|
||||||
case SPAWNCREATURE:
|
|
||||||
case SPAWNITEM:
|
|
||||||
//do nothing
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Actual simulation
|
|
||||||
//
|
|
||||||
switch(state){
|
|
||||||
case ACCELERATING: {
|
|
||||||
//velocity calculation
|
|
||||||
velocity = velocity + acceleration;
|
|
||||||
if(velocity > maxNaturalVelocity){
|
|
||||||
velocity = maxNaturalVelocity;
|
|
||||||
}
|
|
||||||
CreatureUtils.setVelocity(parent, velocity);
|
|
||||||
//update rotation
|
|
||||||
updateRotation(rotation,facingVector);
|
|
||||||
//add movement impulse
|
|
||||||
addMovementForce(velocity,rotation,collidable);
|
|
||||||
//if server, update all clients to simulation changes
|
|
||||||
serverUpdateTree(position,rotation,velocity);
|
|
||||||
} break;
|
|
||||||
case DECELERATING: {
|
|
||||||
//velocity calculation
|
|
||||||
velocity = velocity - acceleration;
|
|
||||||
if(velocity < minVelocity){
|
|
||||||
velocity = minVelocity;
|
|
||||||
}
|
|
||||||
CreatureUtils.setVelocity(parent, velocity);
|
|
||||||
//update rotation
|
|
||||||
updateRotation(rotation,facingVector);
|
|
||||||
//add movement impulse
|
|
||||||
addMovementForce(velocity,rotation,collidable);
|
|
||||||
//if server, update all clients to simulation changes
|
|
||||||
serverUpdateTree(position,rotation,velocity);
|
|
||||||
} break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the rotation of the airplane
|
|
||||||
* @param rotation Rotation quaternion
|
|
||||||
* @param rotationVector Rotation vector
|
|
||||||
*/
|
|
||||||
void updateRotation(Quaterniond rotation, Vector3d rotationVector){
|
|
||||||
if(Globals.RUN_CLIENT && this.parent == Globals.playerEntity){
|
|
||||||
Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
|
||||||
float pitch = CameraEntityUtils.getCameraPitch(Globals.playerCamera) / 180 * (float)Math.PI;
|
|
||||||
float yaw = -(CameraEntityUtils.getCameraYaw(Globals.playerCamera) + 180) / 180 * (float)Math.PI;
|
|
||||||
|
|
||||||
|
|
||||||
float deltaYaw = yaw - previousYaw;
|
|
||||||
|
|
||||||
if(deltaYaw > 0){
|
|
||||||
rollVal += -rollFactor;
|
|
||||||
}
|
|
||||||
if(deltaYaw < 0){
|
|
||||||
rollVal += rollFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Quaterniond yawQuat = new Quaterniond().fromAxisAngleRad(new Vector3d(0,1,0), yaw);
|
|
||||||
Quaterniond pitchQuat = new Quaterniond().fromAxisAngleRad(MathUtils.getOriginVector(), pitch);
|
|
||||||
Quaterniond rollQuat = new Quaterniond().fromAxisAngleRad(MathUtils.getOriginVector(), rollVal);
|
|
||||||
|
|
||||||
rotation.slerp(yawQuat.mul(pitchQuat).mul(rollQuat),0.1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//rotate thrust vector
|
|
||||||
rotationVector.set(rotation.transform(MathUtils.getOriginVector()));
|
|
||||||
// rotationVector.set(new Vector3f((float)rotationVector.x,(float)rotationVector.y,(float)rotationVector.z).mul(1.0f - this.maxRotationSpeed).add(new Vector3f(cameraEyeVector).mul(-this.maxRotationSpeed)));
|
|
||||||
|
|
||||||
|
|
||||||
rollVal = rollVal * 0.9f;
|
|
||||||
previousYaw = yaw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds the force to actually move the airplane entity
|
|
||||||
* @param velocity The current velocity
|
|
||||||
* @param facingVector The current facing vector
|
|
||||||
* @param collidable The collidable of the entity
|
|
||||||
*/
|
|
||||||
void addMovementForce(float velocity, Quaterniond rotation, Collidable collidable){
|
|
||||||
Vector3d impulseDir = rotation.transform(MathUtils.getOriginVector());
|
|
||||||
collidable.addImpulse(new Impulse(new Vector3d(impulseDir), new Vector3d(0,0,0), new Vector3d(0,0,0), velocity * Globals.timekeeper.getSimFrameTime(), "movement"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the instance is a server, update all clients within the chunk as appropriate
|
|
||||||
* @param position The position of the airplane
|
|
||||||
* @param facingVector The facing vector of the airplane
|
|
||||||
* @param velocity The velocity of the airplane
|
|
||||||
*/
|
|
||||||
void serverUpdateTree(Vector3d position, Quaterniond rotation, float velocity){
|
|
||||||
if(Globals.RUN_SERVER){
|
|
||||||
int stateNumber = 0;
|
|
||||||
switch(this.state){
|
|
||||||
case ACCELERATING:
|
|
||||||
stateNumber = 0;
|
|
||||||
break;
|
|
||||||
case DECELERATING:
|
|
||||||
stateNumber = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(
|
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
|
||||||
parent.getId(),
|
|
||||||
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
|
||||||
position.x,
|
|
||||||
position.y,
|
|
||||||
position.z,
|
|
||||||
rotation.x,
|
|
||||||
rotation.y,
|
|
||||||
rotation.z,
|
|
||||||
rotation.w,
|
|
||||||
velocity,
|
|
||||||
0,
|
|
||||||
stateNumber
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a network message relavent to this tree
|
|
||||||
* @param networkMessage The network message to register
|
|
||||||
*/
|
|
||||||
public void addNetworkMessage(EntityMessage networkMessage) {
|
|
||||||
networkMessageQueue.add(networkMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines the animation to play at a given point in the simulation loop
|
|
||||||
* @return The animation to play as a string
|
|
||||||
*/
|
|
||||||
public String determineCorrectAnimation(){
|
|
||||||
String rVal = "";
|
|
||||||
|
|
||||||
switch(state){
|
|
||||||
case ACCELERATING:
|
|
||||||
rVal = Animation.ANIMATION_IDLE_1;
|
|
||||||
break;
|
|
||||||
case DECELERATING:
|
|
||||||
rVal = Animation.ANIMATION_IDLE_1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return rVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current state of the behavior tree
|
|
||||||
* @return The current state of the behavior tree
|
|
||||||
*/
|
|
||||||
public AirplaneMovementTreeState getState(){
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the minimum velocity of this airplane tree
|
|
||||||
* @param minVelocity The minimum velocity
|
|
||||||
*/
|
|
||||||
public void setMinimumVelocity(float minVelocity){
|
|
||||||
this.minVelocity = minVelocity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the max rotation speed of this airplane movement tree
|
|
||||||
* @param maxRotationSpeed The max rotation speed
|
|
||||||
*/
|
|
||||||
public void setMaxRotationSpeed(float maxRotationSpeed){
|
|
||||||
this.maxRotationSpeed = maxRotationSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -33,7 +33,6 @@ import electrosphere.entity.state.inventory.ServerInventoryState;
|
|||||||
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
|
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
|
||||||
import electrosphere.entity.state.life.ClientLifeTree;
|
import electrosphere.entity.state.life.ClientLifeTree;
|
||||||
import electrosphere.entity.state.life.ServerLifeTree;
|
import electrosphere.entity.state.life.ServerLifeTree;
|
||||||
import electrosphere.entity.state.movement.AirplaneMovementTree;
|
|
||||||
import electrosphere.entity.state.movement.FallTree;
|
import electrosphere.entity.state.movement.FallTree;
|
||||||
import electrosphere.entity.state.movement.JumpTree;
|
import electrosphere.entity.state.movement.JumpTree;
|
||||||
import electrosphere.entity.state.movement.ServerFallTree;
|
import electrosphere.entity.state.movement.ServerFallTree;
|
||||||
@ -198,24 +197,6 @@ public class CreatureUtils {
|
|||||||
rVal.putData(EntityDataStrings.FALL_TREE, fallTree);
|
rVal.putData(EntityDataStrings.FALL_TREE, fallTree);
|
||||||
Globals.clientScene.registerBehaviorTree(fallTree);
|
Globals.clientScene.registerBehaviorTree(fallTree);
|
||||||
break;
|
break;
|
||||||
//
|
|
||||||
// Airplane
|
|
||||||
case AirplaneMovementSystem.AIRPLANE_MOVEMENT_SYSTEM: {
|
|
||||||
//construct tree
|
|
||||||
AirplaneMovementSystem airplaneMovementSystem = (AirplaneMovementSystem) movementSystem;
|
|
||||||
AirplaneMovementTree airplaneMovementTree = new AirplaneMovementTree(rVal, CollisionObjUtils.getCollidable(rVal));
|
|
||||||
//set properties
|
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_MAX_NATURAL_VELOCITY, airplaneMovementSystem.getMaxVelocity());
|
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_ACCELERATION, airplaneMovementSystem.getAcceleration());
|
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_VELOCITY, 0f);
|
|
||||||
airplaneMovementTree.setMinimumVelocity(airplaneMovementSystem.getMinVelocity());
|
|
||||||
airplaneMovementTree.setMaxRotationSpeed(airplaneMovementSystem.getMaxRotationSpeed());
|
|
||||||
//register misc stuff
|
|
||||||
rVal.putData(EntityDataStrings.CLIENT_MOVEMENT_BT, airplaneMovementTree);
|
|
||||||
CreatureUtils.setFacingVector(rVal, MathUtils.getOriginVector());
|
|
||||||
Globals.clientScene.registerBehaviorTree(airplaneMovementTree);
|
|
||||||
Globals.clientScene.registerEntityToTag(rVal, EntityTags.MOVEABLE);
|
|
||||||
} break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(rawType.getEquipPoints() != null && rawType.getEquipPoints().size() > 0){
|
if(rawType.getEquipPoints() != null && rawType.getEquipPoints().size() > 0){
|
||||||
@ -489,24 +470,6 @@ public class CreatureUtils {
|
|||||||
rVal.putData(EntityDataStrings.FALL_TREE, fallTree);
|
rVal.putData(EntityDataStrings.FALL_TREE, fallTree);
|
||||||
ServerBehaviorTreeUtils.attachBTreeToEntity(rVal, fallTree);
|
ServerBehaviorTreeUtils.attachBTreeToEntity(rVal, fallTree);
|
||||||
break;
|
break;
|
||||||
//
|
|
||||||
// Airplane
|
|
||||||
case AirplaneMovementSystem.AIRPLANE_MOVEMENT_SYSTEM: {
|
|
||||||
//construct tree
|
|
||||||
AirplaneMovementSystem airplaneMovementSystem = (AirplaneMovementSystem) movementSystem;
|
|
||||||
AirplaneMovementTree airplaneMovementTree = new AirplaneMovementTree(rVal, CollisionObjUtils.getCollidable(rVal));
|
|
||||||
//set properties
|
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_MAX_NATURAL_VELOCITY, airplaneMovementSystem.getMaxVelocity());
|
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_ACCELERATION, airplaneMovementSystem.getAcceleration());
|
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_VELOCITY, 0f);
|
|
||||||
airplaneMovementTree.setMinimumVelocity(airplaneMovementSystem.getMinVelocity());
|
|
||||||
airplaneMovementTree.setMaxRotationSpeed(airplaneMovementSystem.getMaxRotationSpeed());
|
|
||||||
//register misc stuff
|
|
||||||
rVal.putData(EntityDataStrings.SERVER_MOVEMENT_BT, airplaneMovementTree);
|
|
||||||
CreatureUtils.setFacingVector(rVal, MathUtils.getOriginVector());
|
|
||||||
ServerBehaviorTreeUtils.attachBTreeToEntity(rVal, airplaneMovementTree);
|
|
||||||
ServerEntityTagUtils.attachTagToEntity(rVal, EntityTags.MOVEABLE);
|
|
||||||
} break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(rawType.getEquipPoints() != null && rawType.getEquipPoints().size() > 0){
|
if(rawType.getEquipPoints() != null && rawType.getEquipPoints().size() > 0){
|
||||||
@ -792,8 +755,6 @@ public class CreatureUtils {
|
|||||||
BehaviorTree movementTree = clientGetEntityMovementTree(e);
|
BehaviorTree movementTree = clientGetEntityMovementTree(e);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
((ClientGroundMovementTree)movementTree).addNetworkMessage(em);
|
((ClientGroundMovementTree)movementTree).addNetworkMessage(em);
|
||||||
} else if(movementTree instanceof AirplaneMovementTree){
|
|
||||||
((AirplaneMovementTree)movementTree).addNetworkMessage(em);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -801,8 +762,6 @@ public class CreatureUtils {
|
|||||||
BehaviorTree movementTree = serverGetEntityMovementTree(e);
|
BehaviorTree movementTree = serverGetEntityMovementTree(e);
|
||||||
if(movementTree instanceof ServerGroundMovementTree){
|
if(movementTree instanceof ServerGroundMovementTree){
|
||||||
((ServerGroundMovementTree)movementTree).addNetworkMessage(em);
|
((ServerGroundMovementTree)movementTree).addNetworkMessage(em);
|
||||||
} else if(movementTree instanceof AirplaneMovementTree){
|
|
||||||
((AirplaneMovementTree)movementTree).addNetworkMessage(em);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user