Page 1 of 2

Mod for new ore (Mod not showing up)

Posted: Wed Nov 23, 2016 8:28 pm
by Grundox
So I wanted to create a mod for a new ore. The ore should not have any special use. These uses will be added sometime later. The following is what I have made so far and I thought I am finished. However it's not working (no errors & no showing up in the mod library). I know the local is missing but thats not a problem right now.
first folder is "grundoxores"
next folder is "graphics" with the folders "entity" with "ores" and "icons" with .png datas each
next folder is "prototypes" with "hämatit.lua":

Code: Select all

data:extend(
{
   {
   type = "autoplace-control",
   name = "hämatit",
   richness = true,
   order = "b-e"
   },
   {
   type = "noise-layer",
   name = "hämatit"
   },
   {
   type = "resource",
   name = "hämatit",
   icon = "__grundoxores__/graphics/icons/hämatit.png",
   flags = {"placeable-neutral"},
   order="a-b-a",
   map_color = {r=0.26, g=0.30, b=0.39},
   minable =
   {
     hardness = 1,
     mining_particle = "hämatit-particle",
     mining_time = 1.5,
     result = "hämatit"
   },
   collision_box = {{ -0.1, -0.1}, {0.1, 0.1}},
   selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
   autoplace =
   {
     control = "hämatit",
     sharpness = 1,
     richness_multiplier = 13000,
     richness_base = 350,
     size_control_multiplier = 0.06,
     peaks = {
      {
        influence = 0.3,
        starting_area_weight_optimal = 0,
        starting_area_weight_range = 0,
        starting_area_weight_max_range = 2,
      },
      {
        influence = 0.55,
        noise_layer = "hämatit",
        noise_octaves_difference = -2.3,
        noise_persistence = 0.4,
        starting_area_weight_optimal = 0,
        starting_area_weight_range = 0,
        starting_area_weight_max_range = 2,
      },
     },
   },
    stage_counts = {1000, 600, 400, 200, 100, 50, 20, 1},
   stages =
   {
     sheet =
     {
      filename = "__grundoxores__/graphics/entity/ores/hämatit-ore.png",
      priority = "extra-high",
        width = 38,
        height = 38,
        frame_count = 4,
        variation_count = 8
     }
   },
  },
{
    type = "item",
    name = "hämatit",
    icon = "__grundoxores__/graphics/icons/hämatit.png",
    flags = {"goes-to-main-inventory"},
   subgroup = "hämatit",
    order = "a[hämatit]",
    stack_size = 200
},
}
)
under "prototypes" is "data.lua":

Code: Select all

require("prototypes.entity")
under "data.lua" is "info.json":

Code: Select all

{
  "name": "grundoxores",
  "version": "0.14.0",
  "factorio_version": "0.14",
  "title": "Grundox' Ores Mod",
  "author": "Grundox",
  "contact": "matthias.puck8@gmail.com",
  "homepage": "",
  "description": "This mod allows you to change the settings of Bob's mods.",
  "dependencies": ["base >= 0.14.0"]
}
So please tell me: what is missing? Why isn't it working?

Re: Mod for new ore

Posted: Thu Nov 24, 2016 2:49 pm
by bobingabout
require("prototypes.entity")
yet you said
folder is "prototypes" with "hämatit.lua"

Change it to:
require("prototypes.hämatit")
That might do it?

data.lua wants to be in the main folder, next to info.json.

Also, the text in info.json looks like it is taken straight out of my mod. You might want to update that.

Re: Mod for new ore

Posted: Thu Nov 24, 2016 5:11 pm
by Grundox
bobingabout wrote:require("prototypes.entity")
yet you said
folder is "prototypes" with "hämatit.lua"

Change it to:
require("prototypes.hämatit")
That might do it?

data.lua wants to be in the main folder, next to info.json.

Also, the text in info.json looks like it is taken straight out of my mod. You might want to update that.
with "under" I meant next to.
Yes I did. I didn't think this would be a problem, because I thought all info.json's should be the same (in a way). I was inspired by your mods so I thought I might kinda like copy some things. But don't worry: I'm not trying to steal your codes or something. I want to make these mods for me and two friends of mine. No one else. If it's still a problem for you, then I will of course change it :)

Re: Mod for new ore

Posted: Thu Nov 24, 2016 5:19 pm
by Grundox
I changed the data.lua as you told me. Still there is no mod showing up.
Can you spot any other mistakes?
Thank you so far though.

Re: Mod for new ore

