feat: Add initial player character, movement, network synchronization, bot AI, and game managers.
This commit is contained in:
@@ -31,10 +31,15 @@ func _normalize_tile(tile: int) -> int:
|
||||
func grab_item(grid_position: Vector2i) -> bool:
|
||||
var has_ap = player.action_points > 0 if TurnManager.turn_based_mode else true
|
||||
|
||||
if not enhanced_gridmap or not has_ap:
|
||||
if not enhanced_gridmap:
|
||||
print("[Grab] Failed for %s: enhanced_gridmap is null" % player.name)
|
||||
return false
|
||||
if not has_ap:
|
||||
print("[Grab] Failed for %s: no AP (%d)" % [player.name, player.action_points])
|
||||
return false
|
||||
|
||||
if player.get("is_frozen"):
|
||||
print("[Grab] Failed for %s: player is frozen" % player.name)
|
||||
return false
|
||||
|
||||
var cell = Vector3i(grid_position.x, 1, grid_position.y)
|
||||
@@ -49,9 +54,11 @@ func grab_item(grid_position: Vector2i) -> bool:
|
||||
is_adjacent = true
|
||||
break
|
||||
if not is_adjacent:
|
||||
print("[Grab] Failed for %s: %s is not adjacent to current %s" % [player.name, grid_position, player.current_position])
|
||||
return false
|
||||
|
||||
if item == -1:
|
||||
print("[Grab] Failed for %s: no item at %s Layer 1" % [player.name, grid_position])
|
||||
return false
|
||||
|
||||
# === AUTO-ARRANGE LOGIC (Client-side pre-check) ===
|
||||
@@ -62,12 +69,15 @@ func grab_item(grid_position: Vector2i) -> bool:
|
||||
if not is_powerup:
|
||||
target_slot = find_best_goal_slot_for_item(item)
|
||||
if target_slot == -1:
|
||||
print("Player: No valid slot found for item.")
|
||||
print("[Grab] Failed for %s: No valid slot found for item %d." % [player.name, item])
|
||||
return false # no space
|
||||
|
||||
if not player.is_multiplayer_authority():
|
||||
print("[Grab] Failed for %s: not authority" % player.name)
|
||||
return false
|
||||
|
||||
print("[Grab] %s SUCCESS! Grabbing item %d at %s into slot %d" % [player.name, item, grid_position, target_slot])
|
||||
|
||||
# Play pickup animation (synced across network)
|
||||
if player.is_multiplayer_authority() and player.has_method("sync_pickup_animation"):
|
||||
player.rpc("sync_pickup_animation")
|
||||
|
||||
Reference in New Issue
Block a user