Find the planet setups in an exported build
The registry scanned res://PlanetSetups for names ending ".tres". An export does not ship those: text resources are converted to binary and the pack carries "<name>.tres.remap", which ResourceLoader follows when asked for the original path. So the scan found nothing in the web build, every planet drew no setup, and since #211 the setup IS the garrison - every world in the deployed game was deserted, with nothing logged to say why. Confirmed by reading index.pck, which holds rocky_default.tres.remap and no .tres. The suite runs from source, where the bug cannot occur, so the name resolution is its own function and tested against the exact strings the pack contains. Also: the planning centre listed transporters and repair drones but set_vessel_target() still refused anything not fleet-eligible, so both rows had buttons that did nothing - the worst shape a refusal can take. Listing and setting read the same rule now, and a standing order is only offered to a crafter that can actually take it. And two quests close the chain: the tentacle world, which the scanner will not offer until the story hands it over, and the Warden itself. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
This commit is contained in:
parent
c6f9eb467f
commit
df4d5e35f9
6 changed files with 179 additions and 8 deletions
|
|
@ -14,6 +14,28 @@ const SETUPS_DIR: String = "res://PlanetSetups"
|
|||
# registered it, while a direct script preload never depends on that cache.
|
||||
const PLANET_SETUP_SCRIPT: Script = preload("res://surface/PlanetSetup.gd")
|
||||
|
||||
|
||||
# The name to LOAD for a directory entry, or "" for an entry that is not a
|
||||
# setup at all.
|
||||
#
|
||||
# An export does not ship the .tres. Text resources are converted to binary
|
||||
# and the pack carries "<name>.tres.remap" beside them - the remap points at
|
||||
# the converted file, and ResourceLoader follows it when asked for the
|
||||
# ORIGINAL path. So a scan that matches on ".tres" finds every setup when run
|
||||
# from source and none at all in an exported build, which is what emptied
|
||||
# every planet of its garrison on the web version: no setups, no enemies, and
|
||||
# nothing logged anywhere to say so.
|
||||
#
|
||||
# The suite runs from source, so nothing here can catch that by running the
|
||||
# game - this function exists to be tested directly.
|
||||
static func setup_file_name(entry: String) -> String:
|
||||
var name: String = entry
|
||||
if name.ends_with(".remap"):
|
||||
name = name.get_basename()
|
||||
if name.ends_with(".tres") or name.ends_with(".res"):
|
||||
return name
|
||||
return ""
|
||||
|
||||
static var _all: Array = []
|
||||
static var _scanned: bool = false
|
||||
# Which setup each planet drew, once it has drawn one. See setup_for_planet.
|
||||
|
|
@ -29,8 +51,11 @@ static func _ensure_scanned() -> void:
|
|||
return
|
||||
dir.list_dir_begin()
|
||||
var file_name: String = dir.get_next()
|
||||
var seen: Dictionary = {}
|
||||
while file_name != "":
|
||||
if not dir.current_is_dir() and file_name.ends_with(".tres"):
|
||||
var setup_file: String = setup_file_name(file_name)
|
||||
if not dir.current_is_dir() and setup_file != "" and not seen.has(setup_file):
|
||||
seen[setup_file] = true
|
||||
# CACHE_MODE_REPLACE, not a plain load(). Godot caches resources by
|
||||
# path, so after the map editor saved a setup this handed back the
|
||||
# CACHED copy - still holding the values from before the save. The
|
||||
|
|
@ -42,7 +67,7 @@ static func _ensure_scanned() -> void:
|
|||
# existing instance in place instead of minting a new one, so
|
||||
# object identity across a rescan survives - which the per-planet
|
||||
# map assignments depend on (see setup_for_planet).
|
||||
var res: Resource = ResourceLoader.load(SETUPS_DIR + "/" + file_name,
|
||||
var res: Resource = ResourceLoader.load(SETUPS_DIR + "/" + setup_file,
|
||||
"", ResourceLoader.CACHE_MODE_REPLACE)
|
||||
if res != null and res.get_script() == PLANET_SETUP_SCRIPT:
|
||||
_all.append(res)
|
||||
|
|
|
|||
Loading…
Reference in a new issue