Hey,
I tested the included Debug/Test World scenario from AbandonedRuins_updated_fork 1.5.5.
This is specifically the scenario available from Factorio's scenario menu which creates the dedicated debug-ruins surface and places the registered ruins there for inspection.
Normal Freeplay spawning is not affected by the issues described below.
I found several independent problems in the Test World. I attached a unified diff against the unmodified 1.5.5 sources.
After applying these fixes, the Test World starts successfully and the registered ruins are displayed correctly.
- Test World fails to parse
Initial error:
level/control.lua:83: ')' expected (to close '(' at line 50) near 'if'
File:
scenarios/debug/control.lua
Cause:
The script.on_event(defines.events.on_player_created, function(event) block contains an additional end after the debug surface creation/logging code.
This closes the function body too early while the surrounding script.on_event(...) call is still waiting for its closing ).
Fix:
Remove the stray end and let the event handler continue normally until the final end).
- Invalid remote interface call
The Test World contains:
remote_call("AbandonedRuins", "get_ruin_sizes")
Factorio's remote interface API uses:
remote.call(...)
Fix:
remote_call(...) -> remote.call(...)
- Registered ruin count uses the table instead of its length
The scenario calculates the total number of ruins using:
total_ruins_amount = total_ruins_amount + ruin_set[size]
However, get_ruin_set() returns a table containing arrays of ruin definitions for each size.
So ruin_set[size] is a table, not a numeric value.
Fix:
Count the entries in the array instead:
total_ruins_amount = total_ruins_amount + #ruin_set[size]
The patched version also checks that the size entry actually exists before counting it.
- Debug surface is accepted by spawn_ruin() but rejected by clear_area()
After fixing the scenario script, the Test World started but failed while placing the first ruins with:
AbandonedRuins_updated_fork/lua/spawning.lua:386: surface.name='debug-ruins' is a debug surface, no clearing needed.
Call stack:
Test World -> spawn_ruin() -> clear_area() -> error()
The dedicated debug surface is already supported by spawn_ruin(), but clear_area() explicitly throws an error when it encounters the same surface:
surface.name == constants.DEBUG_SURFACE_NAME
The message itself already states that no clearing is required.
Fix:
Instead of raising an error, the debug-surface branch now skips the clearing step and returns success:
return true
This allows spawn_ruin() to continue normally on the Test World surface.
Normal surfaces still use the existing clearing logic unchanged.
Additional improvement: weighted ruin sets in the Test World
This is not required to fix the original Test World crashes, but I added it because it makes the scenario much more useful with ruin packs that use weighted registration.
Some ruin packs intentionally register the same ruin definition multiple times in the ruin set to influence normal random spawn probability.
For example:
ruin_A, ruin_A, ruin_A, ruin_B
is a valid way to give ruin_A three times the selection weight of ruin_B.
That behavior is correct for normal Freeplay spawning.
However, the Test World iterates over the registered selection entries directly. With weighted registrations, this means it would physically place the same ruin multiple times instead of showing each actual ruin definition once.
The patch therefore creates a display-only de-duplicated ruin list for the Test World.
This de-duplication:
only affects the Debug/Test World,
does not modify the registered ruin set,
does not change spawn probabilities,
and does not affect normal Freeplay spawning.
Additional cleanup
The patch also:
uses the ruin-size order returned by get_ruin_sizes(),
guards against an empty ruin set,
and removes the direct runtime-setting modification from the scenario.
Result
With all of the above changes applied, I can successfully start the Debug/Test World and inspect the registered ruins.
I used it afterwards to verify the Angel ruin integration in AbandonedRuins-Combined, and the ruins are displayed/spawned correctly.
The attached patch only changes:
scenarios/debug/control.lua
and
lua/spawning.lua
The normal Freeplay ruin spawning logic and spawn weights are otherwise unchanged.
If useful, we can also provide the fully patched 1.5.5 build we used for testing, so you can compare it directly against the original version.
Greetings
MoSII2710