model

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MECH_POWER_ON_SECONDS   float64 = 5.0
	MECH_TURN_RATE_FACTOR   float64 = (0.25 * geom.Pi) / TICKS_PER_SECOND
	MECH_TURRET_RATE_FACTOR float64 = 1.5 * MECH_TURN_RATE_FACTOR

	MECH_JUMP_JET_BOOST_PER_JET     float64 = 10.0 / METERS_PER_UNIT / TICKS_PER_SECOND
	MECH_JUMP_JET_DELAY_SECONDS     float64 = 5.0
	MECH_JUMP_JET_RECHARGE_SECONDS  float64 = 5.0
	MECH_JUMP_JET_DIRECTIONAL_ANGLE float64 = geom.Pi / 8
)
View Source
const (
	METERS_PER_UNIT  float64 = 20
	TICKS_PER_SECOND float64 = 60
	SECONDS_PER_TICK float64 = 1 / TICKS_PER_SECOND

	VELOCITY_TO_KPH float64 = (METERS_PER_UNIT / 1000) * (TICKS_PER_SECOND * 60 * 60)
	KPH_TO_VELOCITY float64 = 1 / VELOCITY_TO_KPH

	GRAVITY_METERS_PSS float64 = 9.80665
	GRAVITY_UNITS_PTT  float64 = GRAVITY_METERS_PSS / METERS_PER_UNIT / (TICKS_PER_SECOND * TICKS_PER_SECOND)

	CEILING_JUMP float64 = 5.0
	CEILING_VTOL float64 = 5.0 // TODO: set flight ceiling in map yaml
)
View Source
const (
	AMMO_NOT_APPLICABLE = iota
	AMMO_BALLISTIC
	AMMO_LRM
	AMMO_SRM
	AMMO_STREAK_SRM
)
View Source
const (
	MechResourceType        string = "mechs"
	VehicleResourceType     string = "vehicles"
	VTOLResourceType        string = "vtols"
	InfantryResourceType    string = "infantry"
	EmplacementResourceType string = "emplacements"
	ProjectilesResourceType string = "projectiles"
	EffectsResourceType     string = "effects"
	EnergyResourceType      string = "energy"
	MissileResourceType     string = "missile"
	BallisticResourceType   string = "ballistic"
)
View Source
const (
	UNIT_POWER_OFF_SECONDS float64 = 1.5
)

Variables

View Source
var (
	Randish *rand.Rand
)

Functions

func AngleDistance

func AngleDistance(a, b float64) float64

func ClampAngle

func ClampAngle(angle float64) float64

ClampAngle clamps the given angle in a range of -pi to pi

func ClampAngle2Pi added in v0.0.1

func ClampAngle2Pi(angle float64) float64

ClampAngle2Pi clamps the given in a range of 0 to 2*pi

func EntityDistance

func EntityDistance(e1, e2 Entity) float64

func GetGroupsForWeapon

func GetGroupsForWeapon(w Weapon, weaponGroups [][]Weapon) []uint

func HeadingPitchTowardPoint3D

func HeadingPitchTowardPoint3D(source, target *geom3d.Vector3) (float64, float64)

func InArray added in v0.0.1

func InArray(array, search interface{}) bool

func IsBetweenDegrees

func IsBetweenDegrees(start, end, mid float64) bool

func IsBetweenRadians

func IsBetweenRadians(start, end, mid float64) bool

func IsEntityUnit

func IsEntityUnit(entity Entity) bool

func IsWeaponInGroup

func IsWeaponInGroup(w Weapon, g uint, weaponGroups [][]Weapon) bool

func ListMissionFilenames

func ListMissionFilenames() ([]string, error)

func NewBallisticWeapon

func NewBallisticWeapon(r *ModelBallisticWeaponResource, collisionRadius, collisionHeight float64, offset *geom.Vector2, parent Entity) (*BallisticWeapon, Projectile)

func NewEnergyWeapon

func NewEnergyWeapon(r *ModelEnergyWeaponResource, collisionRadius, collisionHeight float64, offset *geom.Vector2, parent Entity) (*EnergyWeapon, Projectile)

func NewMissileWeapon

func NewMissileWeapon(r *ModelMissileWeaponResource, collisionRadius, collisionHeight float64, offset *geom.Vector2, onePxOffset *geom.Vector2, parent Entity) (*MissileWeapon, Projectile)

func PointInProximity

func PointInProximity(distance, srcX, srcY, tgtX, tgtY float64) bool

func RandFloat64In

func RandFloat64In(lo, hi float64) float64

func TechBaseString

func TechBaseString(t TechBase) string

func WeaponPosition3D

func WeaponPosition3D(e Unit, weaponOffX, weaponOffY float64) *geom3d.Vector3

WeaponPosition3D gets the X, Y and Z axis offsets needed for weapon projectile spawned from a 2-D sprite reference

Types

type Ammo

type Ammo struct {
	// contains filtered or unexported fields
}

func NewAmmoStock

func NewAmmoStock() *Ammo

func (*Ammo) AddAmmoBin

func (a *Ammo) AddAmmoBin(ammoType AmmoType, ammoTons float64, forWeapon Weapon) *AmmoBin

AddAmmoBin creates ammo bin or updates existing one for the same ammo type/weapon

func (*Ammo) AmmoBinList

func (a *Ammo) AmmoBinList() []*AmmoBin

AmmoBinList returns the list of ammo bins

func (*Ammo) CheckAmmo

func (a *Ammo) CheckAmmo(forWeapon Weapon) int

CheckAmmo checks the available ammount count of a weapon

func (*Ammo) ConsumeAmmo

func (a *Ammo) ConsumeAmmo(forWeapon Weapon, consumeN int) *AmmoBin

ConsumeAmmo consumes the ammo count of weapon fired N times

func (*Ammo) GetAmmoBin

func (a *Ammo) GetAmmoBin(ammoType AmmoType, forWeapon Weapon) *AmmoBin

GetAmmoBin finds existing ammo bin, if present, for given weapon

type AmmoBin

type AmmoBin struct {
	// contains filtered or unexported fields
}

func (*AmmoBin) AmmoCount

func (a *AmmoBin) AmmoCount() int

func (*AmmoBin) AmmoMax

func (a *AmmoBin) AmmoMax() int

func (*AmmoBin) AmmoType

func (a *AmmoBin) AmmoType() AmmoType

func (*AmmoBin) ConsumeAmmo

func (a *AmmoBin) ConsumeAmmo(forWeapon Weapon, consumeN int)

ConsumeAmmo consumes the ammo count of weapon fired N times

func (*AmmoBin) ForWeapon

func (a *AmmoBin) ForWeapon() Weapon

type AmmoType

type AmmoType int

func AmmoTypeForWeapon

func AmmoTypeForWeapon(forWeapon Weapon) AmmoType

func (AmmoType) Name

func (t AmmoType) Name() string

func (AmmoType) ShortName

func (t AmmoType) ShortName() string

type BallisticWeapon

type BallisticWeapon struct {
	Resource *ModelBallisticWeaponResource
	// contains filtered or unexported fields
}

func (*BallisticWeapon) AmmoBin

func (w *BallisticWeapon) AmmoBin() *AmmoBin

func (*BallisticWeapon) AmmoPerTon

func (w *BallisticWeapon) AmmoPerTon() int

func (*BallisticWeapon) Audio

func (w *BallisticWeapon) Audio() string

func (*BallisticWeapon) Classification

func (w *BallisticWeapon) Classification() WeaponClassification

func (*BallisticWeapon) Clone

func (w *BallisticWeapon) Clone() Weapon

func (*BallisticWeapon) Cooldown

func (w *BallisticWeapon) Cooldown() float64

func (*BallisticWeapon) Damage

func (w *BallisticWeapon) Damage() float64

func (*BallisticWeapon) DecreaseCooldown

func (w *BallisticWeapon) DecreaseCooldown(decreaseBy float64)

func (*BallisticWeapon) Distance

func (w *BallisticWeapon) Distance() float64

func (*BallisticWeapon) File

func (w *BallisticWeapon) File() string

func (*BallisticWeapon) Heat

func (w *BallisticWeapon) Heat() float64

func (*BallisticWeapon) MaxCooldown

func (w *BallisticWeapon) MaxCooldown() float64

func (*BallisticWeapon) Name

func (w *BallisticWeapon) Name() string

func (*BallisticWeapon) Offset

func (w *BallisticWeapon) Offset() *geom.Vector2

func (*BallisticWeapon) Parent

func (w *BallisticWeapon) Parent() Entity

func (*BallisticWeapon) ProjectileCount

func (w *BallisticWeapon) ProjectileCount() int

func (*BallisticWeapon) ProjectileDelay

func (w *BallisticWeapon) ProjectileDelay() float64

