Documentation
¶
Index ¶
- type AssembleConstructionCrewOrder
- type AssembleFactoryGroupOrder
- type AssembleFarmGroupOrder
- type AssembleMineGroupOrder
- type AssembleSpyTeamOrder
- type AssemblyPhaseOrder
- type ClusterList
- type ClusterListItem
- type ControlColonyOrder
- type ControlPhaseOrder
- type ControlShipOrder
- type Coordinates
- type CorS
- type CorSs
- type Deposit
- type Deposits
- type Engine
- func (e *Engine) ClusterScan(origin Coordinates) ClusterList
- func (e *Engine) Execute(pos []*PhaseOrders, phases ...string) error
- func (e *Engine) ExecuteAssemblyPhase(pos []*PhaseOrders) (errs []error)
- func (e *Engine) ExecuteCombatPhase(pos []*PhaseOrders) (errs []error)
- func (e *Engine) ExecuteControlPhase(pos []*PhaseOrders) (errs []error)
- func (e *Engine) ExecuteFactoryProductionPhase(pos []*PhaseOrders) (errs []error)
- func (e *Engine) ExecuteFarmProductionPhase(pos []*PhaseOrders) (errs []error)
- func (e *Engine) ExecuteFuelAllocationPhase(pos []*PhaseOrders) (errs []error)
- func (e *Engine) ExecuteLaborAllocationPhase(pos []*PhaseOrders) (errs []error)
- func (e *Engine) ExecuteLifeSupportPhase(pos []*PhaseOrders) (errs []error)
- func (e *Engine) ExecuteMineProductionPhase(pos []*PhaseOrders) (errs []error)
- func (e *Engine) ExecuteRetoolPhase(pos []*PhaseOrders) (errs []error)
- func (e *Engine) NextSeq() int
- func (e *Engine) Report(w io.Writer, playerIds ...int) error
- type FactoryGroup
- type FactoryGroupUnits
- type FactoryGroups
- type FarmGroup
- type FarmGroups
- type InventoryUnit
- type InventoryUnits
- type MineGroup
- type MineGroups
- type NameColonyOrder
- type NameShipOrder
- type Nation
- type Pay
- type PhaseOrders
- type Planet
- type Player
- type Population
- type Rations
- type RetoolFactoryGroupOrder
- type RetoolMiningGroupOrder
- type RetoolPhaseOrder
- type Skills
- type Star
- type Stars
- type System
- type Unit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssembleConstructionCrewOrder ¶
type AssembleFactoryGroupOrder ¶
type AssembleFarmGroupOrder ¶
type AssembleMineGroupOrder ¶
type AssembleSpyTeamOrder ¶
type AssemblyPhaseOrder ¶
type AssemblyPhaseOrder struct { ConstructionCrew *AssembleConstructionCrewOrder FactoryGroup *AssembleFactoryGroupOrder FarmGroup *AssembleFarmGroupOrder MiningGroup *AssembleMineGroupOrder SpyTeam *AssembleSpyTeamOrder }
type ClusterList ¶
type ClusterList []*ClusterListItem
func (ClusterList) Less ¶
func (u ClusterList) Less(i, j int) bool
Less implements the sort.Sort interface
func (ClusterList) Swap ¶
func (u ClusterList) Swap(i, j int)
Swap implements the sort.Sort interface
type ClusterListItem ¶
type ControlColonyOrder ¶
type ControlColonyOrder struct {
Id string // id of colony to take control of
}
type ControlPhaseOrder ¶
type ControlPhaseOrder struct { ControlColony *ControlColonyOrder ControlShip *ControlShipOrder NameColony *NameColonyOrder NameShip *NameShipOrder }
type ControlShipOrder ¶
type ControlShipOrder struct {
Id string // id of ship to take control of
}
type Coordinates ¶
Coordinates are the x,y,z coordinates of a system
func (Coordinates) String ¶
func (c Coordinates) String() string
type CorS ¶
type CorS struct { Id int // unique identifier Kind string // orbital, ship, or surface HullId string // S or C + MSN MSN int // manufacturer serial number; in game id for the colony or ship BuiltBy *Nation // nation that originally built the colony or ship Name string // name of this colony or ship TechLevel int // tech level of this colony or ship ControlledBy *Player // player that controls this colony or ship Planet *Planet // planet the colony or ship is located at Hull InventoryUnits Inventory InventoryUnits Population Population Pay Pay Rations Rations FactoryGroups FactoryGroups // list of the factory groups FarmGroups FarmGroups // list of the farm groups MineGroups MineGroups // list of the mine groups // contains filtered or unexported fields }
CorS is a colony or ship
func (*CorS) InitializeInventory ¶
func (cs *CorS) InitializeInventory()
type Deposit ¶
type Deposit struct { Id int // unique identifier No int // number of deposit on planet Product *Unit // fuel, gold, metallic, non-metallic InitialQty int // in metric tonnes RemainingQty int // in metric tonnes YieldPct float64 // percentage of each mass unit that yields units Planet *Planet // planet deposit is on ControlledBy *CorS // colony controlling this deposit }
Deposit of fuel, gold, metal, or non-metals on the surface of a planet
type Engine ¶
type Engine struct { Version string Game struct { Id int Code string Name string Turn struct { Year int Quarter int StartDt time.Time EndDt time.Time } } Colonies map[string]*CorS CorSById map[int]*CorS Deposits map[int]*Deposit FactoryGroups map[int]*FactoryGroup FarmGroups map[int]*FarmGroup MineGroups map[int]*MineGroup Nations map[int]*Nation Planets map[int]*Planet Players map[int]*Player Ships map[string]*CorS Stars map[int]*Star Systems map[int]*System Units map[int]*Unit UnitsFromString map[string]*Unit Seq int }
func (*Engine) ClusterScan ¶
func (e *Engine) ClusterScan(origin Coordinates) ClusterList
func (*Engine) Execute ¶
func (e *Engine) Execute(pos []*PhaseOrders, phases ...string) error
Execute runs all the orders in the list of phases. If the list is empty, no phases will run.
func (*Engine) ExecuteAssemblyPhase ¶
func (e *Engine) ExecuteAssemblyPhase(pos []*PhaseOrders) (errs []error)
ExecuteAssemblyPhase runs all the orders in the assembly phase.
func (*Engine) ExecuteCombatPhase ¶
func (e *Engine) ExecuteCombatPhase(pos []*PhaseOrders) (errs []error)
ExecuteCombatPhase runs all the orders in the combat phase.
func (*Engine) ExecuteControlPhase ¶
func (e *Engine) ExecuteControlPhase(pos []*PhaseOrders) (errs []error)
ExecuteControlPhase runs all the orders in the control phase.
func (*Engine) ExecuteFactoryProductionPhase ¶
func (e *Engine) ExecuteFactoryProductionPhase(pos []*PhaseOrders) (errs []error)
ExecuteFactoryProductionPhase runs all the orders in the factory production phase.
func (*Engine) ExecuteFarmProductionPhase ¶
func (e *Engine) ExecuteFarmProductionPhase(pos []*PhaseOrders) (errs []error)
ExecuteFarmProductionPhase runs all the orders in the farm production phase.
func (*Engine) ExecuteFuelAllocationPhase ¶
func (e *Engine) ExecuteFuelAllocationPhase(pos []*PhaseOrders) (errs []error)
ExecuteFuelAllocationPhase runs all the orders in the fuel allocation phase.
func (*Engine) ExecuteLaborAllocationPhase ¶
func (e *Engine) ExecuteLaborAllocationPhase(pos []*PhaseOrders) (errs []error)
ExecuteLaborAllocationPhase runs all the orders in the fuel allocation phase.
func (*Engine) ExecuteLifeSupportPhase ¶
func (e *Engine) ExecuteLifeSupportPhase(pos []*PhaseOrders) (errs []error)
ExecuteLifeSupportPhase runs all the orders in the life support phase.
func (*Engine) ExecuteMineProductionPhase ¶
func (e *Engine) ExecuteMineProductionPhase(pos []*PhaseOrders) (errs []error)
ExecuteMineProductionPhase runs all the orders in the mine production phase.
func (*Engine) ExecuteRetoolPhase ¶
func (e *Engine) ExecuteRetoolPhase(pos []*PhaseOrders) (errs []error)
ExecuteRetoolPhase runs all the orders in the retool phase.
type FactoryGroup ¶
type FactoryGroup struct { CorS *CorS // ship or colony that controls the group Id int // unique identifier No int // group number, range 1...255 Product *Unit // unit being produced by the group Units InventoryUnits // units assigned to the group StageQty [4]int // assumes four turns to produce a single unit }
FactoryGroup is a group of factories on a ship or colony. Each group is dedicated to manufacturing one type of unit.
type FactoryGroupUnits ¶
type FactoryGroupUnits struct { Unit *Unit // factory unit doing the manufacturing TotalQty int // number of factory units in the group }
FactoryGroupUnits is the number of factories working together in the group
type FactoryGroups ¶
type FactoryGroups []*FactoryGroup
func (FactoryGroups) Len ¶
func (f FactoryGroups) Len() int
func (FactoryGroups) Less ¶
func (f FactoryGroups) Less(i, j int) bool
func (FactoryGroups) Swap ¶
func (f FactoryGroups) Swap(i, j int)
type FarmGroup ¶
type FarmGroup struct { CorS *CorS // ship or colony that controls the group Id int // unique identifier No int // group number, range 1...10 Product *Unit // unit being produced by the group Units InventoryUnits // units assigned to the group StageQty [4]int // assumes four turns to produce a single unit }
FarmGroup is a group of farm units on a ship or colony.
type FarmGroups ¶
type FarmGroups []*FarmGroup
func (FarmGroups) Len ¶
func (f FarmGroups) Len() int
func (FarmGroups) Less ¶
func (f FarmGroups) Less(i, j int) bool
func (FarmGroups) Swap ¶
func (f FarmGroups) Swap(i, j int)
type InventoryUnit ¶
type InventoryUnits ¶
type InventoryUnits []*InventoryUnit
func (InventoryUnits) Len ¶
func (u InventoryUnits) Len() int
func (InventoryUnits) Less ¶
func (u InventoryUnits) Less(i, j int) bool
func (InventoryUnits) Swap ¶
func (u InventoryUnits) Swap(i, j int)
type MineGroup ¶
type MineGroup struct { CorS *CorS // colony that controls the group Id int // unique identifier No int Deposit *Deposit // deposit being mined Unit *InventoryUnit // mine units in the group StageQty [4]int // assumes four turns to produce a single unit }
MineGroup is a group of mines working a single deposit. All mine units in a group must be the same type and tech level.
type MineGroups ¶
type MineGroups []*MineGroup
func (MineGroups) Len ¶
func (m MineGroups) Len() int
func (MineGroups) Less ¶
func (m MineGroups) Less(i, j int) bool
func (MineGroups) Swap ¶
func (m MineGroups) Swap(i, j int)
type NameColonyOrder ¶
type NameShipOrder ¶
type Nation ¶
type Nation struct { Id int // unique id for nation No int // nation number, starts at 1 Name string // unique name for this nation GovtName string // name of the government GovtKind string // kind of government HomePlanet *Planet // nation's home planet ControlledBy *Player // player controlling this nation Speciality string // nation's speciality for research TechLevel int // current tech level of the nation ResearchPointsPool int // points in pool // not used currently Skills }
Nation is a single nation in the game. The controller of the nation rules it, and may designate other players to control ships and colonies in the nation. These players are called viceroys or regents.
type PhaseOrders ¶
type PhaseOrders struct { Player *Player // orders sorted by phase Combat []*orders.Order SetUp []*orders.Order Disassembly []*orders.Order Retool []*RetoolPhaseOrder Transfer []*orders.Order Assembly []*AssemblyPhaseOrder Trade []*orders.Order Survey []*orders.Order Espionage []*orders.Order Movement []*orders.Order Draft []*orders.Order Pay []*orders.Order Ration []*orders.Order Control []*ControlPhaseOrder }
type Planet ¶
type Planet struct { Id int // unique identifier System *System Star *Star OrbitNo int // 1...10 Kind string // asteroid belt, empty, gas giant, terrestrial HabitabilityNo int // 0...25 Colonies CorSs Deposits Deposits Ships CorSs }
Planet is an orbit. It may be empty.
type Player ¶
type Player struct { Id int // unique id for a player UserId int // user that controls this player Name string // unique name for this player MemberOf *Nation // nation the player is aligned with ReportsTo *Player // player that this player reports to Colonies CorSs // colonies controlled by this player Ships CorSs // ships controlled by this player Logger struct { MP *message.Printer W io.Writer } }
type Population ¶
type Population struct { ProfessionalQty int SoldierQty int UnskilledQty int UnemployedQty int ConstructionCrewQty int SpyTeamQty int RebelPct float64 BirthsPriorTurn int NaturalDeathsPriorTurn int }
func (Population) Total ¶
func (p Population) Total() int
type RetoolFactoryGroupOrder ¶
type RetoolMiningGroupOrder ¶
type RetoolPhaseOrder ¶
type RetoolPhaseOrder struct { FactoryGroup *RetoolFactoryGroupOrder MiningGroup *RetoolMiningGroupOrder }
type Star ¶
type Star struct { Id int // unique identifier System *System Sequence string // A, B, etc Kind string Planets []*Planet }
Star is a stellar system in the game. It contains zero or more planets, with each planet assigned to an orbit ranging from 1...10
type System ¶
type System struct { Id int // unique identifier Coords Coordinates Stars []*Star }
type Unit ¶
type Unit struct { Id int // unique identifier Kind string Code string TechLevel int Name string Description string MassPerUnit float64 // mass (in metric tonnes) of a single unit VolumePerUnit float64 // volume (in cubic meters) of a single unit Hudnut bool // if true, unit can be disassembled when stowed StowedVolumePerUnit float64 // volume (in cubic meters) of a single unit when stowed FuelPerUnitPerTurn float64 MetsPerUnitPerTurn float64 NonMetsPerUnitPerTurn float64 }
Unit is a thing in the game.