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
+23 -11
View File
@@ -26,26 +26,38 @@ cross-server:
enabled: false
gate:
# Any of these materials count as the decorative frame ring. Mix and match to match
# your build (the default matches an obsidian/gold-block/birch-planks arch).
# The exact shape of a gate, read top row to bottom row. This is matched precisely
# against the world - no flood-fill guessing. Symbols:
# * = frame block (never touched by the plugin)
# 1 = chevron - a frame block that lights up to chevron-lit-material while
# dialing/open, then reverts to whatever it looked like at rest when closed
# 2 = interior ("iris") - filled with iris-material while open, air while closed
# 0 = ignored - not part of the gate at all
# Must be built in a single vertical plane, one block thick, aligned to the world's
# X or Z axis (i.e. facing north/south/east/west, not built at an angle).
template:
- "00000000000"
- "0000*1*0000"
- "00012221000"
- "00*22222*00"
- "0*2222222*0"
- "01222222210"
- "0*2222222*0"
- "00*22222*00"
- "00012221000"
- "0000***0000"
- "00000000000"
# Any of these materials satisfy a '*' or '1' cell above. Mix and match to match your
# build (the default matches an obsidian/gilded-blackstone ring).
frame-materials:
- OBSIDIAN
- GOLD_BLOCK
- GILDED_BLACKSTONE
- BIRCH_PLANKS
- OAK_PLANKS
# Chevrons are NOT a separate material you have to place - the plugin automatically
# picks this many frame blocks, evenly spaced around the ring, and swaps them to
# chevron-lit-material while dialing/open, then restores whatever they looked like
# at rest when the gate closes. So a chevron can rest as plain obsidian and only
# stand out once it lights up.
chevron-lit-material: GILDED_BLACKSTONE
chevron-count: 6
# Material poured into the interior (the "event horizon") while the gate is open.
iris-material: WATER
max-frame-blocks: 300
max-iris-blocks: 200
min-frame-blocks: 8
# After placing a "[Stargate]" sign, the owner has this long to left-click (punch) a
# block of the actual gate frame to link it - the sign itself can sit anywhere, like a
# DHD console away from the gate, instead of being mounted directly on the frame.