func (*BallisticWeapon) ProjectileSpread

func (w *BallisticWeapon) ProjectileSpread() float64

func (*BallisticWeapon) SetAmmoBin

func (w *BallisticWeapon) SetAmmoBin(ammoBin *AmmoBin)

func (*BallisticWeapon) ShortName

func (w *BallisticWeapon) ShortName() string

func (*BallisticWeapon) SpawnProjectile

func (w *BallisticWeapon) SpawnProjectile(angle, pitch float64, spawnedBy Unit) *Projectile

func (*BallisticWeapon) SpawnProjectileToward

func (w *BallisticWeapon) SpawnProjectileToward(target *geom3d.Vector3, spawnedBy Unit) *Projectile

func (*BallisticWeapon) Summary added in v0.0.1

func (w *BallisticWeapon) Summary() string

func (*BallisticWeapon) Tech

func (w *BallisticWeapon) Tech() TechBase

func (*BallisticWeapon) Tonnage

func (w *BallisticWeapon) Tonnage() float64

func (*BallisticWeapon) TriggerCooldown

func (w *BallisticWeapon) TriggerCooldown()

func (*BallisticWeapon) Type

func (w *BallisticWeapon) Type() WeaponType

func (*BallisticWeapon) Velocity

func (w *BallisticWeapon) Velocity() float64

type BasicEntity

type BasicEntity struct {
	// contains filtered or unexported fields
}

func BasicCollisionEntity

func BasicCollisionEntity(x, y, z float64, anchor raycaster.SpriteAnchor, collisionRadius, collisionHeight, hitPoints float64) *BasicEntity

func BasicVisualEntity

func BasicVisualEntity(x, y, z float64, anchor raycaster.SpriteAnchor) *BasicEntity

func (*BasicEntity) Anchor

func (e *BasicEntity) Anchor() raycaster.SpriteAnchor

func (*BasicEntity) ApplyDamage

func (e *BasicEntity) ApplyDamage(damage float64)

func (*BasicEntity) ArmorPoints

func (e *BasicEntity) ArmorPoints() float64

func (*BasicEntity) Clone

func (e *BasicEntity) Clone() Entity

func (*BasicEntity) CollisionHeight

func (e *BasicEntity) CollisionHeight() float64

func (*BasicEntity) CollisionRadius

func (e *BasicEntity) CollisionRadius() float64

func (*BasicEntity) Heading

func (e *BasicEntity) Heading() float64

func (*BasicEntity) IsDestroyed

func (e *BasicEntity) IsDestroyed() bool

func (*BasicEntity) MaxArmorPoints

func (e *BasicEntity) MaxArmorPoints() float64

func (*BasicEntity) MaxStructurePoints

func (e *BasicEntity) MaxStructurePoints() float64

func (*BasicEntity) Parent

func (e *BasicEntity) Parent() Entity

func (*BasicEntity) Pitch

func (e *BasicEntity) Pitch() float64

func (*BasicEntity) Pos

func (e *BasicEntity) Pos() *geom.Vector2

func (*BasicEntity) PosZ

func (e *BasicEntity) PosZ() float64

func (*BasicEntity) SetAnchor

func (e *BasicEntity) SetAnchor(anchor raycaster.SpriteAnchor)

func (*BasicEntity) SetArmorPoints

func (e *BasicEntity) SetArmorPoints(armor float64)

func (*BasicEntity) SetCollisionHeight

func (e *BasicEntity) SetCollisionHeight(collisionHeight float64)

func (*BasicEntity) SetCollisionRadius

func (e *BasicEntity) SetCollisionRadius(collisionRadius float64)

func (*BasicEntity) SetHeading

func (e *BasicEntity) SetHeading(angle float64)

func (*BasicEntity) SetParent

func (e *BasicEntity) SetParent(parent Entity)

func (*BasicEntity) SetPitch

func (e *BasicEntity) SetPitch(pitch float64)

func (*BasicEntity) SetPos

func (e *BasicEntity) SetPos(pos *geom.Vector2)

func (*BasicEntity) SetPosZ

func (e *BasicEntity) SetPosZ(posZ float64)

func (*BasicEntity) SetStructurePoints

func (e *BasicEntity) SetStructurePoints(structure float64)

func (*BasicEntity) SetVelocity

func (e *BasicEntity) SetVelocity(velocity float64)

func (*BasicEntity) SetVelocityZ

func (e *BasicEntity) SetVelocityZ(velocityZ float64)

func (*BasicEntity) StructurePoints

func (e *BasicEntity) StructurePoints() float64

func (*BasicEntity) Velocity

func (e *BasicEntity) Velocity() float64

func (*BasicEntity) VelocityZ

func (e *BasicEntity) VelocityZ() float64

type Emplacement

type Emplacement struct {
	*UnitModel
	Resource *ModelEmplacementResource
}

func NewEmplacement

func NewEmplacement(r *ModelEmplacementResource, collisionRadius, collisionHeight float64, cockpitOffset *geom.Vector2) *Emplacement

func (*Emplacement) Clone

func (e *Emplacement) Clone() Entity

func (*Emplacement) CloneUnit

func (e *Emplacement) CloneUnit() Unit

func (*Emplacement) Heat

func (e *Emplacement) Heat() float64

func (*Emplacement) HeatDissipation

func (e *Emplacement) HeatDissipation() float64

func (*Emplacement) MaxArmorPoints

func (e *Emplacement) MaxArmorPoints() float64

func (*Emplacement) MaxStructurePoints

func (e *Emplacement) MaxStructurePoints() float64

func (*Emplacement) Name

func (e *Emplacement) Name() string

func (*Emplacement) Tonnage

func (e *Emplacement) Tonnage() float64

func (*Emplacement) TriggerWeapon

func (e *Emplacement) TriggerWeapon(w Weapon) bool

func (*Emplacement) TurnRate

func (e *Emplacement) TurnRate() float64

func (*Emplacement) Update

func (e *Emplacement) Update() bool

func (*Emplacement) Variant

func (e *Emplacement) Variant() string

type EnergyWeapon

type EnergyWeapon struct {
	Resource *ModelEnergyWeaponResource
	// contains filtered or unexported fields
}

func (*EnergyWeapon) AmmoBin

func (w *EnergyWeapon) AmmoBin() *AmmoBin

func (*EnergyWeapon) AmmoPerTon

func (w *EnergyWeapon) AmmoPerTon() int

func (*EnergyWeapon) Audio

func (w *EnergyWeapon) Audio() string

func (*EnergyWeapon) Classification

func (w *EnergyWeapon) Classification() WeaponClassification

func (*EnergyWeapon) Clone

func (w *EnergyWeapon) Clone() Weapon

func (*EnergyWeapon) Cooldown

func (w *EnergyWeapon) Cooldown() float64

func (*EnergyWeapon) Damage

func (w *EnergyWeapon) Damage() float64

func (*EnergyWeapon) DecreaseCooldown

func (w *EnergyWeapon) DecreaseCooldown(decreaseBy float64)

func (*EnergyWeapon) Distance

func (w *EnergyWeapon) Distance() float64

func (*EnergyWeapon) File

func (w *EnergyWeapon) File() string

func (*EnergyWeapon) Heat

func (w *EnergyWeapon) Heat() float64

func (*EnergyWeapon) MaxCooldown

func (w *EnergyWeapon) MaxCooldown() float64

func (*EnergyWeapon) Name

func (w *EnergyWeapon) Name() string

func (*EnergyWeapon) Offset

func (w *EnergyWeapon) Offset() *geom.Vector2

func (*EnergyWeapon) Parent

func (w *EnergyWeapon) Parent() Entity

func (*EnergyWeapon) ProjectileCount

func (w *EnergyWeapon) ProjectileCount() int

func (*EnergyWeapon) ProjectileDelay

func (w *EnergyWeapon) ProjectileDelay() float64

func (*EnergyWeapon) ProjectileSpread

func (w *EnergyWeapon) ProjectileSpread() float64

func (*EnergyWeapon) SetAmmoBin

func (w *EnergyWeapon) SetAmmoBin(ammoBin *AmmoBin)

func (*EnergyWeapon) ShortName

func (w *EnergyWeapon) ShortName() string

func (*EnergyWeapon) SpawnProjectile

func (w *EnergyWeapon) SpawnProjectile(angle, pitch float64, spawnedBy Unit) *Projectile

func (*EnergyWeapon) SpawnProjectileToward

func (w *EnergyWeapon) SpawnProjectileToward(target *geom3d.Vector3, spawnedBy Unit) *Projectile

func (*EnergyWeapon) Summary added in v0.0.1

func (w *EnergyWeapon) Summary() string

func (*EnergyWeapon) Tech

func (w *EnergyWeapon) Tech() TechBase

