fix: empty out all gridmap layers under candy pump and use precise duration timer for projectile destruction (experimental branch)
This commit is contained in:
@@ -128,8 +128,10 @@ func spawn_projectile(target_world_pos: Vector3, duration: float) -> void:
|
|||||||
# We need to wait for the X/Z tween to finish, but since it's parallel we can just use a separate timer or tween
|
# We need to wait for the X/Z tween to finish, but since it's parallel we can just use a separate timer or tween
|
||||||
# to kill the projectile exactly when duration is reached, ensuring it doesn't get killed early by X/Z finishing 1 frame earlier than Y
|
# to kill the projectile exactly when duration is reached, ensuring it doesn't get killed early by X/Z finishing 1 frame earlier than Y
|
||||||
get_tree().create_timer(duration).timeout.connect(func():
|
get_tree().create_timer(duration).timeout.connect(func():
|
||||||
if is_instance_valid(spin_tween): spin_tween.kill()
|
if is_instance_valid(spin_tween):
|
||||||
if is_instance_valid(projectile): projectile.queue_free()
|
spin_tween.kill()
|
||||||
|
if is_instance_valid(projectile):
|
||||||
|
projectile.queue_free()
|
||||||
)
|
)
|
||||||
|
|
||||||
func can_rpc() -> bool:
|
func can_rpc() -> bool:
|
||||||
|
|||||||
@@ -391,35 +391,35 @@ func sync_arena_setup() -> void:
|
|||||||
print("[Gauntlet] Client: Syncing Arena Setup (%dx%d)..." % [ARENA_COLUMNS, ARENA_ROWS])
|
print("[Gauntlet] Client: Syncing Arena Setup (%dx%d)..." % [ARENA_COLUMNS, ARENA_ROWS])
|
||||||
_apply_arena_setup()
|
_apply_arena_setup()
|
||||||
|
|
||||||
func _apply_arena_setup() -> void:
|
func _apply_arena_setup() -> void:
|
||||||
"""Shared arena layout logic for host + clients."""
|
"""Shared arena layout logic for host + clients."""
|
||||||
if not gridmap:
|
if not gridmap:
|
||||||
gridmap = get_parent().get_node_or_null("EnhancedGridMap")
|
gridmap = get_parent().get_node_or_null("EnhancedGridMap")
|
||||||
if not gridmap:
|
if not gridmap:
|
||||||
gridmap = get_node_or_null("/root/Main/EnhancedGridMap")
|
gridmap = get_node_or_null("/root/Main/EnhancedGridMap")
|
||||||
if not gridmap: return
|
if not gridmap: return
|
||||||
|
|
||||||
# Resize grid (bypass setters that wipe the map)
|
# Resize grid (bypass setters that wipe the map)
|
||||||
gridmap.set("columns", ARENA_COLUMNS)
|
gridmap.set("columns", ARENA_COLUMNS)
|
||||||
gridmap.set("rows", ARENA_ROWS)
|
gridmap.set("rows", ARENA_ROWS)
|
||||||
|
|
||||||
# Clear all
|
# Clear all
|
||||||
gridmap.clear()
|
gridmap.clear()
|
||||||
|
|
||||||
# Build the 20x20 arena
|
# Build the 20x20 arena
|
||||||
for x in range(ARENA_COLUMNS):
|
for x in range(ARENA_COLUMNS):
|
||||||
for z in range(ARENA_ROWS):
|
for z in range(ARENA_ROWS):
|
||||||
var pos = Vector2i(x, z)
|
var pos = Vector2i(x, z)
|
||||||
|
|
||||||
# Center 3x3 block: NPC obstacle (Candy Pump)
|
# Center 3x3 block: NPC obstacle (Candy Pump)
|
||||||
if _is_npc_zone(pos):
|
if _is_npc_zone(pos):
|
||||||
# Make the floor empty (-1) beneath the Candy Pump
|
# Make the floor empty (-1) beneath the Candy Pump
|
||||||
# We need to clear all possible layers just in case
|
# We need to clear all possible layers just in case
|
||||||
gridmap.set_cell_item(Vector3i(x, 0, z), -1)
|
gridmap.set_cell_item(Vector3i(x, 0, z), -1)
|
||||||
gridmap.set_cell_item(Vector3i(x, 1, z), -1)
|
gridmap.set_cell_item(Vector3i(x, 1, z), -1)
|
||||||
gridmap.set_cell_item(Vector3i(x, 2, z), -1)
|
gridmap.set_cell_item(Vector3i(x, 2, z), -1)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Boundary walls: perimeter (row 0, row 19, col 0, col 19)
|
# Boundary walls: perimeter (row 0, row 19, col 0, col 19)
|
||||||
if x == 0 or x == ARENA_COLUMNS - 1 or z == 0 or z == ARENA_ROWS - 1:
|
if x == 0 or x == ARENA_COLUMNS - 1 or z == 0 or z == ARENA_ROWS - 1:
|
||||||
# Also make border walls visually walkable floors instead of red blocks
|
# Also make border walls visually walkable floors instead of red blocks
|
||||||
@@ -427,11 +427,11 @@ func sync_arena_setup() -> void:
|
|||||||
gridmap.set_cell_item(Vector3i(x, 1, z), -1)
|
gridmap.set_cell_item(Vector3i(x, 1, z), -1)
|
||||||
gridmap.set_cell_item(Vector3i(x, 2, z), -1)
|
gridmap.set_cell_item(Vector3i(x, 2, z), -1)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Interior: walkable floor
|
# Interior: walkable floor
|
||||||
gridmap.set_cell_item(Vector3i(x, 0, z), TILE_WALKABLE)
|
gridmap.set_cell_item(Vector3i(x, 0, z), TILE_WALKABLE)
|
||||||
gridmap.set_cell_item(Vector3i(x, 1, z), -1)
|
gridmap.set_cell_item(Vector3i(x, 1, z), -1)
|
||||||
gridmap.set_cell_item(Vector3i(x, 2, z), -1)
|
gridmap.set_cell_item(Vector3i(x, 2, z), -1)
|
||||||
|
|
||||||
gridmap.diagonal_movement = true
|
gridmap.diagonal_movement = true
|
||||||
gridmap.update_grid_data()
|
gridmap.update_grid_data()
|
||||||
|
|||||||
Reference in New Issue
Block a user