feat: Implement initial main scene, player scripts, and core game manager systems for input, actions, playerboard, special tiles, and UI.
This commit is contained in:
@@ -474,7 +474,6 @@ func auto_put_item() -> bool:
|
||||
var main = player.get_tree().get_root().get_node_or_null("Main")
|
||||
if main and main.ui_manager and not (player.is_bot or player.is_in_group("Bots")):
|
||||
main.ui_manager.update_playerboard_ui()
|
||||
main.ui_manager.current_action_state = main.ui_manager.ActionState.NONE
|
||||
|
||||
# === Server Sync ===
|
||||
player.rpc("sync_grid_item", cell.x, cell.y, cell.z, item)
|
||||
@@ -488,71 +487,8 @@ func auto_put_item() -> bool:
|
||||
# ARRANGE Operations
|
||||
# =============================================================================
|
||||
|
||||
func arrange_playerboard_item(slot_index: int):
|
||||
if player.action_points < 2 or player.playerboard[slot_index] == -1:
|
||||
return
|
||||
|
||||
#var selected_item = player.playerboard[slot_index]
|
||||
var adjacent_slots = get_adjacent_playerboard_slots(slot_index)
|
||||
|
||||
var main = player.get_tree().get_root().get_node_or_null("Main")
|
||||
if not main or not main.ui_manager.playerboard_ui:
|
||||
return
|
||||
|
||||
# Store the selected slot
|
||||
selected_playerboard_slot = slot_index
|
||||
|
||||
# Highlight selected slot
|
||||
var selected_slot_ui = main.ui_manager.playerboard_ui.get_child(slot_index)
|
||||
if selected_slot_ui.get_child_count() > 1:
|
||||
selected_slot_ui.get_child(1).show()
|
||||
|
||||
# Highlight valid adjacent slots
|
||||
for adj_slot in adjacent_slots:
|
||||
if player.playerboard[adj_slot] == -1: # Only highlight empty adjacent slots
|
||||
if not (player.is_bot or player.is_in_group("Bots")):
|
||||
var adj_slot_ui = main.ui_manager.playerboard_ui.get_child(adj_slot)
|
||||
if adj_slot_ui.get_child_count() > 2:
|
||||
adj_slot_ui.get_child(2).show()
|
||||
player.action_manager.highlighted_cells.append(adj_slot)
|
||||
|
||||
# Connect to slot click signals
|
||||
for i in range(player.playerboard.size()):
|
||||
var slot = main.ui_manager.playerboard_ui.get_child(i)
|
||||
if not slot.gui_input.is_connected(player._on_slot_clicked):
|
||||
slot.gui_input.connect(player._on_slot_clicked.bind(i))
|
||||
|
||||
func handle_slot_clicked(slot_index: int):
|
||||
var main = player.get_tree().get_root().get_node_or_null("Main")
|
||||
if not main or main.ui_manager.current_action_state != main.ui_manager.ActionState.ARRANGING:
|
||||
return
|
||||
|
||||
if selected_playerboard_slot == -1 or slot_index == selected_playerboard_slot:
|
||||
return
|
||||
|
||||
var adjacent_slots = get_adjacent_playerboard_slots(selected_playerboard_slot)
|
||||
if slot_index in adjacent_slots and player.playerboard[slot_index] == -1 and not (slot_index in HIDDEN_SLOTS):
|
||||
# Move item to empty target slot
|
||||
var selected_item = player.playerboard[selected_playerboard_slot]
|
||||
player.playerboard[slot_index] = selected_item
|
||||
player.playerboard[selected_playerboard_slot] = -1
|
||||
|
||||
if player.is_multiplayer_authority():
|
||||
player.rpc("sync_playerboard", player.playerboard)
|
||||
player.consume_action_points(2)
|
||||
player.has_performed_action = true
|
||||
|
||||
# Clear highlights
|
||||
player.clear_highlights()
|
||||
player.clear_playerboard_highlights()
|
||||
|
||||
# Reset selection
|
||||
selected_playerboard_slot = -1
|
||||
|
||||
# Update the visual representation
|
||||
if not (player.is_bot or player.is_in_group("Bots")):
|
||||
main.ui_manager.update_playerboard_ui()
|
||||
main.ui_manager.current_action_state = main.ui_manager.ActionState.NONE
|
||||
# Arrangement mode has been removed along with ActionMenu.
|
||||
pass
|
||||
|
||||
# =============================================================================
|
||||
# Helper Functions
|
||||
|
||||
Reference in New Issue
Block a user