func (*EnergyWeapon) Tonnage

func (w *EnergyWeapon) Tonnage() float64

func (*EnergyWeapon) TriggerCooldown

func (w *EnergyWeapon) TriggerCooldown()

func (*EnergyWeapon) Type

func (w *EnergyWeapon) Type() WeaponType

func (*EnergyWeapon) Velocity

func (w *EnergyWeapon) Velocity() float64

type Entity

type Entity interface {
	Pos() *geom.Vector2
	SetPos(*geom.Vector2)
	PosZ() float64
	SetPosZ(float64)

	Anchor() raycaster.SpriteAnchor
	SetAnchor(raycaster.SpriteAnchor)

	Heading() float64
	SetHeading(float64)
	Pitch() float64
	SetPitch(float64)
	Velocity() float64
	SetVelocity(float64)
	VelocityZ() float64
	SetVelocityZ(float64)

	CollisionRadius() float64
	SetCollisionRadius(float64)
	CollisionHeight() float64
	SetCollisionHeight(float64)

	ApplyDamage(float64)
	ArmorPoints() float64
	SetArmorPoints(float64)
	MaxArmorPoints() float64
	StructurePoints() float64
	SetStructurePoints(float64)
	MaxStructurePoints() float64
	IsDestroyed() bool

	Clone() Entity
	Parent() Entity
	SetParent(Entity)
}

type HeatSinkType

type HeatSinkType int
const (
	NONE   HeatSinkType = iota // 0
	SINGLE                     // 1
	DOUBLE                     // 2
)

type Infantry

type Infantry struct {
	*UnitModel
	Resource *ModelInfantryResource
}

func NewInfantry

func NewInfantry(r *ModelInfantryResource, collisionRadius, collisionHeight float64, cockpitOffset *geom.Vector2) *Infantry

func (*Infantry) Clone

func (e *Infantry) Clone() Entity

func (*Infantry) CloneUnit

func (e *Infantry) CloneUnit() Unit

func (*Infantry) Heat

func (e *Infantry) Heat() float64

func (*Infantry) HeatDissipation

func (e *Infantry) HeatDissipation() float64

func (*Infantry) MaxArmorPoints

func (e *Infantry) MaxArmorPoints() float64

func (*Infantry) MaxStructurePoints

func (e *Infantry) MaxStructurePoints() float64

func (*Infantry) Name

func (e *Infantry) Name() string

func (*Infantry) Tonnage

func (e *Infantry) Tonnage() float64

func (*Infantry) TriggerWeapon

func (e *Infantry) TriggerWeapon(w Weapon) bool

func (*Infantry) TurnRate

func (e *Infantry) TurnRate() float64

func (*Infantry) Update

func (e *Infantry) Update() bool

func (*Infantry) Variant

func (e *Infantry) Variant() string

type Location

type Location int
const (
	HEAD Location = iota
	CENTER_TORSO
	LEFT_TORSO
	RIGHT_TORSO
	LEFT_ARM
	RIGHT_ARM
	LEFT_LEG
	RIGHT_LEG
	FRONT
	RIGHT
	LEFT
	TURRET
)

type Map

type Map struct {
	NumRaycastLevels int                `yaml:"numRaycastLevels"`
	Levels           [][][]int          `yaml:"levels"`
	GenerateLevels   MapGenerateLevels  `yaml:"generateLevels"`
	Lighting         MapLighting        `yaml:"lighting"`
	Textures         map[int]MapTexture `yaml:"textures"`
	FloorBox         MapTexture         `yaml:"floorBox"`
	SkyBox           MapTexture         `yaml:"skyBox"`
	Flooring         MapFlooring        `yaml:"flooring"`
	Clutter          []MapClutter       `yaml:"clutter"`
	Sprites          []MapSprite        `yaml:"sprites"`
	SpriteFill       []MapSpriteFill    `yaml:"spriteFill"`
	SpriteStamps     []MapSpriteStamp   `yaml:"spriteStamps"`
	Seed             int64              `yaml:"seed"`
}

func LoadMap

func LoadMap(mapFile string) (*Map, error)

func (*Map) GetCollisionLines

func (m *Map) GetCollisionLines(clipDistance float64) []*geom.Line

func (*Map) GetMapTexture

func (m *Map) GetMapTexture(texIndex int) MapTexture

func (*Map) IsWallAt

func (m *Map) IsWallAt(levelNum, x, y int) bool

func (*Map) Level

func (m *Map) Level(levelNum int) [][]int

func (*Map) NumLevels

func (m *Map) NumLevels() int

type MapClutter

type MapClutter struct {
	Image          string  `yaml:"image"`
	FloorPathMatch *RegExp `yaml:"floorPathMatch"`
	Frequency      float64 `yaml:"frequency"`
	Scale          float64 `yaml:"scale"`
}

type MapFloorPathing

type MapFloorPathing struct {
	Image string      `yaml:"image"`
	Rects [][2][2]int `yaml:"rects"`
	Lines [][][2]int  `yaml:"lines"`
}

type MapFlooring

type MapFlooring struct {
	Default string            `yaml:"default"`
	Pathing []MapFloorPathing `yaml:"pathing"`
}

type MapGenerateLevels

type MapGenerateLevels struct {
	MapSize      [2]int               `yaml:"mapSize"`
	BoundaryWall MapTexture           `yaml:"boundaryWall"`
	Prefabs      []MapGeneratePrefabs `yaml:"prefabs"`
}

type MapGeneratePrefabs

type MapGeneratePrefabs struct {
	Name      string    `yaml:"name"`
	Levels    [][][]int `yaml:"levels"`
	Positions [][2]int  `yaml:"positions"`
}

type MapLighting

type MapLighting struct {
	Falloff      float64  `yaml:"falloff"`
	Illumination float64  `yaml:"illumination"`
	MinLightRGB  [3]uint8 `yaml:"minLightRGB"`
	MaxLightRGB  [3]uint8 `yaml:"maxLightRGB"`
}

func (MapLighting) LightRGB

func (m MapLighting) LightRGB() (*color.NRGBA, *color.NRGBA)

type MapSprite

type MapSprite struct {
	Image             string       `yaml:"image"`
	Positions         [][2]float64 `yaml:"positions"`
	ZPosition         float64      `yaml:"zPosition"`
	CollisionPxRadius float64      `yaml:"collisionRadius"`
	CollisionPxHeight float64      `yaml:"collisionHeight"`
	HitPoints         float64      `yaml:"hitPoints"`
	Scale             float64      `default:"1.0" yaml:"scale,omitempty"`
	Anchor            SpriteAnchor `yaml:"anchor"`
	Stamp             string       `yaml:"stamp"`
}

type MapSpriteFill

type MapSpriteFill struct {
	Image             string     `yaml:"image"`
	Quantity          int        `yaml:"quantity"`
	CollisionPxRadius float64    `yaml:"collisionRadius"`
	CollisionPxHeight float64    `yaml:"collisionHeight"`
	HitPoints         float64    `yaml:"hitPoints"`
	ScaleRange        [2]float64 `yaml:"scaleRange"`
	Rect              [2][2]int  `yaml:"rect"`
}

type MapSpriteStamp

type MapSpriteStamp struct {
	Id      string      `yaml:"id"`
	Sprites []MapSprite `yaml:"sprites"`
}

type MapTexture

type MapTexture struct {
	Image string `yaml:"image"`
	SideX string `yaml:"sideX"`
	SideY string `yaml:"sideY"`
}

func (MapTexture) GetImage

func (m MapTexture) GetImage(side int) string

type Mech

type Mech struct {
	*UnitModel
	Resource      *ModelMechResource
	PowerOffTimer int
	PowerOnTimer  int
}

func NewMech

func NewMech(r *ModelMechResource, collisionRadius, collisionHeight float64, cockpitOffset *geom.Vector2) *Mech

func (*Mech) Class

func (e *Mech) Class() MechClass

func (*Mech) Clone

func (e *Mech) Clone() Entity

func (*Mech) CloneUnit

func (e *Mech) CloneUnit() Unit

func (*Mech) MaxArmorPoints

func (e *Mech) MaxArmorPoints() float64

func (*Mech) MaxStructurePoints

func (e *Mech) MaxStructurePoints() float64

func (*Mech) Name

func (e *Mech) Name() string

func (*Mech) SetPowered

func (e *Mech) SetPowered(powered UnitPowerStatus)

func (*Mech) Tonnage

func (e *Mech) Tonnage() float64

func (*Mech) Update

func (e *Mech) Update() bool

func (*Mech) Variant

func (e *Mech) Variant() string

type MechClass

type MechClass int
const (
	MECH_LIGHT MechClass = iota
	MECH_MEDIUM
	MECH_HEAVY
	MECH_ASSAULT
)

