feat: implement PlayerboardManager for handling tile collection, power-up consumption, and grid synchronization.

This commit is contained in:
Yogi Wiguna
2026-03-30 12:21:46 +08:00
parent 37b84f2ab3
commit 52d9b4bffb
14 changed files with 133 additions and 44 deletions
+11 -2
View File
@@ -530,9 +530,14 @@ func sync_walk_animation() -> void:
play_walk_animation()
@rpc("any_peer", "call_local", "reliable")
func sync_pickup_animation() -> void:
"""Sync pickup/grab animation across network."""
func sync_pickup_animation(item_id: int = -1) -> void:
"""Sync pickup/grab animation across network and play sound."""
play_pickup_animation()
if item_id >= 11 and item_id <= 14:
SfxManager.play("pick_up_power_tile")
elif item_id >= 7 and item_id <= 10:
SfxManager.play("pick_up_tiles")
@rpc("any_peer", "call_local", "reliable")
func sync_put_animation() -> void:
@@ -875,6 +880,7 @@ func drop_random_item():
# Drop it
playerboard[slot_index] = -1
rpc("sync_playerboard", playerboard)
SfxManager.play("tile_scatter")
# Sync grid item
var cell = Vector3i(drop_pos.x, 1, drop_pos.y)
@@ -906,6 +912,7 @@ func drop_all_tiles():
if dropped_count > 0:
rpc("sync_playerboard", playerboard)
rpc("trigger_screen_shake", "targeted")
SfxManager.play("tile_scatter")
NotificationManager.send_message(self , NotificationManager.MESSAGES.CRITICALLY_HIT, NotificationManager.MessageType.WARNING)
print("Player %s dropped %d tiles due to Super Push" % [name, dropped_count])
@@ -968,6 +975,7 @@ func on_stop_phase_violation():
if main:
main.rpc("sync_grid_item", cell.x, cell.y, cell.z, item_id)
SfxManager.rpc("play_rpc", "tile_scatter")
NotificationManager.send_message(self , "STOP VIOLATION! Tiles scattered!", NotificationManager.MessageType.WARNING)
func _find_multiple_drop_positions(count: int) -> Array:
@@ -2229,6 +2237,7 @@ func sync_grab_tekton(tekton_path: NodePath):
is_attack_mode = false
SfxManager.play("pick_up_tekton_roaming")
play_pickup_animation()
print("[Player %s] Grabbed Tekton %s" % [name, tekton.name])
func throw_tekton():