How to add energy consume to exists entity (deepcopy)

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
MaZy
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sat Jun 21, 2014 2:10 pm
Contact:

How to add energy consume to exists entity (deepcopy)

Post by MaZy »

Hey, I am working on a mod for first time which allows me teleport items between chests. This is of course too op so I want to make huge energy consume for each teleportation.

For now I use Steel Chest and Requester Chest (because of the UI) but with deepcopy.

Now I want to make requester chest to consume power and used this for the start

Code: Select all

energy_source =
{
  type = "electric",
  usage_priority = "secondary-input",
  drain = "0.1kW"
}
But it does not drain. Also if I use in lua entity.power_usage it says
Entity is not electric-energy-interface
Cannot I not modifier/add energy_source if I use deepcopy? Like

Code: Select all

table.deepcopy(data.raw["logistic-container"]["logistic-chest-requester"]) 

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

Re: How to add energy consume to exists entity (deepcopy)

Post by DaveMcW »

You can only add energy source to a prototype that supports it. See the list here: https://wiki.factorio.com/Prototype_overview

The workaround is to make two entities and use control.lua to coordinate them.

MaZy
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sat Jun 21, 2014 2:10 pm
Contact:

Re: How to add energy consume to exists entity (deepcopy)

Post by MaZy »

DaveMcW wrote:
Sat Mar 13, 2021 6:25 pm
The workaround is to make two entities and use control.lua to coordinate them.
What do you mean exactly? Something like invisible entities with energy source?

At the moment it looks like this:

Post Reply

Return to “Modding discussion”