Sorry, been a bit sidetracked so haven't had chance to follow this up until now with a few more screenshots and some vague explanation of how this works so here goes...
When anything spawns at the only available square to do so, be it friend or foe, it's going to want to get into my base as directly as possible, that being this way -
If it's a merchant or gnomads then they walk through and everything is groovy.
If it's enemies then things get more interesting.
The automatons on patrol that have a large section of pressure plates between their 2 patrol points. As long as one of those plates is being stood upon then the main door stays pathable which allows your friendlies through but upon sighting an enemy, the automatons move to intercept, leaving their patrol route and barring the main entrance which forces the ai to repath as demonstrated here:
The pressure plates you see the goblins standing on force the entrance to the bug cave open, allowing bugs to path towards the surface:
I'll discuss specific pathing mechanics at the end but for now I'll just talk through the flow of play and the choices avaiable.
Goblins have spawned, been sucessfully repathed to the holding area, bugs are wandering in the bug temple but currently no path to the surface exists so they are just milling about.
From here the option are to
A- Use archers to kill the goblins then open the path and loot.
B- Wait and see if a mant invasion occurs before the goblins starve or are allowed to leave and let them fight it out for viewing pleasure.
C- Allow the bugs to path to the surface and let them fight it out with the goblins.
It is entirely viable to create another room in which to trap mants to allow you to create 3 way fights but this map isn't set up for that and my archers are already well enough trained so let's have some inter-species combat!
The appropriate lever has now been pulled to bring the beetles up and into their holding pen (I found it best to have that lever so you can stop the goblins wandering into the temple if you don't want them to)
Now all we need to do is pull the lever that closes off access to the temple then the lever that separates the two holding areas and the fight begins.
In this example the bug nest was cleared fairly recently so the numbers are a poor example but you get the idea...
Another handy feature of the hatch separating the 2 areas is that a lot of the combat happens directly on top of it which allows the corpses etc to be dropped down into the base itself for ease of looting.
Now in regards to the reasoning behind the plethora of hatches and plates...
I like to have 3 "entrances" per holding area. 2 of these will be unpathable under any circumstance but the ai will never reach that conclusion. This is achieved by having the 2 outer paths hooked up to hatches and pressure plates on either side so it looks like a path unless anything tries to use it, in which case they stand on a pressure plate which opens the hatch in front of it which in turn makes the ai find a new path.
By having one of these on either side of the real path, the ai will bounce between them unless there are enough things to stand on plates on both sides but that never happens for long enough for it to be an issue.
The middle path is the actively pathable one and as such is denoted by a copper floor tile underneath it's lever... because red means danger and when you have a ton of levers it's easy to accidentally flip the wrong one.
The fake entrances also have levers because when you're trying to haul corpses etc it's annoying to see them try a wrong path every time before going the right way.
The very front gate operates in much the same way but with a couple of extra features like the automaton guarded entrance and a few extra hatches for reasons I am sure were good at the time but I struggle to remember at the moment.
Here's what it looks like under the bonnet:
in game mechanic abuse, passing power with out axle loss........
No idea what this chap is on about.