blueprints

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindBuilding string = "building"
	KindResource string = "resource"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Blueprint

type Blueprint interface {
	Encode() ([]byte, error)
	Decode(src []byte) error
	Kind() string
	GetID() string
	GetVersion() int
}

type Building

type Building struct {
	ID             uuid.UUID            `json:"id" yaml:"id"`
	Name           BuildingName         `json:"name" yaml:"name"`
	InitialAmount  int                  `json:"initial_amount" yaml:"initial_amount"`
	WorkersMaximum int                  `json:"workers_maximum" yaml:"workers_maximum"`
	Cost           []ResourceCost       `json:"cost" yaml:"cost"`
	Generates      []Generator          `json:"generates" yaml:"generates"`
	Transforms     []Transformer        `json:"transforms" yaml:"transforms"`
	Stores         map[ResourceName]int `json:"stores" yaml:"stores"`
	BuildTime      string               `json:"build_time" yaml:"build_time"`
	Version        int                  `json:"version" yaml:"version"`
}

func (*Building) Decode

func (b *Building) Decode(src []byte) error

func (*Building) Encode

func (b *Building) Encode() ([]byte, error)

func (*Building) GetID

func (b *Building) GetID() string

func (*Building) GetVersion

func (b *Building) GetVersion() int

func (*Building) Kind

func (b *Building) Kind() string

type BuildingName

type BuildingName string
const (
	House      BuildingName = "house"
	Warehouse  BuildingName = "warehouse"
	Woodcutter BuildingName = "woodcutter"
	Lumberyard BuildingName = "lumberyard"
)

func (BuildingName) String

func (r BuildingName) String() string

type Generator

type Generator struct {
	Name       ResourceName `json:"name" yaml:"name"`
	Amount     int          `json:"amount" yaml:"amount"`
	TickLength string       `json:"tick_length" yaml:"tick_length"`
}

type Resource

type Resource struct {
	Name           ResourceName `json:"name" yaml:"name"`
	StartingAmount int          `json:"starting_amount" yaml:"starting_amount"`
	StartingCap    int          `json:"starting_cap" yaml:"starting_cap"`
	CapFormula     string       `json:"cap_formula" yaml:"cap_formula"`
	Version        int          `json:"version" yaml:"version"`
}

func (*Resource) Decode

func (r *Resource) Decode(src []byte) error

func (*Resource) Encode

func (r *Resource) Encode() ([]byte, error)

func (*Resource) GetID

func (r *Resource) GetID() string

func (*Resource) GetVersion

func (r *Resource) GetVersion() int

func (*Resource) Kind

func (r *Resource) Kind() string

type ResourceCost

type ResourceCost struct {
	Resource  ResourceName
	Amount    int
	Permanent bool
}

type ResourceName

type ResourceName string
const (
	Population ResourceName = "Population"
	Wood       ResourceName = "Wood"
	Stone      ResourceName = "Stone"
	Planks     ResourceName = "Planks"
)

func (ResourceName) String

func (r ResourceName) String() string

type Transformer

type Transformer struct {
	Name       string              `json:"name" yaml:"name"`
	Cost       []TransformerCost   `json:"cost" yaml:"cost"`
	Result     []TransformerResult `json:"result" yaml:"result"`
	TickLength string              `json:"tick_length" yaml:"tick_length"`
}

func (Transformer) CostStructList

func (t Transformer) CostStructList() *structpb.ListValue

func (Transformer) ResultStructList

func (t Transformer) ResultStructList() *structpb.ListValue

type TransformerCost

type TransformerCost struct {
	Resource  ResourceName `json:"resource" yaml:"resource"`
	Amount    int          `json:"amount" yaml:"amount"`
	Temporary bool         `json:"is_temporary" yaml:"is_temporary"`
}

type TransformerResult

type TransformerResult struct {
	Resource ResourceName `json:"resource" yaml:"resource"`
	Amount   int          `json:"amount" yaml:"amount"`
}

Jump to

Keyboard shortcuts

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