extra

package
v0.0.0-...-0c1458e Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package extra provides handling for the extra data that may be appended on to a save.Entity

The type of the Extra depends on the TypePath of the save.Entity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Circuit

type Circuit struct {
	ID        int32
	LevelName string
	PathName  string
}

type CircuitSubsystem

type CircuitSubsystem struct {
	Circuits []*Circuit
}

type ConveyorBelt

type ConveyorBelt struct {
	Items []*ConveyorBeltItem
}

type ConveyorBeltItem

type ConveyorBeltItem struct {
	ResourceName string
	LevelName    string
	PathName     string
	Position     float32
}

type Extra

type Extra struct {
	Type Type

	// The Value of the Extra.
	//
	// Accessing the value can be achieved by calling the appropriate Get method
	// on the Extra based on its Type.
	Value Value
}

func Parse

func Parse(typePath string, l int32, d *data.Data) (*Extra, error)

Parse an Extra

func (*Extra) GetCircuitSubsystem

func (e *Extra) GetCircuitSubsystem() (*CircuitSubsystem, error)

func (*Extra) GetConveyorBelt

func (e *Extra) GetConveyorBelt() (*ConveyorBelt, error)

func (*Extra) GetGameMode

func (e *Extra) GetGameMode() (*GameMode, error)

func (*Extra) GetGameState

func (e *Extra) GetGameState() (*GameState, error)

func (*Extra) GetPlayerState

func (e *Extra) GetPlayerState() (*PlayerState, error)

func (*Extra) GetPowerLine

func (e *Extra) GetPowerLine() (*PowerLine, error)

func (*Extra) GetTrain

func (e *Extra) GetTrain() (*Train, error)

func (*Extra) GetUnknown

func (e *Extra) GetUnknown() (*UnknownExtra, error)

func (*Extra) GetVehicle

func (e *Extra) GetVehicle() (*Vehicle, error)

func (*Extra) Serialize

func (e *Extra) Serialize(d *data.Data) error

Serialize an Extra

type GameMode

type GameMode struct {
	Objects []*Reference
}

type GameState

type GameState struct {
	Objects []*Reference
}

type PlayerState

type PlayerState struct {
	Data []byte
	// contains filtered or unexported fields
}

type PowerLine

type PowerLine struct {
	SourceLevelName string
	SourcePathName  string
	TargetLevelName string
	TargetPathName  string
}

type Reference

type Reference struct {
	LevelName string `json:"levelName"`
	PathName  string `json:"pathName"`
}

type Train

type Train struct {
	PreviousLevelName string
	PreviousPathName  string
	NextLevelName     string
	NextPathName      string
}

type Type

type Type string
const (
	CircuitSubsystemExtraType Type = "CircuitSubsystem"
	ConveyorBeltExtraType     Type = "ConveyorBelt"
	GameModeExtraType         Type = "GameMode"
	GameStateExtraType        Type = "GameState"
	PlayerStateExtraType      Type = "PlayerState"
	PowerLineExtraType        Type = "PowerLine"
	TrainExtraType            Type = "Train"
	UnknownExtraType          Type = "Unknown"
	VehicleExtraType          Type = "Vehicle"
)

type UnknownExtra

type UnknownExtra struct {
	Data []byte
	// contains filtered or unexported fields
}

UnknownExtra is the default extra that will be returned if we encounter extra data in a save.Entity with a TypePath that we don't have explicit handling for.

type Value

type Value interface {
	// contains filtered or unexported methods
}

type Vehicle

type Vehicle struct {
	Data []VehicleData
}

type VehicleData

type VehicleData struct {
	Name string
	Data []byte
}

Jump to

Keyboard shortcuts

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