When a unit's script is set/changed at runtime (not during the initial level load) — e.g. a client authoring a unit's code, as demo_sea now does under SEA_SAVE — the script file is written to scripts/<id>.nim and runs correctly, but the unit is not added to level.json's load_order.
Reload still works (load_order is only an optimization to avoid re-resolving dependencies across reload passes), so this is not a correctness bug — just a missed optimization: a unit whose script was authored post-load won't get its dependency-ordered slot until some later save that rebuilds load_order.
Repro: SEA_SIZE=40 SEA_FRAMES=4 SEA_SAVE=1 nim r bin/demos/demo_sea.nim against a running Enu, then inspect level.json — load_order stays [] though scripts/<id>.nim exists and runs on reload.
Expected: units with a script should appear in load_order regardless of when the script was set.
When a unit's script is set/changed at runtime (not during the initial level load) — e.g. a client authoring a unit's
code, asdemo_seanow does underSEA_SAVE— the script file is written toscripts/<id>.nimand runs correctly, but the unit is not added tolevel.json'sload_order.Reload still works (load_order is only an optimization to avoid re-resolving dependencies across reload passes), so this is not a correctness bug — just a missed optimization: a unit whose script was authored post-load won't get its dependency-ordered slot until some later save that rebuilds load_order.
Repro:
SEA_SIZE=40 SEA_FRAMES=4 SEA_SAVE=1 nim r bin/demos/demo_sea.nimagainst a running Enu, then inspectlevel.json—load_orderstays[]thoughscripts/<id>.nimexists and runs on reload.Expected: units with a script should appear in load_order regardless of when the script was set.