feat: make the radiator report its own internal state
v1.1.0 loaded cleanly and still did nothing, so the NetworkValue rewrite was not the whole story. Rather than keep guessing at which link in the chain is dead, add indicator icons bound to the internal signals. An indicator draws while its toggle is off, so one glance at a radiator now separates the cases that were previously indistinguishable: wrench absent -> the AddBase never merged; nothing in the mod runs thermal missile -> no thermal-ammo signal arriving resource -> no hold signal arriving from a battery Tests check that every added indicator binds to a component that exists and to a sprite that exists in the indicators atlas. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011oLWY1G6S8U35bi2FxVWni
This commit is contained in:
+44
-1
@@ -365,7 +365,50 @@ def test_no_name_collisions_with_vanilla():
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 7. The mod manifest must declare the fields Cosmoteer requires.
|
||||
# 7. Added indicators must bind to a real toggle and a real atlas sprite.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_added_indicators_are_valid():
|
||||
mod = rules_parser.parse_file(os.path.join(MOD_ROOT, "mod.rules"))
|
||||
radiator_components = resolve("<ships/terran/radiator/radiator.rules>/Part/Components")
|
||||
added = rules_parser.parse_file(os.path.join(MOD_ROOT, "components", "radiator_auto.rules"))
|
||||
known = set(added.order) | set(radiator_components.order if radiator_components else [])
|
||||
|
||||
atlas = vanilla("gui/game/indicators/indicators.rules")
|
||||
check(atlas is not None, "cannot read the indicators atlas")
|
||||
|
||||
for action in iter_actions(mod):
|
||||
kind = action.get("Action")
|
||||
add_to = action.get("AddTo")
|
||||
if not kind or kind.value != "AddMany" or add_to is None:
|
||||
continue
|
||||
if "Indicators" not in add_to.value:
|
||||
continue
|
||||
entries = action.get("ManyToAdd")
|
||||
check(entries is not None, "indicator AddMany has no ManyToAdd list")
|
||||
if entries is None:
|
||||
continue
|
||||
for key in entries.order:
|
||||
entry = entries.children[key]
|
||||
toggle = entry.get("Toggle")
|
||||
check(toggle is not None, "an added indicator has no Toggle")
|
||||
if toggle is not None:
|
||||
check(
|
||||
toggle.value.strip() in known,
|
||||
f"added indicator binds to unknown component '{toggle.value.strip()}'",
|
||||
)
|
||||
sprite = entry.get("AtlasSprite/File")
|
||||
check(sprite is not None, "an added indicator has no AtlasSprite/File")
|
||||
if sprite is not None and atlas is not None:
|
||||
name = sprite.value.strip().rsplit("/", 1)[-1]
|
||||
check(
|
||||
name in atlas.children,
|
||||
f"added indicator uses unknown atlas sprite '{name}'",
|
||||
)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 8. The mod manifest must declare the fields Cosmoteer requires.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_manifest_is_well_formed():
|
||||
|
||||
Reference in New Issue
Block a user