feat: Implement the Stop 'n' Go game mode, including phase management, player missions, movement penalties, and associated player movement logic.
This commit is contained in:
@@ -120,17 +120,24 @@ func simple_move_to(grid_position: Vector2i) -> bool:
|
||||
|
||||
rotate_towards_target(grid_position)
|
||||
|
||||
if player.is_multiplayer_authority() and _can_rpc():
|
||||
if player.is_multiplayer_authority():
|
||||
if player.has_method("sync_walk_animation"):
|
||||
player.rpc("sync_walk_animation")
|
||||
if _can_rpc():
|
||||
player.rpc("sync_walk_animation")
|
||||
else:
|
||||
player.sync_walk_animation()
|
||||
|
||||
var path = [Vector2(player.current_position.x, player.current_position.y), Vector2(grid_position.x, grid_position.y)]
|
||||
path.pop_front()
|
||||
|
||||
current_move_direction = grid_position - player.current_position
|
||||
|
||||
if player.is_multiplayer_authority() and _can_rpc():
|
||||
player.rpc("start_movement_along_path", path, not (player.is_bot or player.is_in_group("Bots")))
|
||||
if player.is_multiplayer_authority():
|
||||
var is_bot = player.is_bot or player.is_in_group("Bots")
|
||||
if _can_rpc():
|
||||
player.rpc("start_movement_along_path", path, not is_bot)
|
||||
else:
|
||||
player.start_movement_along_path(path, not is_bot)
|
||||
|
||||
return true
|
||||
|
||||
|
||||
@@ -244,14 +244,11 @@ func _apply_arena_setup():
|
||||
# Spawn tiles for missions
|
||||
if multiplayer.is_server():
|
||||
_spawn_mission_tiles()
|
||||
# Client already constructs the base arena locally via _apply_arena_setup()
|
||||
# So no need to blast huge 5KB arrays across the network.
|
||||
|
||||
# Sync the WHOLE grid to all clients to ensure size and stripes are correct
|
||||
var main = get_node("/root/Main")
|
||||
if main and can_rpc():
|
||||
# Gather all floor 0 and floor 1 data
|
||||
var floor0_data = gridmap.get_floor_data(0)
|
||||
var floor1_data = gridmap.get_floor_data(1)
|
||||
main.rpc("sync_full_grid_data_stop_n_go", floor0_data, floor1_data, gridmap.columns, gridmap.rows)
|
||||
# For any specifically spawned tiles (like missions), they are sent individually
|
||||
# by sync_grid_item inside _spawn_mission_tiles.
|
||||
|
||||
func _spawn_mission_tiles():
|
||||
var gridmap = get_node("/root/Main/EnhancedGridMap")
|
||||
@@ -270,6 +267,9 @@ func _spawn_mission_tiles():
|
||||
if (floor_item == TILE_WALKABLE or floor_item == TILE_SAFE):
|
||||
if gridmap.get_cell_item(Vector3i(x, 1, z)) == -1:
|
||||
gridmap.set_cell_item(Vector3i(x, 1, z), tile_type)
|
||||
var main = get_node("/root/Main")
|
||||
if main and can_rpc():
|
||||
main.rpc("sync_grid_item", x, 1, z, tile_type)
|
||||
count += 1
|
||||
|
||||
func _assign_missions():
|
||||
|
||||
Reference in New Issue
Block a user