type MissileWeapon

type MissileWeapon struct {
	Resource *ModelMissileWeaponResource
	// contains filtered or unexported fields
}

func (*MissileWeapon) AmmoBin

func (w *MissileWeapon) AmmoBin() *AmmoBin

func (*MissileWeapon) AmmoPerTon

func (w *MissileWeapon) AmmoPerTon() int

func (*MissileWeapon) Audio

func (w *MissileWeapon) Audio() string

func (*MissileWeapon) Classification

func (w *MissileWeapon) Classification() WeaponClassification

func (*MissileWeapon) Clone

func (w *MissileWeapon) Clone() Weapon

func (*MissileWeapon) Cooldown

func (w *MissileWeapon) Cooldown() float64

func (*MissileWeapon) Damage

func (w *MissileWeapon) Damage() float64

func (*MissileWeapon) DecreaseCooldown

func (w *MissileWeapon) DecreaseCooldown(decreaseBy float64)

func (*MissileWeapon) Distance

func (w *MissileWeapon) Distance() float64

func (*MissileWeapon) File

func (w *MissileWeapon) File() string

func (*MissileWeapon) Heat

func (w *MissileWeapon) Heat() float64

func (*MissileWeapon) IsLockOn

func (w *MissileWeapon) IsLockOn() bool

func (*MissileWeapon) IsLockOnLockRequired

func (w *MissileWeapon) IsLockOnLockRequired() bool

func (*MissileWeapon) LockOnGroupRadius

func (w *MissileWeapon) LockOnGroupRadius() float64

func (*MissileWeapon) LockOnTurnRate

func (w *MissileWeapon) LockOnTurnRate() float64

func (*MissileWeapon) MaxCooldown

func (w *MissileWeapon) MaxCooldown() float64

func (*MissileWeapon) Name

func (w *MissileWeapon) Name() string

func (*MissileWeapon) Offset

func (w *MissileWeapon) Offset() *geom.Vector2

func (*MissileWeapon) Parent

func (w *MissileWeapon) Parent() Entity

func (*MissileWeapon) ProjectileCount

func (w *MissileWeapon) ProjectileCount() int

func (*MissileWeapon) ProjectileDelay

func (w *MissileWeapon) ProjectileDelay() float64

func (*MissileWeapon) ProjectileSpread

func (w *MissileWeapon) ProjectileSpread() float64

func (*MissileWeapon) SetAmmoBin

func (w *MissileWeapon) SetAmmoBin(ammoBin *AmmoBin)

func (*MissileWeapon) ShortName

func (w *MissileWeapon) ShortName() string

func (*MissileWeapon) SpawnProjectile

func (w *MissileWeapon) SpawnProjectile(angle, pitch float64, spawnedBy Unit) *Projectile

func (*MissileWeapon) SpawnProjectileToward

func (w *MissileWeapon) SpawnProjectileToward(target *geom3d.Vector3, spawnedBy Unit) *Projectile

func (*MissileWeapon) Summary added in v0.0.1

func (w *MissileWeapon) Summary() string

func (*MissileWeapon) Tech

func (w *MissileWeapon) Tech() TechBase

func (*MissileWeapon) Tonnage

func (w *MissileWeapon) Tonnage() float64

func (*MissileWeapon) TriggerCooldown

func (w *MissileWeapon) TriggerCooldown()

func (*MissileWeapon) Type

func (w *MissileWeapon) Type() WeaponType

func (*MissileWeapon) Velocity

func (w *MissileWeapon) Velocity() float64

type Mission

type Mission struct {
	Title        string               `yaml:"title" validate:"required"`
	Briefing     string               `yaml:"briefing" validate:"required"`
	MapPath      string               `yaml:"map" validate:"required"`
	MusicPath    string               `yaml:"music"`
	DropZone     *MissionDropZone     `yaml:"dropZone" validate:"required"`
	Lighting     *MapLighting         `yaml:"lighting,omitempty"`
	FloorBox     *MapTexture          `yaml:"floorBox,omitempty"`
	SkyBox       *MapTexture          `yaml:"skyBox,omitempty"`
	NavPoints    []*NavPoint          `yaml:"navPoints"`
	Objectives   *MissionObjectives   `yaml:"objectives" validate:"required"`
	Mechs        []MissionMech        `yaml:"mechs"`
	Vehicles     []MissionVehicle     `yaml:"vehicles"`
	VTOLs        []MissionVTOL        `yaml:"vtols"`
	Infantry     []MissionInfantry    `yaml:"infantry"`
	Emplacements []MissionEmplacement `yaml:"emplacements"`
	// contains filtered or unexported fields
}

func LoadMission

func LoadMission(missionFile string) (*Mission, error)

func (*Mission) Map

func (m *Mission) Map() *Map

type MissionDestroyObjectives added in v0.0.1

type MissionDestroyObjectives struct {
	All  bool   `yaml:"all,omitempty"`
	Unit string `yaml:"unit,omitempty"`
}

type MissionDropZone

type MissionDropZone struct {
	Position [2]float64 `yaml:"position" validate:"required"`
	Heading  float64    `yaml:"heading" validate:"required"`
}

type MissionEmplacement

type MissionEmplacement struct {
	ID       string     `yaml:"id"`
	Unit     string     `yaml:"unit" validate:"required"`
	Position [2]float64 `yaml:"position" validate:"required"`
}

type MissionInfantry

type MissionInfantry struct {
	ID         string       `yaml:"id"`
	Unit       string       `yaml:"unit" validate:"required"`
	Position   [2]float64   `yaml:"position" validate:"required"`
	PatrolPath [][2]float64 `yaml:"patrolPath"`
}

type MissionMech

type MissionMech struct {
	ID         string       `yaml:"id"`
	Unit       string       `yaml:"unit" validate:"required"`
	Position   [2]float64   `yaml:"position" validate:"required"`
	PatrolPath [][2]float64 `yaml:"patrolPath"`
}

type MissionNavDustoff added in v0.0.1

type MissionNavDustoff struct {
	Name string `yaml:"name" validate:"required"`
}

type MissionNavObjectives added in v0.0.1

type MissionNavObjectives struct {
	Visit   []*MissionNavVisit   `yaml:"visit,omitempty"`
	Dustoff []*MissionNavDustoff `yaml:"dustoff,omitempty"`
}

type MissionNavVisit added in v0.0.1

type MissionNavVisit struct {
	Name string `yaml:"name" validate:"required"`
}

type MissionObjectives added in v0.0.1

type MissionObjectives struct {
	Destroy []*MissionDestroyObjectives `yaml:"destroy"`
	Protect []*MissionProtectObjectives `yaml:"protect"`
	Nav     *MissionNavObjectives       `yaml:"nav"`
}

func (*MissionObjectives) Text added in v0.0.1

func (o *MissionObjectives) Text() string

type MissionProtectObjectives added in v0.0.1

type MissionProtectObjectives struct {
	Unit string `yaml:"unit,omitempty"`
}

type MissionVTOL

type MissionVTOL struct {
	ID         string       `yaml:"id"`
	Unit       string       `yaml:"unit" validate:"required"`
	Position   [2]float64   `yaml:"position" validate:"required"`
	ZPosition  float64      `yaml:"zPosition" validate:"required"`
	PatrolPath [][2]float64 `yaml:"patrolPath"`
}

type MissionVehicle

type MissionVehicle struct {
	ID         string       `yaml:"id"`
	Unit       string       `yaml:"unit" validate:"required"`
	Position   [2]float64   `yaml:"position" validate:"required"`
	PatrolPath [][2]float64 `yaml:"patrolPath"`
}

type ModelAmmoType

type ModelAmmoType struct {
	AmmoType
}

func (*ModelAmmoType) UnmarshalText

func (t *ModelAmmoType) UnmarshalText(b []byte) error

Unmarshals into AmmoType

type ModelBallisticWeaponResource

type ModelBallisticWeaponResource struct {
	File             string                   `yaml:"-"`
	Name             string                   `yaml:"name" validate:"required"`
	ShortName        string                   `yaml:"short" validate:"required"`
	Tech             ModelTech                `yaml:"tech" validate:"required"`
	Tonnage          float64                  `yaml:"tonnage" validate:"gt=0,lte=100"`
	Damage           float64                  `yaml:"damage" validate:"gt=0"`
	Heat             float64                  `yaml:"heat" validate:"gte=0"`
	Distance         float64                  `yaml:"distance" validate:"gt=0"`
	ExtremeDistance  float64                  `yaml:"extremeDistance" validate:"gte=0"`
	Velocity         float64                  `yaml:"velocity" validate:"gt=0"`
	Cooldown         float64                  `yaml:"cooldown" validate:"gt=0"`
	AmmoPerTon       int                      `yaml:"ammoPerTon" validate:"gte=0"`
	ProjectileCount  int                      `yaml:"projectileCount" validate:"gt=0"`
	ProjectileDelay  float64                  `yaml:"projectileDelay" validate:"gte=0"`
	ProjectileSpread float64                  `yaml:"projectileSpread" validate:"gte=0"`
	Projectile       *ModelProjectileResource `yaml:"projectile"`
	Audio            string                   `yaml:"audio" validate:"required"`
}

