resource

package
v0.0.0-...-a30bc99 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package resource provides natural and manmade resources. It implements a system for dealing with such.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resource

type Resource struct {
	Name         string   `json:"name" db:"name"`
	Description  string   `json:"description" db:"description"`
	MainMaterial string   `json:"main_material" db:"main_material"`
	Origin       string   `json:"origin" db:"origin"`
	Tags         []string `json:"tags" db:"tags"`
	Commonality  int      `json:"commonality" db:"commonality"`
	Value        int      `json:"value" db:"value"`
}

Resource is a useful resource

func ByTag

func ByTag(tag string, from []Resource) []Resource

ByTag returns a slice of resources that have the given tag

func Random

func Random(resources []Resource) Resource

Random returns a random resource from a list

func RandomSet

func RandomSet(min int, max int, resources []Resource) []Resource

RandomSet returns a slice of random elements of the given resources

func (Resource) HasTag

func (resource Resource) HasTag(tag string) bool

HasTag returns true if the resource has a given tag

func (Resource) InSlice

func (resource Resource) InSlice(resources []Resource) bool

InSlice checks if a given resource is in a slice of resources

Jump to

Keyboard shortcuts

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