obj

package
v0.0.0-...-4ede3f3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package obj provides tools to work with game entities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	ID ids.Info `json:"id"`
	// internal name for development
	Name string `json:"name"`
	// img or clip to render, objects can be invisible e.g. areas to trigger an action
	Asset ids.Topic `json:"asset,omitempty"`
	// text info for obj that can be inspected
	Descr string `json:"descr,omitempty"`
	// dialog id for items with a dialog e.g. terminals or keypads
	Dia ids.Dia `json:"dia,omitempty"`
}

func (*Info) Make

func (*Info) Make(id uint32) Info

func (*Info) MarshalBinary

func (o *Info) MarshalBinary() ([]byte, error)

func (*Info) Named

func (o *Info) Named() string

func (*Info) UID

func (o *Info) UID() uint32

func (*Info) UnmarshalBinary

func (o *Info) UnmarshalBinary(raw []byte) error

type InfoTable

type InfoTable = ids.ListTable[ids.Info, Info, *Info]

type Obj

type Obj struct {
	ID ids.Obj `json:"id"`
	// generic info
	Info ids.Info `json:"info"`
	// level position and dimension
	Lvl ids.Lvl `json:"lvl"`
	geo.Box
	// specific components:
	// loot inventory id of lootable items
	Loot ids.Inv `json:"loot,omitempty"`
}

Obj represents all things that can be positioned in levels.

func (*Obj) Make

func (*Obj) Make(id uint32) Obj

func (*Obj) MarshalBinary

func (o *Obj) MarshalBinary() ([]byte, error)

func (*Obj) UID

func (o *Obj) UID() uint32

func (*Obj) UnmarshalBinary

func (o *Obj) UnmarshalBinary(raw []byte) error

type ObjTable

type ObjTable = ids.ListTable[ids.Obj, Obj, *Obj]

type Sys

type Sys struct {
	Info InfoTable
	Obj  ObjTable
}

Sys is the object system of a game world where the obj ids map into the list offset by one.

func (*Sys) DelInfo

func (s *Sys) DelInfo(id ids.Info) error

func (*Sys) DelObj

func (s *Sys) DelObj(id ids.Obj) error

func (*Sys) NewInfo

func (s *Sys) NewInfo(name string) (*Info, error)

func (*Sys) NewObj

func (s *Sys) NewObj(nfo ids.Info) (*Obj, error)

Jump to

Keyboard shortcuts

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