server play equiped animations
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-08-04 16:24:20 -04:00
parent 056e631240
commit aca8c36732
2 changed files with 17 additions and 2 deletions

View File

@ -27,6 +27,7 @@ import electrosphere.entity.state.inventory.UnrelationalInventoryState;
import electrosphere.entity.types.attach.AttachUtils; import electrosphere.entity.types.attach.AttachUtils;
import electrosphere.entity.types.creature.CreatureUtils; import electrosphere.entity.types.creature.CreatureUtils;
import electrosphere.entity.types.item.ItemUtils; import electrosphere.entity.types.item.ItemUtils;
import electrosphere.game.data.common.TreeDataAnimation;
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.game.data.creature.type.block.BlockVariant;
import electrosphere.game.data.creature.type.equip.EquipPoint; import electrosphere.game.data.creature.type.equip.EquipPoint;
@ -41,6 +42,7 @@ import electrosphere.server.datacell.Realm;
import electrosphere.server.datacell.ServerDataCell; import electrosphere.server.datacell.ServerDataCell;
import electrosphere.server.datacell.utils.DataCellSearchUtils; import electrosphere.server.datacell.utils.DataCellSearchUtils;
import electrosphere.server.datacell.utils.ServerEntityTagUtils; import electrosphere.server.datacell.utils.ServerEntityTagUtils;
import electrosphere.server.poseactor.PoseActor;
import electrosphere.server.utils.ServerScriptUtils; import electrosphere.server.utils.ServerScriptUtils;
@SynchronizedBehaviorTree(name = "serverEquipState", isServer = true, correspondingTree="clientEquipState") @SynchronizedBehaviorTree(name = "serverEquipState", isServer = true, correspondingTree="clientEquipState")
@ -424,6 +426,20 @@ public class ServerEquipState implements BehaviorTree {
@Override @Override
public void simulate(float deltaTime) { public void simulate(float deltaTime) {
PoseActor thirdPersonActor = EntityUtils.getPoseActor(parent);
//play animations for equip points that have items equipped
for(EquipPoint point : this.equipPoints){
if(this.hasEquippedAtPoint(point.getEquipPointId()) && point.getEquippedAnimation() != null){
TreeDataAnimation animation = point.getEquippedAnimation();
//play third person
if(!thirdPersonActor.isPlayingAnimation() || !thirdPersonActor.isPlayingAnimation(animation)){
if(animation != null){
thirdPersonActor.playAnimation(animation);
}
thirdPersonActor.incrementAnimationTime(0.0001);
}
}
}
} }
/** /**

View File

@ -49,7 +49,6 @@ import electrosphere.game.data.collidable.CollidableTemplate;
import electrosphere.game.data.creature.type.CreatureData; import electrosphere.game.data.creature.type.CreatureData;
import electrosphere.game.data.creature.type.SprintSystem; import electrosphere.game.data.creature.type.SprintSystem;
import electrosphere.game.data.creature.type.attack.AttackMove; import electrosphere.game.data.creature.type.attack.AttackMove;
import electrosphere.game.data.creature.type.movement.AirplaneMovementSystem;
import electrosphere.game.data.creature.type.movement.FallMovementSystem; import electrosphere.game.data.creature.type.movement.FallMovementSystem;
import electrosphere.game.data.creature.type.movement.GroundMovementSystem; import electrosphere.game.data.creature.type.movement.GroundMovementSystem;
import electrosphere.game.data.creature.type.movement.JumpMovementSystem; import electrosphere.game.data.creature.type.movement.JumpMovementSystem;
@ -469,7 +468,7 @@ public class CreatureUtils {
} }
} }
if(rawType.getEquipPoints() != null && rawType.getEquipPoints().size() > 0){ if(rawType.getEquipPoints() != null && rawType.getEquipPoints().size() > 0){
ServerEquipState.setEquipState(rVal, new ServerEquipState(rVal,rawType.getEquipPoints())); ServerEquipState.attachTree(rVal, rawType.getEquipPoints());
rVal.putData(EntityDataStrings.EQUIP_INVENTORY, RelationalInventoryState.buildRelationalInventoryStateFromEquipList(rawType.getEquipPoints())); rVal.putData(EntityDataStrings.EQUIP_INVENTORY, RelationalInventoryState.buildRelationalInventoryStateFromEquipList(rawType.getEquipPoints()));
} }
if(rawType.getBlockSystem() != null){ if(rawType.getBlockSystem() != null){