Replace flood-fill scanner with an exact gate template

Instead of guessing a gate's shape by flood-filling connected frame
material, the plugin now matches a fixed ASCII template against the
world (gate.template in config.yml), the same idea as the classic
Stargate plugin's .gate files. Default is an 11x11 ring with 7
chevrons at their real positions rather than auto-spaced.

- New GateTemplate parses the '*'/'1'/'2'/'0' grid.
- New GateTemplateScanner tries every plausible alignment of a
  punched block against a frame/chevron cell, then verifies the rest
  of the template matches; no more flood-fill leak/enclosure
  diagnostics needed since the shape is exact.
- The player's look direction at punch time (snapped to N/S/E/W)
  decides whether template columns run along world X or Z; this
  facing is now stored in Gate.facing (repurposing the old
  sign-attachment field) so restarts can re-scan deterministically.
- Exit-teleport yaw now comes from that stored facing instead of a
  geometric guess.
- Removed gate.chevron-count/max-frame-blocks/max-iris-blocks/
  min-frame-blocks - the template itself defines size and chevrons.
This commit is contained in:
Michael Burgess
2026-08-09 10:48:47 -04:00
parent 317602c00e
commit ed8415a497
7 changed files with 310 additions and 266 deletions
+39 -16
View File
@@ -16,29 +16,52 @@ Build everything with `./gradlew build`. Jars land in each module's `build/libs/
## Building a gate
1. Build a fully-enclosed ring out of any block(s) in `gate.frame-materials` (default:
obsidian, gold block, gilded blackstone, birch/oak planks). Leave the middle hollow.
No gaps - the ring must be a sealed loop.
2. Nothing else to build for chevrons. On creation, the plugin automatically picks
`gate.chevron-count` (default 6) frame blocks, evenly spaced around the ring, and
remembers what they looked like at rest. While dialing/open those blocks swap to
`gate.chevron-lit-material` (default gilded blackstone); closing the gate restores
them to their original block, so a chevron can rest as plain obsidian and blend
invisibly into the frame until it lights up.
3. Place a sign anywhere - it doesn't need to touch the frame, so it can act like a DHD
A gate's shape is a fixed template in `config.yml` (`gate.template`), matched exactly
against the world - not flood-filled or guessed. The default is an 11x11 ring with 7
chevrons, laid out top row to bottom row:
```
00000000000
0000*1*0000
00012221000
00*22222*00
0*2222222*0
01222222210
0*2222222*0
00*22222*00
00012221000
0000***0000
00000000000
```
- `*` — frame block, never touched by the plugin. Must be one of `gate.frame-materials`
(default: obsidian, gold block, gilded blackstone, birch/oak planks).
- `1` — a chevron: a frame block (same material rules as `*`) that swaps to
`gate.chevron-lit-material` (default gilded blackstone) while dialing/open, then
reverts to whatever it looked like at rest when the gate closes. So a chevron can
rest as plain obsidian and blend invisibly into the frame until it lights up.
- `2` — interior ("iris"), filled with `gate.iris-material` (default water) while open.
- `0` — ignored, not part of the gate.
Build it in a single vertical plane, one block thick, aligned to the world's X or Z
axis (facing north/south/east/west - not built at an angle). Edit `gate.template` in
`config.yml` if you want a different size or chevron count/placement.
1. Build the frame to match the template.
2. Place a sign anywhere - it doesn't need to touch the frame, so it can act like a DHD
console standing apart from the gate - with:
- Line 1: `[Stargate]`
- Line 2: network name (blank = default network)
- Line 3: gate name (blank = auto-generated)
- Line 4: `hidden` to keep it out of the cycle list, `fixed:GateName` to lock this
gate to always dial `GateName` (no right-click cycling), or blank
4. The sign will show "Punch the gate (30s)". Within `gate.link-timeout-seconds`,
left-click (punch) any block of the frame ring, within `gate.max-link-distance` of
the sign. The plugin flood-fills out from that block, confirms it's a fully enclosed
ring, and links the sign to it.
3. The sign will show "Punch the gate (30s)". Within `gate.link-timeout-seconds`, stand
facing the gate square-on and left-click (punch) any `*` or `1` block, within
`gate.max-link-distance` of the sign. The plugin matches the template against the
world starting from that block and links the sign to it.
If punching a block doesn't work, the plugin tells you exactly why in chat - an
unrecognized frame material, a gap in the ring, too far from the sign, etc.
If punching a block doesn't work, the plugin tells you exactly why in chat - wrong
material, no orientation of the template lines up, too far from the sign, etc.
## Using a gate