feat: Implement player movement, rotation, and advanced push mechanics with new PlayerMovementManager, StopNGoManager, and player scene script.
This commit is contained in:
@@ -1257,6 +1257,17 @@ func move_player_to_clicked_position(grid_position: Vector2i):
|
||||
|
||||
@rpc("any_peer", "call_local")
|
||||
func start_movement_along_path(path: Array, clear_visual: bool = true):
|
||||
# SERVER-SIDE VIOLATION CHECK (for Stop n Go)
|
||||
if multiplayer.is_server() and LobbyManager.game_mode == "Stop n Go":
|
||||
var main = get_tree().root.get_node_or_null("Main")
|
||||
if main:
|
||||
var sng_manager = main.get_node_or_null("StopNGoManager")
|
||||
if sng_manager and sng_manager.has_method("check_movement_violation"):
|
||||
# Check if the START of this movement is a violation
|
||||
# We use current_position as the 'from' point.
|
||||
var target_pos = Vector2i(path[0].x, path[0].y) if path.size() > 0 else current_position
|
||||
sng_manager.check_movement_violation(name.to_int(), current_position, target_pos)
|
||||
|
||||
is_player_moving = true
|
||||
if path.size() > 0:
|
||||
target_position = Vector2i(path[-1].x, path[-1].y)
|
||||
|
||||
@@ -62,14 +62,6 @@ func simple_move_to(grid_position: Vector2i) -> bool:
|
||||
print("[Move] Failed: Player is frozen")
|
||||
return false
|
||||
|
||||
# Stop n Go Mode Violation Check
|
||||
var main = player.get_tree().root.get_node_or_null("Main")
|
||||
if main:
|
||||
var manager = main.get_node_or_null("StopNGoManager")
|
||||
if manager and manager.has_method("check_movement_violation"):
|
||||
if manager.check_movement_violation(player.name.to_int(), player.current_position, grid_position):
|
||||
print("[Move] Failed: Stop N Go Violation")
|
||||
return false
|
||||
|
||||
var distance: int
|
||||
if use_diagonal_movement:
|
||||
|
||||
@@ -330,13 +330,12 @@ func _penalize_player(player_id: int):
|
||||
|
||||
var player_node = main.get_node_or_null(str(player_id))
|
||||
if player_node:
|
||||
# Don't reset mission progress!
|
||||
# Just Drop All Tiles (which already exist on player)
|
||||
# We now use the 'on_stop_phase_violation' RPC which scatters tiles around the player
|
||||
# like they got attacked, instead of just dropping them in one pile.
|
||||
if can_rpc():
|
||||
player_node.rpc("drop_all_tiles")
|
||||
player_node.rpc("on_stop_phase_violation")
|
||||
|
||||
# Also send message
|
||||
NotificationManager.send_message(player_node, "Moved during STOP! Tiles Dropped!", NotificationManager.MessageType.WARNING)
|
||||
# Notification is also handled inside on_stop_phase_violation on the player node
|
||||
emit_signal("player_penalized", player_id)
|
||||
|
||||
func update_mission_progress(player_id: int, tile_id: int):
|
||||
|
||||
Reference in New Issue
Block a user