Posted: Fri Nov 25, 2016 9:47 am
by Mooncat
Your mod folder name should be "grundoxores_0.14.0" instead of just "grundoxores".
But Factorio should complain about this. Are you sure you put the mod folder in the right place?

Re: Mod for new ore

Posted: Fri Nov 25, 2016 3:50 pm
by Grundox
Changing just the name didn't do much. Though I added a control.lua wich didn't seem to do anything as well but when I added the locale I finally got an error:
"Error when loading mod "grundoxores 0.14.0" _grundoxores_/data.lua:1: module prototypes.hämatit not found; no such file _grundoxores_/prototypes/h?matit.lua no such file _grundoxores_/prototypes/h?matit.lua no such file
D:/Steam/steamapps/common/Factorio/data/core/lualib/prototypes/h?matit.lua

Does anyone know what the problem is?

Mod not showing up

Posted: Sat Nov 26, 2016 1:52 pm
by Grundox
Merged with your existing thread, it's basically the same problem and people might find relevant info faster if it's all in one thread --daniel34

I wanted to make a simple mod just with a new ore showing up:
-grundoxores_0.14.0.rar
--grundoxores_0.14.0
---prototypes
----hämatit.lua:

Code: Select all

hämatit =
{
  name = "hämatit",
  tint = {r = 1, g = 0.75, b = 0},
  map_color = {r=0.9, g=0.63, b=0},
  hardness = 0.6,
  mining_time = 2,
  enabled = true,
  icon = "__grundoxores__/graphics/icon/hämatit.png",
  stage_mult = 10,
  item =
  {
    create = true,
    stack_size = 200
  },
  sprite =
  {
    sheet = 2
  },
  autoplace =
  {
    create = true,
    starting_area = true,
    richness = 1,
    size = 1.2
  }
}

data:extend({
-- Item
  {
    type = "item",
    name = "hämatit-plate",
    icon = "__grundoxores__/graphics/icon/hämatit.png",
    flags = {"goes-to-main-inventory"},
    subgroup = "plates-plates",
    order = "ag",
    stack_size = 200
  },

--Recipe
  {
    type = "recipe",
    name = "hämatit-plate",
    category = "smelting",
    energy_required = 7,
    ingredients = {{ "hämatit", 2}},
    result = "hämatit-plate"
  },
})
---locale
----en
-----grundoxores.cfg

Code: Select all

[entity-name]
hämatit=hämatit

[item-name]
hämatit=__ENTITY__hämatit__

[autoplace-control-names]
hämatit=__ENTITY__hämatit__
---graphics
----icons
-----hämatit.png
----entity
-----ores
------hämatit.png
---info.json

Code: Select all

{
  "name": "grundoxores",
  "version": "0.14.0",
  "factorio_version": "0.14",
  "title": "Grundox' Ores Mod",
  "author": "Grundox",
  "contact": "matthias.puck8@gmail.com",
  "homepage": "",
  "description": "This mod adds some ores.",
  "dependencies": ["base >= 0.14.0"]
}
---data.lua

Code: Select all

require("config")
require("prototypes.hämatit")
---config.lua

Code: Select all

--Define if ores is installed
ores = true --Default: True
It looks to me like I am missing the entity or something like me. What's the problem? Please help me or if you want to correct it. Thanks

Re: Mod not showing up

Posted: Sat Nov 26, 2016 2:05 pm
by steinio
First it must be a zip file not a rar.
'You could upload the whole file so we can inspect it.

Greetings steinio

Re: Mod for new ore (Mod not showing up)

Posted: Sat Nov 26, 2016 2:27 pm
by daniel34
Grundox wrote:Changing just the name didn't do much. Though I added a control.lua wich didn't seem to do anything as well but when I added the locale I finally got an error:
"Error when loading mod "grundoxores 0.14.0" _grundoxores_/data.lua:1: module prototypes.hämatit not found; no such file _grundoxores_/prototypes/h?matit.lua no such file _grundoxores_/prototypes/h?matit.lua no such file
D:/Steam/steamapps/common/Factorio/data/core/lualib/prototypes/h?matit.lua

Does anyone know what the problem is?
Based on the error message my guess is that the ä-umlaut is causing the problem. It looks for hämatit but this gets somehow translated to h?matit.
Changing the filename and require()-statement to haematit (maybe other instances/occurrences too) might fix that.

