models

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RockyPlanet BodyType = iota
	SmallGasGiant
	LargeGasGiant
	PlanetoidBelt
	StellarBody
	Empty
	StellarBodyString   = "star"
	SmallGasGiantString = "small_gas_giant"
	LargeGasGiantString = "large_gas_giant"
	PlanetoidBeltString = "planetoid_belt"
	RockyPlanetString   = "rocky_planet"
)
View Source
const (
	Ring  = 0
	Small = -1
)
View Source
const (
	SOLITARY int = 7
	BINARY   int = 11
	TRINARY  int = 12
)
View Source
const (
	StarportA = iota
	StarportB
	StarportC
	StarportD
	StarportE
	StarportX
	StarportY
	StarportH
	StarportG
	StarportF
	StarportNone
)
View Source
const CENTER = -1 << (bits.UintSize - 1) // MIN_INT
View Source
const FAR_ORBIT = 1<<(bits.UintSize-1) - 1 // MAX_INT
View Source
const NEAR_ORBIT = -1

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body interface {
	GetType() BodyType
}

type BodyType

type BodyType int

func (BodyType) MarshalJSON

func (bt BodyType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (*BodyType) UnmarshalJSON

func (bt *BodyType) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type EmptyOrbit

type EmptyOrbit struct {
	StarSystemId   int
	StellarOrbit   int
	PlanetaryOrbit int
}

func (*EmptyOrbit) GetOrbit

func (eo *EmptyOrbit) GetOrbit() (int, int)

func (*EmptyOrbit) GetType

func (eo *EmptyOrbit) GetType() BodyType

func (*EmptyOrbit) MarshalJSON

func (eo *EmptyOrbit) MarshalJSON() ([]byte, error)

func (*EmptyOrbit) ToMap

func (eo *EmptyOrbit) ToMap() map[string]interface{}

type GasGiant

type GasGiant struct {
	Type  BodyType
	Moons map[int]Planet
	// contains filtered or unexported fields
}

func CreateGasGiant

func CreateGasGiant(dg *util.DiceGenerator) *GasGiant

func (*GasGiant) FromMap

func (gg *GasGiant) FromMap(init map[string]interface{})

func (*GasGiant) GetOrbit

func (gg *GasGiant) GetOrbit() (int, int)

func (*GasGiant) GetType

func (gg *GasGiant) GetType() BodyType

func (*GasGiant) MarshalJSON

func (gg *GasGiant) MarshalJSON() ([]byte, error)

func (*GasGiant) SetType

func (gg *GasGiant) SetType(bt BodyType) error

func (*GasGiant) ToMap

func (gg *GasGiant) ToMap() map[string]interface{}

func (*GasGiant) UnmarshalJSON

func (gg *GasGiant) UnmarshalJSON(b []byte) error

type MinorPlanet

type MinorPlanet struct {
	Planet
	MainWorldId     int
	Classifications TradeClassifications
	Zone            Zone
}

func (*MinorPlanet) GetType

func (mp *MinorPlanet) GetType() BodyType

type Orbit

type Orbit interface {
	GetType() BodyType
	GetOrbit() (int, int)
}

type Planet

type Planet struct {
	Id   int    `json:"-"`
	Name string `json:"name"`
	UniversalPlanetProfile
	Port      Starport `json:"starport"`
	ScoutBase bool     `json:"scout"`
	NavalBase bool     `json:"naval"`

	Satellites      map[int]*Planet      `json:"-"`
	Classifications TradeClassifications `json:"classifications"`
	// contains filtered or unexported fields
}

func NewPlanet

func NewPlanet(initial map[string]interface{}, dg *DiceGenerator) *Planet

func (*Planet) FromMap

func (p *Planet) FromMap(init map[string]interface{})

func (*Planet) GetOrbit

func (p *Planet) GetOrbit() (int, int)

func (*Planet) GetType

func (p *Planet) GetType() BodyType

func (*Planet) ToMap

func (p *Planet) ToMap() map[string]interface{}

type Region

type Region struct {
	Id     int
	X      int
	Y      int
	Name   string
	Height int
	Width  int
}

type Star

type Star struct {
	Class        StellarClass `json:"class"`
	Size         StellarSize  `json:"size"`
	SizeFraction int          `json:"fraction"`
	Orbit        int          `json:"orbit"`
}

func (*Star) FromMap

func (s *Star) FromMap(init map[string]interface{})

func (*Star) GetNearestMajorClass

func (s *Star) GetNearestMajorClass() string

func (*Star) GetOrbits

func (s *Star) GetOrbits(zones ...Zone) map[int]interface{}

func (*Star) GetType

func (s *Star) GetType() BodyType

func (*Star) MarshalJSON

func (s *Star) MarshalJSON() ([]byte, error)

func (*Star) ToMap

func (s *Star) ToMap() map[string]interface{}

func (*Star) UnmarshalJSON

func (s *Star) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type StarPosition

type StarPosition int
const (
	PRIMARY StarPosition = iota
	SECONDARY
	TERTIARY
)

func (StarPosition) MarshalJSON

func (sp StarPosition) MarshalJSON() ([]byte, error)

func (*StarPosition) UnmarshalJSON

func (sp *StarPosition) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type StarSystem

type StarSystem struct {
	Stars map[StarPosition]*Star `json:"stars"`
	*Planet
	X          int        `json:"x"`
	Y          int        `json:"y"`
	Sector     string     `json:"sector"`
	SubSector  string     `json:"subsector"`
	TravelZone TravelZone `json:"travel_zone,string"`

	Orbits []Orbit `json:"orbits"`
	// contains filtered or unexported fields
}

func NewStarSystem

func NewStarSystem(initial map[string]interface{}, dg *util.DiceGenerator) *StarSystem

func (*StarSystem) Coordinate

func (ss *StarSystem) Coordinate() string

func (*StarSystem) FromMap

func (ss *StarSystem) FromMap(init map[string]interface{})

func (*StarSystem) GetBodies

func (ss *StarSystem) GetBodies(bodyTypes ...BodyType) []Orbit

func (*StarSystem) MarshalJSON

func (ss *StarSystem) MarshalJSON() ([]byte, error)

func (*StarSystem) ToMap

func (ss *StarSystem) ToMap() map[string]interface{}

func (*StarSystem) UnmarshalJSON

func (ss *StarSystem) UnmarshalJSON(b []byte) error

type Starport

type Starport int

func (Starport) MarshalJSON

func (sp Starport) MarshalJSON() ([]byte, error)

func (Starport) UnmarshalJSON

func (sp Starport) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type StellarClass

type StellarClass int

StellarClass represents the spectral classification

const (
	B StellarClass = iota
	A
	M
	K
	G
	F
)

func GetAllStellarClasses

func GetAllStellarClasses() []StellarClass

GetAllStellarClasses provides all stellar classes

func (StellarClass) MarshalJSON

func (sc StellarClass) MarshalJSON() ([]byte, error)

func (*StellarClass) ToString

func (sc *StellarClass) ToString() string

func (*StellarClass) UnmarshalJSON

func (sc *StellarClass) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type StellarSize

type StellarSize int

StellarSize represents the size of a star

const (
	Ia StellarSize = iota
	Ib
	II
	III
	IV
	V
	VI
	D
)

func GetAllStellarSizes

func GetAllStellarSizes() []StellarSize

GetAllStellarSizes returns all valid stellar sizes

func (StellarSize) MarshalJSON

func (ss StellarSize) MarshalJSON() ([]byte, error)

func (*StellarSize) ToString

func (ss *StellarSize) ToString() string

func (*StellarSize) UnmarshalJSON

func (ss *StellarSize) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type TradeClassification

type TradeClassification int
const (
	Agricultural TradeClassification = iota
	NonAgricultural
	Industrial
	NonIndustrial
	Rich
	Poor
	Farming
	Mining
	Colony
	Research
	Military
)

func (TradeClassification) MarshalJSON

func (tc TradeClassification) MarshalJSON() ([]byte, error)

func (*TradeClassification) UnmarshalJSON

func (tc *TradeClassification) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type TradeClassifications

type TradeClassifications map[TradeClassification]bool

func (TradeClassifications) MarshalJSON

func (tc TradeClassifications) MarshalJSON() ([]byte, error)

func (TradeClassifications) UnmarshalJSON

func (tc TradeClassifications) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type TravelZone

type TravelZone int

TravelZone Interstellar Travel Zone

const (
	Green TravelZone = iota
	Yellow
	Red
)

func (TravelZone) MarshalJSON

func (tz TravelZone) MarshalJSON() ([]byte, error)

func (*TravelZone) UnmarshalJSON

func (tz *TravelZone) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type UniversalPlanetProfile

type UniversalPlanetProfile struct {
	Size       int `json:"size"`
	Atmosphere int `json:"atmosphere"`
	Hydro      int `json:"hydro"`
	Population int `json:"population"`
	Government int `json:"government"`
	LawLevel   int `json:"lawlevel"`
	TechLevel  int `json:"techlevel"`
}

func (*UniversalPlanetProfile) FromMap

func (upp *UniversalPlanetProfile) FromMap(init map[string]interface{})

func (*UniversalPlanetProfile) ToMap

func (upp *UniversalPlanetProfile) ToMap() map[string]interface{}

type Zone

type Zone int

Zone stores orbital zone types

const (
	UNAVAILABLE Zone = iota
	INNER
	HABITABLE
	OUTER
)

Orbit Zones (UNAVAILABLE = inside star, INNER = inside habitable zone, OUTER = outside habitable zone )

func (Zone) MarshalJSON

func (sz Zone) MarshalJSON() ([]byte, error)

func (Zone) ToString

func (z Zone) ToString() string

func (*Zone) UnmarshalJSON

func (z *Zone) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

Jump to

Keyboard shortcuts

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