CodeLenny / factorio-recipe-extraction

Extracts recipes from Factorio, including recipes added from mods.
https://codelenny.github.io/factorio-recipe-extraction/
7 stars 1 forks source link

Errors in combination with Bob's and Angel's mods #12

Open marandus opened 6 years ago

marandus commented 6 years ago

As mentioned before, I ran into issued when I tried to extract game data with Bob's and Angel's mods installed. There seem to be some internal lua objects that your are not present while your tools runs and thus mod data cannot be loaded properly. Logs below.

The ~/Applications/factorio-recipe-extraction/factorio folder is a full merge of both ~/Games/Steam/steamapps/common/Factorio (which is the installation directory) and ~/.factorio (which is the user-specific data directory), so all data should be available.

$ $(npm bin)/factorio-extractor --output /tmp/factorio.json --data ~/Applications/factorio-recipe-extraction/factorio
Running data.lua
Running data-updates.lua
Running data-final-fixes.lua
Exception Of Lua Code Has Failed:
...Cx5w/bobenemies_0.15.2/prototypes/alien-artifact.lua:1: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "if not bobmods then bobmods = {} end..."]:23: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "if not bobmods then bobmods = {} end..."]:5: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...binserters_0.15.1/prototypes/technology-inserter.lua:32: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...bassembly_0.15.7/prototypes/assembly-electronics.lua:1: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "--INITIALIZE..."]:7: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...P1ZOD/boblogistics_0.15.6/prototypes/robot-parts.lua:1: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "--INITIALIZE..."]:9: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "if not bobmods then bobmods = {} end..."]:9: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "if not bobmods then bobmods = {} end..."]:5: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...62Cu20rpYIDGx/bobmining_0.15.2/prototypes/drills.lua:1: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "--INITIALIZE..."]:15: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "if not angelsmods then angelsmods = {} end..."]:6: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "if not angelsmods then angelsmods = {} end..."]:6: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "if settings.startup["bobmods-enemies-aliens..."]:1: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...nLfyxQuc/boblibrary_0.15.10/technology-functions.lua:44: attempt to concatenate global 'new' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "for i, ore in pairs(bobmods.ores) do..."]:70: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...NgIehwQdgZ/bobplates_0.15.12/prototypes/overides.lua:1: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...y_0.15.7/prototypes/assembly-electronics-updates.lua:1: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...fining_0.8.1/prototypes/recipe-builder-fallbacks.lua:3: attempt to index field 'functions' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...0.15.6/prototypes/recipe/roboport-recipe-updates.lua:1: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "require("prototypes.recipe-updates")..."]:10: attempt to index field 'carbon' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...elspetrochem_0.6.1/prototypes/petrochem-generate.lua:3: attempt to index field 'functions' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...NgIehwQdgZ/bobplates_0.15.12/prototypes/overides.lua:1: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "require("prototypes.recipe-updates")..."]:6: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...nLfyxQuc/boblibrary_0.15.10/technology-functions.lua:44: attempt to concatenate global 'new' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...s_0.15.4/prototypes/recipe/module-merged-updates.lua:1: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...pYIDGx/bobmining_0.15.2/prototypes/drill-updates.lua:1: attempt to index global 'settings' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...A1WTLS5f/bobgreenhouse_0.15.2/prototypes/updates.lua:9: attempt to index field 'bob-greenhouse-items' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...cessing_0.4.1/prototypes/bio-processing-override.lua:1: attempt to index field 'functions' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "if angelsmods and angelsmods.refining then..."]:5: attempt to index field 'angels-warehouses' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
[string "if angelsmods and angelsmods.refining then..."]:2: attempt to index field 'functions' (a nil value)

Continuing.
Exception Of Lua Code Has Failed:
...ochem_0.6.1/prototypes/petrochem-global-override.lua:1: attempt to index field 'functions' (a nil value)

Continuing.
Ignorning 33 Lua errors.
Extracted Factorio data.
marandus commented 6 years ago

Oh, just realized I did not attach my mod-list.json. Here you go:

