entities

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParticleTypeFire      ParticleType = iota
	ParticleTypeSteamVent              = 1
	ParticleTypeFountain               = 2
	ParticleTypeFireball               = 3
	ParticleTypeTape                   = 4
	ParticleTypeLightning              = 7
	ParticleTypeSteam                  = 9
	ParticleTypeWater                  = 10
	ParticleTypeSnow                   = 13
	// your guess is as good as mine
	ParticleTypeMeter   = 5
	ParticleTypeMeterVS = 6
	ParticleTypeFlame   = 11
	ParticleTypeSmoke   = 12
	// i'm dying
	ParticleTypeLensFlare           = 32
	ParticleTypeLensFlareSparkle    = 33
	ParticleTypeLensFlareSun        = 34
	ParticleTypeLensFlareSparkleSun = 35
)

Variables

View Source
var ENTITY_TYPES = []EntityInfo{
	&Light{},
	&MapModel{},
	&PlayerStart{},
	&EnvMap{},
	&Particles{},
	&Sound{},
	&Spotlight{},
	&Shells{},
	&Bullets{},
	&Rockets{},
	&Rounds{},
	&Grenades{},
	&Cartridges{},
	&Health{},
	&Boost{},
	&GreenArmour{},
	&YellowArmour{},
	&Quad{},
	&Teleport{},
	&Teledest{},
	&Carrot{},
	&JumpPad{},
	&Base{},
	&RespawnPoint{},
	&Box{},
	&Barrel{},
	&Platform{},
	&Elevator{},
	&Flag{},
}
View Source
var ENTITY_TYPE_MAP = map[C.EntityType]EntityInfo{}
View Source
var Empty = fmt.Errorf("value was missing, check default")
View Source
var PARTICLE_TYPES = []ParticleInfo{
	&Fire{},
	&SteamVent{},
	&Fountain{},
	&Fireball{},
	&Tape{},
	&Lightning{},
	&Steam{},
	&Water{},
	&Snow{},
	&Meter{},
	&MeterVS{},
	&Flame{},
	&SmokePlume{},
	&LensFlareSparkleSun{},
	&LensFlareSparkle{},
	&LensFlareSun{},
	&LensFlare{},
}
View Source
var PARTICLE_TYPE_MAP = map[ParticleType]ParticleInfo{}
View Source
var PARTICLE_TYPE_STRINGS = map[ParticleType]string{
	ParticleTypeFire:                "fire",
	ParticleTypeSteamVent:           "steamVent",
	ParticleTypeFountain:            "fountain",
	ParticleTypeFireball:            "fireball",
	ParticleTypeTape:                "tape",
	ParticleTypeLightning:           "lightning",
	ParticleTypeSteam:               "steam",
	ParticleTypeWater:               "water",
	ParticleTypeSnow:                "snow",
	ParticleTypeMeter:               "meter",
	ParticleTypeMeterVS:             "meterVs",
	ParticleTypeFlame:               "flame",
	ParticleTypeSmoke:               "smoke",
	ParticleTypeLensFlare:           "lensFlare",
	ParticleTypeLensFlareSparkle:    "lensFlareSparkle",
	ParticleTypeLensFlareSun:        "lensFlareSun",
	ParticleTypeLensFlareSparkleSun: "lensFlareSparkleSun",
}

Functions

This section is empty.

Types

type Attributes

type Attributes []int16

func Encode

func Encode(info EntityInfo) (*Attributes, error)

func (*Attributes) Get

func (a *Attributes) Get() (int16, error)

func (*Attributes) Put

func (a *Attributes) Put(value int16)

type Barrel

type Barrel struct {
	Angle  int16 `json:"angle"`
	Model  int16 `json:"model"`
	Weight int16 `json:"weight"`
	Health int16 `json:"health"`
}

func (*Barrel) Type

func (e *Barrel) Type() C.EntityType

type Base

type Base struct {
	Ammo int16 `json:"ammo"`
	Tag  int16 `json:"tag"`
}

func (*Base) Type

func (e *Base) Type() C.EntityType

type Basic

type Basic struct {
	Radius float32 `json:"radius"`
	Height float32 `json:"height"`
	Color  Color16 `json:"color"`
}

type Boost

type Boost Powerup

func (*Boost) Type

func (e *Boost) Type() C.EntityType

type Box

type Box struct {
	Angle  int16 `json:"angle"`
	Model  int16 `json:"model"`
	Weight int16 `json:"weight"`
}

func (*Box) Type

func (e *Box) Type() C.EntityType

type Bullets

type Bullets Powerup

func (*Bullets) Type

func (e *Bullets) Type() C.EntityType

type Carrot

type Carrot struct {
	Tag  int16 `json:"tag"`
	Kind int16 `json:"kind"`
}

func (*Carrot) Type

func (e *Carrot) Type() C.EntityType

type Cartridges

type Cartridges Powerup

func (*Cartridges) Type

func (e *Cartridges) Type() C.EntityType

type Color16

type Color16 struct {
	R byte
	G byte
	B byte
}

