Documentation
¶
Overview ¶
Package resource provides a typed Go client for the resource and pollution commands registered by softmod/factop/resource.lua.
Index ¶
- type Area
- type Client
- func (c *Client) Count(surface string) ([]ResourceCount, error)
- func (c *Client) Find(area Area, name string, limit int, surface string) ([]Resource, error)
- func (c *Client) GetPollution(x, y float64, surface string) (float64, error)
- func (c *Client) SetAmount(x, y float64, amount uint32, surface string) (string, error)
- func (c *Client) SetPollution(x, y, amount float64, surface string) (string, error)
- func (c *Client) TotalPollution(surface string) (float64, error)
- type Resource
- type ResourceCount
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 resource-* and pollution-* RCON command.
func (*Client) Count ¶
func (c *Client) Count(surface string) ([]ResourceCount, error)
Count returns total resource counts for the surface.
func (*Client) GetPollution ¶
GetPollution returns the pollution value at the given position.
func (*Client) SetPollution ¶
SetPollution sets the pollution value at the given position.
type Resource ¶
type Resource struct {
Name string `json:"name"`
X float64 `json:"x"`
Y float64 `json:"y"`
Amount uint32 `json:"amount"`
}
Resource is a resource entity with position and amount.
func ParseResources ¶
ParseResources parses the resource-find wire format: name:x:y:amount,...
type ResourceCount ¶
ResourceCount is a resource name and its total count on a surface.
func ParseCounts ¶
func ParseCounts(s string) ([]ResourceCount, error)
ParseCounts parses the resource-count wire format: name:count,name:count,...