refactor: enhance test framework with automated resource tracking and scripted error capture capabilities
This commit is contained in:
@@ -135,13 +135,8 @@ func simple_move_to(grid_position: Vector2i) -> bool:
|
||||
var main_gauntlet = player.get_tree().root.get_node_or_null("Main")
|
||||
if main_gauntlet and main_gauntlet.get("gauntlet_manager"):
|
||||
gm = main_gauntlet.gauntlet_manager
|
||||
|
||||
# Check if currently trapped
|
||||
if gm and gm.is_active:
|
||||
var pid = player.get("peer_id") if "peer_id" in player else -1
|
||||
if pid != -1 and gm.trapped_players.has(pid):
|
||||
print("[Move] Failed: Player is trapped in a sticky cell")
|
||||
return false
|
||||
|
||||
# Sticky no longer hard-traps — players are slowed instead and can move freely.
|
||||
|
||||
# Check for Tekton interaction (Charged Strike Mode)
|
||||
# If moving into a Tekton's space while Charged, trigger knock
|
||||
@@ -154,19 +149,19 @@ func simple_move_to(grid_position: Vector2i) -> bool:
|
||||
player.knock_tekton()
|
||||
return false # Don't move into the tile, just knock
|
||||
|
||||
# If moving into a sticky cell, trigger trap (unless cleanser active)
|
||||
# If moving into a sticky cell: slow the player (unless cleanser active,
|
||||
# which clears the cell instead). Sticky no longer hard-traps.
|
||||
if gm and gm.is_active and gm.is_sticky_cell(grid_position):
|
||||
var pid = player.get("peer_id") if "peer_id" in player else -1
|
||||
if pid != -1 and gm.is_cleanser_active(pid):
|
||||
# Cleanser immunity: clear sticky cell, use one cell, don't trap
|
||||
# Cleanser immunity: clear sticky cell, use one cell, don't slow
|
||||
gm.clear_sticky_cell(grid_position)
|
||||
gm.use_cleanser_cell(pid)
|
||||
print("[Move] Cleanser cleared sticky cell at %s (%d cells left)" % [grid_position, gm.cleanser_cells_left.get(pid, 0)])
|
||||
else:
|
||||
print("[Move] Player stepping into sticky cell at %s" % grid_position)
|
||||
movement_queue.clear()
|
||||
print("[Move] Player stepping into sticky cell at %s — slowed" % grid_position)
|
||||
if player.is_multiplayer_authority() or multiplayer.is_server():
|
||||
gm._trap_player(player)
|
||||
gm.apply_sticky_slow(player)
|
||||
|
||||
rotate_towards_target(grid_position)
|
||||
|
||||
@@ -348,9 +343,9 @@ func try_push(target_pos: Vector2i, direction: Vector2i) -> bool:
|
||||
gm_sticky.use_cleanser_cell(push_pid)
|
||||
print("[Move] Cleanser cleared push-into-sticky at %s" % pushed_to_pos)
|
||||
else:
|
||||
print("[Move] Player pushed into sticky cell at %s" % pushed_to_pos)
|
||||
print("[Move] Player pushed into sticky cell at %s — slowed" % pushed_to_pos)
|
||||
if multiplayer.is_server() or other_player.is_multiplayer_authority():
|
||||
gm_sticky._trap_player(other_player)
|
||||
gm_sticky.apply_sticky_slow(other_player)
|
||||
|
||||
# 2. Apply freeze/stun effect
|
||||
var stun_duration = 1.0 if (gm_push and gm_push.is_active) else 1.5
|
||||
@@ -397,7 +392,7 @@ func set_speed_multiplier(multiplier: float):
|
||||
func _on_movement_finished():
|
||||
if not movement_queue.is_empty():
|
||||
var next_target = movement_queue.pop_front()
|
||||
# Use a small delay or call_deferred to avoid recursion issues,
|
||||
# Use a small delay or call_deferred to avoid recursion issues,
|
||||
# but keep it snappy by executing immediately if possible.
|
||||
if not simple_move_to(next_target):
|
||||
# If next move failed, clear queue and signal finished
|
||||
@@ -406,6 +401,17 @@ func _on_movement_finished():
|
||||
emit_signal("movement_finished")
|
||||
else:
|
||||
current_move_direction = Vector2i.ZERO
|
||||
# Gauntlet (#072): a Cleanser ends early once the player rests on a safe
|
||||
# cell. Gated on gm.is_active so other game modes are never affected.
|
||||
var gm = null
|
||||
var main_node = player.get_tree().root.get_node_or_null("Main")
|
||||
if main_node and main_node.get("gauntlet_manager"):
|
||||
gm = main_node.gauntlet_manager
|
||||
if gm and gm.is_active and player.get("current_position") != null:
|
||||
var mpid = player.get("peer_id") if "peer_id" in player else -1
|
||||
if mpid != -1 and gm.is_cleanser_active(mpid):
|
||||
if multiplayer.is_server() or player.is_multiplayer_authority():
|
||||
gm.notify_movement_stopped(mpid, player.current_position)
|
||||
emit_signal("movement_finished")
|
||||
|
||||
func move_to_clicked_position(grid_position: Vector2i) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user