Module resource

Module resource 

Source
Expand description

§Resource Module

This module defines the resources that can be generated and combined in the game. It provides a framework for creating basic and complex resources, and for defining the recipes that govern their creation.

§Resources

Resources are defined by the Resource trait, which provides a common interface for all resources. There are two types of resources:

  • Basic Resources: These are the simplest resources, and can be generated with just an EnergyCell. Examples include Oxygen and Hydrogen.
  • Complex Resources: These are created by combining other resources and an energy cell. Examples include Water and Diamond.

§Generator and Combinator

The Generator and Combinator structs are used to manage the recipes for creating resources. The Generator is responsible for creating basic resources, while the Combinator is responsible for creating complex resources.

Each planet has its own Generator and Combinator, which are initialized with the recipes that are available to that planet.

Structs§

AIPartner
A complex resource.
Carbon
A basic resource.
Combinator
Manages the recipes and production of complex resources for a planet.
Diamond
A complex resource.
Dolphin
A complex resource.
Generator
Manages the recipes and production of basic resources for a planet.
Hydrogen
A basic resource.
Life
A complex resource.
Oxygen
A basic resource.
Robot
A complex resource.
Silicon
A basic resource.
Water
A complex resource.

Enums§

BasicResource
An enum that provides a unified type for all possible basic resources.
BasicResourceType
An enum that identifies a BasicResource type without actually containing the underlying resource.
ComplexResource
An enum that provides a unified type for all possible complex resources.
ComplexResourceRequest
An enum that represents a structured request to produce a specific complex resource.
ComplexResourceType
An enum that identifies a ComplexResource type without actually containing the underlying resource.
GenericResource
An enum that contains a resource, which can be either a BasicResource or a ComplexResource.
ResourceType
An enum that identifies a resource, which can be either a BasicResourceType or a ComplexResourceType, without actually containing the underlying resource.

Traits§

Resource
A trait that provides a common interface for all resources.