Page 1 of 1

How to add resource to new resource category?

Posted: Sat Sep 23, 2017 1:21 pm
by Amidamaru4433
How I can to add resource to new resource category? For example, I have ore, which is can mineable only with special expensive mining drill.
I create new category:

Code: Select all

data:extend({
{
    type = "resource-category",
    name = "new_ore"
  },
})

and adding to my mining drill this property

Code: Select all

resource_categories = {"new_ore"},
But I don't understand, how to add my resource to this category, resources haven't properties, associated with categories. Pls, help me solve this problem :cry:

Re: How to add resource to new resource category?

Posted: Sat Sep 23, 2017 1:38 pm
by daniel34
Moved from Modding interface requests to Modding help.

crude-oil has this in the resources.lua:

Code: Select all

    category = "basic-fluid",
The other resources don't have such a line, so I assume the default value is basic-solid, since the vanilla game only has basic-solid and basic-fluid as resource categories.

Have you tried setting the category that way?

Another approach you could take is setting the mining hardness of your new ore a little bit higher, and give your new mining drill a little bit more mining power, so the ore can only be mined with your mining drill. I'm not sure how that mining drill would interact with existing ores though.

Re: How to add resource to new resource category?

Posted: Sat Sep 23, 2017 1:57 pm
by Amidamaru4433
daniel34 wrote: crude-oil has this in the resources.lua:

Code: Select all

    category = "basic-fluid",
wow, [category = "new_ore",] is really work! Now my miner can be placed only on my ore, which is what I wanted! how could I not notice such an easy decision... I checked everything, but I always ignored the oil.
Big thanks for fast and useful help!