Kobolds. Kobolds are a problem. The trap-avoiding little bastards aren't good for anything but disrupting work orders and cutting up yer guard animals. And cleaning up clutter around your entrance only exposes dwarves to danger. So I set about inventing a needlessly complicated machine to solve this (not too complicated, actually). It's also pretty good at getting rid of sieges and goblin thieves, as far as my limited testing has gone. First pictures, and then explanation:
EDIT: standard tileset pictures:
The fort entrance is on level z; ramps to the north lead outside, fort is off to the right. Z+1 is where the magma goes. Oh yes; like all good traps, there is magma. "But Smirk, you fool," I hear you say, "There's holes in that floor! Any magma you put in that room will drain out like yesterday's Taco Bell dinner!" Good catch, Hypothetical Reader, but those holes are in fact blocked.
By the doors below them on level z. What this means is that as long as those doors are closed, the magma stays where it is. But as soon as one is opened, by, say, a kobold trying to steal your precious socks, magma floods down like the unquenchable wrath of Armok.
Basically, what this does is exploit the AI's tendency to get into yer fort by the shortest route possible. Kobold and Goblin thieves can do this
through locked doors, so all you need do is (l)ock those doors so your dwarves and any trade caravans will take the longer route to the left. Since doors claimed by invaders technically stand open, I've added an easily reclaimable door on the south end of the passage just in case all three magma doors get invaded (although I've not seen any invaders make it past door 2 before being swept away so far). Also, the grates next to the doors are necessary so that magma doesn't slosh out diagonally and block pathing.
Clutter: Just to the right of the magma doors is a pit that invaders are pushed into by the flow (stairway explained later). You can make it as deep as you like. The bottom isn't shown here, but I've grated it off with drainage so that any un-melted items can be recovered later. That's where this machine's other function comes in: the magma makes this an automatic de-clutterer, burning away invader remains and clothing and leaving nothing but goblinite.
Sieges: Now, sieges are a slightly different creature: To start with, they don't path through locked doors, so you'll hafta unlock 'em yourself and keep your dwarves away. Easy with burrows. Also, sieges have a bad habit of grouping around their dead leader and standing there looking ugly. For that reason, I've made the pit very deep and put a stairway in the center of it. What this
should do (I'm pretty sure) is wash the lead invader into the deep pit, causing the troops to try and follow the body down to the bottom via the stairwell - triggering the trap in the process. Of course, I haven't tested it yet, so no guarantees.
Design Problems: It's a bit complicated to set up and you need a renewable magma source. Also, need to build everything out of magma-safe materials. The pit wouldn't be necessary, except in early designs un-meltable weapons blocked the doors open and led to an unstoppable magmafall. To help with this I built three hatches over the hole in the magma chamber and linked 'em to a lever so that the magma can be shut off in event of emergencies. The biggest problem, though, will probably be with building destroyers during sieges. I've only had 1 siege using this thing (the same siege where I figured out I needed to solve the leader problem), and luckily the trolls were stupid enough to stand
right on top of the grate they were trying to destroy, so that goblins passing by and opening the first magma door also splashed magma diagonally onto the trolls and did away with 'em quite nicely. But I can't be sure that's repeatable behavior without more testing.
Speaking of testing, I'm gonna go do some more of that. Thoughts?
EDIT: Better/less confusing pictures.