Fix SummonToken tile-filter validation: reject bad picks before costs are paid

Three bugs fixed for abilities like Demonate Leviathan (SummonToken + TileFilter):

1. Server: AbilityUsesThisTurn was incremented (and costs paid) before effect-level
   TileFilter validation ran. Added PreValidateClientTileTargets() called before the
   use-count increment so an invalid tile pick wastes no uses and no sacrificed tokens.

2. Server: SummonToken silently break'd when TileFilter or token-affinity check failed,
   giving the client no error. Changed both to throw GameException("INVALID_TILE").

3. Client: tile_passes_filters() only checked the target selector's filters, not the
   effect-level TileFilter (e.g. SummonToken.tileFilter). Added _collect_effect_tile_filters()
   and TileAffinityMatches handling so invalid tiles are never highlighted or accepted.

Also includes: Art2dUrl/ModelUrl deltas in GameStateDiffer/GameMessages/GameEngine,
unit_mesh_builder token-model URL fallback + shader/tint helpers, ModelCache v3 bump,
Game.gd unit delta merging for art2dUrl/modelUrl.

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:
dingo
2026-05-12 07:06:54 -04:00
co-authored by Claude Happy
parent 3bbf419836
commit f3e5363c13
10 changed files with 210 additions and 37 deletions
+2
View File
@@ -692,6 +692,8 @@ func _merge_unit_delta(unit: Dictionary, ud: Dictionary) -> void:
if ud.has("effectsJson") and ud["effectsJson"] != null: unit["effectsJson"] = ud["effectsJson"]
if ud.has("abilitiesJson") and ud["abilitiesJson"] != null: unit["abilitiesJson"] = ud["abilitiesJson"]
if ud.has("abilityUsesJson") and ud["abilityUsesJson"] != null: unit["abilityUsesJson"] = ud["abilityUsesJson"]
if ud.has("art2dUrl") and ud["art2dUrl"] != null: unit["art2dUrl"] = ud["art2dUrl"]
if ud.has("modelUrl") and ud["modelUrl"] != null: unit["modelUrl"] = ud["modelUrl"]
func _on_server_push(type: String, payload: Variant) -> void:
+1 -1
View File
@@ -17,7 +17,7 @@ extends Node
## stale .bin files from the old scheme are purged on first launch.
const _CACHE_DIR := "user://remote_model_cache"
const _CACHE_VER := "v2" # bump this when the disk-key scheme changes
const _CACHE_VER := "v3" # bump this when cached GLBs need to be re-fetched
# On web exports, direct CDN fetches are blocked by CORS (Ceph RadosGW doesn't send
# Access-Control-Allow-Origin). Route through the game server proxy instead.