{
  "mods": [
    {
      "name": "base",
      "enabled": true
    },
    {
      "name": "angelsaddons-locales",
      "enabled": true
    },
    {
      "name": "angelsaddons-oresilos",
      "enabled": true
    },
    {
      "name": "angelsaddons-petrotrain",
      "enabled": true
    },
    {
      "name": "angelsaddons-pressuretanks",
      "enabled": true
    },
    {
      "name": "angelsaddons-warehouses",
      "enabled": true
    },
    {
      "name": "angelsbioprocessing",
      "enabled": true
    },
    {
      "name": "angelsinfiniteores",
      "enabled": true
    },
    {
      "name": "angelspetrochem",
      "enabled": true
    },
    {
      "name": "angelsrefining",
      "enabled": true
    },
    {
      "name": "bobassembly",
      "enabled": true
    },
    {
      "name": "bobelectronics",
      "enabled": true
    },
    {
      "name": "bobenemies",
      "enabled": true
    },
    {
      "name": "bobgreenhouse",
      "enabled": true
    },
    {
      "name": "bobinserters",
      "enabled": true
    },
    {
      "name": "boblibrary",
      "enabled": true
    },
    {
      "name": "boblogistics",
      "enabled": true
    },
    {
      "name": "bobmining",
      "enabled": true
    },
    {
      "name": "bobmodules",
      "enabled": true
    },
    {
      "name": "bobores",
      "enabled": true
    },
    {
      "name": "bobplates",
      "enabled": true
    },
    {
      "name": "bobpower",
      "enabled": true
    },
    {
      "name": "bobrevamp",
      "enabled": true
    },
    {
      "name": "bobtech",
      "enabled": true
    },
    {
      "name": "bobvehicleequipment",
      "enabled": true
    },
    {
      "name": "bobwarfare",
      "enabled": true
    },
    {
      "name": "EvoGUI",
      "enabled": true
    },
    {
      "name": "RailTanker",
      "enabled": true
    }
  ]
}

And mod-setting.json, maybe useful as well:

