Skip to content

Scripts set after initial level load aren't added to load_order #77

Description

@dsrw

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.jsonload_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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions