I was thinking of things we could do with mechanisms in another thread when this came to me. Why not create a few basic mechanism-types that the dwarves can use to create far more complicated systems? Specifically, I'm thinking of the following; all would require a mechanism to create and another for each link, and would take up a whole space:
* First, registers. They're noisy every time they get updated, which is done by other machines. Dwarves can also be sent to set them directly.
* Second, branch-machines. These can be linked to a register and up to two other triggerable items, like bridges or floodgates; it also needs an incoming link of its own to trigger it. When a branch machine is triggered, it consults its target register; if that register is zero, it triggers whatever object it has been linked to for its 'false' branch. Otherwise it triggers whatever has been linked to its 'true' branch. If a link is blank, nothing happens on that branch.
* Finally, incrementers/decrementers. When one of these is triggered, it adds or subtracts one from register it has been linked to, as appropriate. It can be set to then automatically trigger another object... say, a branch machine or a floodgate.
The player can, in effect, chain these devices up into an 'execution chain' to do more complicated things; using them, it would be simple for the dwarves to set up a pressure plate that floods the room the tenth time it has been stepped on, for instance. With a little more ingenuity, the player could set up 'one-way' pressure plates that require a pull of a lever to reverse, or a while line of pressure-plate flood traps that can all be reset with the pull of a single lever, or anything else they want handled.
For ease of use, there could be a few more mechanisms; these are not strictly necessary, but would save untold space and time:
* An addition mechanism, which links to up to three registers; it adds the value of two of them and puts it in the third. If either of the two are unlinked, it uses a zero for that one. Likewise, a subtraction mechanism using the same concept.
* The branch mechanism could be expanded to support two registers to compare, and could be set to branch on not equal, branch on equal, branch on less than, and so forth.
Of course, although the above is more than sufficient to calculate anything that can be calculated, it is unlikely to satisfy the dwarves' thirst for rube-goldberg death machines. So, a few other ideas:
* A clock mechanism, which triggers whatever it has been linked to on a set schedule. The player can set it to trigger at the start of a specific season, or to trigger every X days, or whatever. In fact, with the above, a mechanism that triggers every day would be sufficient...
* A water switch, which triggers when it is flooded. Similarly, a heat switch, which can be set to trigger for steam, lava, or both.
* Pressure plates that can be set to trigger for friendlies, or even only for friendlies, or only dwarves, or only pets, or whatever.
Now, if these were combined with alarms that could be set to attract pets, then the player could make a dog-powered logic engine.