eventual fall tree synchronization
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
99a7434557
commit
d9d2a74f68
@ -17,6 +17,7 @@
|
||||
|
||||
+ bug fixes
|
||||
Fix falling tree not always deactivating on server
|
||||
Fix cursor always placing at origin
|
||||
Fix server ground movement tree playing animation over falling animation
|
||||
Fix empty item slot not showing underneath dragged item
|
||||
Fix grass rendering distance
|
||||
|
||||
@ -39,6 +39,9 @@ public class ClientGravityTree implements BehaviorTree {
|
||||
|
||||
DBody body;
|
||||
Collidable collidable;
|
||||
|
||||
static final float gravityConstant = 0.2f;
|
||||
static final float linearDamping = 0.1f;
|
||||
|
||||
private ClientGravityTree(Entity e, Object ... params){
|
||||
//Collidable collidable, DBody body, int fallFrame
|
||||
@ -71,9 +74,14 @@ public class ClientGravityTree implements BehaviorTree {
|
||||
public void stop(){
|
||||
state = GravityTreeState.NOT_ACTIVE;
|
||||
}
|
||||
|
||||
static final float gravityConstant = 0.2f;
|
||||
static final float linearDamping = 0.1f;
|
||||
|
||||
/**
|
||||
* Checks if the gravity tree is active
|
||||
* @return true if active, false otherwise
|
||||
*/
|
||||
public boolean isActive(){
|
||||
return this.state == GravityTreeState.ACTIVE;
|
||||
}
|
||||
|
||||
public void simulate(float deltaTime){
|
||||
|
||||
|
||||
@ -38,6 +38,9 @@ public class ServerGravityTree implements BehaviorTree {
|
||||
|
||||
DBody body;
|
||||
Collidable collidable;
|
||||
|
||||
static final float gravityConstant = 0.2f;
|
||||
static final float linearDamping = 0.1f;
|
||||
|
||||
private ServerGravityTree(Entity e, Object ... params){
|
||||
state = GravityTreeState.ACTIVE;
|
||||
@ -76,9 +79,14 @@ public class ServerGravityTree implements BehaviorTree {
|
||||
public void stop(){
|
||||
setState(GravityTreeState.NOT_ACTIVE);
|
||||
}
|
||||
|
||||
static final float gravityConstant = 0.2f;
|
||||
static final float linearDamping = 0.1f;
|
||||
|
||||
/**
|
||||
* Checks if the gravity tree is active
|
||||
* @return true if active, false otherwise
|
||||
*/
|
||||
public boolean isActive(){
|
||||
return this.state == GravityTreeState.ACTIVE;
|
||||
}
|
||||
|
||||
public void simulate(float deltaTime){
|
||||
|
||||
@ -117,6 +125,10 @@ public class ServerGravityTree implements BehaviorTree {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the gravity tree had a collision with a structure
|
||||
* @return true if collided on the most recent frame, false otherwise
|
||||
*/
|
||||
public boolean hadStructureCollision(){
|
||||
boolean rVal = false;
|
||||
for(Impulse impulse : collidable.getImpulses()){
|
||||
@ -128,6 +140,10 @@ public class ServerGravityTree implements BehaviorTree {
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the gravity tree had a collision with terrain
|
||||
* @return true if collided on the most recent frame, false otherwise
|
||||
*/
|
||||
public boolean hadGroundCollision(){
|
||||
boolean rVal = false;
|
||||
for(Impulse impulse : collidable.getImpulses()){
|
||||
@ -144,6 +160,10 @@ public class ServerGravityTree implements BehaviorTree {
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the gravity tree had a collision with an entity
|
||||
* @return true if collided on the most recent frame, false otherwise
|
||||
*/
|
||||
public boolean hadEntityCollision(){
|
||||
boolean rVal = false;
|
||||
for(Impulse impulse : collidable.getImpulses()){
|
||||
|
||||
@ -11,6 +11,7 @@ import electrosphere.entity.btree.StateTransitionUtil;
|
||||
import electrosphere.entity.btree.StateTransitionUtil.StateTransitionUtilItem;
|
||||
import electrosphere.entity.state.AnimationPriorities;
|
||||
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
|
||||
import electrosphere.entity.state.gravity.ClientGravityTree;
|
||||
import electrosphere.entity.state.movement.jump.ClientJumpTree;
|
||||
import electrosphere.game.data.creature.type.movement.FallMovementSystem;
|
||||
import electrosphere.renderer.actor.Actor;
|
||||
@ -64,6 +65,9 @@ public class ClientFallTree implements BehaviorTree {
|
||||
switch(state){
|
||||
case ACTIVE:
|
||||
stateTransitionUtil.simulate(FallState.ACTIVE);
|
||||
if(ClientGravityTree.getClientGravityTree(parent) != null && !ClientGravityTree.getClientGravityTree(parent).isActive()){
|
||||
this.land();
|
||||
}
|
||||
break;
|
||||
case INACTIVE:
|
||||
break;
|
||||
|
||||
@ -5,6 +5,7 @@ import electrosphere.entity.EntityDataStrings;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.btree.BehaviorTree;
|
||||
import electrosphere.entity.state.AnimationPriorities;
|
||||
import electrosphere.entity.state.gravity.ServerGravityTree;
|
||||
import electrosphere.entity.state.movement.jump.ServerJumpTree;
|
||||
import electrosphere.game.data.creature.type.movement.FallMovementSystem;
|
||||
import electrosphere.server.poseactor.PoseActor;
|
||||
@ -39,7 +40,6 @@ public class ServerFallTree implements BehaviorTree {
|
||||
PoseActor poseActor = EntityUtils.getPoseActor(parent);
|
||||
switch(state){
|
||||
case ACTIVE:
|
||||
frameCurrent++;
|
||||
if(poseActor != null){
|
||||
String animationToPlay = determineCorrectAnimation();
|
||||
if(
|
||||
@ -50,16 +50,27 @@ public class ServerFallTree implements BehaviorTree {
|
||||
poseActor.incrementAnimationTime(0.0001);
|
||||
}
|
||||
}
|
||||
if(ServerGravityTree.getServerGravityTree(parent) != null && !ServerGravityTree.getServerGravityTree(parent).isActive()){
|
||||
this.land();
|
||||
}
|
||||
frameCurrent++;
|
||||
break;
|
||||
case INACTIVE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the fall tree
|
||||
*/
|
||||
public void start(){
|
||||
state = FallState.ACTIVE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the fall tree is active
|
||||
* @return true if is active, false otherwise
|
||||
*/
|
||||
public boolean isFalling(){
|
||||
return state == FallState.ACTIVE;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user