Documentation ¶
Index ¶
- type Bag
- func (b *Bag) Add(elem interface{}, count uint) error
- func (b *Bag) GetAvailableSpace() uint
- func (b *Bag) GetItemCount() uint
- func (b *Bag) Has(elem interface{}, count uint) bool
- func (b *Bag) IsEmpty() bool
- func (b *Bag) IsFull() bool
- func (b *Bag) MarshalJSON() ([]byte, error)
- func (b *Bag) Remove(elem interface{}, count uint) error
- func (b *Bag) UnmarshalJSON(bytes []byte) error
- type Colonist
- type Counter
- type DesireType
- type Desires
- type Equipment
- type Equippable
- type NeedType
- type Needs
- type SkillType
- type Skills
- type Stackable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bag ¶
type Bag struct { Size uint Items []interface{} }
func (*Bag) GetAvailableSpace ¶
func (*Bag) GetItemCount ¶
func (*Bag) MarshalJSON ¶
MarshalJSON will marshal needs into it's attributes
func (*Bag) UnmarshalJSON ¶
UnmarshalJSON fills in the attributes of needs
type Colonist ¶
type Colonist struct { Key string `json:"key"` Name string `json:"name"` Status string `json:"status"` Age uint `json:"age"` Bag *storage.Storage `json:"bag"` Equipment *Equipment `json:"equipment"` Desires Desires `json:"desires"` Needs Needs `json:"needs"` Skills Skills `json:"skills"` }
Colonist struct
func NewColonist ¶
func NewColonist() *Colonist
GenerateColonist returns a new colonist with the given name and a random set of skills and stats.
func (*Colonist) EquipArmor ¶
func (c *Colonist) EquipArmor(e Equippable) (Equippable, error)
EquipArmor equips the armor if the requirements are met. Returns the currently equipped armor or nil if no armor is equipped.
func (*Colonist) EquipHelmet ¶
func (c *Colonist) EquipHelmet(e Equippable) (Equippable, error)
EquipHelmet equips the helmet if the requirements are met. Returns the currently equipped helmet or nil if no helmet is equipped.
func (*Colonist) EquipWeapon ¶
func (c *Colonist) EquipWeapon(e Equippable) (Equippable, error)
EquipWeapon equips the weapon if the requirements are met. Returns the currently equipped weapon or nil if no weapon is equipped.
type DesireType ¶
type DesireType string
const ( Fulfillment DesireType = "Fulfillment" Belonging DesireType = "Belonging" Esteem DesireType = "Esteem" )
type Desires ¶
type Desires map[DesireType]float64
func (Desires) Decrease ¶
func (d Desires) Decrease(t DesireType, amount float64)
func (Desires) Increase ¶
func (d Desires) Increase(t DesireType, amount float64)
type Equipment ¶
type Equipment struct { Head Equippable `json:"head"` Weapon Equippable `json:"weapon"` Body Equippable `json:"body"` }
Equipment for the Colonist
type Equippable ¶
type Equippable interface { }
Equippable items can be assigned to the head, weapon or body slot of a colonist's equipment.
type SkillType ¶
type SkillType string
const ( Hunting SkillType = "Hunting" Crafting SkillType = "Crafting" Cooking SkillType = "Cooking" Building SkillType = "Building" Gathering SkillType = "Gathering" Mining SkillType = "Mining" Woodcutting SkillType = "Woodcutting" Science SkillType = "Science" Combat SkillType = "Combat" Charisma SkillType = "Charisma" Medicine SkillType = "Medicine" Tinkering SkillType = "Tinkering" )