feat: Introduce modular player system with dedicated managers for movement, race, input, playerboard, actions, special tiles, and powerups, along with a new main scene and documentation.
This commit is contained in:
@@ -14,6 +14,12 @@ func initialize(p_player: Node3D, p_gridmap: Node):
|
||||
player = p_player
|
||||
enhanced_gridmap = p_gridmap
|
||||
|
||||
func _normalize_tile(tile: int) -> int:
|
||||
"""Convert holo tiles (11-14) to normal tiles (7-10) for goal comparison."""
|
||||
if tile >= 11 and tile <= 14:
|
||||
return tile - 4
|
||||
return tile
|
||||
|
||||
# =============================================================================
|
||||
# GRAB Operations
|
||||
# =============================================================================
|
||||
@@ -230,8 +236,10 @@ func auto_put_item() -> bool:
|
||||
if current_item == -1:
|
||||
continue
|
||||
|
||||
# Normalize item for goal comparison (holo tiles 11-14 = normal tiles 7-10)
|
||||
var normalized_item = _normalize_tile(current_item)
|
||||
# Item is not in goals at all → definitely junk, put this first
|
||||
if not current_item in player.goals:
|
||||
if not normalized_item in player.goals:
|
||||
put_slot = i
|
||||
break
|
||||
|
||||
@@ -253,8 +261,10 @@ func auto_put_item() -> bool:
|
||||
var goal_row = row - 1
|
||||
var goal_col = col - 1
|
||||
var expected_goal = player.goals[goal_row * 3 + goal_col]
|
||||
# Normalize for comparison (holo tiles 11-14 = normal tiles 7-10)
|
||||
var normalized_board = _normalize_tile(board_item)
|
||||
# If the item doesn't match what should be in this goal position, it's misplaced
|
||||
if board_item != expected_goal and expected_goal != -1:
|
||||
if normalized_board != expected_goal and expected_goal != -1:
|
||||
put_slot = i
|
||||
break
|
||||
|
||||
@@ -390,6 +400,9 @@ func find_best_goal_slot_for_item(item: int) -> int:
|
||||
if item == -1:
|
||||
return -1
|
||||
|
||||
# Normalize item - treat holo tiles (11-14) the same as normal tiles (7-10)
|
||||
var normalized_item = _normalize_tile(item)
|
||||
|
||||
# Convert goals to 2D (3x3)
|
||||
var goals_2d = []
|
||||
for i in range(3):
|
||||
@@ -401,7 +414,7 @@ func find_best_goal_slot_for_item(item: int) -> int:
|
||||
# Search for where this item should go in the central 3x3 (mapped to 5x5 board)
|
||||
for i in range(3):
|
||||
for j in range(3):
|
||||
if goals_2d[i][j] == item:
|
||||
if goals_2d[i][j] == normalized_item:
|
||||
var board_row = i + 1 # offset to center in 5x5
|
||||
var board_col = j + 1
|
||||
var slot_index = board_row * 5 + board_col
|
||||
|
||||
Reference in New Issue
Block a user