From 3a52bde5780e661d6559a8d61e14bf2a5687f542 Mon Sep 17 00:00:00 2001 From: rainlizard Date: Thu, 19 Oct 2023 21:14:44 +1100 Subject: [PATCH 1/2] Limit dragging to thing mode --- Scenes/Selector.gd | 76 ++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/Scenes/Selector.gd b/Scenes/Selector.gd index 165d43fc..b984ed14 100644 --- a/Scenes/Selector.gd +++ b/Scenes/Selector.gd @@ -60,7 +60,6 @@ var preventClickWhenFocusing = false enum {MODE_TILE, MODE_SUBTILE} var mode = MODE_TILE - func _ready(): change_mode(MODE_TILE) @@ -98,43 +97,46 @@ func mouse_button_on_field(): # Initial on-press button if Input.is_action_just_pressed("mouse_left"): - draggingInstance = false - - var youClickedOnAnAlreadyInspectedThing = false - if oInspector.inspectorSubtile.floor() == cursorSubtile.floor(): - if is_instance_valid(oInspector.inspectingInstance): - youClickedOnAnAlreadyInspectedThing = true - - if Input.is_action_pressed("place_overlapping"): - canPlace = true - - # Check if something is under the cursor and initiate dragging - # If you're clicking on an inspected subtile, then drag the inspected object. (helps with stacked objects)) - - var thingAtCursor - if youClickedOnAnAlreadyInspectedThing == true: - thingAtCursor = oInspector.inspectingInstance - oInspector.deselect() - else: - thingAtCursor = instance_position(get_global_mouse_position(), "Instance") - if is_instance_valid(thingAtCursor): - holdClickOnInstance = thingAtCursor - drag_init_relative_pos = thingAtCursor.global_position - get_global_mouse_position() - - if youClickedOnAnAlreadyInspectedThing == false: - if oSelection.cursorOnInstancesArray.empty() == false and mode == MODE_SUBTILE: - if is_instance_valid(oSelection.cursorOnInstancesArray[0]) == true: - oInspector.inspect_something(oSelection.cursorOnInstancesArray[0]) - else: - oInspector.deselect() + match mode: + MODE_TILE: + match oEditingTools.TOOL_SELECTED: + oEditingTools.RECTANGLE: + oRectangleSelection.set_initial_position(cursorTile) + oEditingTools.PAINTBUCKET: + oSelection.construct_shape_for_placement(oSelection.CONSTRUCT_FILL) + MODE_SUBTILE: + draggingInstance = false + + var youClickedOnAnAlreadyInspectedThing = false + if oInspector.inspectorSubtile.floor() == cursorSubtile.floor(): + if is_instance_valid(oInspector.inspectingInstance): + youClickedOnAnAlreadyInspectedThing = true + + if Input.is_action_pressed("place_overlapping"): + canPlace = true + + # Check if something is under the cursor and initiate dragging + # If you're clicking on an inspected subtile, then drag the inspected object. (helps with stacked objects)) + + var thingAtCursor + + if youClickedOnAnAlreadyInspectedThing == true: + thingAtCursor = oInspector.inspectingInstance + oInspector.deselect() + else: + thingAtCursor = instance_position(get_global_mouse_position(), "Instance") + if is_instance_valid(thingAtCursor): + holdClickOnInstance = thingAtCursor + drag_init_relative_pos = thingAtCursor.global_position - get_global_mouse_position() + + if youClickedOnAnAlreadyInspectedThing == false: + if oSelection.cursorOnInstancesArray.empty() == false: + if is_instance_valid(oSelection.cursorOnInstancesArray[0]) == true: + oInspector.inspect_something(oSelection.cursorOnInstancesArray[0]) + else: + oInspector.deselect() - match oEditingTools.TOOL_SELECTED: - oEditingTools.RECTANGLE: - oRectangleSelection.set_initial_position(cursorTile) - oEditingTools.PAINTBUCKET: - if mode == MODE_TILE: - oSelection.construct_shape_for_placement(oSelection.CONSTRUCT_FILL) - pass + # Holding down button if Input.is_action_pressed("mouse_left"): From 2309fc21a8136f17416f85c3de4bcc3e7b30f0d4 Mon Sep 17 00:00:00 2001 From: rainlizard Date: Thu, 19 Oct 2023 21:26:41 +1100 Subject: [PATCH 2/2] don't run github-actions twice --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 285d9d2b..fce6ae79 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,7 +2,11 @@ name: Automatic builds on: push: + branches: + - main pull_request: + branches: + - '*' jobs: build_application: