Wood Gasification updated

by yokmp

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

Content
10 months ago
2.0
12.1K
Fluids Manufacturing

b Crash w/o Space Age

1 year, 1 month ago
(updated 1 year, 1 month 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.

1 year, 1 month ago

I discovered the same issue yesterday and ill look into it

1 year, 1 month ago

All right!

1 year, 1 month ago
(updated 1 year, 1 month 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

1 year, 1 month ago
(updated 1 year, 1 month 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]

1 year, 1 month ago

Neat.
I hope i've fixed it in 4.1.3

1 year, 1 month ago

Aight!👍

1 year, 1 month ago

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

1 year, 1 month ago

For now? Ouch ... ^^

New response