type ModelEffectResource

type ModelEffectResource struct {
	Image      string                   `yaml:"image" validate:"required"`
	ImageSheet *ModelResourceImageSheet `yaml:"imageSheet"`
	Scale      float64                  `yaml:"scale" validate:"gt=0"`
	Audio      string                   `yaml:"audio" validate:"required"`
	RandAudio  []string                 `yaml:"randAudio"`
}

type ModelEmplacementResource

type ModelEmplacementResource struct {
	File              string                   `yaml:"-"`
	Name              string                   `yaml:"name" validate:"required"`
	Variant           string                   `yaml:"variant" validate:"required"`
	Image             string                   `yaml:"image" validate:"required"`
	ImageSheet        *ModelResourceImageSheet `yaml:"imageSheet"`
	Tech              ModelTech                `yaml:"tech" validate:"required"`
	Height            float64                  `yaml:"height" validate:"gt=0"`
	HeightPxGap       int                      `yaml:"heightPixelGap" validate:"gte=0"`
	Armor             float64                  `yaml:"armor" validate:"gte=0"`
	Structure         float64                  `yaml:"structure" validate:"gt=0"`
	CollisionPxRadius float64                  `yaml:"collisionRadius" validate:"gt=0"`
	CollisionPxHeight float64                  `yaml:"collisionHeight" validate:"gt=0"`
	CockpitPxOffset   [2]float64               `yaml:"cockpitOffset" validate:"required"`
	Armament          []*ModelResourceArmament `yaml:"armament"`
	Ammo              []*ModelResourceAmmo     `yaml:"ammo"`
}

type ModelEnergyWeaponResource

type ModelEnergyWeaponResource struct {
	File            string                   `yaml:"-"`
	Name            string                   `yaml:"name" validate:"required"`
	ShortName       string                   `yaml:"short" validate:"required"`
	Tech            ModelTech                `yaml:"tech" validate:"required"`
	Tonnage         float64                  `yaml:"tonnage" validate:"gt=0,lte=100"`
	Damage          float64                  `yaml:"damage" validate:"gt=0"`
	Heat            float64                  `yaml:"heat" validate:"gte=0"`
	Distance        float64                  `yaml:"distance" validate:"gt=0"`
	ExtremeDistance float64                  `yaml:"extremeDistance" validate:"gte=0"`
	Velocity        float64                  `yaml:"velocity" validate:"gt=0"`
	Cooldown        float64                  `yaml:"cooldown" validate:"gt=0"`
	ProjectileCount int                      `yaml:"projectileCount" validate:"gt=0"`
	ProjectileDelay float64                  `yaml:"projectileDelay" validate:"gte=0"`
	Projectile      *ModelProjectileResource `yaml:"projectile"`
	Audio           string                   `yaml:"audio" validate:"required"`
}

type ModelHeatSinkType

type ModelHeatSinkType struct {
	HeatSinkType
}

func (*ModelHeatSinkType) UnmarshalText

func (t *ModelHeatSinkType) UnmarshalText(b []byte) error

Unmarshals into HeatSinkType

type ModelInfantryResource

type ModelInfantryResource struct {
	File              string                   `yaml:"-"`
	Name              string                   `yaml:"name" validate:"required"`
	Variant           string                   `yaml:"variant" validate:"required"`
	Image             string                   `yaml:"image" validate:"required"`
	ImageSheet        *ModelResourceImageSheet `yaml:"imageSheet"`
	Tech              ModelTech                `yaml:"tech" validate:"required"`
	Height            float64                  `yaml:"height" validate:"gt=0"`
	HeightPxGap       int                      `yaml:"heightPixelGap" validate:"gte=0"`
	Speed             float64                  `yaml:"speed" validate:"gt=0,lte=250"`
	JumpJets          int                      `yaml:"jumpJets" validate:"gte=0,lte=20"`
	Armor             float64                  `yaml:"armor" validate:"gte=0"`
	Structure         float64                  `yaml:"structure" validate:"gt=0"`
	CollisionPxRadius float64                  `yaml:"collisionRadius" validate:"gt=0"`
	CollisionPxHeight float64                  `yaml:"collisionHeight" validate:"gt=0"`
	CockpitPxOffset   [2]float64               `yaml:"cockpitOffset" validate:"required"`
	Armament          []*ModelResourceArmament `yaml:"armament"`
	Ammo              []*ModelResourceAmmo     `yaml:"ammo"`
}

type ModelLocation

type ModelLocation struct {
	Location
}

func (*ModelLocation) UnmarshalText

func (t *ModelLocation) UnmarshalText(b []byte) error

Unmarshals into Location

type ModelMechResource

type ModelMechResource struct {
	File              string                   `yaml:"-"`
	Name              string                   `yaml:"name" validate:"required"`
	Variant           string                   `yaml:"variant" validate:"required"`
	Image             string                   `yaml:"image" validate:"required"`
	Tech              ModelTech                `yaml:"tech" validate:"required"`
	Tonnage           float64                  `yaml:"tonnage" validate:"gt=0,lte=200"`
	Height            float64                  `yaml:"height" validate:"gt=0"`
	HeightPxGap       int                      `yaml:"heightPixelGap" validate:"gte=0"`
	Speed             float64                  `yaml:"speed" validate:"gt=0,lte=250"`
	JumpJets          int                      `yaml:"jumpJets" validate:"gte=0,lte=20"`
	Armor             float64                  `yaml:"armor" validate:"gte=0"`
	Structure         float64                  `yaml:"structure" validate:"gt=0"`
	CollisionPxRadius float64                  `yaml:"collisionRadius" validate:"gt=0"`
	CollisionPxHeight float64                  `yaml:"collisionHeight" validate:"gt=0"`
	CockpitPxOffset   [2]float64               `yaml:"cockpitOffset" validate:"required"`
	HeatSinks         *ModelResourceHeatSinks  `yaml:"heatSinks"`
	Armament          []*ModelResourceArmament `yaml:"armament"`
	Ammo              []*ModelResourceAmmo     `yaml:"ammo"`
}

type ModelMissileWeaponLockOn

type ModelMissileWeaponLockOn struct {
	LockRequired bool    `yaml:"lockRequired"`
	TurnRate     float64 `yaml:"turnRate" validate:"gt=0"`
	GroupRadius  float64 `yaml:"groupRadius" validate:"gt=0"`
}

type ModelMissileWeaponResource

type ModelMissileWeaponResource struct {
	File            string                    `yaml:"-"`
	Name            string                    `yaml:"name" validate:"required"`
	ShortName       string                    `yaml:"short" validate:"required"`
	Tech            ModelTech                 `yaml:"tech" validate:"required"`
	Tonnage         float64                   `yaml:"tonnage" validate:"gt=0,lte=100"`
	Damage          float64                   `yaml:"damage" validate:"gt=0"`
	Heat            float64                   `yaml:"heat" validate:"gte=0"`
	Distance        float64                   `yaml:"distance" validate:"gt=0"`
	ExtremeDistance float64                   `yaml:"extremeDistance" validate:"gte=0"`
	Velocity        float64                   `yaml:"velocity" validate:"gt=0"`
	Cooldown        float64                   `yaml:"cooldown" validate:"gt=0"`
	AmmoPerTon      int                       `yaml:"ammoPerTon" validate:"gte=0"`
	ProjectileCount int                       `yaml:"projectileCount" validate:"gt=0"`
	ProjectileDelay float64                   `yaml:"projectileDelay" validate:"gte=0"`
	Projectile      *ModelProjectileResource  `yaml:"projectile"`
	LockOn          *ModelMissileWeaponLockOn `yaml:"lockOn,omitempty"`
	Audio           string                    `yaml:"audio" validate:"required"`
}

type ModelProjectileResource

type ModelProjectileResource struct {
	Image             string                   `yaml:"image" validate:"required"`
	ImageSheet        *ModelResourceImageSheet `yaml:"imageSheet"`
	CollisionPxRadius float64                  `yaml:"collisionRadius" validate:"gt=0"`
	CollisionPxHeight float64                  `yaml:"collisionHeight" validate:"gt=0"`
	Scale             float64                  `yaml:"scale" validate:"gt=0"`
	ImpactEffect      *ModelEffectResource     `yaml:"impactEffect"`
}

type ModelResourceAmmo