http://www.lua.org/manual/5.0/manual.html#2.1
Identifiers in Lua can be any string of letters, digits, and underscores, not beginning with a digit. (The definition of letter depends on the current locale: any character considered alphabetic by the current locale can be used in an identifier.)
This might also (at least partially) apply to filenames used with require(), therefore prototypes.hämatit might not be valid depending on the locale the Factorio Lua interpreter uses.

As steinio mentioned, if this doesn't help then upload your mod file so we can inspect it ourselves.

Re: Mod for new ore (Mod not showing up)

Posted: Sat Nov 26, 2016 3:24 pm
by Grundox
So now I changed the folder from rar to zip and I got a different error. Then I changed every "ä" to "ae" and got this error: http://img5.fotos-hochladen.net/uploads ... awr1j2.png
As you told me, I uploaded the zip as well http://cloud.directupload.net/4T76 (no viruses included) ;)

Re: Mod for new ore (Mod not showing up)

Posted: Sat Nov 26, 2016 3:54 pm
by daniel34
Your config file was named configl.lua (I removed the extra l) and your haematit.lua was encoded as UTF-8 instead of ANSI, you get the error 'unexpected symbol near char(239)' when that happens. If you're using Notepad++ then simply go to Format (Kodierung) and select ANSI.

I played around with your code a little bit and got it to run using the following haematit.lua. The mod is listed under mods and the ore shows up on the game creation screen but it doesn't actually spawn, no idea why (probably forgot something or made a mistake as I never made a mod that spawns a new ore):

Code: Select all

data:extend({
	{
	  name = "haematit",
	  type = "autoplace-control",
	  tint = {r = 1, g = 0.75, b = 0},
	  map_color = {r=0.9, g=0.63, b=0},
	  hardness = 0.6,
	  mining_time = 2,
	  enabled = true,
	  icon = "__grundoxores__/graphics/icons/haematit.png",
	  stage_mult = 10,
	  item =
	  {
		create = true,
		stack_size = 200
	  },
	  sprite =
	  {
		sheet = 2
	  },
	  autoplace =
	  {
		create = true,
		starting_area = true,
		richness = 1,
		size = 1.2
	  }
	},

-- Item
  {
	type = "item",
    name = "haematit",
    icon = "__grundoxores__/graphics/entity/ores/haematit.png",
    flags = {"goes-to-main-inventory"},
    subgroup = "raw-resource",
    order = "haematit",
    stack_size = 50
  },

  {
    type = "item",
    name = "haematit-plate",
    icon = "__grundoxores__/graphics/icons/haematit.png",
    flags = {"goes-to-main-inventory"},
    subgroup = "raw-material",
    order = "ag",
    stack_size = 200
  },

--Recipe
  {
    type = "recipe",
    name = "haematit-plate",
    category = "smelting",
    energy_required = 7,
    ingredients = {{ "haematit", 2}},
    result = "haematit-plate"
  },
})
I'm also not sure how an autoplace-control has to be defined, but both the vanilla game and bob's use it for ore generation and I hope some fellow modder can help you out there.

Re: Mod for new ore (Mod not showing up)

Posted: Sat Nov 26, 2016 11:46 pm
by Grundox
Wow thanks a lot daniel34 that helped a ton!
I compared haematit.lu with some of the bobs ores and ther wasn't a lot different so I deleted the "type = "autoplace-control", " since bob doesn't have it but I got a big error so I changed it back.
Also I saw the items in the recipe which is a big progress.
I probably should also change the .png s because they look very weird. Did Factorio cut the images off?
You can not change the amount of the ore in the starting menu of a new game. I'd say that could be the problem maybe?
There is the link again: http://cloud.directupload.net/4T7g and hopefully we can get this mod to work.

Re: Mod for new ore (Mod not showing up)

Posted: Sun Nov 27, 2016 3:22 am
by Nexela
Grundox wrote:Wow thanks a lot daniel34 that helped a ton!
I compared haematit.lu with some of the bobs ores and ther wasn't a lot different so I deleted the "type = "autoplace-control", " since bob doesn't have it but I got a big error so I changed it back.
Also I saw the items in the recipe which is a big progress.
I probably should also change the .png s because they look very weird. Did Factorio cut the images off?
You can not change the amount of the ore in the starting menu of a new game. I'd say that could be the problem maybe?
There is the link again: http://cloud.directupload.net/4T7g and hopefully we can get this mod to work.
Bob does a lot of stuff through his library functions.

for i, ore in pairs(bobmods.ores) do
bobmods.lib.resource.generate_data_stage(ore)
end

That makes a call to his library mod which sets up and fills in the autoplace controls and various other things.


