Page 1 of 1

How to add energy consume to exists entity (deepcopy)

Posted: Sat Mar 13, 2021 5:54 pm
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"]) 

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

Posted: Sat Mar 13, 2021 6:25 pm
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.

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

Posted: Sun Mar 14, 2021 5:59 pm
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: