Alex's RGB Lamp

by qqwertt

Adds a new lamp with fully customizable colors.

Content
3 years ago
1.1
370
Circuit network

b Horrible for UPS

1 year, 8 months ago
(updated 1 year, 8 months ago)

Horrible for UPS

First 5 lines of control.lua:

script.on_event(defines.events.on_tick,
  function(event)
    for _, surface in pairs(game.surfaces) do
      for _, lamp in pairs(surface.find_entities_filtered({name="qwrt-lamp"})) do
        for _, light in pairs(lamp.surface.find_entities_filtered({name="lamp-light",area={{lamp.position.x-0.01,lamp.position.y-0.01},{lamp.position.x+0.01,lamp.position.y+0.01}}})) do
  1. This shouldn't be running every tick, it should spread over multiple ticks.
  2. It should be holding references in global instead of scanning the surface
  3. Running another scan for every lamp is even worse

I would recommend not using this mod for anything serious if you care about performance. If you need more UPS friendly fancy combinators I recommend https://mods.factorio.com/mod/nixie-tubes by justarandomgeek.

New response