{
  "startup": {
    "angels-enable-icon-scaling-silos": {
      "value": true
    },
    "angels-enable-icon-scaling-warehouses": {
      "value": true
    },
    "angels-infinite-ores-yield": {
      "value": 20
    },
    "angels-oil-gas-yield": {
      "value": 20
    },
    "angels-fissure-yield": {
      "value": 20
    },
    "angels-lower-infinite-yield": {
      "value": 1
    },
    "angels-enablefluidreq": {
      "value": true
    },
    "angels-enableinfiniteiron": {
      "value": true
    },
    "angels-enableinfinitecopper": {
      "value": true
    },
    "angels-enableinfinitestone": {
      "value": true
    },
    "angels-enableinfinitecoal": {
      "value": true
    },
    "angels-enableinfiniteuranium": {
      "value": true
    },
    "angels-enableinfiniteangelsore1": {
      "value": true
    },
    "angels-enableinfiniteangelsore2": {
      "value": true
    },
    "angels-enableinfiniteangelsore3": {
      "value": true
    },
    "angels-enableinfiniteangelsore4": {
      "value": true
    },
    "angels-enableinfiniteangelsore5": {
      "value": true
    },
    "angels-enableinfiniteangelsore6": {
      "value": true
    },
    "angels-enableinfinitebobbauxite": {
      "value": true
    },
    "angels-enableinfinitebobcobalt": {
      "value": true
    },
    "angels-enableinfinitebobgems": {
      "value": true
    },
    "angels-enableinfinitebobgold": {
      "value": true
    },
    "angels-enableinfiniteboblead": {
      "value": true
    },
    "angels-enableinfinitebobnickel": {
      "value": true
    },
    "angels-enableinfinitebobquartz": {
      "value": true
    },
    "angels-enableinfinitebobrutile": {
      "value": true
    },
    "angels-enableinfinitebobsilver": {
      "value": true
    },
    "angels-enableinfinitebobsulfur": {
      "value": true
    },
    "angels-enableinfinitebobtin": {
      "value": true
    },
    "angels-enableinfinitebobtungsten": {
      "value": true
    },
    "angels-enableinfinitebobzinc": {
      "value": true
    },
    "angels-enableinfiniteyuoki": {
      "value": true
    },
    "angels-enableinfiniteuraniumpower": {
      "value": true
    },
    "angels-enableinfinitedarkmatter": {
      "value": true
    },
    "angels-enable-converter": {
      "value": true
    },
    "angels-hide-converter": {
      "value": true
    },
    "angels-enable-acids": {
      "value": true
    },
    "angels-enable-auto-barreling": {
      "value": false
    },
    "angels-marathon-buildingmulti": {
      "value": 2
    },
    "angels-marathon-buildingtime": {
      "value": 2
    },
    "angels-marathon-intermediatemulti": {
      "value": 1
    },
    "angels-marathon-rawmulti": {
      "value": 1
    },
    "bobmods-assembly-chemicalplants": {
      "value": true
    },
    "bobmods-assembly-electrolysers": {
      "value": true
    },
    "bobmods-assembly-electronicmachines": {
      "value": true
    },
    "bobmods-assembly-furnaces": {
      "value": true
    },
    "bobmods-assembly-multipurposefurnaces": {
      "value": true
    },
    "bobmods-assembly-oilrefineries": {
      "value": true
    },
    "bobmods-enemies-aliensdropartifacts": {
      "value": true
    },
    "bobmods-enemies-enableartifacts": {
      "value": true
    },
    "bobmods-enemies-enablenewartifacts": {
      "value": true
    },
    "bobmods-enemies-enablesmallartifacts": {
      "value": true
    },
    "bobmods-inserters-long2": {
      "value": true
    },
    "bobmods-inserters-more2": {
      "value": true
    },
    "bobmods-logistics-drainlessinserters": {
      "value": false
    },
    "bobmods-logistics-extremelyfastbelt": {
      "value": true
    },
    "bobmods-logistics-flyingrobotframes": {
      "value": true
    },
    "bobmods-logistics-roboportrecipeupdate": {
      "value": true
    },
    "bobmods-logistics-robotparts": {
      "value": true
    },
    "bobmods-logistics-robotrequireprevious": {
      "value": true
    },
    "bobmods-mining-areadrills": {
      "value": true
    },
    "bobmods-mining-miningaxes": {
      "value": true
    },
    "bobmods-mining-miningdrills": {
      "value": true
    },
    "bobmods-mining-pumpjacks": {
      "value": true
    },
    "bobmods-mining-waterminers": {
      "value": true
    },
    "bobmods-modules-enablegodmodules": {
      "value": false
    },
    "bobmods-modules-enablegreenmodules": {
      "value": true
    },
    "bobmods-modules-enableproductivitylimitation": {
      "value": true
    },
    "bobmods-modules-enablerawproductivitymodules": {
      "value": true
    },
    "bobmods-modules-enablerawspeedmodules": {
      "value": true
    },
    "bobmods-modules-perlevel-bonus-consumption": {
      "value": 0.1
    },
    "bobmods-modules-perlevel-bonus-pollution": {
      "value": 0.15
    },
    "bobmods-modules-perlevel-bonus-pollutioncreate": {
      "value": 0.5
    },
    "bobmods-modules-perlevel-bonus-productivity": {
      "value": 0.05
    },
    "bobmods-modules-perlevel-bonus-speed": {
      "value": 0.2
    },
    "bobmods-modules-perlevel-penalty-consumption": {
      "value": 0.1
    },
    "bobmods-modules-perlevel-penalty-pollution": {
      "value": 0.15
    },
    "bobmods-modules-perlevel-penalty-speed": {
      "value": 0.05
    },
    "bobmods-modules-productivityhasspeed": {
      "value": false
    },
    "bobmods-modules-start-bonus-consumption": {
      "value": 0
    },
    "bobmods-modules-start-bonus-pollution": {
      "value": 0
    },
    "bobmods-modules-start-bonus-pollutioncreate": {
      "value": 0
    },
    "bobmods-modules-start-bonus-productivity": {
      "value": 0
    },
    "bobmods-modules-start-bonus-speed": {
      "value": 0
    },
    "bobmods-modules-start-penalty-consumption": {
      "value": 0
    },
    "bobmods-modules-start-penalty-pollution": {
      "value": 0
    },
    "bobmods-modules-start-penalty-speed": {
      "value": 0.2
    },
    "bobmods-modules-transmitproductivity": {
      "value": false
    },
    "bobmods-gems-amethystratio": {
      "value": 0.5
    },
    "bobmods-gems-diamondratio": {
      "value": 0.2
    },
    "bobmods-gems-emeraldratio": {
      "value": 0.6
    },
    "bobmods-gems-rubyratio": {
      "value": 1
    },
    "bobmods-gems-sapphireratio": {
      "value": 0.8
    },
    "bobmods-gems-topazratio": {
      "value": 0.4
    },
    "bobmods-ores-enablebauxite": {
      "value": true
    },
    "bobmods-ores-enablecobaltore": {
      "value": true
    },
    "bobmods-ores-enablegemsore": {
      "value": true
    },
    "bobmods-ores-enablegoldore": {
      "value": true
    },
    "bobmods-ores-enableleadore": {
      "value": true
    },
    "bobmods-ores-enablenickelore": {
      "value": true
    },
    "bobmods-ores-enablequartz": {
      "value": true
    },
    "bobmods-ores-enablerutile": {
      "value": true
    },
    "bobmods-ores-enablesilverore": {
      "value": true
    },
    "bobmods-ores-enablesulfur": {
      "value": true
    },
    "bobmods-ores-enablethoriumore": {
      "value": true
    },
    "bobmods-ores-enabletinore": {
      "value": true
    },
    "bobmods-ores-enabletungstenore": {
      "value": true
    },
    "bobmods-ores-enablewaterores": {
      "value": true
    },
    "bobmods-ores-enablezincore": {
      "value": true
    },
    "bobmods-ores-enhancestone": {
      "value": true
    },
    "bobmods-ores-gemprobability": {
      "value": 0.05
    },
    "bobmods-ores-gemsfromotherores": {
      "value": false
    },
    "bobmods-ores-infiniteore": {
      "value": false
    },
    "bobmods-ores-leadgivesnickel": {
      "value": true
    },
    "bobmods-ores-leadnickelratio": {
      "value": 0.6
    },
    "bobmods-ores-nickelcobaltratio": {
      "value": 0.4
    },
    "bobmods-ores-nickelgivescobalt": {
      "value": true
    },
    "bobmods-ores-unsortedgemore": {
      "value": true
    },
    "bobmods-plates-batteryupdate": {
      "value": true
    },
    "bobmods-plates-cheapersteel": {
      "value": true
    },
    "bobmods-plates-groundwater": {
      "value": true
    },
    "bobmods-plates-inventorysize": {
      "value": 60
    },
    "bobmods-plates-oreoverride": {
      "value": true
    },
    "bobmods-plates-purewater": {
      "value": true
    },
    "bobmods-plates-vanillabarrelling": {
      "value": false
    },
    "bobmods-vehicleequipment-enablevehiclegrids": {
      "value": true
    },
    "bobmods-warfare-drainlesslaserturrets": {
      "value": false
    },
    "bobmods-warfare-robotupdate": {
      "value": true
    }
  },
  "runtime-global": {},
  "runtime-per-user": {}
}
CodeLenny commented 6 years ago

