Documentation
¶
Overview ¶
Package species implements the backbone of all living entities in a world
Index ¶
- type Data
- type Simplified
- type Species
- func ByResource(resource string, from []Species) []Species
- func ByTag(tag string, from []Species) []Species
- func ByTagIn(tags []string, from []Species) []Species
- func ExcludeTag(tag string, from []Species) []Species
- func FilterHumidity(humidity int, from []Species) []Species
- func FilterTemperature(temperature int, from []Species) []Species
- func Load(fileName string) ([]Species, error)
- func Random(amount int, from []Species) []Species
- func RandomWithResourceTag(resourceTag string, from []Species) (Species, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct {
Species []Species `json:"species"`
}
Data is a struct containing a slice of Species
type Simplified ¶
type Simplified struct { Name string `json:"name"` PluralName string `json:"plural_name"` Adjective string `json:"adjective"` Description string `json:"description"` }
Simplified is a simplified version of a species meant for JSON display
type Species ¶
type Species struct { Name string `json:"name" db:"name"` PluralName string `json:"plural_name" db:"plural_name"` Adjective string `json:"adjective" db:"adjective"` Commonality int `json:"commonality" db:"commonality"` PossibleTraits []trait.Template `json:"possible_traits" db:"possible_traits"` // Traits that individuals of this species *might* have CommonTraits []trait.Template `json:"common_traits" db:"common_traits"` // Traits that all members of this species share AgeCategories []age.Category `json:"age_categories" db:"age_categories"` MinHumidity int `json:"min_humidity" db:"humidity_min"` MaxHumidity int `json:"max_humidity" db:"humidity_max"` MinTemperature int `json:"min_temperature" db:"temperature_min"` MaxTemperature int `json:"max_temperature" db:"temperature_max"` Resources []resource.Resource `json:"resources" db:"resources"` // These are resources that can be derived from this species Tags []string `json:"tags" db:"tags"` }
Species is a species of living thing
func ByResource ¶
ByResource returns a slice of species that have the given resource
func ExcludeTag ¶
ExcludeTag returns a slice without a given tag
func FilterHumidity ¶
FilterHumidity filters a slice of Species by humidity
func FilterTemperature ¶
FilterTemperature filters a slice of Species by temperature
func RandomWithResourceTag ¶
RandomWithResourceTag returns a random species that has a resource with the given tag
func (Species) HasResource ¶
HasResource returns true if the species has a given resource
func (Species) HasResourceWithTag ¶
HasResourceWithTag returns true if the species has a resource with a given tag
func (Species) Simplify ¶
func (s Species) Simplify() Simplified
Simplify returns a simplified version of a given species