config

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArenaConfig

type ArenaConfig struct {
	ScoreLimit         *int  `toml:"score_limit"`
	TimeoutIsDraw      *bool `toml:"timeout_is_draw"`
	SuddenDeathEnabled *bool `toml:"sudden_death_enabled"`
}

type BabelConfig

type BabelConfig struct {
	Reverse          *bool    `toml:"reverse"`
	CaptureLimit     *int     `toml:"capture_limit"`
	RegenerateTower  *bool    `toml:"regenerate_tower"`
	RegenerationRate *float64 `toml:"regeneration_rate"`
}

type BoundaryDamage

type BoundaryDamage struct {
	Left   int `toml:"left"`
	Right  int `toml:"right"`
	Top    int `toml:"top"`
	Bottom int `toml:"bottom"`
	Damage int `toml:"damage"`
}

type CTFConfig

type CTFConfig struct {
	CaptureLimit     *int     `toml:"capture_limit"`
	CaptureTimeBonus *float64 `toml:"capture_time_bonus"`
	FlagReturnTime   *float64 `toml:"flag_return_time"`
}

type Config

type Config struct {
	Server    ServerConfig
	Teams     TeamsConfig
	Passwords PasswordsConfig
	RateLimit RateLimitConfig
	Voting    VotingConfig
	Gamemode  GamemodeConfig `toml:"gamemode"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error

type GamemodeConfig

type GamemodeConfig struct {
	CTF   *CTFConfig   `toml:"ctf"`
	TC    *TCConfig    `toml:"tc"`
	TDM   *TDMConfig   `toml:"tdm"`
	Babel *BabelConfig `toml:"babel"`
	Arena *ArenaConfig `toml:"arena"`
	Laby  *LabyConfig  `toml:"laby"`
}

type GamemodeID

type GamemodeID int
const (
	GamemodeCTF   GamemodeID = 0
	GamemodeTC    GamemodeID = 1
	GamemodeBabel GamemodeID = 2
	GamemodeTDM   GamemodeID = 3
	GamemodeArena GamemodeID = 4
	GamemodeLaby  GamemodeID = 5
)

func ParseGamemode

func ParseGamemode(id int) (GamemodeID, error)

func (GamemodeID) String

func (g GamemodeID) String() string

type IntelConfig

type IntelConfig struct {
	Team1Position [3]float64 `toml:"team1_position"`
	Team2Position [3]float64 `toml:"team2_position"`
	Team1Base     [3]float64 `toml:"team1_base"`
	Team2Base     [3]float64 `toml:"team2_base"`
}

type LabyConfig added in v0.2.0

type LabyConfig struct {
	CapLimit   *int     `toml:"cap_limit"`
	HogTimeout *int     `toml:"hog_timeout"`
	RegenRate  *float64 `toml:"regen_rate"`
}

type MapConfig

type MapConfig struct {
	Map          MapInfo           `toml:"map"`
	SpawnPoints  SpawnPointsConfig `toml:"spawnpoints"`
	Water        WaterConfig       `toml:"water"`
	Intel        IntelConfig       `toml:"intel"`
	Tents        TentsConfig       `toml:"tents"`
	Extensions   MapExtensions     `toml:"extensions,omitempty"`
	Protected    []string          `toml:"protected,omitempty"`
	Area         []float64         `toml:"area,omitempty"`
	Ball         []float64         `toml:"ball,omitempty"`
	BlueGoal     []float64         `toml:"blue_goal,omitempty"`
	GreenGoal    []float64         `toml:"green_goal,omitempty"`
	PenaltyAreas [][]float64       `toml:"penalty_areas,omitempty"`
}

func DefaultMapConfig

func DefaultMapConfig() *MapConfig

returns a fresh map configuration populated with default values

func LoadMapConfig

func LoadMapConfig(path string) (*MapConfig, error)

func LoadMapConfigToml

func LoadMapConfigToml(path string) (*MapConfig, error)

type MapExtensions

type MapExtensions struct {
	WaterDamage      *int
	BoundaryDamage   *BoundaryDamage
	TimeLimit        *int
	CapLimit         *int
	DisabledCommands []string

	Babel        *bool
	Push         *bool
	Arena        *bool
	TDM          *bool
	TC           *bool
	Infiltration *bool
	Murderball   *bool
	Boss         *bool

	PushSpawnRange *int
	PushBlueSpawn  []float64
	PushBlueCP     []float64
	PushGreenSpawn []float64
	PushGreenCP    []float64

	Extras map[string]any
}

func (*MapExtensions) UnmarshalTOML

func (m *MapExtensions) UnmarshalTOML(data interface{}) error

type MapInfo

type MapInfo struct {
	Author      string `toml:"author"`
	Description string `toml:"description"`
	FogColor    [3]int `toml:"fog_color"`
}

type MasterHost

type MasterHost struct {
	Host string `toml:"host"`
	Port int    `toml:"port"`
}

type PasswordsConfig

type PasswordsConfig struct {
	Manager   string `toml:"manager"`
	Admin     string `toml:"admin"`
	Moderator string `toml:"moderator"`
	Guard     string `toml:"guard"`
	Trusted   string `toml:"trusted"`
}

type RateLimitConfig

type RateLimitConfig struct {
	Enabled               bool `toml:"enabled"`
	PacketsPerSecond      int  `toml:"packets_per_second"`
	BurstSize             int  `toml:"burst_size"`
	PositionPacketsPerSec int  `toml:"position_packets_per_sec"`
	OrientPacketsPerSec   int  `toml:"orient_packets_per_sec"`
	BlockPacketsPerSec    int  `toml:"block_packets_per_sec"`
}

type ServerConfig

type ServerConfig struct {
	Name             string       `toml:"name"`
	Port             int          `toml:"port"`
	Gamemode         int          `toml:"gamemode"`
	CaptureLimit     int          `toml:"capture_limit"`
	Master           bool         `toml:"master"`
	MasterHosts      []MasterHost `toml:"master_hosts"`
	Maps             []string     `toml:"maps"`
	WelcomeMessages  []string     `toml:"welcome_messages"`
	PeriodicMessages []string     `toml:"periodic_messages"`
	MaxPlayers       int          `toml:"max_players"`
	RespawnTime      int          `toml:"respawn_time"`

	// logging configuration
	LogToFile bool `toml:"log_to_file"`

	// ctf specific
	CaptureTimeBonus float64 `toml:"capture_time_bonus"`
	FlagReturnTime   float64 `toml:"flag_return_time"`

	// tdm specific
	KillLimit          int     `toml:"kill_limit"`
	IntelPoints        int     `toml:"intel_points"`
	RemoveIntel        bool    `toml:"remove_intel"`
	HeadshotMultiplier float64 `toml:"headshot_multiplier"`
	EnableKillstreaks  bool    `toml:"enable_killstreaks"`

	// babel specific
	BabelReverse      bool    `toml:"babel_reverse"`
	BabelCaptureLimit int     `toml:"babel_capture_limit"`
	RegenerateTower   bool    `toml:"regenerate_tower"`
	RegenerationRate  float64 `toml:"regeneration_rate"`

	// arena specific
	ArenaScoreLimit    int  `toml:"arena_score_limit"`
	ArenaTimeoutIsDraw bool `toml:"timeout_is_draw"`
	ArenaSuddenDeath   bool `toml:"sudden_death_enabled"`

	// tc specific
	TCMaxScore        int     `toml:"tc_max_score"`
	TCCaptureDistance float64 `toml:"tc_capture_distance"`
	TCCaptureRate     float64 `toml:"tc_capture_rate"`

	// laby specific
	LabyCapLimit   int     `toml:"laby_cap_limit"`
	LabyHogTimeout int     `toml:"laby_hog_timeout"`
	LabyRegenRate  float64 `toml:"laby_regen_rate"`

	// vxlgen tower metadata which is set dynamically after generation
	TowerPosX   int `toml:"-"`
	TowerPosY   int `toml:"-"`
	TowerCellsX int `toml:"-"`
	TowerCellsY int `toml:"-"`
	TowerCellsZ int `toml:"-"`
}

type SpawnArea

type SpawnArea struct {
	Start [3]int `toml:"start"`
	End   [3]int `toml:"end"`
}

type SpawnPointsConfig

type SpawnPointsConfig struct {
	Team1       SpawnArea   `toml:"team1"`
	Team2       SpawnArea   `toml:"team2"`
	Team1Points [][]float64 `toml:"team1_points,omitempty"`
	Team2Points [][]float64 `toml:"team2_points,omitempty"`
}

type TCConfig

type TCConfig struct {
	MaxScore        *int     `toml:"max_score"`
	CaptureDistance *float64 `toml:"capture_distance"`
	CaptureRate     *float64 `toml:"capture_rate"`
}

type TDMConfig

type TDMConfig struct {
	KillLimit          *int     `toml:"kill_limit"`
	IntelPoints        *int     `toml:"intel_points"`
	RemoveIntel        *bool    `toml:"remove_intel"`
	HeadshotMultiplier *float64 `toml:"headshot_multiplier"`
	EnableKillstreaks  *bool    `toml:"enable_killstreaks"`
}

type TeamInfo

type TeamInfo struct {
	Name  string `toml:"name"`
	Color [3]int `toml:"color"`
}

type TeamsConfig

type TeamsConfig struct {
	Team1 TeamInfo `toml:"team1"`
	Team2 TeamInfo `toml:"team2"`
}

type TentArea

type TentArea struct {
	Start [3]int `toml:"start"`
	End   [3]int `toml:"end"`
}

type TentsConfig

type TentsConfig struct {
	Team1 TentArea `toml:"team1"`
	Team2 TentArea `toml:"team2"`
}

type VotingConfig

type VotingConfig struct {
	VotekickEnabled     bool `toml:"votekick_enabled"`
	VotekickPercentage  int  `toml:"votekick_percentage"`
	VotekickBanDuration int  `toml:"votekick_ban_duration"`
	VoteCooldown        int  `toml:"vote_cooldown"`
	VoteTimeout         int  `toml:"vote_timeout"`
	VotemapEnabled      bool `toml:"votemap_enabled"`
	VotemapPercentage   int  `toml:"votemap_percentage"`
	VotemapChoices      int  `toml:"votemap_choices"`
	VotemapAllowExtend  bool `toml:"votemap_allow_extend"`
}

type WaterConfig

type WaterConfig struct {
	Enabled bool    `toml:"enabled"`
	Damage  int     `toml:"damage"`
	Level   float32 `toml:"level"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL