srb2conflicts

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// SourceBareFile is used on resources that are not stored inside a WAD or PK3 archive
	SourceBareFile = "__BARE"

	// UndefinedSOCEntry is used when a SOC definition is requested but not found
	UndefinedSOCEntry = "__UNDEFINED"
)

Variables

View Source
var (
	ErrSOCUnexpectedProperty = errors.New("unexpected property in SOC")
	ErrSOCUnexpectedLump     = errors.New("unexpected lump in SOC")
)

Functions

This section is empty.

Types

type CheckDirectoryOptions

type CheckDirectoryOptions struct {
	IgnoreFiles []string
}

type CheckDirectoryResult

type CheckDirectoryResult struct {
	Files        []string
	Maps         ResourceMap[GameMap]
	MapConflicts map[string][]GameMap
}

func CheckDirectory

func CheckDirectory(path string, options CheckDirectoryOptions) (CheckDirectoryResult, error)

type GameMap

type GameMap struct {
	ID       string
	Source   string
	SOCFile  string
	SOCEntry SOCBlock
}

GameMap is a SRB2 map that has been defined via SOC entry

func (GameMap) LevelName

func (g GameMap) LevelName() string

LevelName retrieves the in-game level name from the SOC entry

type Lump

type Lump struct {
	Kind   string
	Source string
	Path   string
}

Lump is a generic lump resource in a WAD/PK3/bare file

type PK3File

type PK3File struct {
	Path  string
	Files []string
	SOCs  []*SOCDefinition
	Skins []Skin
}

func LoadPK3

func LoadPK3(path string) (*PK3File, error)

func NewPK3

func NewPK3(path string) *PK3File

type ResourceMap

type ResourceMap[T any] map[string][]T

ResourceMap is a dictionary of resources, ideally only one resource should occupy a key

func (ResourceMap[T]) Join

func (r ResourceMap[T]) Join(other ResourceMap[T])

Join adds the contents of another resource map to the current one

type SOCBlock

type SOCBlock struct {
	Kind       string
	LumpID     string
	Properties map[string]string
	Extra      []string
	Lumps      []string
}

type SOCDefinition

type SOCDefinition struct {
	Slots    []string
	Maps     ResourceMap[GameMap]
	Other    []SOCBlock
	Source   string
	FilePath string
}

func LoadSOC

func LoadSOC(path string) (*SOCDefinition, error)

func NewSOCDef

func NewSOCDef(source, file string) *SOCDefinition

func (*SOCDefinition) AddBlock

func (s *SOCDefinition) AddBlock(block SOCBlock)

func (*SOCDefinition) Freeslots

func (s *SOCDefinition) Freeslots() ResourceMap[Lump]

type Skin

type Skin struct {
	ID   string
	Name string
	Path string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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