water spawner work
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-11-30 12:20:36 -05:00
parent 7d6134c183
commit 2d8b172f16
5 changed files with 52 additions and 0 deletions

View File

@ -1193,6 +1193,10 @@ Remove concurrent datastructure usage in cell management
Auto close prepared queries that are iterated over Auto close prepared queries that are iterated over
Fix viewport loading Fix viewport loading
(11/30/2024)
Water spawner firing on repeat
# TODO # TODO

View File

@ -157,6 +157,38 @@ public class ItemActions {
} }
} }
/**
* Repeats the secondary item action
*/
public static void repeatSecondaryItemAction(){
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Vector3d cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
}
//tell the server we want the secondary hand item to STOP doing something
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestPerformItemActionMessage(
"handRight",
ITEM_ACTION_CODE_SECONDARY,
ITEM_ACTION_CODE_STATE_REPEAT,
cursorPos.x,
cursorPos.y,
cursorPos.z
));
//TODO: do any immediate client side calculations here (ie start playing an animation until we get response from server)
if(Globals.playerEntity != null){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
if(data.getClientSideSecondary() != null){
ClientScriptUtils.fireSignal(data.getClientSideSecondary());
}
}
}
}
/** /**
* Releases the secondary item action * Releases the secondary item action
*/ */

View File

@ -35,6 +35,9 @@ public class ScriptClientVoxelUtils {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera)); Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera)); Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
Vector3d cursorPos = collisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE); Vector3d cursorPos = collisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
}
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);
} }
@ -59,6 +62,9 @@ public class ScriptClientVoxelUtils {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera)); Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera)); Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
Vector3d cursorPos = collisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE); Vector3d cursorPos = collisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
}
Vector3i worldPos = new Vector3i( Vector3i worldPos = new Vector3i(
(int)(cursorPos.x / ServerTerrainChunk.CHUNK_DIMENSION), (int)(cursorPos.x / ServerTerrainChunk.CHUNK_DIMENSION),
(int)(cursorPos.y / ServerTerrainChunk.CHUNK_DIMENSION), (int)(cursorPos.y / ServerTerrainChunk.CHUNK_DIMENSION),

View File

@ -584,6 +584,10 @@ public class ControlCategoryMainGame {
controlMap.get(ITEM_SECONDARY).setOnPress(new ControlMethod() {public void execute(MouseState mouseState) { controlMap.get(ITEM_SECONDARY).setOnPress(new ControlMethod() {public void execute(MouseState mouseState) {
ItemActions.attemptSecondaryItemAction(); ItemActions.attemptSecondaryItemAction();
}}); }});
controlMap.get(ITEM_SECONDARY).setOnRepeat(new ControlMethod() {public void execute(MouseState mouseState) {
ItemActions.attemptSecondaryItemAction();
}});
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) {
ItemActions.releaseSecondaryItemAction(); ItemActions.releaseSecondaryItemAction();
}}); }});

View File

@ -269,6 +269,12 @@ public class ServerFluidManager {
* @param value The value to set it to * @param value The value to set it to
*/ */
public void deformFluidAtLocationToValue(Vector3i worldPos, Vector3i voxelPos, float weight, int value){ public void deformFluidAtLocationToValue(Vector3i worldPos, Vector3i voxelPos, float weight, int value){
if(voxelPos.x < 0 || voxelPos.y < 0 || voxelPos.z < 0){
return;
}
if(worldPos.x < 0 || worldPos.y < 0 || worldPos.z < 0){
return;
}
// TerrainModification modification = new TerrainModification(worldPos,voxelPos,weight,value); // TerrainModification modification = new TerrainModification(worldPos,voxelPos,weight,value);
// //could be null if, for instance, arena mode // //could be null if, for instance, arena mode
// if(model != null){ // if(model != null){