feat: implement PlayerboardManager for handling tile collection, power-up consumption, and grid synchronization.
This commit is contained in:
@@ -82,7 +82,7 @@ func grab_item(grid_position: Vector2i) -> bool:
|
||||
|
||||
# Play pickup animation (synced across network)
|
||||
if player.is_multiplayer_authority() and player.has_method("sync_pickup_animation"):
|
||||
player.rpc("sync_pickup_animation")
|
||||
player.rpc("sync_pickup_animation", item)
|
||||
|
||||
# === Optimistic Local Update (immediate visual feedback) ===
|
||||
# Apply changes locally first, server will validate/sync
|
||||
@@ -95,9 +95,7 @@ func grab_item(grid_position: Vector2i) -> bool:
|
||||
if special_tiles_manager:
|
||||
special_tiles_manager.add_powerup_from_item(item)
|
||||
|
||||
SfxManager.play("pick_up_power_tile")
|
||||
# Animation for powerup?
|
||||
# ...
|
||||
# Animation and sound handled via sync_pickup_animation RPC above
|
||||
|
||||
# Skip adding to playerboard. Just consume.
|
||||
else:
|
||||
@@ -311,6 +309,10 @@ func bot_try_grab_item() -> bool:
|
||||
|
||||
player.playerboard[empty_slot] = item
|
||||
|
||||
# Play pickup animation for bot
|
||||
if player.has_method("sync_pickup_animation"):
|
||||
player.rpc("sync_pickup_animation", item)
|
||||
|
||||
var main = player.get_tree().get_root().get_node_or_null("Main")
|
||||
if main:
|
||||
main.rpc("sync_grid_item", current_cell.x, current_cell.y, current_cell.z, -1)
|
||||
@@ -338,6 +340,10 @@ func bot_try_grab_item() -> bool:
|
||||
if player.is_multiplayer_authority():
|
||||
player.playerboard[empty_slot] = item
|
||||
|
||||
# Play pickup animation for bot
|
||||
if player.has_method("sync_pickup_animation"):
|
||||
player.rpc("sync_pickup_animation", item)
|
||||
|
||||
var main = player.get_tree().get_root().get_node_or_null("Main")
|
||||
if main:
|
||||
main.rpc("sync_grid_item", cell.x, cell.y, cell.z, -1)
|
||||
|
||||
Reference in New Issue
Block a user