inventory

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CallbackBuildings    = "buildings"
	CallbackGenerators   = "generators"
	CallbackTransformers = "transformers"

	KeyBuilding          = "building"
	KeyDisableGenerators = "disable_generators"

	KeyResource = "resource"
	KeyAmount   = "amount"

	StateQueued   = "queued"
	StateInactive = "inactive"
	StateActive   = "active"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Building added in v0.2.0

type Building struct {
	ID                uuid.UUID
	State             string
	WorkersMaximum    int
	WorkersCurrent    int
	Completion        time.Time
	ReservedResources []ReservedResource
}

type BuildingRegister

type BuildingRegister struct {
	Name      common.BuildingName
	Completed []Building
	Queue     []Building
	// contains filtered or unexported fields
}

type Callback added in v0.2.0

type Callback struct {
	Name    string
	Subject string
	Method  func(*protobuf.TimerFired)
}

type Grain

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

func (*Grain) Decode

func (g *Grain) Decode(b []byte) error

func (*Grain) Encode

func (g *Grain) Encode() ([]byte, error)

func (*Grain) Identity

func (g *Grain) Identity() string

func (*Grain) Init

func (g *Grain) Init(ctx cluster.GrainContext)

func (*Grain) Kind

func (g *Grain) Kind() string

func (*Grain) ReceiveDefault

func (g *Grain) ReceiveDefault(ctx cluster.GrainContext)

func (*Grain) Reserve added in v0.2.0

func (*Grain) Restore

func (*Grain) Start

func (*Grain) Terminate

func (g *Grain) Terminate(ctx cluster.GrainContext)

type InsufficientResourceError added in v0.2.0

type InsufficientResourceError struct {
	Resource common.ResourceName
}

func (InsufficientResourceError) Error added in v0.2.0

type InvalidResourceError added in v0.2.0

type InvalidResourceError struct {
	Resource common.ResourceName
}

func (InvalidResourceError) Error added in v0.2.0

func (e InvalidResourceError) Error() string

type ReservedResource added in v0.2.0

type ReservedResource struct {
	Name      string
	Amount    int
	Permanent bool
}

type ResourceRegister

type ResourceRegister struct {
	Name       common.ResourceName
	CapFormula string
	Cap        int
	Amount     int
	Reserved   int
	// contains filtered or unexported fields
}

func (*ResourceRegister) Update

func (rr *ResourceRegister) Update(amount int)

func (*ResourceRegister) UpdateCap

func (rr *ResourceRegister) UpdateCap(resources map[common.ResourceName]*ResourceRegister, buildings map[common.BuildingName]*BuildingRegister) error

Jump to

Keyboard shortcuts

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