server gravity fix
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-28 11:56:09 -04:00
parent e2e3dcf2c9
commit 26431072b3
2 changed files with 18 additions and 7 deletions

View File

@ -2013,6 +2013,10 @@ QuadMesh memory pooling
Load characters from save db when re-loading valid save
Fix memory leaks
(05/28/2025)
Server entities without collidables deactivate gravity trees

View File

@ -87,14 +87,21 @@ public class ServerGravityTree implements BehaviorTree {
//make sure physics is available
if(collidable == null){
switch(this.state){
case ACTIVE: {
this.setState(GravityTreeState.NOT_ACTIVE);
} break;
case NOT_ACTIVE: {
} break;
}
return;
}
//state machine
switch(state){
case ACTIVE:
case ACTIVE: {
if(this.hadGroundCollision() || !this.bodyIsActive()){
setState(GravityTreeState.NOT_ACTIVE);
this.setState(GravityTreeState.NOT_ACTIVE);
ServerJumpTree jumpTree;
if((jumpTree = ServerJumpTree.getServerJumpTree(parent))!=null){
jumpTree.land();
@ -114,14 +121,14 @@ public class ServerGravityTree implements BehaviorTree {
}
frameCurrent++;
}
break;
case NOT_ACTIVE:
if(hadEntityCollision()){
start();
} break;
case NOT_ACTIVE: {
if(this.hadEntityCollision() && this.bodyIsActive()){
this.start();
}
//nothing here atm
//eventually want to check if need to re-activate somehow
break;
} break;
}
}