Repository navigation
Conversation
Post-ECS space objects are userdata, not tables, so the type(item.obj)=="table" assert in findClearSpot fired inside constructEnvironment at init and the scenario never started (reproduced on unpatched master). Accept table or userdata. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
WarpJammer() has no faction, so warp_jammer_info[block_warp_jammer:getFaction()] indexes nil in constructEnvironment and the scenario stops at init (seen once the findClearSpot assert is fixed). Set it to Independent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pre-ECS API returned nil; scripts test 'docked_with ~= nil' (scenarios 22, 23, 24, 27, 32, 33, 34, 44, 48, 74) and then call docked_with:getCallSign() or read .comms_data, which throws on a boolean false. Observed: scenario 23 comms at line 3945 (flight crashed at 706 s), 32:4622. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
finalStats reads getReputationPoints() from getPlayerShip(-1), which is nil or invalid once every player ship is gone (the 'All players destroyed' defeat path, and a game with no ship yet). Fall back to 0 instead of calling a nil method. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
general note that crashes or failures specific to ECS/master-branch might be potential signs of reverse scenario API compatibility breakage, and if so might need to be addressed in the API instead of the scenarios if these changes cause failures with the scenario in the as-tested-in 2024.12.08 release, they might not be desirable changes |
|
Thanks, that's a fair point. Both scenarios were written against 2024.12.08 (
The same question applies to some of my other open PRs. Most of the guards in #2908, #2909 and #2913, and part of #2914, work around two API changes:
Would API-side fixes for these be wanted? If so, I'll send those and cut the scenario guards down to the real scenario bugs. I checked all of this by reading the code at the tag. I haven't run the changed scenarios on a 2024.12.08 build. 🤖 Generated with Claude Code |
Scenarios 23 (Defenders or Pirates) and 24 (Iris Siege) cannot start on current master. This PR fixes the init crashes and the
getDockedWith()return value that crashes 23 a few minutes in.What was wrong
findClearSpotassertstype(item.obj)=="table". Space objects are now entities, sotype()returns"userdata"and the assert fires insideconstructEnvironmentbefore anything is created:scenario_23_pirate.lua:2460/scenario_24_iris.lua:1717("... but got a userdata instead"). Scenarios 27 and 34 already accept userdata (5ac3bc9); 23 and 24 kept the old form (6 asserts per file).WarpJammer()has no faction, sowarp_jammer_info[block_warp_jammer:getFaction()]indexes nil atscenario_24_iris.lua:1364. Seen as soon as the first fix lets 24 get that far.Entity:getDockedWith()returnsfalsewhen not docked. Scripts test~= niland then index the result, soscenario_23_pirate.lua:3945throws ("attempt to index a boolean value") a few minutes into a run;scenario_32_devour.lua:3906/4622has the same pattern. The function now returnsnil, as before the ECS rewrite.getPlayerShip(-1):getReputationPoints()is called when no valid player ship exists (defeat with no players). Falls back to 0.Commits (separate so any can be dropped or changed)
scenarios 23/24: findClearSpot accepts a userdata space object(12 one-line edits)scenario_24_iris: give the block warp jammer a factionEntity:getDockedWith() returns nil, not false, when not docked(scripts/api/entity/spaceship.lua, 1 line)scenario_24_iris: finalStats tolerates no valid player shipgetDockedWith is shared API
scripts/: 25 uses, none compares the result totrue/false; all test== nil,~= nilor truthiness. None insrc/. Scenarios 22, 23, 24, 27, 32, 33, 34, 44, 48, 56, 57, 74 andcomms_scenario_utility.luacall it.falsewould change behaviour.if docked_with thenfix at each site instead if you prefer to keep the API as it is. That is ~15 edits across ~10 scenarios.Testing
scripts/precheck (luaparse): 106 files, 0 failed.23:2460and24:1717; after, both pass init.23:4379(the Sweeper template has nocreateroutine), and in 242587(base_rangenil inupdatePlayerLongRangeSensorsfor a shipsetPlayershas not set up yet) and2478(comms_datanil,goodsOnShipoverride takes 2 arguments). I have fixes for those and can send them as separate PRs.docked_withcomms branches at 23:3988/32:4622 were only reached by reading), full playthroughs to a win, the other scenarios that callgetDockedWith(33, 34, 44, 48, 56, 57, 74) at runtime, Linux/macOS.🤖 Generated with Claude Code