Page 1 of 1

Neighboring Entities and Mod Feasibility

Posted: Tue Sep 06, 2016 1:11 am
by Lap
After looking over the api and milling about other mods I had a few questions on feasibility of an idea before I dedicate too much time to it. I know I could do this in pure Lua, but I haven't done much Factorio specific tinkering.

Essentially the idea would be to make nuclear power unique by making it very similar to Reactor Incremental, or the alternative IndustrialCraft Implementation.

Players build small components like fuel cells, coolant, etc, and it becomes puzzle mini game. Fuel cells produce electricity, but they also produce heat. Too much heat and the reactor will need to shutdown or the items will break (or the reactor explode!). This heat can be mitigated by building cooling vents and such. The thing that makes this interesting is that fuel cells that are placed adjacent to each other produce electricity more efficiently, but they produce MUCH more heat. This lets players build reactor designs that can be very fuel efficient, but possibly dangerous, or go for less efficient, safer options.

So the grid based minigame looks something like this:

Image

Now in Factorio there is two ways I might be able to do this:

1. Have players build individual buildings inside the reactor using the Factorissimo method. Buildings would need to interact with adjacent buildings.

2. Use a large building with an equipment_grid.


So...

A. Would either of these methods function without lagging too much?
B. Are either of these methods even possible?
-Can I easily get neighboring entities that aren't pipes or wires?
-Can buildings even have equipment grids?
-Can I change the value of an individual entities electrical production (or other values without affecting the whole class)?

Re: Neighboring Entities and Mod Feasibility

Posted: Tue Sep 06, 2016 3:18 am
by aubergine18
There's a third option: Use a Surface (think factorissimo mod, but instead of building factory you build nuclear reactor).

You can get entities in a given location, area or adjacent (horiz and vert) etc. See http://lua-api.factorio.com/latest/LuaSurface.html

I'm not sure if buildings can have equipment grids (think it's only vehicles but not sure). Even if they could, I'm not sure it would be reliable approach to use. IMO better to do it on the map with entities, as that opens lots of room for experimentation.

You can set all the electrical properties, a good mod to look at is https://mods.factorio.com/mods/Klonan/KS_Power

In recent update to Factorio additional properties were added, see the News forum and API reference for more infos.