id

package
v0.0.0-...-154d7ca Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyCharacter = "morogue:character"
	KeyTile      = "morogue:tile"
	KeyDoor      = "morogue:door"
	KeyMob       = "morogue:mob"
	KeyItem      = "morogue:item"
	KeyWeapon    = "morogue:weapon"
	KeyArmor     = "morogue:armor"
	KeyFood      = "morogue:food"
	//
	KeyPlace   = "morogue:place"
	KeyFixture = "morogue:fixture"
)

Variables

View Source
var KeyToNamespace map[string]UUID
View Source
var NamespaceToKey map[UUID]string

NamespaceToKey provides a mapping of morogue's UUIDv5s to their string keys.

Functions

This section is empty.

Types

type UUID

type UUID uuid.UUID

UUID is a UUID. In general, most UUIDs in morogue are UUIDv5s used to identify static types of objects, such as archetypes, items, and weapons. These are generally acquired through the UID func.

var (
	Character UUID
	Tile      UUID
	Door      UUID
	Mob       UUID
	Item      UUID
	Weapon    UUID
	Armor     UUID
	Food      UUID
	//
	Place   UUID
	Fixture UUID
)

func UID

func UID(ns UUID, name string) (UUID, error)

UID generates a unique identifier for the given name in the given morogue namespace. The namespace must be one this is defined in namespaces.

func (UUID) Bytes

func (u UUID) Bytes() []byte

Bytes returns a byte slice representation of the UUID.

func (UUID) IsNil

func (u UUID) IsNil() bool

IsNil returns true if the UUID is nil.

func (UUID) String

func (u UUID) String() string

String returns a string representation of the UUID.

func (*UUID) UnmarshalJSON

func (u *UUID) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a UUID from data in either UUID form or in a morogue valid "namespace:name" format, such as "morogue:tile:stone-wall".

type WID

type WID int

WID is UUIDv4 that represents world-based things.

type WIDGenerator

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

WIDGenerator generates WIDs.

func (*WIDGenerator) Next

func (w *WIDGenerator) Next() WID

Next returns the next WID (top+1) and increases the internal top WID.

func (*WIDGenerator) Top

func (w *WIDGenerator) Top() WID

Top returns the "top" WID, which corresponds to the last WID generated.

Jump to

Keyboard shortcuts

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