Page 1 of 1

Adding "energy_usage" to "market"

Posted: Sat Mar 26, 2022 12:09 am
by hyspeed
Hi,

I'm wanting to use the market entity as a source for a teleporter entity but have it require energy to activate.
I've created a data:extend and added some energy attributes to it, but the created entity doesn't require power.
Is there an additional attribute I need to add for it to recognize it needs power?
Or should I use a different source entity?

Code: Select all

-- teleporter is a modification of the market
local teleporter = util.table.deepcopy( data.raw["market"]["market"])
teleporter.name = "coe-teleporter"
teleporter.energy_source = {
  type = "electric",
  usage_priority = "primary-input"
}
teleporter.energy_usage = "250kW"
teleporter.active_energy_usage = "2000KW"
teleporter.destructible = false
data:extend({teleporter})
thanks

Re: Adding "energy_usage" to "market"

Posted: Sat Mar 26, 2022 3:53 am
by Silari
Market's don't support an energy source - you can see this in the documentation: https://wiki.factorio.com/Prototype/Market . Unless it's part of the definition adding one won't do anything. You'll have to use a different entity - lamps are a pretty common one, or accumulators if you just want something to store energy so you can remove that energy later via scripting when activated.