Skip to content

fix 2.1.14 parsing by including an extra unknown field - #7

Closed
thejoshwolfe wants to merge 1 commit into
rfvgyhn:mainfrom
thejoshwolfe:patch-1
Closed

fix 2.1.14 parsing by including an extra unknown field#7
thejoshwolfe wants to merge 1 commit into
rfvgyhn:mainfrom
thejoshwolfe:patch-1

Conversation

@thejoshwolfe

Copy link
Copy Markdown

closes #6.

This makes a default settings exchange string parse without errors for Factorio 2.1.14.

I didn't find any explanation of this field in https://lua-api.factorio.com/latest/types/UnitGroupSettings.html , so i called it unknown.

@rfvgyhn

rfvgyhn commented Aug 23, 2026

Copy link
Copy Markdown
Owner

I think unit group might not be the correct change. build_base_unit_dispatch_cooldown was added at some point which this tool doesn't currently account for. https://lua-api.factorio.com/2.1.13/types/EnemyExpansionSettings.html. It appears to account for the uint32 you've added here. It doesn't show up in https://github.com/wube/factorio-data/blob/master/map-settings.example.json though which makes it easy to miss.

@thejoshwolfe

Copy link
Copy Markdown
Author

Yeah, i'm pretty lost in this unit group stuff. I determined where to put this new line of code by stepping through with a debugger until something parsed clearly wrong, like a float parsing as 1e-308 or something like that, and then just inserting one integer read before it.

If there's a better approach than guesswork, we should definitely be able to do better than this PR.

@rfvgyhn

rfvgyhn commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Yeah, I'm guessing it broke in unit group because that new field is part of enemy expansion which happens right before unit group and the first couple fields of unit group are the same type as the last few fields of enemy expansion.

Short of decompiling the factorio binary, I think guesswork with hints from the doc changes is our best option.

If you want to make the change in this PR I'll merge it. If you'd prefer to close this PR and open a new one I can merge that. Or I can just make the change. Whatever is easier for you with your other PR is good with me.

@rfvgyhn

rfvgyhn commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Looks like that field was added to the data repo in their latest commit. wube/factorio-data@8c37187#diff-d63ed68af1a2bdf627a00071fe54cf544ff575339461af0cd9bef43580c242bc

@rfvgyhn

rfvgyhn commented Aug 26, 2026

Copy link
Copy Markdown
Owner

I added v2.1.13 support in 9c5bd61 by adding enemy_expansion.build_base_unit_dispatch_cooldown. Thanks for narrowing it down.

@rfvgyhn rfvgyhn closed this Aug 26, 2026
@thejoshwolfe
thejoshwolfe deleted the patch-1 branch August 26, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2.1.14: Unexpected data after end

2 participants