Energy Types

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Shaderon
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Dec 13, 2019 8:27 pm
Contact:

Energy Types

Post by Shaderon »

At first hello I'm Shaderon (you can also call me just Shade ;) ), this is my first post on the forum but I hope you will take it serious and if someone know how to solve this problem will want to help me. I'm play Factorio for a long time. For last several months I think about do my own mod, I have lots of ideas that I want to realize to game but I also encountered some problems, one of them seems to me the most problematic so I will describe it below

In factorio we have some types of energy source "electric", "burner", "heat", "fluid", "void". So these are an available energy sources in the game that we can use in our mods. But what if I want to create my own energy type? I have some conceptions that I want to do in my future mod, but to make them I need to create my own type of energy source because if I use existing energy sources I will be able to provide them using existing energy transmission means such as pipes or electric poles. But I want to create my own way of transmitting my own type of energy that will not be transportable through the above-mentioned means of energy transmission.

So my question" is there a possibility to add your own type of energy in game, and if so how to do it?
Pain is an universal constant.

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

Re: Energy Types

Post by DaveMcW »

No, Factorio does not support adding new energy types. But Lua is a complete programming language, so you can create whatever you want. The tricky part is figuring out what you can reuse from the game to make your task easier. I recommend reusing burner or fluid, so you have a buffer to play with.

You have to create the distribution network from scratch. You can use simple-entity-with-owner to represent pieces of the network, unless you find another entity with functionality you can reuse.

User avatar
Shaderon
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Dec 13, 2019 8:27 pm
Contact:

Re: Energy Types

Post by Shaderon »

Sounds tricky as you said. It creates more problems but it's also a solution.

But on patch 0.1.5 there was added a nuke reactor as well as new energy type "heat"! So, how they was add it? If they can add new energy type what called heat, then there must be an other option to add new energy type, less complicated than you offer above. Or maybe it was added to a game by the method that can't be allowed or impossible to use by modders?

I'm just curious cuz as I said, I played Factorio for several years and I remember that time before atomic reactor was added when energy type what called "heat" doesn't exist, so if they can add reactor that use new energy source, then there must be an method to add new type of energy that's maybe easier to do than this what you wrote above.

or not?
Pain is an universal constant.

User avatar
Linver
Fast Inserter
Fast Inserter
Posts: 158
Joined: Wed Jan 09, 2019 2:28 pm
Contact:

Re: Energy Types

Post by Linver »

Hi, Shaderon
like u probably have already done, reading this page https://wiki.factorio.com/Types/EnergySource where is writed how in prototypes must be defined the energy soruce, u can see that is specified that five types, this kind of parts of Factorio is called "hardcoded", because is something that in Factorio can't be modified, many modders play with recipes adding in the ingredients of one item something to use like a "soruce", like a steam for make a steam assembler or something else, but u can't trully use a new item or "object" for the energy soruce.

The DaveMcW suggestion is good and bad, theoretically u can script in lua all u want, making some entity checking for make it working with some conditions, u can interact with entities on map through control.lua in a mod using this events: https://lua-api.factorio.com/latest/events.html but this will cost UPS in the game, have a code that consume too much UPS (this depend from implementations and what events are you using) is bad because the games will become slowly with small factories and players don't like when mods use too much UPS, so the problem is that if u find a good way (low UPS usage) to create a new simulated energy source with scripting, this can be an idea, but is difficult to do.

User avatar
Shaderon
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Dec 13, 2019 8:27 pm
Contact:

Re: Energy Types

Post by Shaderon »

Yeah this is what I've been afraid of. So if it's hardcoded there is a huge problem, also creating objects that's have too much condition that makes game run slowly on small factory is not good solution. But... when we create a new type of pipe or something that transfer fluids, we can use property that called " fluid_box" wich we have in this an optional properties called "minimum_temperature" and maximum_temperature. As I understand, thats determines the temperature range that the fluid must have in order for it to be passed through the pipe.

So my first question is: If I create new type of pipe thats maybe not look like a pipe, but as a kind of energy transferer, next I set temperature range between value that other fluid and pipes that vanilla Factorio doesn't use, then will it work?

And second question is: does my new type of energy as a fluid will not pass though a Factorio pipes and also do my pipes will not allow the Factorio fluids to pass through it?

I hope it work like that because if it then this will be the easiest option to create own type of energy but using mechanics of fluid transfer.

And thanks for all response above :D
Pain is an universal constant.

Post Reply

Return to “Modding help”