I'm assuming the output was corrupted or missing items as well? The extractor complains about any error thrown by the lua code, but then skips the broken file and continues.

The official tests for the extractor actually have an error message or two printed - I think 5dim's looks for Bob's mods to merge their results, and complains when it can't find it, but the output still (probably) works.

I'm guessing that a bunch of mods were completely skipped by the number of errors, but just wanted to check.

I just realized this might be an issue with Factorio v0.15 - I think that 15 added mod settings, which is probably what Bob's is complaining about for the majority of the errors.

I'd also wager a guess that the other half of the errors are depending on content from the first Bob's files - e.g:

bob_lib.psudocode
require settings;
export bobFunctions;

Which would throw an error about not finding "settings'.

bobs_weapons.psudocode
require bobFunctions;
export bobShooter;

Which would throw an error about not finding "functions"

I'm not certain that the mod settings are to blame for everything, but I'd first tackle implementing settings.

This program was based off of Foreman, which still doesn't have support for 0.15 published.
However, it does appear that there are some changes that implement settings.

It looks like it would take a moderate amount of changes to get settings implemented.
@marandus any chance you'd want to take a wack at them? Otherwise I'll try to get to them in the near future.

marandus commented 6 years ago

The output is intact, but a lot of stuff is missing. Thus it is of no use at all.

