Adding a new ressource to the game

Place to get help with not working mods / modding interface.
Post Reply
egooo
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Apr 23, 2022 2:48 pm
Contact:

Adding a new ressource to the game

Post by egooo »

Hello,

I have added a new resource to my mod. I'm still working on the details. But the first thing I noticed is, that the icon is not shown in the map generation dialogue. Where is this icon taken from? I would've guessed it is the icon specified in 'icon' of the resource prototype.
Map generator.PNG
Map generator.PNG (70.63 KiB) Viewed 1472 times
A reduced example code is attached.
Attachments
data.lua
(1.38 KiB) Downloaded 48 times

Qon
Smart Inserter
Smart Inserter
Posts: 2119
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Adding a new ressource to the game

Post by Qon »

The things listed there are the resources that are placed on the map. So my guess is that you didn't add an icon for the autoplace-control prototype, just for the resource itself. The oil patch doesn't have the liquid black oil drop as icon, right? It has the sprite of oil pool that you see on the ground. So look for how sprite/icon references are handled for the prototypes of the other resources.

So I just checked in my Factorio/data/base/prototypes/autoplace-controls.lua file
and see things like

Code: Select all

{
    type = "autoplace-control",
    name = "uranium-ore",
    localised_name = {"", "[entity=uranium-ore] ", {"entity-name.uranium-ore"}},
    richness = true,
    order = "b-e",
    category = "resource"
  },
  {
    type = "autoplace-control",
    name = "crude-oil",
    localised_name = {"", "[entity=crude-oil] ", {"entity-name.crude-oil"}},
    richness = true,
    order = "b-f",
    category = "resource"
  },
Look at localised_name. If you want an icon in the name, add an icon in the name. Add as many icons as you want. You can make it completely out of icons if you want.

egooo
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Apr 23, 2022 2:48 pm
Contact:

Re: Adding a new ressource to the game

Post by egooo »

Wow, the icon is part of the name! Thanks, it's working now.

egooo
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Apr 23, 2022 2:48 pm
Contact:

Re: Adding a new ressource to the game

Post by egooo »

Is it possible to prevent grass on a resource? Grass growing on top of a sunflower don't look right ;-)

egooo
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Apr 23, 2022 2:48 pm
Contact:

Re: Adding a new ressource to the game

Post by egooo »

It is not possible to change the render_layer of a resource, correct? Sunflower on top of grass would be nice.

So the only way is to have no grass placed on the resource field. I already set 'remove_decoratives' to true. But this doesns't seem to work either.

Any ideas?

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Adding a new ressource to the game

Post by DaveMcW »

If you are comfortable with control.lua scripting, you could add a simple-entity on top of each resource with the render_layer you want.

You would have to handle on_chunk_generated and on_resource_depleted events.

egooo
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Apr 23, 2022 2:48 pm
Contact:

Re: Adding a new ressource to the game

Post by egooo »

Thanks for the idea! I'll take this in consideration, when starting to implement the control stage features. Do you thinks it is also possible to implement the richness based variations of the graphic?

Post Reply

Return to “Modding help”