audio + debounce work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
4e7cfe05e7
commit
7b1610d847
BIN
assets/Audio/interact/Grab Cloth High A.wav
Normal file
BIN
assets/Audio/interact/Grab Cloth High A.wav
Normal file
Binary file not shown.
BIN
assets/Audio/interact/High Five A.wav
Normal file
BIN
assets/Audio/interact/High Five A.wav
Normal file
Binary file not shown.
BIN
assets/Audio/interact/Medium Stones Impact C.wav
Normal file
BIN
assets/Audio/interact/Medium Stones Impact C.wav
Normal file
Binary file not shown.
@ -1532,6 +1532,9 @@ ServerWorldData conversion methods are static now
|
|||||||
Fix character data serialization only serializing dataType
|
Fix character data serialization only serializing dataType
|
||||||
Potential fix for realm undefined for server terrain physics entity
|
Potential fix for realm undefined for server terrain physics entity
|
||||||
Fix macro character entities not being assigned ServerCharacterData
|
Fix macro character entities not being assigned ServerCharacterData
|
||||||
|
Audio on placing blocks
|
||||||
|
Audio on placing/removing voxels
|
||||||
|
Debounce item usage activations
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,10 +2,12 @@ package electrosphere.client.interact;
|
|||||||
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
|
import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType;
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
import electrosphere.client.script.ClientScriptUtils;
|
import electrosphere.client.script.ClientScriptUtils;
|
||||||
import electrosphere.collision.CollisionEngine;
|
import electrosphere.collision.CollisionEngine;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.state.attack.ClientAttackTree;
|
import electrosphere.entity.state.attack.ClientAttackTree;
|
||||||
import electrosphere.entity.state.attack.ShooterTree;
|
import electrosphere.entity.state.attack.ShooterTree;
|
||||||
@ -164,6 +166,11 @@ public class ItemActions {
|
|||||||
if(data.getClientSideSecondary() != null){
|
if(data.getClientSideSecondary() != null){
|
||||||
ClientScriptUtils.fireSignal(data.getClientSideSecondary());
|
ClientScriptUtils.fireSignal(data.getClientSideSecondary());
|
||||||
}
|
}
|
||||||
|
if(data.getSecondaryUsage() != null){
|
||||||
|
if(data.getSecondaryUsage().getBlockId() != null){
|
||||||
|
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.INTERACT_SFX_BLOCK_PLACE, VirtualAudioSourceType.CREATURE, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,10 +4,13 @@ import org.graalvm.polyglot.HostAccess.Export;
|
|||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3i;
|
import org.joml.Vector3i;
|
||||||
|
|
||||||
|
import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType;
|
||||||
|
import electrosphere.audio.movement.MovementAudioService.InteractionType;
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
import electrosphere.client.terrain.editing.TerrainEditing;
|
import electrosphere.client.terrain.editing.TerrainEditing;
|
||||||
import electrosphere.collision.CollisionEngine;
|
import electrosphere.collision.CollisionEngine;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.server.physics.terrain.manager.ServerTerrainChunk;
|
import electrosphere.server.physics.terrain.manager.ServerTerrainChunk;
|
||||||
|
|
||||||
@ -50,6 +53,7 @@ public class ScriptClientVoxelUtils {
|
|||||||
}
|
}
|
||||||
if(Globals.clientSelectedVoxelType != null){
|
if(Globals.clientSelectedVoxelType != null){
|
||||||
TerrainEditing.editTerrain(cursorPos, 1.1f, Globals.clientSelectedVoxelType.getId(), EDIT_INCREMENT);
|
TerrainEditing.editTerrain(cursorPos, 1.1f, Globals.clientSelectedVoxelType.getId(), EDIT_INCREMENT);
|
||||||
|
Globals.movementAudioService.getAudioPath(Globals.clientSelectedVoxelType.getId(), InteractionType.STEP_SHOE_REG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,6 +112,7 @@ public class ScriptClientVoxelUtils {
|
|||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
}
|
}
|
||||||
TerrainEditing.removeTerrainGated(cursorPos, 1.1f, REMOVE_INCREMENT);
|
TerrainEditing.removeTerrainGated(cursorPos, 1.1f, REMOVE_INCREMENT);
|
||||||
|
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.INTERACT_SFX_DIG, VirtualAudioSourceType.CREATURE, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -585,7 +585,7 @@ public class ControlCategoryMainGame {
|
|||||||
ItemActions.attemptSecondaryItemAction();
|
ItemActions.attemptSecondaryItemAction();
|
||||||
}});
|
}});
|
||||||
controlMap.get(ITEM_SECONDARY).setOnRepeat(new ControlMethod() {public void execute(MouseState mouseState) {
|
controlMap.get(ITEM_SECONDARY).setOnRepeat(new ControlMethod() {public void execute(MouseState mouseState) {
|
||||||
ItemActions.attemptSecondaryItemAction();
|
ItemActions.repeatSecondaryItemAction();
|
||||||
}});
|
}});
|
||||||
controlMap.get(ITEM_SECONDARY).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
controlMap.get(ITEM_SECONDARY).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
||||||
controlMap.get(ITEM_SECONDARY).setOnRelease(new ControlMethod() {public void execute(MouseState mouseState) {
|
controlMap.get(ITEM_SECONDARY).setOnRelease(new ControlMethod() {public void execute(MouseState mouseState) {
|
||||||
|
|||||||
@ -597,6 +597,9 @@ public class Globals {
|
|||||||
AssetDataStrings.UI_SFX_ITEM_RELEASE,
|
AssetDataStrings.UI_SFX_ITEM_RELEASE,
|
||||||
AssetDataStrings.UI_SFX_INVENTORY_OPEN,
|
AssetDataStrings.UI_SFX_INVENTORY_OPEN,
|
||||||
AssetDataStrings.UI_SFX_INVENTORY_CLOSE,
|
AssetDataStrings.UI_SFX_INVENTORY_CLOSE,
|
||||||
|
AssetDataStrings.INTERACT_SFX_BLOCK_PICKUP,
|
||||||
|
AssetDataStrings.INTERACT_SFX_BLOCK_PLACE,
|
||||||
|
AssetDataStrings.INTERACT_SFX_DIG,
|
||||||
};
|
};
|
||||||
LoggerInterface.loggerStartup.INFO("Loading default audio resources");
|
LoggerInterface.loggerStartup.INFO("Loading default audio resources");
|
||||||
for(String path : audioToInit){
|
for(String path : audioToInit){
|
||||||
|
|||||||
@ -82,4 +82,11 @@ public class AssetDataStrings {
|
|||||||
public static final String COMPUTE_LIGHT_CLUSTER = "Shaders/core/light/cluster.comp";
|
public static final String COMPUTE_LIGHT_CLUSTER = "Shaders/core/light/cluster.comp";
|
||||||
public static final String COMPUTE_LIGHT_CULL = "Shaders/core/light/cull.comp";
|
public static final String COMPUTE_LIGHT_CULL = "Shaders/core/light/cull.comp";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interaction-specific audio
|
||||||
|
*/
|
||||||
|
public static final String INTERACT_SFX_DIG = "Audio/interact/Medium Stones Impact C.wav";
|
||||||
|
public static final String INTERACT_SFX_BLOCK_PICKUP = "Audio/interact/Grab Cloth High A.wav";
|
||||||
|
public static final String INTERACT_SFX_BLOCK_PLACE = "Audio/interact/High Five A.wav";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,11 @@ public class ItemUsage {
|
|||||||
*/
|
*/
|
||||||
Integer blockId;
|
Integer blockId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls whether this usage only fires on mouse down
|
||||||
|
*/
|
||||||
|
Boolean onlyOnMouseDown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the spawn entity id of the item usage
|
* Gets the spawn entity id of the item usage
|
||||||
* @return The spawn entity id
|
* @return The spawn entity id
|
||||||
@ -47,6 +52,22 @@ public class ItemUsage {
|
|||||||
this.blockId = blockId;
|
this.blockId = blockId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether this usage only fires on mouse down
|
||||||
|
* @return if true, the usage only fires on mouse down
|
||||||
|
*/
|
||||||
|
public Boolean getOnlyOnMouseDown() {
|
||||||
|
return onlyOnMouseDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether this usage only fires on mouse down
|
||||||
|
* @param onlyOnMouseDown true to only fire on mouse down
|
||||||
|
*/
|
||||||
|
public void setOnlyOnMouseDown(Boolean onlyOnMouseDown) {
|
||||||
|
this.onlyOnMouseDown = onlyOnMouseDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,7 @@ public class PlayerActions {
|
|||||||
Entity playerEntity = EntityLookupUtils.getEntityById(connectionHandler.getPlayerEntityId());
|
Entity playerEntity = EntityLookupUtils.getEntityById(connectionHandler.getPlayerEntityId());
|
||||||
|
|
||||||
if(message.getitemActionCode() == ItemActions.ITEM_ACTION_CODE_SECONDARY){
|
if(message.getitemActionCode() == ItemActions.ITEM_ACTION_CODE_SECONDARY){
|
||||||
|
int itemActionCodeState = message.getitemActionCodeState();
|
||||||
ServerToolbarState serverToolbarState = ServerToolbarState.getServerToolbarState(playerEntity);
|
ServerToolbarState serverToolbarState = ServerToolbarState.getServerToolbarState(playerEntity);
|
||||||
if(serverToolbarState != null && serverToolbarState.getRealWorldItem() != null){
|
if(serverToolbarState != null && serverToolbarState.getRealWorldItem() != null){
|
||||||
Item item = Globals.gameConfigCurrent.getItemMap().getItem(serverToolbarState.getRealWorldItem());
|
Item item = Globals.gameConfigCurrent.getItemMap().getItem(serverToolbarState.getRealWorldItem());
|
||||||
@ -60,7 +61,12 @@ public class PlayerActions {
|
|||||||
if(shouldBlock){
|
if(shouldBlock){
|
||||||
PlayerActions.block(playerEntity, message);
|
PlayerActions.block(playerEntity, message);
|
||||||
} else if(item.getSecondaryUsage() != null){
|
} else if(item.getSecondaryUsage() != null){
|
||||||
PlayerActions.secondaryUsage(playerEntity, item, message);
|
if(
|
||||||
|
item.getSecondaryUsage().getOnlyOnMouseDown() == null ||
|
||||||
|
(itemActionCodeState == ItemActions.ITEM_ACTION_CODE_STATE_ON && item.getSecondaryUsage().getOnlyOnMouseDown())
|
||||||
|
){
|
||||||
|
PlayerActions.secondaryUsage(playerEntity, item, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user