If your mod depends on bobsmod then feel free to use his library calls in your code. Otherwise reading through the base game prototypes for something like copper will give you an idea on what all is needed to create new ores.

Re: Mod for new ore (Mod not showing up)

Posted: Sun Nov 27, 2016 11:53 am
by Arch666Angel
To create an ore you need:
-the noise layer (tells the engine where to put it)
-the autoplace control (enables the world generation menu entry and also modifies the noise layer according to your settings)
-the resource entity (defines autoplace for the specific entity see above and things like hardness, mining time and output)
-the item/ore the field produces

Here is an example block from my ores

Code: Select all

data:extend(
{
	{
	type = "autoplace-control",
	name = "angels-ore1",
	richness = true,
	order = "b-e"
	},
	{
	type = "noise-layer",
	name = "angels-ore1"
	},
	{
	type = "resource",
	name = "angels-ore1",
	icon = "__angelsinfiniteores__/graphics/icons/angels-ore1.png",
	flags = {"placeable-neutral"},
	order="a-b-a",
--	map_color = {r=0.21, g=0.25, b=0.34},
	map_color = {r=0.26, g=0.30, b=0.39},
	minable =
	{
	  hardness = 1,
	  mining_particle = "angels-ore1-particle",
	  mining_time = 1.5,
	  result = "angels-ore1"
	},
	collision_box = {{ -0.1, -0.1}, {0.1, 0.1}},
	selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
	autoplace =
	{
		control = "angels-ore1",
		sharpness = 1,
		richness_multiplier = 5000,
		richness_multiplier_distance_bonus = 20,
		richness_base = 2000,
		coverage = 0.02,
		peaks = {
			{
				noise_layer = "angels-ore1",
				noise_octaves_difference = -1.5,
				noise_persistence = 0.3,
				starting_area_weight_optimal = 0,
				starting_area_weight_range = 0,
				starting_area_weight_max_range = 2,
			},
			{
				noise_layer = "angels-ore1",
				noise_octaves_difference = -2,
				noise_persistence = 0.3,
				starting_area_weight_optimal = 1,
				starting_area_weight_range = 0,
				starting_area_weight_max_range = 2,
			},
			{
				influence = 0.15,
				starting_area_weight_optimal = 1,
				starting_area_weight_range = 0,
				starting_area_weight_max_range = 2,
			}
		}
	},
    stage_counts = {1000, 600, 400, 200, 100, 50, 20, 1},
	stages =
	{
	  sheet =
	  {
		filename = "__angelsinfiniteores__/graphics/entity/ores/ore-6.png",
		priority = "extra-high",
		tint = {r=0.26, g=0.30, b=0.39},
        width = 38,
        height = 38,
        frame_count = 4,
        variation_count = 8
	  }
	},
  },
}
)

Re: Mod for new ore (Mod not showing up)

Posted: Mon Nov 28, 2016 10:18 am
by bobingabout
Yeah, as mentioned... unless you're planning to use my library, my mod is probably a bad example, because I do a lot of things my own way, and my functions will convert my Jargon into code the game understand.

Re: Mod for new ore (Mod not showing up)

Posted: Tue Nov 29, 2016 6:37 pm
by Grundox
I tired out your code, angel, and put in particles in graphics -> entity -> ores-particle and got that http://www.fotos-hochladen.net/uploads/ ... f0qz96.png

Re: Mod for new ore (Mod not showing up)

Posted: Tue Nov 29, 2016 7:07 pm
by Arch666Angel
Grundox wrote:I tired out your code, angel, and put in particles in graphics -> entity -> ores-particle and got that http://www.fotos-hochladen.net/uploads/ ... f0qz96.png
You need to define particles for the Hämatit, or just use one of the already defined ones for example copper-ore-particle.

Re: Mod for new ore (Mod not showing up)

Posted: Wed Nov 30, 2016 3:23 pm
by Grundox
You need to define particles for the Hämatit, or just use one of the already defined ones for example copper-ore-particle.
I defined particles now (I think) but still the same error accurs. http://cloud.directupload.net/95hC

Re: Mod for new ore (Mod not showing up)

Posted: Thu Dec 01, 2016 7:56 am
by Arch666Angel
Should work now, also made a custom ore sheet and icon for you.

Re: Mod for new ore (Mod not showing up)

Posted: Thu Dec 01, 2016 8:24 pm
by Grundox
Wow thank you so much for taking your time for me Angel! And thanks to everyone else. You guys helped me a ton!