# Barotrauma — panel-native dedicated server module.
#
# Native Linux binary from SteamCMD app 1026340. NO RCON of any kind:
# verified 2026-07-14 — the server prints "Redirected input is detected but
# is not supported by this application. Input will be ignored." on boot, so
# even the stdio adapter can never deliver commands. Admin = in-game host
# console / clientpermissions.xml only.
#
# Reference: https://github.com/CubeCoders/AMPTemplates (Barotrauma.kvp)

id: barotrauma
name: "Barotrauma"
version: 0.1.0
authors:
  - panel contributors

supported_modes:
  - docker

runtime:
  docker:
    image: panel-barotrauma:latest
    # Host networking -- container shares the host net namespace, so
    # any port the game/mod binds is directly on the LAN. AMP-like
    # model. Multi-instance safety comes from env-driven per-instance
    # ports (panel allocator + env: mapping on each ports entry).
    network_mode: host
    browseable_root: /game-saves
    browseable_roots:
      - name: "Saves & Configs"
        path: /game-saves
        hint: "serversettings.xml + saves/ + clientpermissions.xml"
      - name: "Game Files"
        path: /game
        hint: "Server binaries, Mods/"
    env:
      SERVER_NAME: "panel Barotrauma"
      MAX_PLAYERS: "16"
      SERVER_PASSWORD: ""
      # Steam server-browser listing. ALSO gates the Steamworks A2S query
      # port: with False the required query port never binds (verified).
      # AMP defaults True too.
      IS_PUBLIC: "True"
      # Pre-declared so the agent's resolve.go filter lets panel-allocated
      # ports flow through to the container env. Barotrauma has no CLI port
      # args (AMP injects XML attributes too) — the entrypoint seeds/patches
      # port= / queryport= in serversettings.xml from these on every boot.
      GAME_PORT: "27015"
      QUERY_PORT: "27016"
    volumes:
      - { type: volume, name: "panel-$INSTANCE_ID-saves", container: "/game-saves" }
      - { type: volume, name: "panel-$INSTANCE_ID-game",  container: "/game" }
      - { target: "$DATA_PATH/logs", container: "/game-saves/logs" }

ports:
  - { name: game,  proto: udp, default: 27015, required: true, env: GAME_PORT }
  - { name: query, proto: udp, default: 27016, required: true, env: QUERY_PORT }

resources:
  min_ram_mb: 1024
  recommended_ram_mb: 2048

# No rcon block: the dedicated server explicitly ignores redirected stdin
# (see header comment), and there is no network RCON in the game.
# Log-derived player events. Regexes converted from CubeCoders'
# AMPTemplates (barotrauma.kvp) — .NET (?<n>) syntax -> Go (?P<n>).
# Sourced-from-template; not yet exercised against a live client.
events:
  join:
    pattern: '(?P<name>.+?) has joined the server\.$'
    kind: join
  leave:
    pattern: '(?P<name>.+?) has left the server\.$'
    kind: leave


update_providers:
  - id: stable
    kind: steamcmd
    app_id: "1026340"
    install_path: /game

# --- Manifest-driven UI metadata (WI-07) --------------------------
# Consumed by the CONTROLLER/dashboard only (the controller loads its
# own ./modules copy at startup); the agent ignores these at runtime.
# ready_pattern is a JavaScript regex (slash-delimited when it needs
# flags) moved verbatim from the dashboard's READY_PATTERNS map.
ready_pattern: '/Server started|Listening to \w+ connections/i'
appearance:
  emoji: "🚢"
  grad: "linear-gradient(135deg,#1e3a5f,#3b6e8c)"
  art: "/game-art/barotrauma.jpg"
  steam: "602960"
