Improve gridmap item placement and UI logic
Enhanced the auto_put_item logic to better identify and place non-goal or excess tiles from the playerboard onto the grid. Updated gridmap and dock scripts for improved cell option handling and UI consistency. Adjusted mesh library item order and main scene cell data for better alignment. Expanded spawn and finish locations for player logic.
This commit is contained in:
@@ -638,12 +638,13 @@ func _update_cell_option_buttons():
|
||||
set_cell_item(position, 0)
|
||||
|
||||
func _set(property, value):
|
||||
if property == "mesh_library":
|
||||
mesh_library = value
|
||||
_on_mesh_library_changed()
|
||||
return true
|
||||
if property.begins_with("data/cells") and Engine.is_editor_hint():
|
||||
call_deferred("_emit_grid_updated")
|
||||
return false
|
||||
|
||||
func _emit_grid_updated():
|
||||
emit_signal("grid_updated")
|
||||
|
||||
# Toggle diagonal movement
|
||||
func set_diagonal_movement(enable: bool):
|
||||
diagonal_movement = enable
|
||||
|
||||
@@ -121,6 +121,7 @@ func add_custom_item_state(name: String, id: int):
|
||||
#
|
||||
#item_states_container.add_child(container)
|
||||
|
||||
|
||||
func add_item_state_ui(item_state: CustomItemState):
|
||||
var container = HBoxContainer.new()
|
||||
|
||||
@@ -295,10 +296,14 @@ func _update_grid_ui():
|
||||
|
||||
# Ensure the selected item in the OptionButton corresponds to the current cell item
|
||||
var cell_item = enhanced_gridmap.get_cell_item(Vector3i(x, current_floor, z))
|
||||
if cell_item != -1 and cell_item < option.get_item_count():
|
||||
option.select(cell_item)
|
||||
if cell_item == -1:
|
||||
option.select(0) # "Empty"
|
||||
else:
|
||||
option.select(0) # Select the first item if the cell is empty
|
||||
var item_index = cell_item + 1 # because "Empty" is index 0
|
||||
if item_index < option.get_item_count():
|
||||
option.select(item_index)
|
||||
else:
|
||||
option.select(0)
|
||||
|
||||
option.item_selected.connect(_on_cell_item_selected.bind(option))
|
||||
option.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
@@ -324,7 +329,9 @@ func _update_grid_ui():
|
||||
cell_container.add_child(rotation_option)
|
||||
row_container.add_child(cell_container)
|
||||
cell_options.append(option)
|
||||
enhanced_gridmap._update_cell_option_buttons()
|
||||
|
||||
|
||||
# enhanced_gridmap._update_cell_option_buttons()
|
||||
|
||||
func _update_astar_ui():
|
||||
start_x_spin.max_value = enhanced_gridmap.columns - 1
|
||||
@@ -456,7 +463,7 @@ func _on_non_walkable_item_changed(value):
|
||||
|
||||
func _on_grid_updated():
|
||||
update_ui()
|
||||
enhanced_gridmap._update_cell_option_buttons()
|
||||
# enhanced_gridmap._update_cell_option_buttons()
|
||||
|
||||
func _on_cell_rotation_changed(index: int, option: OptionButton):
|
||||
var position = option.get_meta("grid_position")
|
||||
|
||||
@@ -51,22 +51,21 @@ item/5/mesh_cast_shadow = 1
|
||||
item/5/shapes = []
|
||||
item/5/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
||||
item/5/navigation_layers = 1
|
||||
item/6/name = "tile_coin"
|
||||
item/6/mesh = ExtResource("4_76xkl")
|
||||
item/6/name = "empty"
|
||||
item/6/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
||||
item/6/mesh_cast_shadow = 1
|
||||
item/6/shapes = []
|
||||
item/6/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
||||
item/6/navigation_layers = 1
|
||||
item/7/name = "tile_diamond"
|
||||
item/7/mesh = ExtResource("5_j2mx0")
|
||||
item/7/name = "tile_heart"
|
||||
item/7/mesh = ExtResource("6_ptqbt")
|
||||
item/7/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
||||
item/7/mesh_cast_shadow = 1
|
||||
item/7/shapes = []
|
||||
item/7/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
||||
item/7/navigation_layers = 1
|
||||
item/8/name = "tile_heart"
|
||||
item/8/mesh = ExtResource("6_ptqbt")
|
||||
item/8/name = "tile_diamond"
|
||||
item/8/mesh = ExtResource("5_j2mx0")
|
||||
item/8/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
||||
item/8/mesh_cast_shadow = 1
|
||||
item/8/shapes = []
|
||||
@@ -79,3 +78,10 @@ item/9/mesh_cast_shadow = 1
|
||||
item/9/shapes = []
|
||||
item/9/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
||||
item/9/navigation_layers = 1
|
||||
item/10/name = "tile_coin"
|
||||
item/10/mesh = ExtResource("4_76xkl")
|
||||
item/10/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
||||
item/10/mesh_cast_shadow = 1
|
||||
item/10/shapes = []
|
||||
item/10/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
||||
item/10/navigation_layers = 1
|
||||
|
||||
Reference in New Issue
Block a user