Wood Gasification updated

by yokmp

**Too much wood? Not enough oil? Turn surplus wood into petroleum gas, solid fuel and crude oil instead of letting it pile up.** Updated Wood Gasification from cappie https://mods.factorio.com/mod/Wood_Gasification And included the K2 Greenhouse https://mods.factorio.com/mod/Krastorio2greenhouse None of these mods are mine, i just modified them to work with 2.0 / 2.1

Content
2 months ago
2.0 - 2.1
13.4K
Fluids Manufacturing

b Crash w/o Space Age

2 years ago
(updated 2 years ago)

Hi, just wanted to let you know that the mod crashes the game due to invalid references when the Space Age DLC is not installed. I ended up making a fix for myself, while also changing tech and tidying up a bit. Would you like a copy? I have uploaded it to my Google Drive:

https://drive.google.com/file/d/1DsoQo4AGf06z49h2aKbIFG5Xwt2CmDnq/view?usp=sharing

Mind you, I don't know whether it works with the DLC installed.

2 years ago

I discovered the same issue yesterday and ill look into it

2 years ago

All right!

2 years ago
(updated 2 years ago)

Game still crash with the newest fix from 15h ago :(

Err.-Msg.:
Wood_Gasification_updated /prototypes/space-age.lua:120: attempt to index field 'minable' (a nil value)
stack traceback:
Wood_Gasification_updated /prototypes/space-age.lua:120: in main chunk
[C]: in function 'require'
Wood_Gasification_updated /data.lua:6: in main chunk

2 years ago
(updated 2 years ago)

Thanks for the update, the mod seems to work fine now! As for the problem reported above, my non-expert guess is, that a nil check must be made for the entire address, since the minable or result property below it could be removed by another mod (they are both optional properties according to docs).

A standard function I like to use (for the sake of compactness), is this:

function address_exists(t, ...)
  for i = 1, select("#", ...) do
    if t == nil then return false end
    t = t[select(i, ...)]
  end
  return true
end

An implementation would then look like this:

local t = data.raw.tree
  for _, value in pairs(t) do
    if address_exists(minable, "result") and value.minable.result == "wood" then
      [code]
    end
  end
end

Which should at least prevent a crash. Pardon the unsolicited advice, just really wanted to share! The function is very useful for deep tables. [Edit: Fixed code and explanation above]

2 years ago

Neat.
I hope i've fixed it in 4.1.3

2 years ago

Aight!👍

2 years ago

Thanks for the realy fast support! it works for now - happy to use the mod again ^^

2 years ago

For now? Ouch ... ^^

New response