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
6 months ago
2.0
11.7K
Fluids Manufacturing

b Crash w/o Space Age

9 months ago
(updated 9 months 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.

9 months ago

I discovered the same issue yesterday and ill look into it

9 months ago

All right!

9 months ago
(updated 9 months 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

9 months ago
(updated 9 months 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]

9 months ago

Neat.
I hope i've fixed it in 4.1.3

9 months ago

Aight!👍

9 months ago

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

9 months ago

For now? Ouch ... ^^

New response