kirkmcdonald / factorio-tools Goto Github PK
View Code? Open in Web Editor NEWTools dealing with the game Factorio.
Tools dealing with the game Factorio.
The output of factoriodump
on my (heavily modded, details below) installation includes entries with "results": [ [] ]
that he web UI barfs on. Looking at the rest of the JSON file, it looks like this is indeed not valid content.
local-0.17.66.json
: https://gist.github.com/abesto/df511c5a0c5cac980ed643401b23bf3cfactoriodump -v
: https://gist.github.com/abesto/eb2eba85dd2300f9343969217d88f08e "cobalt-oxide-from-copper": {
"amount": 1,
"name": "stone",
"type": "item"
}, {
"amount": 1,
"name": "solid-carbon",
"type": "item"
}, {
"amount": 5,
"name": "gas-hydrogen",
"type": "fluid"
} ],
"localized_name": {
"en": "Advanced copper processing with Cobalt oxide"
},
"main_product": "copper-plate",
"name": "cobalt-oxide-from-copper",
"order": "c-b[cobalt-oxide-from-copper]",
"results": [ [], [] ],
"subgroup": "bob-material-chemical",
"type": "recipe"
},
ls mods
, mod-list.json
factorio-tools
: 8c66310factorio-tools
was built and executed in a Docker image built from this Dockerfile
: https://gist.github.com/abesto/d249d7add8ef2b10b8e71b08b9690876I understand this is probably a weird edge-case that only comes up with tons of complex mods. Then again, a calculator is especially useful in such a playthrough. And who knows, maybe it's an easy fix, or highlights some other problem that was hiding so far, so thought I'd submit this anyway.
๐
When a runtime error happens while executing lua code only the error, but no stacktrace is displayed. It would be a nice convenience feature if that could be added.
I know this strictly doesn't belong here, but your golua
repository does not have issues enabled (due to being forked I believe) and the original project seems inactive, so I thought I'd put it here.
For reference this has also been reported at aarzilli/golua#58
KirkMcDonald/FactorioLoaderLib#3 addresses two more differences between how mods are processed as opposed to how Factorio does it. I think these and the ones already fixed are only the first of a whole lot of probably more subtle and harder to track down discrepancies. The examples I can think of right now:
table.sort
.
pairs()
to be deterministic (by I think insertion order) while it won't be in the loader. These will probably not manifest themselves in hard crashes, but instead cause slightly wrong recipe lists (aka harder to find and fix).tostring(10.0) == "10"
is true in 5.2 but false in 5.3.Because of that I would suggest to use the Factorio environment itself rather than emulating it. Two options I see here:
mod-list.json
and executes it's code in data-final-fixes.lua
. I don't know how well this would work when the game is running simultaneously (probably a desired feature). I think it is possible at least in the stand-alone version, I don't have any idea whether this would work with the steam build though.I'm trying to generate a data dump for Factorio 0.17.38 + Space Exploration mod but I'm facing a few issues in the process. It's likely that some of the changed recipes come from AAI Industry mod.
Issues:
data*.lua
files do not get executed! test
(?) angelsbioprocessing
Execution log (with -verbose):
data loaded
no localized name for ammo named grappling-gun-ammo
no localized name for gun named grappling-gun
hack icon: electric-energy-interface
no localized name for item named burner-assembling-machine
no localized name for item named aai-signal-sender
no localized name for item named motor
no localized name for item named vehicle-fuel
no localized name for item named concrete-wall
no localized name for item named burner-turbine
hack icon: infinity-pipe
no localized name for item named fuel-processor
no localized name for item named glass
no localized name for item named sand
no localized name for item named aai-signal-receiver
no localized name for item named burner-lab
no localized name for item named steel-wall
no localized name for item named small-iron-electric-pole
no localized name for item named stone-tablet
hack icon: escape-pod-power
no localized name for item named electric-motor
no localized name for mining-tool named dummy-steel-axe
main product does not exist: fill-petroleum-gas-barrel
recipe skip: fill-petroleum-gas-barrel because of icon
main product does not exist: fill-petroleum-gas-barrel
recipe skip: fill-petroleum-gas-barrel because of icon
recipe skip: empty-sulfuric-acid-barrel because of icon
recipe skip: empty-sulfuric-acid-barrel because of icon
no localized name for recipe named burner-assembling-machine
no localized name for recipe named burner-assembling-machine
main product does not exist: vehicle-fuel-from-coal
recipe skip: vehicle-fuel-from-coal because of subgroup
main product does not exist: vehicle-fuel-from-coal
recipe skip: vehicle-fuel-from-coal because of subgroup
main product does not exist: vehicle-fuel-from-solid-fuel
recipe skip: vehicle-fuel-from-solid-fuel because of subgroup
main product does not exist: vehicle-fuel-from-solid-fuel
recipe skip: vehicle-fuel-from-solid-fuel because of subgroup
main product does not exist: vehicle-fuel-from-nuclear-fuel
recipe skip: vehicle-fuel-from-nuclear-fuel because of subgroup
main product does not exist: vehicle-fuel-from-nuclear-fuel
recipe skip: vehicle-fuel-from-nuclear-fuel because of subgroup
main product does not exist: vehicle-fuel-from-rocket-fuel
recipe skip: vehicle-fuel-from-rocket-fuel because of subgroup
main product does not exist: vehicle-fuel-from-rocket-fuel
recipe skip: vehicle-fuel-from-rocket-fuel because of subgroup
no localized name for recipe named aai-signal-sender
no localized name for recipe named aai-signal-sender
recipe skip: empty-heavy-oil-barrel because of icon
recipe skip: empty-heavy-oil-barrel because of icon
main product does not exist: fill-heavy-oil-barrel
recipe skip: fill-heavy-oil-barrel because of icon
main product does not exist: fill-heavy-oil-barrel
recipe skip: fill-heavy-oil-barrel because of icon
main product does not exist: fill-light-oil-barrel
recipe skip: fill-light-oil-barrel because of icon
main product does not exist: fill-light-oil-barrel
recipe skip: fill-light-oil-barrel because of icon
no localized name for recipe named motor
no localized name for recipe named motor
recipe skip: empty-crude-oil-barrel because of icon
recipe skip: empty-crude-oil-barrel because of icon
main product does not exist: fill-crude-oil-barrel
recipe skip: fill-crude-oil-barrel because of icon
main product does not exist: fill-crude-oil-barrel
recipe skip: fill-crude-oil-barrel because of icon
recipe skip: empty-water-barrel because of icon
recipe skip: empty-water-barrel because of icon
main product does not exist: fill-water-barrel
recipe skip: fill-water-barrel because of icon
main product does not exist: fill-water-barrel
recipe skip: fill-water-barrel because of icon
recipe skip: empty-petroleum-gas-barrel because of icon
recipe skip: empty-petroleum-gas-barrel because of icon
recipe skip: empty-lubricant-barrel because of icon
recipe skip: empty-lubricant-barrel because of icon
main product does not exist: fill-lubricant-barrel
recipe skip: fill-lubricant-barrel because of icon
main product does not exist: fill-lubricant-barrel
recipe skip: fill-lubricant-barrel because of icon
main product does not exist: fill-sulfuric-acid-barrel
recipe skip: fill-sulfuric-acid-barrel because of icon
main product does not exist: fill-sulfuric-acid-barrel
recipe skip: fill-sulfuric-acid-barrel because of icon
no localized name for recipe named grappling-gun-ammo
no localized name for recipe named grappling-gun-ammo
no localized name for recipe named concrete-wall
no localized name for recipe named concrete-wall
no localized name for recipe named grappling-gun
no localized name for recipe named grappling-gun
no localized name for recipe named aai-signal-receiver
no localized name for recipe named aai-signal-receiver
no localized name for recipe named burner-lab
no localized name for recipe named burner-lab
no localized name for recipe named steel-wall
no localized name for recipe named steel-wall
no localized name for recipe named small-iron-electric-pole
no localized name for recipe named small-iron-electric-pole
no localized name for recipe named glass-from-sand
no localized name for recipe named glass-from-sand
no localized name for recipe named sand-from-stone
no localized name for recipe named sand-from-stone
no localized name for recipe named burner-turbine
no localized name for recipe named burner-turbine
recipe skip: empty-light-oil-barrel because of icon
recipe skip: empty-light-oil-barrel because of icon
main product does not exist: nuclear-fuel-reprocessing
no localized name for recipe named fuel-processor
no localized name for recipe named fuel-processor
main product does not exist: vehicle-fuel-from-wood
recipe skip: vehicle-fuel-from-wood because of subgroup
main product does not exist: vehicle-fuel-from-wood
recipe skip: vehicle-fuel-from-wood because of subgroup
no localized name for recipe named stone-tablet
no localized name for recipe named stone-tablet
no localized name for recipe named electric-motor
no localized name for recipe named electric-motor
no localized name for furnace named fuel-processor
no localized name for assembling-machine named burner-assembling-machine
no localized name for boiler named burner-turbine
no localized name for generator named burner-turbine-generator
Created files:
/home/wladek/fd/kirkmcdonald.github.io/images/sprite-sheet-be7d3fcec0558bfba2c30582fb45ba17.png
/home/wladek/fd/kirkmcdonald.github.io/data/space-exploration-0.17.38.json
/home/wladek/fd/kirkmcdonald.github.io/data/space-exploration-0.17.38-expensive.json
Mod list:
aai-industry_0.3.17.zip
aai-signal-transmission_0.1.4.zip
alien-biomes_0.4.14.zip
bullet-trails_0.4.1.zip
grappling-gun_0.1.2.zip
robot_attrition_0.3.6.zip
space-exploration_0.1.56.zip
space-exploration-graphics_0.1.39.zip
space-exploration-hr-graphics_0.1.38.zip
space-exploration-postprocess_0.1.37.zip
(bonus question: does the "enabled" flag in the mod-list.cfg matter?)
Any hints how to get around these issues?
Steam path: e:\Steam
game path: f:\SteamLibrary\steamapps\common\Factorio
game version: 0.16.51
tool path: b:\tool
my startup attempts:
b:\tool>factoriocalc.exe
Factorio game directory not found.
b:\tool>factoriocalc.exe -gamedir=f:\SteamLibrary\steamapps\common\Factorio
[string "../FactorioLoaderLib/library/settingloader.lu..."]:6: attempt to index a nil value (local 'f')
b:\tool>factoriocalc.exe -gamedir="f:/SteamLibrary/steamapps/common/Factorio"
[string "../FactorioLoaderLib/library/settingloader.lu..."]:6: attempt to index a nil value (local 'f')
I am trying to get the standalong executable to pick up the mod I have installed so that I can work out what ratios I need to have using this new mod.
Directory of D:\apps\Factorio_factoriocalc\mods
09/09/2019 18:23 <DIR> .
09/09/2019 18:23 <DIR> ..
09/09/2019 06:19 115,982,931 IndustrialRevolution_0.99.1.zip
09/09/2019 18:23 163 mod-list.json
09/09/2019 18:22 728 mod-settings.dat
3 File(s) 115,983,822 bytes
However factoriocalc appears to ignore the mod folder I have given it. And when I go into the browser window that opens up I can not see anything new under "Use recipe set" in Settings
D:\apps\Factorio_factoriocalc>factoriocalc -moddir d:\apps\Factorio_factoriocalc\mods -verbose
data loaded
hack icon: infinity-pipe
hack icon: electric-energy-interface
no localized name for mining-tool named dummy-steel-axe
recipe skip: empty-lubricant-barrel because of icon
recipe skip: empty-lubricant-barrel because of icon
recipe skip: empty-light-oil-barrel because of icon
recipe skip: empty-light-oil-barrel because of icon
recipe skip: empty-heavy-oil-barrel because of icon
recipe skip: empty-heavy-oil-barrel because of icon
main product does not exist: fill-heavy-oil-barrel
recipe skip: fill-heavy-oil-barrel because of icon
main product does not exist: fill-heavy-oil-barrel
recipe skip: fill-heavy-oil-barrel because of icon
recipe skip: empty-crude-oil-barrel because of icon
recipe skip: empty-crude-oil-barrel because of icon
recipe skip: empty-sulfuric-acid-barrel because of icon
recipe skip: empty-sulfuric-acid-barrel because of icon
main product does not exist: fill-sulfuric-acid-barrel
recipe skip: fill-sulfuric-acid-barrel because of icon
main product does not exist: fill-sulfuric-acid-barrel
recipe skip: fill-sulfuric-acid-barrel because of icon
main product does not exist: fill-light-oil-barrel
recipe skip: fill-light-oil-barrel because of icon
main product does not exist: fill-light-oil-barrel
recipe skip: fill-light-oil-barrel because of icon
main product does not exist: fill-water-barrel
recipe skip: fill-water-barrel because of icon
main product does not exist: fill-water-barrel
recipe skip: fill-water-barrel because of icon
main product does not exist: fill-lubricant-barrel
recipe skip: fill-lubricant-barrel because of icon
main product does not exist: fill-lubricant-barrel
recipe skip: fill-lubricant-barrel because of icon
main product does not exist: nuclear-fuel-reprocessing
recipe skip: empty-water-barrel because of icon
recipe skip: empty-water-barrel because of icon
main product does not exist: fill-crude-oil-barrel
recipe skip: fill-crude-oil-barrel because of icon
main product does not exist: fill-crude-oil-barrel
recipe skip: fill-crude-oil-barrel because of icon
main product does not exist: fill-petroleum-gas-barrel
recipe skip: fill-petroleum-gas-barrel because of icon
main product does not exist: fill-petroleum-gas-barrel
recipe skip: fill-petroleum-gas-barrel because of icon
recipe skip: empty-petroleum-gas-barrel because of icon
recipe skip: empty-petroleum-gas-barrel because of icon
Starting server on http://localhost:8000/calc.html
(Ctrl-C to exit.)
factoriodump
from source on Windows 10.
README.md
file says to install Go, packr
, a C compiler, Lua 5.3, and some Lua libraries.
go version go1.20.6 windows/amd64
README.md
says to install 5.3, but the current version of luarocks
complains if I didn't have 5.4 also available).packr build
seems to be for Packr v1 which seems to have disappeared - I'm only able to get Packr v2 packr2
to install, but it seems to work.cd factorio-tools\factoriodump
or cd factorio-tools\factorioload
then go build
or packr2 build
I get this error:C:\git\clones\kirkmcdonald\factorio-tools\factoriodump>packr2 build
github.com/KirkMcDonald/golua/lua: build constraints exclude all Go files in C:\Users\David\go\pkg\mod\github.com\!kirk!mc!donald\[email protected]\lua
Error: exit status 1
(Using --verbose
doesn't show any relevant extra details, unfortunately).
None of the .go
files in C:\Users\David\go\pkg\mod\github.com\!kirk!mc!donald\[email protected]\lua
have build-constraint comments in them, so I'm unsure where that's coming from.
(running go clean -modcache
didn't solve the problem: any attempt to build will fail with the same build-constraints error as above)
Your calculator is amazing for vanilla, so thank you.
I'm interested in running factoriocalc
locally so I can have it calculate the rates for recipes in some of the mods I use.
I'm running Factorio 0.17 on Linux, using the standalone installation. I have Factorio installed at /run/media/seonwoo/Steam/Factorio-Linux
(despite the path, I don't actually have Factorio installed through Steam on Linux) and I have my mods directory at /mnt/veracrypt2/Factorio/mods
. When I run
go run main.go -gamedir /run/media/seonwoo/Steam/Factorio-Linux/ -moddir /mnt/veracrypt2/Factorio/mods/ -verbose
I get the nil value attempted error.
I've narrowed it down to this line:
factorio-tools/factorioload/load.go
Line 228 in a22a0b3
I've never used Lua so I have no idea what L.Call
is meant to do.
Does this have anything to do with the fact that FactorioLoaderLib doesn't work with packed mods? What exactly do you mean by "packed" mods - mods that have been compiled and don't provide source code? (I should preface this with I have no experience with creating mods in Factorio).
I tried to generate a recipe table for vanilla factorio 1.1 before adding several mods to be calculated, but factoriodump crashed.
It choked on a requires clause within the vanilla prototypes yielding the following error:
> ./factoriodump --calcdir=../factorio-web-calc/ --gamedir=~/Programme/Linux/Steam/steamapps/common/Factorio --prefix=vanilla-1-0 --verbose
...io/data/base/prototypes/entity/spidertron-animations.lua:521: module '__base__/prototypes/entity/spidertron-light-positions' not found:
no field package.preload['__base__/prototypes/entity/spidertron-light-positions']could not find ../FactorioLoaderLib/__base__/prototypes/entity/spidertron-light-positions.lua
no file '~/Programme/Linux/Steam/steamapps/common/Factorio/data/base/__base__/prototypes/entity/spidertron-light-positions.lua'
no file '~/Programme/Linux/Steam/steamapps/common/Factorio/data/core/lualib/__base__/prototypes/entity/spidertron-light-positions.lua'
no file '/usr/local/share/lua/5.3/__base__/prototypes/entity/spidertron-light-positions.lua'
no file '/usr/local/share/lua/5.3/__base__/prototypes/entity/spidertron-light-positions/init.lua'
no file '/usr/local/lib/lua/5.3/__base__/prototypes/entity/spidertron-light-positions.lua'
no file '/usr/local/lib/lua/5.3/__base__/prototypes/entity/spidertron-light-positions/init.lua'
no file '/usr/share/lua/5.3/__base__/prototypes/entity/spidertron-light-positions.lua'
no file '/usr/share/lua/5.3/__base__/prototypes/entity/spidertron-light-positions/init.lua'
no file './__base__/prototypes/entity/spidertron-light-positions.lua'
no file './__base__/prototypes/entity/spidertron-light-positions/init.lua'
no file '/usr/local/lib/lua/5.3/__base__/prototypes/entity/spidertron-light-positions.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.3/__base__/prototypes/entity/spidertron-light-positions.so'
no file '/usr/lib/lua/5.3/__base__/prototypes/entity/spidertron-light-positions.so'
no file '/usr/local/lib/lua/5.3/loadall.so'
no file './__base__/prototypes/entity/spidertron-light-positions.so'
The line in question is in base/prototypes/entity/spidertron-animations.lua, however the same problem also occurs in other places if I edit out the __base__/
in this line.
light_positions = require("__base__/prototypes/entity/spidertron-light-positions"),
It seems that __base__
is not being replaced/removed before searching for the file.
Since the webversion can handle 1.1 just fine, I guess either I'm doing something wrong or this repository hasn't been updated. I'd love to get this fixed soon :) Thank you for all your work!
I tried to running factoriocalc 0.3 on factorio 0.18 but I unfortunately get a crash. I am using the windows build 0.3.
I have tried running it with 0.17 and it does work there. Would you be able to add support for 0.18?
I know the recipes havn't changed in 0.18 but I would like to use it with a mod.
I used this for Bob's Pack, trying to get ratios for making Electronic Circuits.
However the calculator only lets you select which Assembly Machine is preferred, but not which Electronic Assembly Machine. Which means it defaulted to the Tech 3 variant.
Is there a way to set this to a lower level?
I really love your calculator! I've just discovered the offline version which imports local mod data and would like to use it.
If I do, I see error messages like:
[string "bobassembly_0.17.2/prototypes/assembly-electr..."]:1: attempt to index a nil value (field 'startup')
or
[string "BigDrills_0.5.4/prototypes/tech/tech.lua"]:47: attempt to call a nil value (global 'unpack')
The relevant lua code from said mods looks like this:
if settings.startup["bobmods-assembly-electronicmachines"].value == true then
and
prerequisites = {"logistics-2", "bucket-wheel-excavator", "advanced-material-processing-2", unpack(preMK2 or {})},
If I start the calculator with an empty mod dir everything works fine. As do most mods, except those that reference settings.startup or try to call unpack.
Factorio version: 0.17.28
Calculator version: 0.3 binary for windows
Mods causing error messages: bobassembly_0.17.2.zip, BigDrills_0.5.4.zip
Is there anything I can do to fix this issue on my end?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.