So I took a look at the lua API and lua itself and hacked something together using only chests and poles.
There's only 1 "input" / "sensor" right now:
- Chest contents (vector of item names with item counts)
There are 3 "modules":
- Filter module: It's a chest with one input pole and one output pole. it takes an input vector of items with item counts and creates an output vector by removing any items from the input vector which are not contained in the filter module chest.
- Count module: Also a chest with one input pole and one output pole. Takes the input vector, sums up the counts for all the items in the vector, and outputs a scalar number (sum of all counts).
- Condition module: Since I didn't feel like introducing true/false boolean values explicitly, I used 1=true/0=false. Module must be configured to have a comparison operation (< or >) and a number to compare against. Input is a scalar number, output is a scalar "fake-boolean" number (1/0, depending on the comparison result). For any real usage scenario, this simple way of setting up the condition is probably not enough.
There are 2 "outputs" / "actors":
- Smart power switch (not sure why I called it "smart", anyway): One "input value pole" and two normal power poles. If the input value scalar number is 1, then both power poles are connected using a cable. If the scalar input number is not 1, then the power poles are not connected. So by connecting a condition module output to the smart power switch input, the condition module controls wheter or not the smart power switch will send power from the left power pole to the right one (or vice versa).
- Smart LED (yeah, very smart): This looks insanely stupid and ugly because I created the sprite in the GIMP. It's not in the video below because I don't want to make you laugh. Anyway, depending on the scalar input value (1/2/3/default) it turns (red/green/blue/off).
The semantics when connecting multiple outputs together are also important: All the values are added up. So "10 iron plate" connected to "5 copper plate and 10 iron plate" results in "20 iron plate and 5 copper plate" when connecting that wire to some input. When adding a third output that emits a scalar value of 3, this results in "20 iron plates, 5 copper plates, and a scalar value of 3". Adding a condition module that currently has its condition fulfilled (=true = scalar 1), the result is "20 iron plates, 5 copper plates, and a scalar value of 4".
So there's no need for a "group module" (DerivePi), because that happens implicitly by connecting multiple outputs to one input. The "summation module" can be simulated using a filter module and a count module.
What I think might be possible to do for inputs:
- light detector (either true/false or even some number indicating how dark it is)
- inventory of a train that is currently on a "smart" piece of rail
- smart radar (assuming this is supposed to count the number of remaining ressources in a ressource field?)
- I guess a few more of the things DerivePi listed, not sure about the API details
Outputs:
- train station that delays train departure based on input value
- enabling/disabling of devices like inserters
- set the smart inserter filter (?? maybe..)
Modules: As long as it is possible to build a working GUI for module configuration, any desired input->output transformation should be possible.
The main issue is that the input/output poles feel strange because it's confusing to have 3 different buildings instead of only 1 when placing a module or sensor/actor. I couldn't figure out how to add 2 "wire connection spots" to a single entity.
Obviously, the code is quite ugly right now. Since I've reused the smart chest and power pole sprite for everything, it is also difficult to work with these things. And there's a scripting error when trying to remove modules/sensors/actors from the map (and probably a lot of other cases) because the code can't handle that. Some of the chests should not be chests, but I just copied that part over because I was too lazy to figure out something that works better. And collision / selection boxes are not quite right either. And a lot of other details are not quite right. You see, I just wanted this to show some reaction when I change something in the smart chest, which it does.
So it's just meant as a proof of concept. If this is supposed to become useful, it needs a lot of work that I can't do because not only do I lack lua and mod API knowledge, I also suck at designing sprites. Though I'm afraid that the wiring part will be quite troublesome, because poles tend to auto-connect to nearby poles. I prevent this by spawning poles at x=10000 y=10000 and then teleporting them to the correct position, but when the user places a pole, things start to be annoying.
Anyway, this is my vid demonstration. Unfortunately my mouse pointer was not captured. You can watch me place down the smart chest, filter module, counter module, condition module with "> 5" condition, and smart power switch. Then I connect the poles and put stuff into the smart chest. I also change the filter chest contents. In case it's not clear, you should watch the smart power switch as it connects and disconnects the left and right power pole when I put stuff into the chest or change the filter config. Yeah, it's probably very confusing.
https://www.youtube.com/watch?v=FjME43PCB0w
Code:
This does not state a license. If someone wants to look into improving this or just wants make sure the files are available freely, I'd be happy to use some free license, but I'm just too lazy to decide on a license now.

Though I won't sue you if you just build upon it without asking, because I'd love to have a mod that is nice to use and does something like this in a sane way.
