Browser seems good to go!

This commit is contained in:
dingo
2026-01-31 10:06:08 -05:00
parent 54ed27b97a
commit a0ee3deeca
6 changed files with 248 additions and 8 deletions
+38
View File
@@ -297,10 +297,48 @@ func _handle_dungeon_enter(data: Dictionary):
for p in portal_list:
var pid = p.get("id", p.get("Id"))
portals[pid] = p
# Prefetch mob textures early on web (mobs list is included in enter payload)
var mobs_list = data.get("mobs", data.get("Mobs", []))
_prefetch_mob_textures_from_list(mobs_list)
set_state(STATE_PLAYING)
dungeon_entered.emit()
func _prefetch_mob_textures_from_list(mobs_list: Array) -> void:
if mobs_list.is_empty():
return
if not UpdateManager or not UpdateManager._is_web:
return
var paths: Array = []
for mob in mobs_list:
if not (mob is Dictionary):
continue
var sprite_config = mob.get("spriteConfig", mob.get("SpriteConfig", null))
if sprite_config == null or not (sprite_config is Dictionary):
continue
# New format (sheets)
if sprite_config.has("sheets"):
var sheets = sprite_config.get("sheets", {})
for sheet_key in sheets:
var sheet_info = sheets[sheet_key]
var path = sheet_info.get("path", "")
if path != "" and not paths.has(path):
paths.append(path)
continue
# Legacy format (sprites)
var sprites = sprite_config.get("sprites", {})
for anim_name in sprites:
var sprite_path = sprites[anim_name]
if sprite_path != "" and not paths.has(sprite_path):
paths.append(sprite_path)
if not paths.is_empty():
UpdateManager.prefetch_files(paths, true, false)
func _parse_tiles(tiles_string: String):
dungeon.tiles = []
if tiles_string.is_empty():