EarendelDevelopers / EarendelDevelopers/factorio-mods

AAI industries erases changes to fuel_categories if fuel_category is still set in data-final-fixes

Open
#306 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
17
Forks
4
PR merge metrics
No merged PRs in 30d

Description

https://wiki.factorio.com/Types/EnergySource#fuel_categories states that `fuel_categories` takes precedence. So the reversal of precedence in data-final-fixes.lua, line 51 looks like a clear bug to me.

I propose the following instead
```lua
if not burner.fuel_categories then
burner.fuel_categories = (burner.fuel_category and { burner.fuel_category }) or { "chemical" } -- the implicit default
elseif burner.fuel_category and not data_util.table_contains(burner.fuel_categories, burner.fuel_category) then
table.insert(burner.fuel_categories, burner.fuel_category)
end
burner.fuel_category = nil -- always obsolete after the above

-- avoid adding processed-chemical twice
if data_util.table_contains( burner.fuel_categories, "chemical") and not data_util.table_contains(burner.fuel_categories, "processed-chemical") then
table.insert(burner.fuel_categories, "processed-chemical")
end
```

(yes, I transfer ownership of that code)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.