tile

package
v0.1.18 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 tile provides a typed Go client for the tile manipulation commands registered by softmod/factop/tile.lua.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Area

type Area struct {
	X1 int
	Y1 int
	X2 int
	Y2 int
}

Area defines a rectangular region in tile coordinates.

func (Area) String

func (a Area) String() string

String formats the area as the x1,y1,x2,y2 wire format.

type Client

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

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

func New

func New(conn *client.Conn) *Client

New creates a tiles Client using the given connection.

func (*Client) Checkerboard

func (c *Client) Checkerboard(area Area, tileA, tileB string, surface string) (string, error)

Checkerboard fills the area with an alternating pattern of two tile types. Corresponds to: /tile-checker x1,y1,x2,y2 tileA tileB [surface]

func (*Client) Fill

func (c *Client) Fill(area Area, tileName string, surface string) (string, error)

Fill places a single tile type across the entire area. Corresponds to: /tile-fill x1,y1,x2,y2 tileName [surface]

func (*Client) Read

func (c *Client) Read(area Area, filterName string, surface string) ([]Tile, error)

Read returns the tiles in the given area, optionally filtered by name. Corresponds to: /tile-read x1,y1,x2,y2 [filterName] [surface]

func (*Client) Remove

func (c *Client) Remove(area Area, filterName string, surface string) (string, error)

Remove restores hidden tiles in the area, optionally filtered by name. Corresponds to: /tile-remove x1,y1,x2,y2 [filterName] [surface]

func (*Client) Replace

func (c *Client) Replace(area Area, fromName, toName string, surface string) (string, error)

Replace swaps one tile type for another across the area. Corresponds to: /tile-replace x1,y1,x2,y2 fromName toName [surface]

type Tile

type Tile struct {
	Name string `json:"name"`
	X    int    `json:"x"`
	Y    int    `json:"y"`
}

Tile represents a single tile at a position.

func Parse

func Parse(s string) ([]Tile, error)

Parse converts the compact tile-read wire format into a slice of Tile. The wire format is: name:x:y,name:x:y,... An empty string returns nil, nil.

Jump to

Keyboard shortcuts

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