Page 1 of 1

Could I get help to fix a mod for personal use?

Posted: Sat Feb 20, 2021 2:36 pm
by kickbackman1277
I'm not sure if this is allowed so my apologies if it isn't im try to get an old mod to work in the current version but I keep getting the following error

Failed to load mods: SingleColorTerrain/data.lua:1: SingleColorTerrain/prototypes/decoratives.lua:2: attempt to index field 'decorative' (a nil value)
stack traceback:
SingleColorTerrain/prototypes/decoratives.lua:2: in main chunk
[C]: in function 'require'
SingleColorTerrain/data.lua:1: in main chunk
stack traceback:
[C]: in function 'require'
SingleColorTerrain/data.lua:1: in main chunk

the mod is: https://mods.factorio.com/mod/SingleColorTerrain

could anyone help/tell me what I have to do to get it working again? thank you

Re: Could I get help to fix a mod for personal use?

Posted: Sat Feb 20, 2021 3:32 pm
by DaveMcW
Delete every line that contains data.raw["decorative"].

The mod is trying to remove them, but they have already been removed from the current version of the game.

Re: Could I get help to fix a mod for personal use?

Posted: Sat Feb 20, 2021 4:16 pm
by kickbackman1277
thank you very much :D

Re: Could I get help to fix a mod for personal use?

Posted: Tue Mar 02, 2021 12:30 am
by jamiechi1
Just for fun I played around with this.

change data.lua:

Code: Select all

--require("prototypes.decoratives")
require("prototypes.entity")
add control.lua:

Code: Select all

function remove_decoratives()
  game.surfaces[1].destroy_decoratives{}
end

script.on_init(remove_decoratives)
In entity.lua add:
data.raw["tile"]["stuff"].decorative_removal_probability = 1 -- where stuff = dry-dirt,dirt-1,dirt-2, etc.
after each data.raw ... code as shown:

Code: Select all

  data.raw["tile"]["dry-dirt"].variants = tile_variations_template(
      "__SingleColorTerrain__/graphics/white.png", "__base__/graphics/terrain/masks/transition-3.png",
      "__SingleColorTerrain__/graphics/hr-white.png", "__base__/graphics/terrain/masks/hr-transition-3.png",
      {
        max_size = 4,
        [1] = { weights = {0.085, 0.085, 0.085, 0.085, 0.087, 0.085, 0.065, 0.085, 0.045, 0.045, 0.045, 0.045, 0.005, 0.025, 0.045, 0.045 } },
        [2] = { probability = 0.91, weights = {0.150, 0.150, 0.150, 0.150, 0.018, 0.020, 0.015, 0.025, 0.015, 0.020, 0.025, 0.015, 0.025, 0.025, 0.010, 0.025 }, },
        [4] = { probability = 0.91, weights = {0.100, 0.80, 0.80, 0.100, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01 }, },
        --[8] = { probability = 1.00, weights = {0.090, 0.125, 0.125, 0.125, 0.125, 0.125, 0.125, 0.025, 0.125, 0.005, 0.010, 0.100, 0.100, 0.010, 0.020, 0.020} },
      }
    )
  data.raw["tile"]["dry-dirt"].decorative_removal_probability = 1
This will insure you don't get decoratives back when you make new dirt to fill a water area.

It would be best for you to wrap all this up in a 'for loop' to shrink this file immensely and to make it easier to fix if you have issues. I'll leave that up to you as a coding exercise.

Also I only fixed the White stuff; and I tested this on a new game (Factorio_1.1.24) and an existing test save I had with only this mod enabled.
Maybe when I have more time I could post the entire mod if that would be helpful to anyone.

And if anyone posts a new version of this please remember to give credit to DellAquilla.
FYI DellAquilla set the license for this mod to Unlicense (public domain).