jump sfx, walk audio fix
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
d7619692ed
commit
ab4b64942d
@ -19,8 +19,6 @@ Things that feel bad:
|
|||||||
|
|
||||||
|
|
||||||
Sound effect on hit
|
Sound effect on hit
|
||||||
Sound effect on walk
|
|
||||||
Sound effect on jump
|
|
||||||
Sound effect on block
|
Sound effect on block
|
||||||
Allow block hotboxes to block damage
|
Allow block hotboxes to block damage
|
||||||
Server packet on damage collision
|
Server packet on damage collision
|
||||||
|
|||||||
@ -510,6 +510,13 @@ Audio on block state transitions
|
|||||||
Strafe/backpedal movement speed multipliers
|
Strafe/backpedal movement speed multipliers
|
||||||
Properly equipping/unequipping 2hand items
|
Properly equipping/unequipping 2hand items
|
||||||
|
|
||||||
|
(08/08/2024)
|
||||||
|
Client surface-audio system
|
||||||
|
Sound effects on footstep
|
||||||
|
New sound effects for movement
|
||||||
|
Jump sound effects
|
||||||
|
Don't play walking audio when entity is jumping
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
|
|||||||
import electrosphere.entity.state.movement.FallTree;
|
import electrosphere.entity.state.movement.FallTree;
|
||||||
import electrosphere.entity.state.movement.SprintTree;
|
import electrosphere.entity.state.movement.SprintTree;
|
||||||
import electrosphere.entity.state.movement.jump.ClientJumpTree;
|
import electrosphere.entity.state.movement.jump.ClientJumpTree;
|
||||||
|
import electrosphere.entity.state.movement.jump.ClientJumpTree.JumpState;
|
||||||
import electrosphere.net.parser.net.message.EntityMessage;
|
import electrosphere.net.parser.net.message.EntityMessage;
|
||||||
import electrosphere.net.synchronization.annotation.SyncedField;
|
import electrosphere.net.synchronization.annotation.SyncedField;
|
||||||
import electrosphere.net.synchronization.annotation.SynchronizableEnum;
|
import electrosphere.net.synchronization.annotation.SynchronizableEnum;
|
||||||
@ -464,7 +465,12 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
|||||||
private void playFootstepAudio(int voxelType, double animationTime, Vector3d position){
|
private void playFootstepAudio(int voxelType, double animationTime, Vector3d position){
|
||||||
Float firstOffset = this.groundMovementData.getFootstepFirstAudioOffset();
|
Float firstOffset = this.groundMovementData.getFootstepFirstAudioOffset();
|
||||||
Float secondOffset = this.groundMovementData.getFootstepSecondAudioOffset();
|
Float secondOffset = this.groundMovementData.getFootstepSecondAudioOffset();
|
||||||
if(!this.playedFootstepFirst && firstOffset != null && animationTime > firstOffset){
|
if(
|
||||||
|
this.shouldPlayFootsteps() &&
|
||||||
|
!this.playedFootstepFirst &&
|
||||||
|
firstOffset != null &&
|
||||||
|
animationTime > firstOffset
|
||||||
|
){
|
||||||
this.playedFootstepFirst = true;
|
this.playedFootstepFirst = true;
|
||||||
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
|
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
Globals.movementAudioService.playAudio(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG);
|
Globals.movementAudioService.playAudio(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG);
|
||||||
@ -472,7 +478,12 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
|||||||
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);
|
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!this.playedFootstepSecond && secondOffset != null && animationTime > secondOffset){
|
if(
|
||||||
|
this.shouldPlayFootsteps() &&
|
||||||
|
!this.playedFootstepSecond &&
|
||||||
|
secondOffset != null &&
|
||||||
|
animationTime > secondOffset
|
||||||
|
){
|
||||||
this.playedFootstepSecond = true;
|
this.playedFootstepSecond = true;
|
||||||
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
|
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
Globals.movementAudioService.playAudio(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG);
|
Globals.movementAudioService.playAudio(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG);
|
||||||
@ -485,6 +496,20 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if this entity should play footstep sound effects
|
||||||
|
* @return true if should play footsteps, false otherwise
|
||||||
|
*/
|
||||||
|
private boolean shouldPlayFootsteps(){
|
||||||
|
if(ClientJumpTree.getClientJumpTree(parent) != null){
|
||||||
|
ClientJumpTree jumpTree = ClientJumpTree.getClientJumpTree(parent);
|
||||||
|
if(jumpTree.getState() != JumpState.INACTIVE){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> Automatically generated </p>
|
* <p> Automatically generated </p>
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import electrosphere.net.synchronization.ServerSynchronizationManager;
|
|||||||
import org.ode4j.math.DVector3C;
|
import org.ode4j.math.DVector3C;
|
||||||
import org.ode4j.ode.DBody;
|
import org.ode4j.ode.DBody;
|
||||||
|
|
||||||
|
import electrosphere.audio.movement.MovementAudioService.InteractionType;
|
||||||
|
import electrosphere.client.terrain.sampling.ClientVoxelSampler;
|
||||||
import electrosphere.collision.PhysicsEntityUtils;
|
import electrosphere.collision.PhysicsEntityUtils;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
@ -43,7 +45,7 @@ public class ClientJumpTree implements BehaviorTree {
|
|||||||
AWAITING_LAND,
|
AWAITING_LAND,
|
||||||
}
|
}
|
||||||
|
|
||||||
@SyncedField
|
@SyncedField(serverSendTransitionPacket = true)
|
||||||
JumpState state = JumpState.INACTIVE;
|
JumpState state = JumpState.INACTIVE;
|
||||||
|
|
||||||
@SyncedField
|
@SyncedField
|
||||||
@ -293,4 +295,29 @@ public class ClientJumpTree implements BehaviorTree {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> (Initially) Automatically Generated </p>
|
||||||
|
* <p>
|
||||||
|
* Performs a state transition on a client state variable.
|
||||||
|
* Will be triggered when a server performs a state change.
|
||||||
|
* </p>
|
||||||
|
* @param newState The new value of the state
|
||||||
|
*/
|
||||||
|
public void transitionState(JumpState newState){
|
||||||
|
this.setState(newState);
|
||||||
|
switch(newState){
|
||||||
|
case INACTIVE: {
|
||||||
|
} break;
|
||||||
|
case ACTIVE: {
|
||||||
|
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
|
Globals.movementAudioService.playAudio(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.JUMP);
|
||||||
|
} else {
|
||||||
|
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.JUMP, EntityUtils.getPosition(parent));
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case AWAITING_LAND: {
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Behavior tree for movement in an entity
|
|||||||
*/
|
*/
|
||||||
public class ServerJumpTree implements BehaviorTree {
|
public class ServerJumpTree implements BehaviorTree {
|
||||||
|
|
||||||
@SyncedField
|
@SyncedField(serverSendTransitionPacket = true)
|
||||||
JumpState state = JumpState.INACTIVE;
|
JumpState state = JumpState.INACTIVE;
|
||||||
|
|
||||||
@SyncedField
|
@SyncedField
|
||||||
@ -146,7 +146,7 @@ public class ServerJumpTree implements BehaviorTree {
|
|||||||
public void setState(JumpState state){
|
public void setState(JumpState state){
|
||||||
this.state = state;
|
this.state = state;
|
||||||
int value = ClientJumpTree.getJumpStateEnumAsShort(state);
|
int value = ClientJumpTree.getJumpStateEnumAsShort(state);
|
||||||
DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(SynchronizationMessage.constructUpdateClientStateMessage(parent.getId(), BehaviorTreeIdEnums.BTREE_SERVERJUMPTREE_ID, FieldIdEnums.TREE_SERVERJUMPTREE_SYNCEDFIELD_STATE_ID, value));
|
DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(SynchronizationMessage.constructServerNotifyBTreeTransitionMessage(parent.getId(), BehaviorTreeIdEnums.BTREE_SERVERJUMPTREE_ID, FieldIdEnums.TREE_SERVERJUMPTREE_SYNCEDFIELD_STATE_ID, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -242,6 +242,14 @@ public class ClientSynchronizationManager {
|
|||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERJUMPTREE_ID: {
|
||||||
|
switch(message.getfieldId()){
|
||||||
|
case FieldIdEnums.TREE_SERVERJUMPTREE_SYNCEDFIELD_STATE_ID:{
|
||||||
|
ClientJumpTree tree = ClientJumpTree.getClientJumpTree(entity);
|
||||||
|
tree.transitionState(ClientJumpTree.getJumpStateShortAsEnum((short)message.getbTreeValue()));
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user