Particles can have colors with a weird encoding scheme. Each element corresponds to the upper four bits in the corresponding element of a 24-bit RGBA color. Instead of messing with this, the Go API treats this as a normal 24-bit color and cuts off the 0x0F bits on encode.

func (*Color16) Decode

func (c *Color16) Decode(a *Attributes) error

func (Color16) Encode

func (c Color16) Encode(a *Attributes) error

func (Color16) MarshalJSON

func (c Color16) MarshalJSON() ([]byte, error)

func (*Color16) UnmarshalJSON

func (c *Color16) UnmarshalJSON(data []byte) error

type Decodable

type Decodable interface {
	Decode(*Attributes) error
}

type Default

type Default[T any] struct {
	// contains filtered or unexported fields
}

just like banks

func NewDefault

func NewDefault[T any](value T) Default[T]

func (*Default[T]) Clear

func (d *Default[T]) Clear()

Indicate that this should use the default value.

func (*Default[T]) Get

func (d *Default[T]) Get() T

func (*Default[T]) IsEmpty

func (d *Default[T]) IsEmpty() bool

func (*Default[T]) Set

func (d *Default[T]) Set(value T)

type Defaultable

type Defaultable interface {
	Defaults() Defaultable
}

type Direction

type Direction byte
const (
	DirectionZ Direction = iota
	DirectionX
	DirectionY
	DirectionNegZ
	DirectionNegX
	DirectionNegY
)

func (*Direction) Decode

func (d *Direction) Decode(a *Attributes) error

func (*Direction) Encode

func (d *Direction) Encode(a *Attributes) error

type Elevator

type Elevator struct {
	Angle int16 `json:"angle"`
	Model int16 `json:"model"`
	Tag   int16 `json:"tag"`
	Speed int16 `json:"speed"`
}

func (*Elevator) Type

func (e *Elevator) Type() C.EntityType

type Encodable

type Encodable interface {
	Encode(*Attributes) error
}

type Entity

type Entity struct {
	Position Vector
	Info     EntityInfo
}

func (*Entity) MarshalJSON

func (e *Entity) MarshalJSON() ([]byte, error)

func (*Entity) UnmarshalJSON

func (e *Entity) UnmarshalJSON(data []byte) error

type EntityInfo

type EntityInfo interface {
	Type() C.EntityType
}

func Decode

func Decode(entityType C.EntityType, a *Attributes) (EntityInfo, error)

type EnvMap

type EnvMap struct {
	Radius int16 `json:"radius"`
	Size   int16 `json:"size"`
	Blur   int16 `json:"blur"`
}

func (*EnvMap) Type

func (e *EnvMap) Type() C.EntityType

type Fire

type Fire Basic

func (Fire) Defaults

func (p Fire) Defaults() Defaultable

func (*Fire) Type

func (p *Fire) Type() ParticleType

type Fireball

type Fireball struct {
	Size  int16   `json:"size"`
	Color Color16 `json:"color"`
}

func (*Fireball) Type

func (p *Fireball) Type() ParticleType

type Flag

type Flag struct {
	Angle int16 `json:"angle"`
	Team  int16 `json:"team"`
}

func (*Flag) Type

func (e *Flag) Type() C.EntityType

type Flame

type Flame Basic

how is this different from Fire?

func (*Flame) Type

func (p *Flame) Type() ParticleType

type Fountain

type Fountain struct {
	Direction Direction
	// TODO handle material colors
	Color Color16
}

func (*Fountain) Type

func (p *Fountain) Type() ParticleType

type GreenArmour

type GreenArmour Powerup

func (*GreenArmour) Type

func (e *GreenArmour) Type() C.EntityType

type Grenades

type Grenades Powerup

func (*Grenades) Type

func (e *Grenades) Type() C.EntityType

type Health

type Health Powerup

func (*Health) Type

func (e *Health) Type() C.EntityType

type JumpPad

type JumpPad struct {
	PushZ int16 `json:"pushZ"`
	PushX int16 `json:"pushX"`
	PushY int16 `json:"pushY"`
	Sound int16 `json:"sound"`
}

func (*JumpPad) Type

func (e *JumpPad) Type() C.EntityType

type LensFlare

type LensFlare struct {
	Color utils.Color `json:"color"`
}

func (*LensFlare) Type

func (p *LensFlare) Type() ParticleType

type LensFlareSparkle

type LensFlareSparkle LensFlare

func (*LensFlareSparkle) Type

func (p *LensFlareSparkle) Type() ParticleType

type LensFlareSparkleSun

type LensFlareSparkleSun LensFlare

func (*LensFlareSparkleSun) Type

type LensFlareSun

type LensFlareSun LensFlare

func (*LensFlareSun) Type

func (p *LensFlareSun) Type() ParticleType

type Light

type Light struct {
	Radius int16       `json:"radius"`
	Color  utils.Color `json:"color"`
}

func (*Light) Type

func (e *Light) Type() C.EntityType

type Lightning

type Lightning Shape

func (*Lightning) Type

func (p *Lightning) Type() ParticleType

type MapModel