type ModelResourceAmmo struct {
	Type      ModelAmmoType `yaml:"type" validate:"required"`
	ForWeapon string        `yaml:"forWeapon"`
	Tons      float64       `yaml:"tons" validate:"gt=0"`
}

type ModelResourceArmament

type ModelResourceArmament struct {
	Weapon   string          `yaml:"weapon" validate:"required"`
	Type     ModelWeaponType `yaml:"type" validate:"required"`
	Location ModelLocation   `yaml:"location" validate:"required"`
	Offset   [2]float64      `yaml:"offset" validate:"required"`
}

type ModelResourceHeatSinks

type ModelResourceHeatSinks struct {
	Quantity int               `yaml:"quantity" validate:"gte=0"`
	Type     ModelHeatSinkType `yaml:"type" validate:"required"`
}

type ModelResourceImageSheet

type ModelResourceImageSheet struct {
	Columns        int             `yaml:"columns" validate:"gt=0"`
	Rows           int             `yaml:"rows" validate:"gt=0"`
	AnimationRate  int             `yaml:"animationRate" validate:"gte=0"`
	AngleFacingRow map[float64]int `yaml:"angleFacingRow"`
	StaticIndex    int             `yaml:"staticIndex" validate:"gte=0"`
}

type ModelResources

type ModelResources struct {
	Mechs            map[string]*ModelMechResource
	Vehicles         map[string]*ModelVehicleResource
	VTOLs            map[string]*ModelVTOLResource
	Infantry         map[string]*ModelInfantryResource
	Emplacements     map[string]*ModelEmplacementResource
	EnergyWeapons    map[string]*ModelEnergyWeaponResource
	MissileWeapons   map[string]*ModelMissileWeaponResource
	BallisticWeapons map[string]*ModelBallisticWeaponResource
}

func LoadModelResources

func LoadModelResources() (*ModelResources, error)

func (*ModelResources) GetBallisticWeaponResource

func (r *ModelResources) GetBallisticWeaponResource(weapon string) *ModelBallisticWeaponResource

func (*ModelResources) GetEmplacementResource

func (r *ModelResources) GetEmplacementResource(unit string) *ModelEmplacementResource

func (*ModelResources) GetEmplacementResourceList

func (r *ModelResources) GetEmplacementResourceList() []*ModelEmplacementResource

GetEmplacementResourceList gets emplacement resources as sorted list

func (*ModelResources) GetEnergyWeaponResource

func (r *ModelResources) GetEnergyWeaponResource(weapon string) *ModelEnergyWeaponResource

func (*ModelResources) GetInfantryResource

func (r *ModelResources) GetInfantryResource(unit string) *ModelInfantryResource

func (*ModelResources) GetInfantryResourceList

func (r *ModelResources) GetInfantryResourceList() []*ModelInfantryResource

GetInfantryResourceList gets infantry resources as sorted list

func (*ModelResources) GetMechResource

func (r *ModelResources) GetMechResource(unit string) *ModelMechResource

func (*ModelResources) GetMechResourceList

func (r *ModelResources) GetMechResourceList() []*ModelMechResource

GetMechResourceList gets mech resources as sorted list

func (*ModelResources) GetMissileWeaponResource

func (r *ModelResources) GetMissileWeaponResource(weapon string) *ModelMissileWeaponResource

func (*ModelResources) GetVTOLResource

func (r *ModelResources) GetVTOLResource(unit string) *ModelVTOLResource

func (*ModelResources) GetVTOLResourceList

func (r *ModelResources) GetVTOLResourceList() []*ModelVTOLResource

GetVTOLResourceList gets vtol resources as sorted list

func (*ModelResources) GetVehicleResource

func (r *ModelResources) GetVehicleResource(unit string) *ModelVehicleResource

func (*ModelResources) GetVehicleResourceList

func (r *ModelResources) GetVehicleResourceList() []*ModelVehicleResource

GetVehicleResourceList gets vehicle resources as sorted list

type ModelTech

type ModelTech struct {
	TechBase
}

func (*ModelTech) UnmarshalText

func (t *ModelTech) UnmarshalText(b []byte) error

Unmarshals into TechBase

type ModelVTOLResource

type ModelVTOLResource struct {
	File              string                   `yaml:"-"`
	Name              string                   `yaml:"name" validate:"required"`
	Variant           string                   `yaml:"variant" validate:"required"`
	Image             string                   `yaml:"image" validate:"required"`
	ImageSheet        *ModelResourceImageSheet `yaml:"imageSheet"`
	Tech              ModelTech                `yaml:"tech" validate:"required"`
	Tonnage           float64                  `yaml:"tonnage" validate:"gt=0,lte=100"`
	Height            float64                  `yaml:"height" validate:"gt=0"`
	HeightPxGap       int                      `yaml:"heightPixelGap" validate:"gte=0"`
	Speed             float64                  `yaml:"speed" validate:"gt=0,lte=250"`
	Armor             float64                  `yaml:"armor" validate:"gte=0"`
	Structure         float64                  `yaml:"structure" validate:"gt=0"`
	CollisionPxRadius float64                  `yaml:"collisionRadius" validate:"gt=0"`
	CollisionPxHeight float64                  `yaml:"collisionHeight" validate:"gt=0"`
	CockpitPxOffset   [2]float64               `yaml:"cockpitOffset" validate:"required"`
	HeatSinks         *ModelResourceHeatSinks  `yaml:"heatSinks"`
	Armament          []*ModelResourceArmament `yaml:"armament"`
	Ammo              []*ModelResourceAmmo     `yaml:"ammo"`
}

type ModelVehicleResource

type ModelVehicleResource struct {
	File              string                   `yaml:"-"`
	Name              string                   `yaml:"name" validate:"required"`
	Variant           string                   `yaml:"variant" validate:"required"`
	Image             string                   `yaml:"image" validate:"required"`
	ImageSheet        *ModelResourceImageSheet `yaml:"imageSheet"`
	Tech              ModelTech                `yaml:"tech" validate:"required"`
	Tonnage           float64                  `yaml:"tonnage" validate:"gt=0,lte=200"`
	Height            float64                  `yaml:"height" validate:"gt=0"`
	HeightPxGap       int                      `yaml:"heightPixelGap" validate:"gte=0"`
	Speed             float64                  `yaml:"speed" validate:"gt=0,lte=250"`
	Armor             float64                  `yaml:"armor" validate:"gte=0"`
	Structure         float64                  `yaml:"structure" validate:"gt=0"`
	CollisionPxRadius float64                  `yaml:"collisionRadius" validate:"gt=0"`
	CollisionPxHeight float64                  `yaml:"collisionHeight" validate:"gt=0"`
	CockpitPxOffset   [2]float64               `yaml:"cockpitOffset" validate:"required"`
	HeatSinks         *ModelResourceHeatSinks  `yaml:"heatSinks"`
	Armament          []*ModelResourceArmament `yaml:"armament"`
	Ammo              []*ModelResourceAmmo     `yaml:"ammo"`
}

type ModelWeaponType

type ModelWeaponType struct {
	WeaponType
}

func (*ModelWeaponType) UnmarshalText

func (t *ModelWeaponType) UnmarshalText(b []byte) error

Unmarshals into WeaponType

type NavObjective int
const (
	NavNonObjective NavObjective = iota
	NavVisitObjective
	NavDustoffObjective
)
type NavPoint struct {
	Name     string     `yaml:"name" validate:"required"`
	Position [2]float64 `yaml:"position" validate:"required"`
	// contains filtered or unexported fields
}
func (n *NavPoint) Image() *ebiten.Image
func (n *NavPoint) Objective() NavObjective
func (n *NavPoint) Pos() geom.Vector2
func (n *NavPoint) SetImage(image *ebiten.Image)
func (n *NavPoint) SetObjective(objective NavObjective)
func (n *NavPoint) SetVisited(visited bool)
func (n *NavPoint) Visited() bool

type Projectile

type Projectile struct {
	Resource *ModelProjectileResource
	// contains filtered or unexported fields
}

func NewProjectile

func NewProjectile(
	r *ModelProjectileResource, damage, velocity, optimalLifespan, extremeLifespan,
	collisionRadius, collisionHeight float64,
) *Projectile

func (*Projectile) Acceleration added in v0.0.1

func (e *Projectile) Acceleration() float64

func (*Projectile) Anchor

func (e *Projectile) Anchor() raycaster.SpriteAnchor

func (*Projectile) ApplyDamage

func (e *Projectile) ApplyDamage(damage float64)

func (*Projectile) ArmorPoints

func (e *Projectile) ArmorPoints() float64

func (*Projectile) Clone

func (e *Projectile) Clone() Entity

func (*Projectile) CockpitOffset

func (e *Projectile) CockpitOffset() *geom.Vector2

