Hello, i just want to make a simple mod that adds new things like a new inserter or a new engine.
To do this i just want to clone existing items in vanilla and then tweak stats and graphic.
Anyone can make me a small example mod for i don't know a "faster" fast inserter?
Thank you very much!
How to just clone and modify and existing item
Re: How to just clone and modify and existing item
Code: Select all
require 'util'
new_ent=table.deepcopy (data.raw.inserter['basic-inserter'])
--basically you look at original prototype definition and put whatever fields you want different in your definition
new_ent.name='not-basic-inserter'
new_ent.rotation_speed=0.08
table.insert(new_ent.resistances,{type='physical',percent=80})
new_ent.hand_base_picture={
filename='__core__/graphics/empty.png',
priority='normal',
width=1,
height = 1,
}
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: How to just clone and modify and existing item
and don't forget that once you've setup new_ent as "not-basic-inseter" (Fairly sure it does have to be the double quote to denote strings) you'll need to actually put it in the game, which is simple
you'll also need to set up new items and recipes etc too, along with any technologies to unlock them.
Personally though, I copy the entire code of an entity when redefining it, then make my changes to that, but it does have the drawback that when the original changes (Like adding circuit wire nodes) that you have to manually go and add them afterwards. in the case of the entity copying system mentioned above, all that would be done for you automatically when the original updates.
Code: Select all
data:extend(
new_ent
)
Personally though, I copy the entire code of an entity when redefining it, then make my changes to that, but it does have the drawback that when the original changes (Like adding circuit wire nodes) that you have to manually go and add them afterwards. in the case of the entity copying system mentioned above, all that would be done for you automatically when the original updates.
Re: How to just clone and modify and existing item
Wow this is handy and did not know you could do it this way.