type MapModel struct {
	Angle int16 `json:"angle"`
	Index int16 `json:"index"`
}

func (*MapModel) Type

func (m *MapModel) Type() C.EntityType

type Meter

type Meter struct {
	Progress int16   `json:"progress"`
	ColorA   Color16 `json:"colorA"`
	ColorB   Color16 `json:"colorB"`
}

func (*Meter) Type

func (p *Meter) Type() ParticleType

type MeterVS

type MeterVS Meter

func (*MeterVS) Type

func (p *MeterVS) Type() ParticleType

type Monster

type Monster struct {
	Angle int16 `json:"angle"`
	Kind  int16 `json:"kind"`
}

func (*Monster) Type

func (e *Monster) Type() C.EntityType

type ParticleInfo

type ParticleInfo interface {
	Type() ParticleType
}

type ParticleType

type ParticleType byte

func (ParticleType) FromString

func (e ParticleType) FromString(value string)

func (ParticleType) String

func (e ParticleType) String() string

type Particles

type Particles struct {
	Particle ParticleType
	Info     ParticleInfo
}

func (*Particles) Decode

func (p *Particles) Decode(a *Attributes) error

func (*Particles) Encode

func (p *Particles) Encode(a *Attributes) error

func (*Particles) MarshalJSON

func (p *Particles) MarshalJSON() ([]byte, error)

func (*Particles) Type

func (p *Particles) Type() C.EntityType

func (*Particles) UnmarshalJSON

func (p *Particles) UnmarshalJSON(data []byte) error

type Platform

type Platform struct {
	Angle int16 `json:"angle"`
	Model int16 `json:"model"`
	Tag   int16 `json:"tag"`
	Speed int16 `json:"speed"`
}

func (*Platform) Type

func (e *Platform) Type() C.EntityType

type PlayerStart

type PlayerStart struct {
	Angle int16 `json:"angle"`
	Tag   int16 `json:"tag"`
}

func (*PlayerStart) Type

func (e *PlayerStart) Type() C.EntityType

type Powerup

type Powerup struct{}

type Quad

type Quad Powerup

func (*Quad) Type

func (e *Quad) Type() C.EntityType

type RespawnPoint

type RespawnPoint struct {
	Angle int16 `json:"angle"`
	Spin  int16 `json:"spin"`
}

func (*RespawnPoint) Type

func (e *RespawnPoint) Type() C.EntityType

type Rockets

type Rockets Powerup

func (*Rockets) Type

func (e *Rockets) Type() C.EntityType

type Rounds

type Rounds Powerup

func (*Rounds) Type

func (e *Rounds) Type() C.EntityType

type Shape

type Shape struct {
	// TODO handle all the fancy shapes
	// This is NOT the same thing as Direction above, it's used to
	// parametrize the size of particles
	Direction int16   `json:"direction"`
	Radius    int16   `json:"radius"`
	Color     Color16 `json:"color"`
	Fade      int16   `json:"fade"` // ms, if 0, 200ms
}

type Shells

type Shells Powerup

func (*Shells) Type

func (e *Shells) Type() C.EntityType

type SmokePlume

type SmokePlume Basic

func (*SmokePlume) Type

func (p *SmokePlume) Type() ParticleType

type Snow

type Snow Shape

func (*Snow) Type

func (p *Snow) Type() ParticleType

type Sound

type Sound struct {
	Index int16 `json:"index"`
}

func (*Sound) Type

func (e *Sound) Type() C.EntityType

type Spotlight

type Spotlight struct {
	Radius int16       `json:"radius"`
	Color  utils.Color `json:"color"`
}

func (*Spotlight) Type

func (e *Spotlight) Type() C.EntityType

type Steam

type Steam Shape

func (*Steam) Type

func (p *Steam) Type() ParticleType

type SteamVent

type SteamVent struct {
	Direction Direction
}

func (*SteamVent) Type

func (p *SteamVent) Type() ParticleType

type Tape

type Tape Shape

func (*Tape) Type

func (p *Tape) Type() ParticleType

type Teledest

type Teledest struct {
	Angle int16 `json:"angle"`
	Tag   int16 `json:"tag"`
}

func (*Teledest) Type

func (e *Teledest) Type() C.EntityType

type Teleport

type Teleport struct {
	Index int16 `json:"index"`
	Model int16 `json:"model"`
	Tag   int16 `json:"tag"`
	Sound int16 `json:"sound"`
}

func (*Teleport) Type

func (e *Teleport) Type() C.EntityType

type Vector

type Vector struct {
	X float32 `json:"x"`
	Y float32 `json:"y"`
	Z float32 `json:"z"`
}

func (Vector) MarshalJSON

func (v Vector) MarshalJSON() ([]byte, error)

func (*Vector) UnmarshalJSON

func (v *Vector) UnmarshalJSON(data []byte) error

type Water

type Water Shape

func (*Water) Type

func (p *Water) Type() ParticleType

type YellowArmour

type YellowArmour Powerup

func (*YellowArmour) Type

func (e *YellowArmour) Type() C.EntityType

Jump to

Keyboard shortcuts

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