func (*Projectile) CollisionHeight

func (e *Projectile) CollisionHeight() float64

func (*Projectile) CollisionRadius

func (e *Projectile) CollisionRadius() float64

func (*Projectile) Damage

func (e *Projectile) Damage() float64

func (*Projectile) DecreaseLifespan

func (e *Projectile) DecreaseLifespan(decreaseBy float64) float64

func (*Projectile) Destroy

func (e *Projectile) Destroy()

func (*Projectile) Heading

func (e *Projectile) Heading() float64

func (*Projectile) InExtremeRange

func (e *Projectile) InExtremeRange() bool

func (*Projectile) IsDestroyed

func (e *Projectile) IsDestroyed() bool

func (*Projectile) Lifespan

func (e *Projectile) Lifespan() float64

func (*Projectile) LockOnOffset

func (e *Projectile) LockOnOffset() *geom3d.Vector3

func (*Projectile) MaxArmorPoints

func (e *Projectile) MaxArmorPoints() float64

func (*Projectile) MaxStructurePoints

func (e *Projectile) MaxStructurePoints() float64

func (*Projectile) MaxVelocity added in v0.0.1

func (e *Projectile) MaxVelocity() float64

func (*Projectile) Parent

func (e *Projectile) Parent() Entity

func (*Projectile) Pitch

func (e *Projectile) Pitch() float64

func (*Projectile) Pos

func (e *Projectile) Pos() *geom.Vector2

func (*Projectile) PosZ

func (e *Projectile) PosZ() float64

func (*Projectile) SetAcceleration added in v0.0.1

func (e *Projectile) SetAcceleration(acceleration float64)

func (*Projectile) SetAnchor

func (e *Projectile) SetAnchor(anchor raycaster.SpriteAnchor)

func (*Projectile) SetArmorPoints

func (e *Projectile) SetArmorPoints(armor float64)

func (*Projectile) SetCollisionHeight

func (e *Projectile) SetCollisionHeight(collisionHeight float64)

func (*Projectile) SetCollisionRadius

func (e *Projectile) SetCollisionRadius(collisionRadius float64)

func (*Projectile) SetHeading

func (e *Projectile) SetHeading(angle float64)

func (*Projectile) SetMaxVelocity added in v0.0.1

func (e *Projectile) SetMaxVelocity(maxVelocity float64)

func (*Projectile) SetParent

func (e *Projectile) SetParent(parent Entity)

func (*Projectile) SetPitch

func (e *Projectile) SetPitch(pitch float64)

func (*Projectile) SetPos

func (e *Projectile) SetPos(pos *geom.Vector2)

func (*Projectile) SetPosZ

func (e *Projectile) SetPosZ(posZ float64)

func (*Projectile) SetStructurePoints

func (e *Projectile) SetStructurePoints(structure float64)

func (*Projectile) SetVelocity

func (e *Projectile) SetVelocity(velocity float64)

func (*Projectile) SetVelocityZ

func (e *Projectile) SetVelocityZ(velocityZ float64)

func (*Projectile) SetWeapon

func (e *Projectile) SetWeapon(weapon Weapon)

func (*Projectile) StructurePoints

func (e *Projectile) StructurePoints() float64

func (*Projectile) Velocity

func (e *Projectile) Velocity() float64

func (*Projectile) VelocityZ

func (e *Projectile) VelocityZ() float64

func (*Projectile) Weapon

func (e *Projectile) Weapon() Weapon

type RegExp

type RegExp struct {
	*regexp.Regexp
}

func (*RegExp) UnmarshalText

func (r *RegExp) UnmarshalText(b []byte) error

Unmarshals into compiled regex

type SpriteAnchor

type SpriteAnchor struct {
	raycaster.SpriteAnchor
}

func (*SpriteAnchor) UnmarshalText

func (r *SpriteAnchor) UnmarshalText(b []byte) error

Unmarshals into raycaster.SpriteAnchor

type TechBase

type TechBase int
const (
	COMMON TechBase = iota
	CLAN
	IS
)

type Unit

type Unit interface {
	Entity
	ID() string
	SetID(string)
	Name() string
	Variant() string
	Tonnage() float64
	UnitType() UnitType

	Heat() float64
	MaxHeat() float64
	HeatDissipation() float64
	OverHeated() bool
	Powered() UnitPowerStatus
	SetPowered(UnitPowerStatus)

	TriggerWeapon(Weapon) bool
	Target() Entity
	SetTarget(Entity)
	TargetLock() float64
	SetTargetLock(float64)

	TurnRate() float64
	SetTargetHeading(float64)
	SetTargetPitch(float64)
	MaxVelocity() float64
	TargetVelocity() float64
	SetTargetVelocity(float64)
	TargetVelocityZ() float64
	SetTargetVelocityZ(float64)
	Update() bool

	HasTurret() bool
	SetHasTurret(bool)
	TurretAngle() float64
	SetTurretAngle(float64)
	TurretRate() float64
	SetTargetTurretAngle(float64)

	CockpitOffset() *geom.Vector2
	Ammunition() *Ammo
	Armament() []Weapon
	AddArmament(Weapon)

	JumpJets() int
	JumpJetsActive() bool
	SetJumpJetsActive(bool)
	JumpJetsDirectional() bool
	SetJumpJetsDirectional(bool)
	JumpJetHeading() float64
	SetJumpJetHeading(float64)
	JumpJetVelocity() float64
	JumpJetDuration() float64
	MaxJumpJetDuration() float64

	Objective() UnitObjective
	SetObjective(UnitObjective)
	SetAsPlayer(bool)
	IsPlayer() bool

	CloneUnit() Unit
}

func EntityUnit

func EntityUnit(entity Entity) Unit

type UnitModel

type UnitModel struct {
	// contains filtered or unexported fields
}

func (*UnitModel) AddArmament

func (e *UnitModel) AddArmament(w Weapon)

func (*UnitModel) Ammunition

func (e *UnitModel) Ammunition() *Ammo

func (*UnitModel) Anchor

func (e *UnitModel) Anchor() raycaster.SpriteAnchor

func (*UnitModel) ApplyDamage

func (e *UnitModel) ApplyDamage(damage float64)

func (*UnitModel) Armament

func (e *UnitModel) Armament() []Weapon

func (*UnitModel) ArmorPoints

func (e *UnitModel) ArmorPoints() float64

func (*UnitModel) CockpitOffset

func (e *UnitModel) CockpitOffset() *geom.Vector2

func (*UnitModel) CollisionHeight

func (e *UnitModel) CollisionHeight() float64

func (*UnitModel) CollisionRadius

func (e *UnitModel) CollisionRadius() float64

func (*UnitModel) DistanceToEntity

func (e1 *UnitModel) DistanceToEntity(e2 Entity) float64

func (*UnitModel) HasTurret

func (e *UnitModel) HasTurret() bool

func (*UnitModel) Heading

func (e *UnitModel) Heading() float64

func (*UnitModel) Heat

func (e *UnitModel) Heat() float64

func (*UnitModel) HeatDissipation

func (e *UnitModel) HeatDissipation() float64

func (*UnitModel) ID added in v0.0.1

func (e *UnitModel) ID() string

func (*UnitModel) IsDestroyed

func (e *UnitModel) IsDestroyed() bool

func (*UnitModel) IsPlayer

func (e *UnitModel) IsPlayer() bool

func (*UnitModel) JumpJetDuration

func (e *UnitModel) JumpJetDuration() float64

func (*UnitModel) JumpJetHeading

func (e *UnitModel) JumpJetHeading() float64

func (*UnitModel) JumpJetVelocity

func (e *UnitModel) JumpJetVelocity() float64

func (*UnitModel) JumpJets

func (e *UnitModel) JumpJets() int

func (*UnitModel) JumpJetsActive

func (e *UnitModel) JumpJetsActive() bool

func (*UnitModel) JumpJetsDirectional added in v0.0.2

func (e *UnitModel) JumpJetsDirectional() bool

func (*UnitModel) MaxHeat

func (e *UnitModel) MaxHeat() float64

func (*UnitModel) MaxJumpJetDuration

func (e *UnitModel) MaxJumpJetDuration() float64

func (*UnitModel) MaxVelocity

func (e *UnitModel) MaxVelocity() float64

func (*UnitModel) Objective added in v0.0.1

func (e *UnitModel) Objective() UnitObjective

func (*UnitModel) OverHeated

func (e *UnitModel) OverHeated() bool

func (*UnitModel) Parent

func (e *UnitModel) Parent() Entity

func (*UnitModel) Pitch

func (e *UnitModel) Pitch() float64

func (*UnitModel) Pos

func (e *UnitModel) Pos() *geom.Vector2

func (*UnitModel) PosZ

func (e *UnitModel) PosZ() float64

