Fix FFA last-man-standing and nil attack-target crash
- GameEngine.Concede: use EliminatePlayer instead of unconditionally setting GamePhase.GameOver — FFA game continues until one team remains. Return value changed to (GameState, bool gameOver) tuple. - GameConcedeHandler / GameForceConcedeHandler: check gameOver flag; when game continues push BroadcastPlayerEliminatedAsync + state update instead of calling FinalizeMultiPlayerGameAsync prematurely. - game_screen.gd _valid_attack_target_coords: use `not (_tpos is Dictionary)` guard instead of typed assignment — prevents nil crash when eliminated players' units still appear in get_all_enemy_units() with position:null. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -2215,7 +2215,9 @@ func _valid_attack_target_coords(unit: Dictionary) -> Array:
|
||||
var to_check : Array = Game.get_all_enemy_units()
|
||||
for t: Dictionary in to_check:
|
||||
if not t.get("canBeAttacked", true): continue
|
||||
var tp : Dictionary = t.get("position", {})
|
||||
var _tpos = t.get("position")
|
||||
if not (_tpos is Dictionary): continue # null when unit removed from board
|
||||
var tp : Dictionary = _tpos
|
||||
if tp.is_empty(): continue
|
||||
var dist : int = abs(tp.get("x", 0) - ux) + abs(tp.get("y", 0) - uy)
|
||||
if dist >= min_r and dist <= max_r:
|
||||
|
||||
Reference in New Issue
Block a user