feat: introduce core player logic with manager integration and power-up inventory UI.
This commit is contained in:
+17
-10
@@ -723,7 +723,6 @@ func apply_stagger(duration: float = 1.5):
|
||||
|
||||
if is_multiplayer_authority():
|
||||
NotificationManager.send_message(self , NotificationManager.MESSAGES.CRUSHED, NotificationManager.MessageType.WARNING)
|
||||
drop_random_item()
|
||||
|
||||
# Grant "Smashed" Bonus (1 bar, max 2)
|
||||
if powerup_manager:
|
||||
@@ -1140,15 +1139,16 @@ func handle_grid_click(grid_position: Vector2i):
|
||||
|
||||
# Modify is_position_occupied to check for selected spawn points
|
||||
func is_position_occupied(pos: Vector2i) -> bool:
|
||||
for player in get_tree().get_nodes_in_group("Players"):
|
||||
if player == self:
|
||||
for p in get_tree().get_nodes_in_group("Players"):
|
||||
if p == self:
|
||||
continue
|
||||
|
||||
if player.spawn_point_selected and player.current_position == pos:
|
||||
# Check if player has selected a spawn point OR is already visible (active in match)
|
||||
if (p.spawn_point_selected or p.visible) and p.current_position == pos:
|
||||
return true
|
||||
|
||||
# Check target position (where they are moving to)
|
||||
if player.is_player_moving and player.target_position == pos:
|
||||
if p.is_player_moving and p.target_position == pos:
|
||||
return true
|
||||
|
||||
return false
|
||||
@@ -1336,12 +1336,16 @@ func simple_move_to(grid_position: Vector2i):
|
||||
func move_player_to_clicked_position(grid_position: Vector2i):
|
||||
movement_manager.move_to_clicked_position(grid_position)
|
||||
|
||||
@rpc("any_peer", "call_remote", "unreliable")
|
||||
func start_movement_along_path(path: Array, clear_visual: bool = true):
|
||||
if is_player_moving:
|
||||
return # ALREADY MOVING. Guard against redundant RPCs or interruptions.
|
||||
@rpc("any_peer", "call_remote", "reliable")
|
||||
func start_movement_along_path(path: Array, clear_visual: bool = true, force: bool = false):
|
||||
if is_player_moving and not force:
|
||||
return # ALREADY MOVING. Guard against redundant RPCs or interruptions unless forced.
|
||||
|
||||
print("[Player] %s starting move along path: %s" % [name, path])
|
||||
if force and movement_manager:
|
||||
movement_manager.movement_queue.clear()
|
||||
movement_manager.current_move_direction = Vector2i.ZERO
|
||||
|
||||
print("[Player] %s starting move along path: %s (Forced: %s)" % [name, path, force])
|
||||
|
||||
# SERVER-SIDE VIOLATION CHECK (for Stop n Go)
|
||||
if multiplayer.is_server() and LobbyManager.game_mode == "Stop n Go":
|
||||
@@ -1797,6 +1801,9 @@ func request_server_put(grid_position: Vector2i, slot_index: int, x: int, y: int
|
||||
# Add new RPC function to notify others about spawn selection
|
||||
@rpc("any_peer", "reliable")
|
||||
func notify_spawn_selected(spawn_pos: Vector2i):
|
||||
# Mark as selected on all peers so occupancy checks work
|
||||
spawn_point_selected = true
|
||||
|
||||
# Update local highlight state for all clients
|
||||
if spawn_pos in highlighted_spawn_points:
|
||||
highlighted_spawn_points.erase(spawn_pos)
|
||||
|
||||
Reference in New Issue
Block a user