building

package
v0.0.0-...-b281173 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assembler

type Assembler struct {
	Entity *data.AssemblingMachine
	// contains filtered or unexported fields
}

func NewAssembler

func NewAssembler(spec *data.AssemblingMachine) *Assembler

func (*Assembler) CraftingSpeed

func (a *Assembler) CraftingSpeed() float64

func (*Assembler) DoCraft

func (a *Assembler) DoCraft() CraftStatus

func (*Assembler) EnergySource

func (a *Assembler) EnergySource() data.EnergySource

func (*Assembler) EnergyUsage

func (a *Assembler) EnergyUsage() float64

func (*Assembler) Inventory

func (a *Assembler) Inventory(slot constants.Inventory) Inventory

func (*Assembler) Name

func (a *Assembler) Name() string

func (*Assembler) ProductivityBonus

func (a *Assembler) ProductivityBonus(recipe string) float64

func (*Assembler) PutModules

func (a *Assembler) PutModules(modules []string) error

func (*Assembler) Recipe

func (a *Assembler) Recipe() *data.Recipe

func (*Assembler) SetRecipe

func (a *Assembler) SetRecipe(recipe *data.Recipe) map[string]int

func (*Assembler) Slots

func (a *Assembler) Slots() *slots

func (*Assembler) Status

func (a *Assembler) Status() CraftStatus

func (*Assembler) TakeModules

func (a *Assembler) TakeModules(modules []string) error

type Boiler

type Boiler struct {
	Entity *data.Boiler
	// contains filtered or unexported fields
}

func NewBoiler

func NewBoiler(spec *data.Boiler) *Boiler

func (*Boiler) Inventory

func (b *Boiler) Inventory(slot constants.Inventory) Inventory

func (*Boiler) Name

func (b *Boiler) Name() string

func (*Boiler) ProductivityBonus

func (b *Boiler) ProductivityBonus(recipe string) float64

func (*Boiler) PutModules

func (b *Boiler) PutModules(modules []string) error

func (*Boiler) Slots

func (b *Boiler) Slots() *slots

func (*Boiler) TakeModules

func (b *Boiler) TakeModules(modules []string) error

type Building

type Building interface {
	Name() string
	Slots() *slots
	Inventory(slot constants.Inventory) Inventory
	PutModules(modules []string) error
	TakeModules(modules []string) error
	ProductivityBonus(recipe string) float64
}

type CraftStatus

type CraftStatus byte
const (
	CraftStatusNoRecipe CraftStatus = iota
	CraftStatusRunning
	CraftStatusWaitingForInput
	CraftStatusOutputBlocked
)

type CraftingBuilding

type CraftingBuilding interface {
	Building
	EnergySource() data.EnergySource
	EnergyUsage() float64
	CraftingSpeed() float64

	// the current recipe that's set or (for furnaces) computed based on the input
	Recipe() *data.Recipe

	// Current status of the machine. Crafting is simplified and assumed to be instant
	// as long as the ingredients are present and there's space to put the products
	Status() CraftStatus

	// applies one crafting cycle, accounting for inventory limitations and
	// module bonuses, and returns the status of the machine
	DoCraft() CraftStatus
}

type ErrForbiddenModules

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

func (ErrForbiddenModules) Error

func (e ErrForbiddenModules) Error() string

type ErrNotEnoughModules

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

func (ErrNotEnoughModules) Error

func (e ErrNotEnoughModules) Error() string

type ErrTooManyModules

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

func (ErrTooManyModules) Error

func (e ErrTooManyModules) Error() string

type Furnace

type Furnace struct {
	Entity *data.Furnace
	// contains filtered or unexported fields
}

func NewFurnace

func NewFurnace(spec *data.Furnace) *Furnace

func (*Furnace) CraftingSpeed

func (f *Furnace) CraftingSpeed() float64

func (*Furnace) DoCraft

func (f *Furnace) DoCraft() CraftStatus

func (*Furnace) EnergySource

func (f *Furnace) EnergySource() data.EnergySource

func (*Furnace) EnergyUsage

func (f *Furnace) EnergyUsage() float64

func (*Furnace) Inventory

func (f *Furnace) Inventory(slot constants.Inventory) Inventory

func (*Furnace) Name

func (f *Furnace) Name() string

func (*Furnace) ProductivityBonus

func (f *Furnace) ProductivityBonus(recipe string) float64

func (*Furnace) PutModules

func (f *Furnace) PutModules(modules []string) error

func (*Furnace) Recipe

func (f *Furnace) Recipe() *data.Recipe

func (*Furnace) Slots

func (f *Furnace) Slots() *slots

func (*Furnace) Status

func (f *Furnace) Status() CraftStatus

func (*Furnace) TakeModules

func (f *Furnace) TakeModules(modules []string) error

type Inventory

type Inventory interface {
	Put(item string, amount int) error
	Take(item string, amount int) error

	Count(item string) int
}

type Lab

type Lab struct {
	Entity *data.Lab
	// contains filtered or unexported fields
}

func NewLab

func NewLab(spec *data.Lab) *Lab

func (*Lab) Inventory

func (l *Lab) Inventory(slot constants.Inventory) Inventory

func (*Lab) Name

func (l *Lab) Name() string

func (*Lab) ProductivityBonus

func (l *Lab) ProductivityBonus(_ string) float64

func (*Lab) PutModules

func (l *Lab) PutModules(modules []string) error

func (*Lab) Slots

func (l *Lab) Slots() *slots

func (*Lab) TakeModules

func (l *Lab) TakeModules(modules []string) error

type Modules

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

func (*Modules) Count

func (m *Modules) Count(module string) int

func (Modules) ProductivityBonus

func (m Modules) ProductivityBonus(recipe string) float64

func (*Modules) Put

func (m *Modules) Put(module string, amount int) error

func (*Modules) Take

func (m *Modules) Take(module string, amount int) error

Jump to

Keyboard shortcuts

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