The Foreman project seems to be pretty dead, last commit is from 2016 and last activity on PRs was from August 2017 and was not even from the project maintainer. The 0.15 fixes were not commented by him at all.

If you want you can try your luck poking him, but I fear that project is dead. I have no idea how all that lua stuff works, so I will be of little help here.

CodeLenny commented 6 years ago

I expected the output would lack too much, but it never hurts to make sure!

Yep, Foreman doesn't seem to be that alive, but I've been seeing if I can just copy the 0.15 PR changes into the Extractor (and have things work) as I don't have the time to actually figure out the Factorio changes (and I'm no Lua expert).

I guess I'll try to copy over the changes in the 0.15 PR sometime soon, but this is a pretty busy week for me. Definitely poke me on Tuesday if you don't hear anything before then!

Sidenote (I'm just curious), what are you intending to use the Extractor for?

marandus commented 6 years ago

Sounds good.

My intent is making the huge amount of recipes that Angel's and Bob's add somehow searchable and maybe later create some up-to-date flowcharts and such from the data. Most graphs you find online are pretty old and outdated or simple that huge that you cannot find a single thing in there. And the in-game GUI is just really, really bad at managing these many recipes, it's hard to find anything in there. Especially because you see the names of the ingredients, but not those of the products. Most recipes from Angel's output two or three different items and they are sometimes really hard to distinguish in-game.

Thus I try to make it a little easier for me and my friends playing together with me, but for that I need up-to-date data. I found a lua script that extracts recipes only, but without the info where to build what the data is only half as useful as it sounds. Your extractor also reads that info (beside a lot other stuff, as far as I can see), so it would be perfect for my use-case.

CodeLenny commented 6 years ago

Sounds like a plan! That's sorta what I was planning to make with the Extractor as well, I wanted to build little "factory units" to assemble a portion of Angel's + Bob's (e.g. an ore processing sub-factory, electronics sub-factory, etc.), and create a tool that would suggest adding additional recipes to the sub-factories where they would be most efficient.

marandus commented 6 years ago

Poke! Any progress on the enhancement?

CodeLenny commented 6 years ago

@marandus Oops! Thanks for the poke, I'll see what I can do!

CodeLenny commented 6 years ago

@marandus I've pushed some code to master that implements settings. Before I call this issue done, mind testing it out for me?

marandus commented 6 years ago

Thanks for the update. Will test it in the next days and report any issues.

marandus commented 6 years ago

Ok, I did some testing around and did not get it to run properly. Maybe I am doing something wrong? This is what I did. To prevent any side effects I made a fresh clone of the repository before building.

$ git clone git@github.com:CodeLenny/factorio-recipe-extraction.git
$ cd factorio-recipe-extraction
$ NODELUA_INCLUDE="/usr/include/lua5.1" NODELUA_FLAGS="-llua5.1" npm install
$ node bin/factorio-extractor.js --output /tmp/factorio.json --data ~/Applications/factorio-recipe-extraction/factorio
Unhandled rejection ReferenceError: value is not defined
    at Extractor.readModSettings (/home/username/Sources/factorio-recipe-extraction/Extractor.js:216:50)
    at Promise.resolve.then.then.then.then.then.then (/home/username/Sources/factorio-recipe-extraction/Extractor.js:147:24)
    at tryCatcher (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/promise.js:638:18)
    at /home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/nodeback.js:42:21

$ cd bin/
$ node factorio-extractor.js --output /tmp/factorio.json --data ~/Applications/factorio-recipe-extraction/factorio
Unhandled rejection ReferenceError: value is not defined
    at Extractor.readModSettings (/home/username/Sources/factorio-recipe-extraction/Extractor.js:216:50)
    at Promise.resolve.then.then.then.then.then.then (/home/username/Sources/factorio-recipe-extraction/Extractor.js:147:24)
    at tryCatcher (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/promise.js:638:18)
    at /home/username/Sources/factorio-recipe-extraction/node_modules/bluebird/js/release/nodeback.js:42:21