block cursor intercept sink movement
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-04-26 17:42:54 -04:00
parent d0fcded76d
commit 7fb0f5a489

View File

@ -1,7 +1,5 @@
package electrosphere.controls.categories;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_LEFT_CONTROL;
import java.util.HashMap;
import java.util.List;
@ -24,6 +22,7 @@ import electrosphere.controls.Control.ControlType;
import electrosphere.controls.ControlHandler;
import electrosphere.controls.ControlHandler.ControlsState;
import electrosphere.controls.MouseState;
import electrosphere.controls.cursor.CursorState;
import electrosphere.engine.Globals;
import electrosphere.engine.Main;
import electrosphere.engine.assetmanager.AssetDataStrings;
@ -45,6 +44,7 @@ import electrosphere.entity.types.common.CommonEntityFlags;
import electrosphere.entity.types.common.CommonEntityUtils;
import electrosphere.entity.types.creature.CreatureUtils;
import electrosphere.game.data.common.interact.InteractionData;
import electrosphere.game.data.item.Item;
import electrosphere.net.parser.net.message.EntityMessage;
import electrosphere.renderer.ui.elements.Window;
import electrosphere.renderer.ui.events.MouseEvent;
@ -512,6 +512,17 @@ public class ControlCategoryMainGame {
mainGameControlList.add(controlMap.get(INPUT_CODE_SINK));
controlMap.get(INPUT_CODE_SINK).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
if(ClientToolbarState.hasClientToolbarState(Globals.playerEntity)){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
if(clientToolbarState.getCurrentPrimaryItem() != null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(clientToolbarState.getCurrentPrimaryItem());
if(Globals.playerCursor != null && Globals.playerBlockCursor != null){
if(itemData.getTokens().contains(CursorState.CURSOR_BLOCK_TOKEN)) {
return;
}
}
}
}
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.DOWN);
@ -601,7 +612,7 @@ public class ControlCategoryMainGame {
mainGameControlList.add(controlMap.get(TOOLBAR_SCROLL));
controlMap.get(TOOLBAR_SCROLL).setOnScroll(new Control.ScrollCallback() {public void execute(MouseState mouseState, ScrollEvent scrollEvent){
boolean handled = false;
if(Globals.controlCallback.getKey(GLFW_KEY_LEFT_CONTROL)){
if(Globals.controlCallback.getKey(GLFW.GLFW_KEY_LEFT_CONTROL)){
//if the block cursor is visible, capture this input and instead modify block cursor
if(Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerBlockCursor)){
Globals.cursorState.updateCursorSize(scrollEvent);