Electric belts

Place to get help with not working mods / modding interface.
Post Reply
comwarrior
Burner Inserter
Burner Inserter
Posts: 17
Joined: Tue Feb 21, 2017 10:51 pm
Contact:

Electric belts

Post by comwarrior »

I'm trying to make a green belt twice as fast as blue belts (which i've done thanks to help) except I want to make each belt, splitter and underground consume power and has a 1 block supply area so that when you put belts in a long belt it supply's power from one end to the other.

So I thaught it might be as simple as adding the following from the power poles into entities.lua.

Code: Select all

	supply_area_distance = 2,
	radius_visualisation_picture =
    {
      filename = "__base__/graphics/entity/small-electric-pole/electric-pole-radius-visualization.png",
      width = 12,
      height = 12,
      priority = "extra-high-no-scale"
    },
	energy_source =
    {
      type = "electric",
      usage_priority = "secondary-input",
      emissions = 0.04 / 2.5
    },
    energy_usage = "10kW",
But alas, no... it seems it's not quite that simple.
Can anyone offer any advice?

Thanks

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

Re: Electric belts

Post by DaveMcW »

It's not simple at all. Factorio entities have very strong opinions about what they can and can't do, the only way to add functionality is to add an additional entity.

In this case you need 3 different entities (features):
transport-belt (belt movement)
electric-energy-interface (energy drain)
electric pole (power area)

Then you need a control.lua script to auto-place a hidden custom pole and custom electric-energy-interface whenever a transport belt is built/removed.
And then you need to check for power loss and disable/re-enable your belts...

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Electric belts

Post by bobingabout »

following on from above post...

although what you're trying to do IS possible with dummy entities and scripting...
everything in the script should probably run every single tick (Because power consumption), and that is going to ABSOLUTELY MURDER performance.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

comwarrior
Burner Inserter
Burner Inserter
Posts: 17
Joined: Tue Feb 21, 2017 10:51 pm
Contact:

Re: Electric belts

Post by comwarrior »

Thanks dave & Bob, much appreciated.
That is a shame, I was expecting / hoping it would be as simple as 'attaching' the necessary properties.
What about making a new subgroup so instead of using the sub group "belt" we made a new subgroup "electric belt" and thus the entities have their own options?

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Electric belts

Post by bobingabout »

subgroup? That's just for where in the crafting menu your recipe appears. it has no effect on the entity itself.

What you're thinking of is making a new subclass of entity, that is not possible in the base game.



What you could try though is going over to the modding interfaces requests subforum and asking if the devs can program in to make it possible for modders to make electric powered belts... but don't hold your breath, it's unlikely to happen. (Not saying it won't, but I'd put money on a bet saying they don't do it)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Electric belts

Post by eradicator »

There was a similar mod idea some time ago: 53172. The author hasn't updated the post in a while but some of my answers there might still be useful :P
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Modding help”