Make modtools/create-unit Steam-arena compatible and add spawn-unit delegator
#21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
modtools/create-unitis invoked on Steam DFHack builds that expose arena state under a different field layout.spawn-unitwrapper that preserves interactive flow while delegating actual unit creation to the Steam-awaremodtools/create-unitimplementation.Description
modtools/create-unit.luato preferdf.global.world.arena_spawnand fall back todf.global.world.arena, andqerrorif no arena spawn state is available.type,filter,interaction,tame) with nil checks and only restore them if previously saved, preventing nil-index crashes on Steam layouts.ARENA_CREATE_CREATUREfirst thenD_LOOK_ARENA_CREATURE, and use a table-formSELECTfallback when directSELECTdelivery fails.spawn-unit.luascript that provides an interactive list/input prompt flow, validates fortress mode and cursor position, validates race/caste andcount, and delegates spawning tocreate_unit.createUnit(...)inside apcall, exposingdo_spawnwhen loaded as a module (dfhack_flags.module).Testing
rgconfirmed thearena_spawnfallback and the key/input fallbacks are present inmodtools/create-unit.lua(succeeded).nl/sedverified the guarded field handling and the new spawn-flow code paths are present (succeeded).Codex Task