surface

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package surface provides a typed Go client for the surface property and chunk management commands registered by softmod/factop/surface.lua.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides typed methods for each surface-* RCON command.

func New

func New(conn *client.Conn) *Client

New creates a surface Client using the given connection.

func (*Client) ClearPollution

func (c *Client) ClearPollution(surface string) (string, error)

ClearPollution clears all pollution on the surface.

func (*Client) DeleteChunk

func (c *Client) DeleteChunk(cx, cy int, surface string) (string, error)

DeleteChunk deletes a chunk at the given chunk coordinates.

func (*Client) Generate

func (c *Client) Generate(x, y float64, radius int, surface string) (string, error)

Generate requests chunk generation at the given position with optional radius.

func (*Client) GetInfo

func (c *Client) GetInfo(surface string) (*Info, error)

GetInfo returns surface properties.

func (*Client) List

func (c *Client) List() ([]SurfaceEntry, error)

List returns all surfaces.

func (*Client) Set

func (c *Client) Set(property, value string, surface string) (string, error)

Set sets a surface property. Property must be a writable boolean or numeric property name.

type Info

type Info struct {
	Name                 string  `json:"name"`
	Index                int     `json:"index"`
	AlwaysDay            bool    `json:"always_day"`
	Daytime              float64 `json:"daytime"`
	Darkness             float64 `json:"darkness"`
	FreezeDaytime        bool    `json:"freeze_daytime"`
	PeacefulMode         bool    `json:"peaceful_mode"`
	NoEnemiesMode        bool    `json:"no_enemies_mode"`
	WindSpeed            float64 `json:"wind_speed"`
	WindOrientation      float64 `json:"wind_orientation"`
	SolarPowerMultiplier float64 `json:"solar_power_multiplier"`
	MinBrightness        float64 `json:"min_brightness"`
	TicksPerDay          int     `json:"ticks_per_day"`
	ShowClouds           bool    `json:"show_clouds"`
	GenerateWithLabTiles bool    `json:"generate_with_lab_tiles"`
}

Info holds the parsed surface properties from surface-info.

func ParseInfo

func ParseInfo(s string) (*Info, error)

ParseInfo parses the surface-info wire format: key:value,key:value,...

type SurfaceEntry

type SurfaceEntry struct {
	Name  string `json:"name"`
	Index int    `json:"index"`
}

SurfaceEntry is a name:index pair from surface-list.

func ParseList

func ParseList(s string) ([]SurfaceEntry, error)

ParseList parses the surface-list wire format: name:index,name:index,...

Jump to

Keyboard shortcuts

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