Documentation
¶
Index ¶
- Constants
- Variables
- func LengthSq(v mgl64.Vec3) float64
- func NewAsteroid(id ID, conf AsteroidConf) (*asteroid, error)
- func NewControlPoint(id ID, conf ControlPointConf) (*controlPoint, error)
- func PartNotAvailable(name string) error
- func RegisterPilot(pilot string, pf pilotFactory)
- type AsteroidConf
- type Condition
- type ControlPointConf
- type CtlPSR
- type Drawable
- type Drawer
- type DudPilot
- type Engine
- type EngineConf
- type FleetConf
- type GenericPilot
- type ID
- type MapConf
- type Object
- type Part
- type PartSetConf
- type Pilot
- type RulesConf
- type ScanResult
- type Sensor
- type SensorConf
- type ShipConf
- type ShipPartConf
- type ShipSR
- type Simulation
- type Thruster
- type ThrusterConf
- type Weapon
- type WeaponConf
Constants ¶
View Source
const NilID = math.MaxUint32
View Source
const SecondsPerTick = 1e-3
Variables ¶
View Source
var ErrOutOfEnergy = errors.New("out of energy")
View Source
var NoScanAvalaible = errors.New("No scan available")
View Source
var OutOfAmmoError = errors.New("Out of ammunition")
Functions ¶
func NewAsteroid ¶
func NewAsteroid(id ID, conf AsteroidConf) (*asteroid, error)
func NewControlPoint ¶
func NewControlPoint(id ID, conf ControlPointConf) (*controlPoint, error)
func PartNotAvailable ¶
func RegisterPilot ¶
func RegisterPilot(pilot string, pf pilotFactory)
Register a ship to make it available
Types ¶
type AsteroidConf ¶
type ControlPointConf ¶
type DudPilot ¶
type DudPilot struct {
GenericPilot
}
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func NewEngine001 ¶
func NewEngineFromConf ¶
func NewEngineFromConf(pos mgl64.Vec3, conf EngineConf) *Engine
type EngineConf ¶
type EngineConf struct {
Mass float64 `yaml:"mass" json:"mass"`
Radius float64 `yaml:"radius" json:"radius"`
Energy float64 `yaml:"energy" json:"energy"`
}
Conf format for loading engines from a file
type GenericPilot ¶
type GenericPilot struct {
Fleet string
Engines []*Engine
Thrusters []*Thruster
Weapons []*Weapon
Sensors []*Sensor
}
func (*GenericPilot) JoinFleet ¶
func (self *GenericPilot) JoinFleet(fleet string)
func (*GenericPilot) LinkParts ¶
func (self *GenericPilot) LinkParts(shipParts []ShipPartConf, availableParts PartSetConf) ([]Part, error)
type MapConf ¶
type MapConf struct {
Radius int64 `yaml:"radius" json:"radius"`
Asteroids []AsteroidConf `yaml:"asteroids" json:"asteroids"`
ControlPoints []ControlPointConf `yaml:"control_points" json:"control_points"`
StartingPoints [][]float64 `yaml:"starting_points" json:"starting_points"`
Rules RulesConf `yaml:"rules" json:"rules"`
}
type PartSetConf ¶
type PartSetConf struct {
Engines map[string]EngineConf `yaml:"engines" json:"engines"`
Thrusters map[string]ThrusterConf `yaml:"thrusters" json:"thrusters"`
Weapons map[string]WeaponConf `yaml:"weapons" json:"weapons"`
Sensors map[string]SensorConf `yaml:"sensors" json:"sensors"`
}
type Pilot ¶
type Pilot interface {
JoinFleet(fleet string)
LinkParts([]ShipPartConf, PartSetConf) ([]Part, error)
Tick(int64)
}
type ScanResult ¶
type ScanResult struct {
Position mgl64.Vec3
Velocity mgl64.Vec3
Mass float64
Radius float64
Health float64
Ships map[ID]ShipSR
ControlPoints map[ID]CtlPSR
// contains filtered or unexported fields
}
func (ScanResult) Done ¶
func (sr ScanResult) Done()
type Sensor ¶
type Sensor struct {
// contains filtered or unexported fields
}
func NewSensor001 ¶
func NewSensorFromConf ¶
func NewSensorFromConf(pos mgl64.Vec3, conf SensorConf) *Sensor
func (*Sensor) Scan ¶
func (self *Sensor) Scan() (ScanResult, error)
type SensorConf ¶
type SensorConf struct {
Mass float64 `yaml:"mass" json:"mass"`
Radius float64 `yaml:"radius" json:"radius"`
Energy float64 `yaml:"energy" json:"energy"`
Power float64 `yaml:"power" json:"power"`
}
Conf format for loading engines from a file
type ShipConf ¶
type ShipConf struct {
Pilot string `yaml:"pilot" json:"pilot"`
Texture string `yaml:"texture" json:"texture"`
HullStrength float64 `yaml:"hull_strength" json:"hull_strength"`
Position []float64 `yaml:"position" json:"position"`
Parts []ShipPartConf `yaml:"parts" json:"parts"`
}
type ShipPartConf ¶
type Simulation ¶
type Simulation struct {
// contains filtered or unexported fields
}
func NewSimulation ¶
func NewSimulation( mp MapConf, parts PartSetConf, fleets []FleetConf, stream Drawer, maxTime time.Duration, fps int64, ) (*Simulation, error)
func (*Simulation) CorrectedFPS ¶
func (sim *Simulation) CorrectedFPS() float64
func (*Simulation) Start ¶
func (sim *Simulation) Start()
type Thruster ¶
type Thruster struct {
// contains filtered or unexported fields
}
func NewThruster001 ¶
func NewThrusterFromConf ¶
func NewThrusterFromConf(pos mgl64.Vec3, conf ThrusterConf) *Thruster
type ThrusterConf ¶
type ThrusterConf struct {
Mass float64 `yaml:"mass" json:"mass"`
Radius float64 `yaml:"radius" json:"radius"`
Force float64 `yaml:"force" json:"force"`
Energy float64 `yaml:"energy" json:"energy"`
}
Conf format for loading thrusters from a file
type Weapon ¶
type Weapon struct {
// contains filtered or unexported fields
}
func NewWeapon001 ¶
func NewWeaponFromConf ¶
func NewWeaponFromConf(pos mgl64.Vec3, conf WeaponConf) *Weapon
func (*Weapon) GetAmmoVel ¶
func (*Weapon) GetCoolDownTicks ¶
type WeaponConf ¶
type WeaponConf struct {
Mass float64 `yaml:"mass" json:"mass"`
Radius float64 `yaml:"radius" json:"radius"`
Energy float64 `yaml:"energy" json:"energy"`
AmmoVelocity float64 `yaml:"ammo_velocity" json:"ammo_velocity"`
AmmoMass float64 `yaml:"ammo_mass" json:"ammo_mass"`
AmmoCapacity int64 `yaml:"ammo_capacity" json:"ammo_capacity"`
AmmoRadius float64 `yaml:"ammo_radius" json:"ammo_radius"`
Cooldown float64 `yaml:"cooldown" json:"cooldown"`
}
Conf format for loading weapons from a file
Source Files
¶
Click to show internal directories.
Click to hide internal directories.