small bugfixes
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-04-03 18:36:15 -04:00
parent 3379f5ca26
commit 86344ebfeb
4 changed files with 44 additions and 25 deletions

View File

@ -429,10 +429,12 @@ public class ServerAttackTree implements BehaviorTree {
this.stateTransitionUtil.simulate(AttackTreeState.BLOCK_RECOIL); this.stateTransitionUtil.simulate(AttackTreeState.BLOCK_RECOIL);
//deactivate hitboxes //deactivate hitboxes
List<Entity> attachedEntities = AttachUtils.getChildrenList(parent); List<Entity> attachedEntities = AttachUtils.getChildrenList(parent);
for(Entity currentAttached : attachedEntities){ if(attachedEntities != null){
if(HitboxCollectionState.hasHitboxState(currentAttached)){ for(Entity currentAttached : attachedEntities){
HitboxCollectionState currentState = HitboxCollectionState.getHitboxState(currentAttached); if(HitboxCollectionState.hasHitboxState(currentAttached)){
currentState.setActive(false); HitboxCollectionState currentState = HitboxCollectionState.getHitboxState(currentAttached);
currentState.setActive(false);
}
} }
} }
if(this.currentMove.getActiveBones() != null && HitboxCollectionState.hasHitboxState(this.parent)){ if(this.currentMove.getActiveBones() != null && HitboxCollectionState.hasHitboxState(this.parent)){
@ -451,10 +453,12 @@ public class ServerAttackTree implements BehaviorTree {
this.stateTransitionUtil.simulate(AttackTreeState.COOLDOWN); this.stateTransitionUtil.simulate(AttackTreeState.COOLDOWN);
//deactive hitboxes //deactive hitboxes
List<Entity> attachedEntities = AttachUtils.getChildrenList(parent); List<Entity> attachedEntities = AttachUtils.getChildrenList(parent);
for(Entity currentAttached : attachedEntities){ if(attachedEntities != null){
if(HitboxCollectionState.hasHitboxState(currentAttached)){ for(Entity currentAttached : attachedEntities){
HitboxCollectionState currentState = HitboxCollectionState.getHitboxState(currentAttached); if(HitboxCollectionState.hasHitboxState(currentAttached)){
currentState.setActive(false); HitboxCollectionState currentState = HitboxCollectionState.getHitboxState(currentAttached);
currentState.setActive(false);
}
} }
} }
if(this.currentMove.getActiveBones() != null && HitboxCollectionState.hasHitboxState(this.parent)){ if(this.currentMove.getActiveBones() != null && HitboxCollectionState.hasHitboxState(this.parent)){

View File

@ -606,9 +606,8 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
public void simulate(){ public void simulate(){
Globals.profiler.beginCpuSample("GriddedDataCellManager.simulate"); Globals.profiler.beginCpuSample("GriddedDataCellManager.simulate");
loadedCellsLock.lock(); loadedCellsLock.lock();
Collection<ServerDataCell> groundCells = this.groundDataCells.values();
boolean runMicroSim = Globals.microSimulation != null && Globals.microSimulation.isReady(); boolean runMicroSim = Globals.microSimulation != null && Globals.microSimulation.isReady();
for(ServerDataCell cell : groundCells){ for(ServerDataCell cell : this.groundDataCells.values()){
if(runMicroSim && this.shouldSimulate(cell)){ if(runMicroSim && this.shouldSimulate(cell)){
Globals.microSimulation.simulate(cell); Globals.microSimulation.simulate(cell);
} }

View File

@ -96,11 +96,6 @@ public class PoseActor {
for(ActorAnimationMask mask : toRemoveMasks){ for(ActorAnimationMask mask : toRemoveMasks){
animationQueue.remove(mask); animationQueue.remove(mask);
} }
PoseModel model = Globals.assetManager.fetchPoseModel(modelPath);
if(model != null){
this.applyAnimationMasks(model);
this.calculateNodeTransforms(model);
}
} }
/** /**
@ -354,18 +349,18 @@ public class PoseActor {
* @param model The posemodel to apply the mask to * @param model The posemodel to apply the mask to
*/ */
void applyAnimationMasks(PoseModel model){ void applyAnimationMasks(PoseModel model){
List<String> bonesUsed = new LinkedList<String>(); List<String> bonesUsed = new LinkedList<String>();
List<String> currentAnimationMask = new LinkedList<String>(); List<String> currentAnimationMask = new LinkedList<String>();
for(ActorAnimationMask mask : animationQueue){ for(ActorAnimationMask mask : animationQueue){
currentAnimationMask.clear(); currentAnimationMask.clear();
for(String currentBone : mask.getBones()){ for(String currentBone : mask.getBones()){
if(!bonesUsed.contains(currentBone)){ if(!bonesUsed.contains(currentBone)){
bonesUsed.add(currentBone); bonesUsed.add(currentBone);
currentAnimationMask.add(currentBone); currentAnimationMask.add(currentBone);
}
} }
model.applyAnimationMask(mask.getAnimationName(), mask.getTime(), currentAnimationMask);
} }
model.applyAnimationMask(mask.getAnimationName(), mask.getTime(), currentAnimationMask);
}
} }
/** /**
@ -392,6 +387,17 @@ public class PoseActor {
} }
} }
/**
* Updates the transform cache for this actor
*/
public void updateTransformCache(){
PoseModel model = Globals.assetManager.fetchPoseModel(modelPath);
if(model != null){
this.applyAnimationMasks(model);
this.calculateNodeTransforms(model);
}
}
/** /**
* Sets the animation scalar * Sets the animation scalar
* @param animationScalar The new animation scalar value * @param animationScalar The new animation scalar value

View File

@ -66,6 +66,16 @@ public class MicroSimulation {
for(Entity collidable : collidables){ for(Entity collidable : collidables){
ServerCollidableTree.getServerCollidableTree(collidable).simulate((float)Globals.timekeeper.getSimFrameTime()); ServerCollidableTree.getServerCollidableTree(collidable).simulate((float)Globals.timekeeper.getSimFrameTime());
} }
//update actor transform caches
poseableEntities = dataCell.getScene().getEntitiesWithTag(EntityTags.POSEABLE);
if(poseableEntities != null){
for(Entity currentEntity : dataCell.getScene().getEntitiesWithTag(EntityTags.POSEABLE)){
//fetch actor
PoseActor currentPoseActor = EntityUtils.getPoseActor(currentEntity);
currentPoseActor.updateTransformCache();
}
}
} }
Globals.profiler.endCpuSample(); Globals.profiler.endCpuSample();
} }