func (*UnitModel) Powered

func (e *UnitModel) Powered() UnitPowerStatus

func (*UnitModel) SetAnchor

func (e *UnitModel) SetAnchor(anchor raycaster.SpriteAnchor)

func (*UnitModel) SetArmorPoints

func (e *UnitModel) SetArmorPoints(armor float64)

func (*UnitModel) SetAsPlayer

func (e *UnitModel) SetAsPlayer(isPlayer bool)

func (*UnitModel) SetCollisionHeight

func (e *UnitModel) SetCollisionHeight(collisionHeight float64)

func (*UnitModel) SetCollisionRadius

func (e *UnitModel) SetCollisionRadius(collisionRadius float64)

func (*UnitModel) SetHasTurret

func (e *UnitModel) SetHasTurret(hasTurret bool)

func (*UnitModel) SetHeading

func (e *UnitModel) SetHeading(angle float64)

func (*UnitModel) SetID added in v0.0.1

func (e *UnitModel) SetID(id string)

func (*UnitModel) SetJumpJetHeading added in v0.0.2

func (e *UnitModel) SetJumpJetHeading(heading float64)

func (*UnitModel) SetJumpJetsActive

func (e *UnitModel) SetJumpJetsActive(active bool)

func (*UnitModel) SetJumpJetsDirectional added in v0.0.2

func (e *UnitModel) SetJumpJetsDirectional(isDirectional bool)

func (*UnitModel) SetObjective added in v0.0.1

func (e *UnitModel) SetObjective(objective UnitObjective)

func (*UnitModel) SetParent

func (e *UnitModel) SetParent(parent Entity)

func (*UnitModel) SetPitch

func (e *UnitModel) SetPitch(pitch float64)

func (*UnitModel) SetPos

func (e *UnitModel) SetPos(pos *geom.Vector2)

func (*UnitModel) SetPosZ

func (e *UnitModel) SetPosZ(posZ float64)

func (*UnitModel) SetPowered

func (e *UnitModel) SetPowered(powered UnitPowerStatus)

func (*UnitModel) SetStructurePoints

func (e *UnitModel) SetStructurePoints(structure float64)

func (*UnitModel) SetTarget

func (e *UnitModel) SetTarget(t Entity)

func (*UnitModel) SetTargetHeading added in v0.0.1

func (e *UnitModel) SetTargetHeading(heading float64)

func (*UnitModel) SetTargetLock

func (e *UnitModel) SetTargetLock(lockPercent float64)

func (*UnitModel) SetTargetPitch added in v0.0.1

func (e *UnitModel) SetTargetPitch(pitch float64)

func (*UnitModel) SetTargetTurretAngle added in v0.0.1

func (e *UnitModel) SetTargetTurretAngle(angle float64)

func (*UnitModel) SetTargetVelocity

func (e *UnitModel) SetTargetVelocity(tVelocity float64)

func (*UnitModel) SetTargetVelocityZ

func (e *UnitModel) SetTargetVelocityZ(tVelocityZ float64)

func (*UnitModel) SetTurretAngle

func (e *UnitModel) SetTurretAngle(angle float64)

func (*UnitModel) SetVelocity

func (e *UnitModel) SetVelocity(velocity float64)

func (*UnitModel) SetVelocityZ

func (e *UnitModel) SetVelocityZ(velocityZ float64)

func (*UnitModel) StructurePoints

func (e *UnitModel) StructurePoints() float64

func (*UnitModel) Target

func (e *UnitModel) Target() Entity

func (*UnitModel) TargetLock

func (e *UnitModel) TargetLock() float64

func (*UnitModel) TargetVelocity

func (e *UnitModel) TargetVelocity() float64

func (*UnitModel) TargetVelocityZ

func (e *UnitModel) TargetVelocityZ() float64

func (*UnitModel) TriggerWeapon

func (e *UnitModel) TriggerWeapon(w Weapon) bool

func (*UnitModel) TurnRate

func (e *UnitModel) TurnRate() float64

func (*UnitModel) TurretAngle

func (e *UnitModel) TurretAngle() float64

func (*UnitModel) TurretRate added in v0.0.1

func (e *UnitModel) TurretRate() float64

func (*UnitModel) UnitType added in v0.0.1

func (e *UnitModel) UnitType() UnitType

func (*UnitModel) Velocity

func (e *UnitModel) Velocity() float64

func (*UnitModel) VelocityZ

func (e *UnitModel) VelocityZ() float64

type UnitObjective added in v0.0.1

type UnitObjective int
const (
	NonUnitObjective UnitObjective = iota
	DestroyUnitObjective
	ProtectUnitObjective
)

type UnitPowerStatus

type UnitPowerStatus int
const (
	POWER_ON         UnitPowerStatus = 1
	POWER_OFF_MANUAL UnitPowerStatus = 0
	POWER_OFF_HEAT   UnitPowerStatus = -1
)

type UnitType added in v0.0.1

type UnitType int
const (
	MapUnitType UnitType = iota
	MechUnitType
	VehicleUnitType
	VTOLUnitType
	InfantryUnitType
	EmplacementUnitType
	TotalUnitTypes
)

type VTOL

type VTOL struct {
	*UnitModel
	Resource *ModelVTOLResource
}

func NewVTOL

func NewVTOL(r *ModelVTOLResource, collisionRadius, collisionHeight float64, cockpitOffset *geom.Vector2) *VTOL

func (*VTOL) Clone

func (e *VTOL) Clone() Entity

func (*VTOL) CloneUnit

func (e *VTOL) CloneUnit() Unit

func (*VTOL) MaxArmorPoints

func (e *VTOL) MaxArmorPoints() float64

func (*VTOL) MaxStructurePoints

func (e *VTOL) MaxStructurePoints() float64

func (*VTOL) Name

func (e *VTOL) Name() string

func (*VTOL) SetTargetVelocityZ

func (e *VTOL) SetTargetVelocityZ(tVelocityZ float64)

func (*VTOL) Tonnage

func (e *VTOL) Tonnage() float64

func (*VTOL) Update

func (e *VTOL) Update() bool

func (*VTOL) Variant

func (e *VTOL) Variant() string

type Vehicle

type Vehicle struct {
	*UnitModel
	Resource *ModelVehicleResource
}

func NewVehicle

func NewVehicle(r *ModelVehicleResource, collisionRadius, collisionHeight float64, cockpitOffset *geom.Vector2) *Vehicle

func (*Vehicle) Clone

func (e *Vehicle) Clone() Entity

func (*Vehicle) CloneUnit

func (e *Vehicle) CloneUnit() Unit

func (*Vehicle) MaxArmorPoints

func (e *Vehicle) MaxArmorPoints() float64

func (*Vehicle) MaxStructurePoints

func (e *Vehicle) MaxStructurePoints() float64

func (*Vehicle) Name

func (e *Vehicle) Name() string

func (*Vehicle) Tonnage

func (e *Vehicle) Tonnage() float64

func (*Vehicle) Update

func (e *Vehicle) Update() bool

func (*Vehicle) Variant

func (e *Vehicle) Variant() string

type Weapon

type Weapon interface {
	File() string
	Name() string
	ShortName() string
	Summary() string
	Tech() TechBase
	Type() WeaponType
	Classification() WeaponClassification
	Tonnage() float64
	Damage() float64
	Heat() float64
	Distance() float64
	Velocity() float64
	Cooldown() float64
	MaxCooldown() float64
	DecreaseCooldown(float64)
	TriggerCooldown()

	Offset() *geom.Vector2
	AmmoPerTon() int
	AmmoBin() *AmmoBin
	SetAmmoBin(ammoBin *AmmoBin)
	ProjectileCount() int
	ProjectileDelay() float64
	ProjectileSpread() float64
	SpawnProjectile(angle, pitch float64, spawnedBy Unit) *Projectile
	SpawnProjectileToward(convergencePoint *geom3d.Vector3, spawnedBy Unit) *Projectile

	Audio() string
	Clone() Weapon
	Parent() Entity
}

type WeaponClassification

type WeaponClassification int
const (
	WEAPON_CLASS_UNDEFINED WeaponClassification = iota
	ENERGY_LASER
	ENERGY_PPC
	ENERGY_FLAMER
	BALLISTIC_MACHINEGUN
	BALLISTIC_AUTOCANNON
	BALLISTIC_LBX_AC
	BALLISTIC_GAUSS
	MISSILE_LRM
	MISSILE_SRM
)

type WeaponFireMode

type WeaponFireMode int
const (
	CHAIN_FIRE WeaponFireMode = iota
	GROUP_FIRE
)

type WeaponType

type WeaponType int
const (
	ENERGY WeaponType = iota
	BALLISTIC
	MISSILE
)

Jump to

Keyboard shortcuts

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