Files
Stargate/README.md
T
Michael Burgess ed8415a497 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.
2026-08-09 10:48:47 -04:00

106 lines
4.4 KiB
Markdown

# Stargate
A network-aware Stargate portal plugin for PaperMC, with sign-based dialing and
cross-server travel over Velocity or BungeeCord.
## Modules
| Module | What it is |
|---|---|
| `stargate-common` | Shared models + JDBC storage (SQLite / MySQL) used only by the Paper plugin |
| `stargate-paper` | The actual gate plugin — install this on every backend server |
| `stargate-velocity` | Proxy companion for Velocity — install on the proxy only if using cross-server gates |
| `stargate-bungee` | Same, for BungeeCord/Waterfall |
Build everything with `./gradlew build`. Jars land in each module's `build/libs/`.
## Building a gate
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
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 - wrong
material, no orientation of the template lines up, too far from the sign, etc.
## Using a gate
- **Right-click** the sign: cycles the destination shown on line 3 among the other
gates on the same network.
- **Left-click** the sign: dials the shown destination — chevrons light in sequence,
then the interior fills with `gate.iris-material` (default water). Walk into it to
teleport. It auto-closes after `dialing.open-seconds`.
## Multi-world
Gates are addressed by network name, not world — a gate on any loaded world can dial
any other gate on the same network regardless of world, exactly like same-server
cross-world travel in the original Stargate mod.
## Cross-server (Velocity / Bungee)
1. Set `storage.type: mysql` in every backend server's `config.yml` and point them at
the **same** database — this is how servers see each other's gates.
2. Give each backend a unique `server-id` in `config.yml` that matches its name in
the proxy config (`velocity.toml` / `config.yml` servers list).
3. Set `cross-server.enabled: true` on every backend.
4. Drop `stargate-velocity` (or `stargate-bungee`) into the proxy's plugin folder.
When a player dials a gate hosted on another backend, the Paper plugin asks the
proxy (over the `stargate:teleport` plugin channel) to connect the player to that
server; once they land, the proxy forwards a delivery message so the destination
server's Stargate instance teleports them to the gate's exit point.
## Permissions
- `stargate.use` (default: true) — dial/cycle gates
- `stargate.create` (default: op) — build new gates
- `stargate.destroy` (default: op) — break your own gates
- `stargate.admin` (default: op) — reload, break/manage any gate
## Commands
- `/sg list [network]`
- `/sg destroy` (look at a gate's sign)
- `/sg reload`