common

package
v0.5.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	GeneratorPop = "population"
)

Variables

View Source
var Buildings map[BuildingName]Building = map[BuildingName]Building{
	House: {
		Name:      House,
		BuildTime: "10s",
		Cost: []*ResourceCost{
			{Resource: Wood, Amount: 20, Permanent: true},
			{Resource: Population, Amount: 2, Permanent: false},
		},
		Generators: []blueprints.Generator{
			{
				Name:       string(Population),
				Amount:     1,
				TickLength: "2s",
			},
		},
		Limits: map[ResourceName]int{
			Population: 6,
		},
	},

	Warehouse: {
		Name:      Warehouse,
		BuildTime: "10s",
		Cost: []*ResourceCost{
			{Resource: Wood, Amount: 50, Permanent: true},
			{Resource: Population, Amount: 5, Permanent: false},
		},
		Limits: map[ResourceName]int{
			Wood:   100,
			Stone:  100,
			Planks: 40,
		},
	},

	Woodcutter: {
		Name:      Woodcutter,
		BuildTime: "10s",
		Cost: []*ResourceCost{
			{Resource: Wood, Amount: 30, Permanent: true},
			{Resource: Population, Amount: 3, Permanent: false},
		},
		Generators: []blueprints.Generator{
			{
				Name:       string(Wood),
				Amount:     3,
				TickLength: "20s",
			},
		},
	},

	Lumberyard: {
		Name:      Lumberyard,
		BuildTime: "1s",
		Cost: []*ResourceCost{
			{Resource: Wood, Amount: 1, Permanent: false},
		},
		Transformers: []blueprints.Transformer{
			{
				Name: string(Planks),
				Cost: []blueprints.TransformerCost{
					{
						Resource:  string(wood.Name),
						Amount:    5,
						Temporary: false,
					},
				},
				Result: []blueprints.TransformerResult{
					{
						Resource: string(planks.Name),
						Amount:   1,
					},
				},
				TickLength: "10s",
			},
		},
	},
}
View Source
var Resources map[ResourceName]Resource = map[ResourceName]Resource{
	Population: population,
	Wood:       wood,
	Planks:     {Name: Planks, StartingCap: 0},
	Stone:      {Name: Stone, StartingCap: 20},
}

Functions

func GetBuildingID

func GetBuildingID(buildingName string) uuid.UUID

func GetInventoryID

func GetInventoryID(userID uuid.UUID) uuid.UUID

Types

type Building

type Building struct {
	Name         BuildingName
	BuildTime    string
	Cost         []*ResourceCost
	Limits       map[ResourceName]int
	Generators   []blueprints.Generator
	Transformers []blueprints.Transformer
}

type BuildingName

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

type Resource

type Resource struct {
	Name           ResourceName
	StartingAmount int
	StartingCap    int
	CapFormula     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"
)

Jump to

Keyboard shortcuts

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