Also, is there a better method to delay setting the bundled outputs to 0 than using os.sleep? I am considering maybe using a timer created each time the launch function is fired, but I am not sure how to create a distinct timer each time the event is fired, or how I would keep track of which wires each timer needs to reset. And that wouldn't prevent the running program from calling the launch function repeatedly on the same wires before they reset. Come to think of it, how would I even pull the timer events when needed? The more I think about it, the more I think about it, the more it sounds like just using os.sleep is the best method, and writing the program and API to minimize the impact of that mandatory delay. A 0.2 second sleep would still allow 5 discrete launch commands per second. But it would be nice to be able to fire multiple launch commands simultaneously.
For reference, this is what I've got so far:
launchdelay = 0.2
launchercluster = {side = "bottom", output = 65535}
function launchercluster:launch (targets)
local excluded = 65535 - self.output
local bundleout = targets - excluded
redstone.setBundledOutput(side, bundleout)
os.sleep(launchdelay)
redstone.setBundledOutput(side, 0)
end
function launchercluster:new (o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
Basically, a program will define a new launcher cluster with the side that it's on and the colors (in decimal form) of that bundle that are included in that cluster. The program then calls the launch function for that cluster, allowing it to launch any combination of colors included in that cluster. IE: If I call launch(65535) but only the colors corresponding to 32767 are a part of that cluster, only those colors will launch. (At least, that's how I hope that bit of code works, I haven't actually tested it yet since the server I was working on is down…)