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 Load characters from save db when re-loading valid save
Fix memory leaks 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 //make sure physics is available
if(collidable == null){ if(collidable == null){
switch(this.state){
case ACTIVE: {
this.setState(GravityTreeState.NOT_ACTIVE);
} break;
case NOT_ACTIVE: {
} break;
}
return; return;
} }
//state machine //state machine
switch(state){ switch(state){
case ACTIVE: case ACTIVE: {
if(this.hadGroundCollision() || !this.bodyIsActive()){ if(this.hadGroundCollision() || !this.bodyIsActive()){
setState(GravityTreeState.NOT_ACTIVE); this.setState(GravityTreeState.NOT_ACTIVE);
ServerJumpTree jumpTree; ServerJumpTree jumpTree;
if((jumpTree = ServerJumpTree.getServerJumpTree(parent))!=null){ if((jumpTree = ServerJumpTree.getServerJumpTree(parent))!=null){
jumpTree.land(); jumpTree.land();
@ -114,14 +121,14 @@ public class ServerGravityTree implements BehaviorTree {
} }
frameCurrent++; frameCurrent++;
} }
break; } break;
case NOT_ACTIVE: case NOT_ACTIVE: {
if(hadEntityCollision()){ if(this.hadEntityCollision() && this.bodyIsActive()){
start(); this.start();
} }
//nothing here atm //nothing here atm
//eventually want to check if need to re-activate somehow //eventually want to check if need to re-activate somehow
break; } break;
} }
} }