entity

package
v0.0.0-...-37f97d0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthEntity        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEntity          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEntity = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTemplate        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTemplate          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTemplate = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type App

type App interface {
	Store
	StoreTemplate
}

Applicative layer for entity domain.

type Cast

type Cast struct {
	AbilityID github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,1,opt,name=AbilityID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"AbilityID"`
	TS        uint64                                `protobuf:"varint,2,opt,name=TS,proto3" json:"TS,omitempty"`
}

func NewPopulatedCast

func NewPopulatedCast(r randyEntity, easy bool) *Cast

func (*Cast) Descriptor

func (*Cast) Descriptor() ([]byte, []int)

func (*Cast) Equal

func (this *Cast) Equal(that interface{}) bool

func (*Cast) GetTS

func (m *Cast) GetTS() uint64

func (*Cast) GoString

func (this *Cast) GoString() string

func (*Cast) Marshal

func (m *Cast) Marshal() (dAtA []byte, err error)

func (*Cast) MarshalTo

func (m *Cast) MarshalTo(dAtA []byte) (int, error)

func (*Cast) MarshalToSizedBuffer

func (m *Cast) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Cast) ProtoMessage

func (*Cast) ProtoMessage()

func (*Cast) Reset

func (m *Cast) Reset()

func (*Cast) Size

func (m *Cast) Size() (n int)

func (*Cast) String

func (this *Cast) String() string

func (*Cast) Unmarshal

func (m *Cast) Unmarshal(dAtA []byte) error

func (*Cast) XXX_DiscardUnknown

func (m *Cast) XXX_DiscardUnknown()

func (*Cast) XXX_Marshal

func (m *Cast) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Cast) XXX_Merge

func (m *Cast) XXX_Merge(src proto.Message)

func (*Cast) XXX_Size

func (m *Cast) XXX_Size() int

func (*Cast) XXX_Unmarshal

func (m *Cast) XXX_Unmarshal(b []byte) error

type E

type E struct {
	// #Identifiers
	ID         github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"ID"`
	TemplateID github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,2,opt,name=TemplateID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"TemplateID"`
	Name       string                                `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"`
	// owner is nil if entity is controlled by player, else it will be pc entity id.
	OwnerID github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,4,opt,name=OwnerID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"OwnerID"`
	// #Stats
	Dead  bool   `protobuf:"varint,5,opt,name=Dead,proto3" json:"Dead,omitempty"`
	HP    uint64 `protobuf:"varint,6,opt,name=HP,proto3" json:"HP,omitempty"`
	MaxHP uint64 `protobuf:"varint,7,opt,name=MaxHP,proto3" json:"MaxHP,omitempty"`
	MP    uint64 `protobuf:"varint,8,opt,name=MP,proto3" json:"MP,omitempty"`
	MaxMP uint64 `protobuf:"varint,9,opt,name=MaxMP,proto3" json:"MaxMP,omitempty"`
	// #Spatial & graphic parameters
	Direction geometry.Vec3                         `protobuf:"bytes,10,opt,name=Direction,proto3" json:"Direction"`
	Position  geometry.Vec3                         `protobuf:"bytes,11,opt,name=Position,proto3" json:"Position"`
	Cast      *Cast                                 `protobuf:"bytes,12,opt,name=Cast,proto3" json:"Cast,omitempty"`
	AssetID   github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,13,opt,name=AssetID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"AssetID"`
	// #In game external ids
	InventoryID github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,14,opt,name=InventoryID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"InventoryID"`
	SpawnID     github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,15,opt,name=SpawnID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"SpawnID"`
	// Timestamp of entity state.
	TS uint64 `protobuf:"varint,16,opt,name=TS,proto3" json:"TS,omitempty"`
	// State is a technical requirement for redis set, each "state" of entity must be unique.
	State github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,17,opt,name=State,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"State"`
}

func NewPopulatedE

func NewPopulatedE(r randyEntity, easy bool) *E

func (*E) Descriptor

func (*E) Descriptor() ([]byte, []int)

func (*E) Equal

func (this *E) Equal(that interface{}) bool

func (*E) GetCast

func (m *E) GetCast() *Cast

func (*E) GetDead

func (m *E) GetDead() bool

func (*E) GetDirection

func (m *E) GetDirection() geometry.Vec3

func (*E) GetHP

func (m *E) GetHP() uint64

func (*E) GetMP

func (m *E) GetMP() uint64

func (*E) GetMaxHP

func (m *E) GetMaxHP() uint64

func (*E) GetMaxMP

func (m *E) GetMaxMP() uint64

func (*E) GetName

func (m *E) GetName() string

func (*E) GetPosition

func (m *E) GetPosition() geometry.Vec3

func (*E) GetTS

func (m *E) GetTS() uint64

func (*E) GoString

func (this *E) GoString() string

func (*E) Marshal

func (m *E) Marshal() (dAtA []byte, err error)

func (*E) MarshalTo

func (m *E) MarshalTo(dAtA []byte) (int, error)

func (*E) MarshalToSizedBuffer

func (m *E) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*E) ProtoMessage

func (*E) ProtoMessage()

func (*E) Reset

func (m *E) Reset()

func (*E) Size

func (m *E) Size() (n int)

func (*E) String

func (this *E) String() string

func (*E) Unmarshal

func (m *E) Unmarshal(dAtA []byte) error

func (*E) XXX_DiscardUnknown

func (m *E) XXX_DiscardUnknown()

func (*E) XXX_Marshal

func (m *E) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*E) XXX_Merge

func (m *E) XXX_Merge(src proto.Message)

func (*E) XXX_Size

func (m *E) XXX_Size() int

func (*E) XXX_Unmarshal

func (m *E) XXX_Unmarshal(b []byte) error

type Filter

type Filter struct {
	ID gulid.ID
}

Filter object for entity domain.

type FilterTemplate

type FilterTemplate struct {
	ID gulid.ID
}

FilterTemplate object for entity template domain.

type Store

type Store interface {
	Upsert(context.Context, E) error
	Fetch(context.Context, Filter) (E, error)
	Delete(context.Context, Filter) error
}

Store layer for entity domain.

type StoreTemplate

type StoreTemplate interface {
	UpsertTemplate(context.Context, Template) error
	FetchTemplate(context.Context, FilterTemplate) (Template, error)
	DeleteTemplate(context.Context, FilterTemplate) error
}

StoreTemplate layer for entity template domain.

type Template

type Template struct {
	// #Identifiers
	ID   github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"ID"`
	Name string                                `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
	// #Stats
	MaxHP uint64 `protobuf:"varint,3,opt,name=MaxHP,proto3" json:"MaxHP,omitempty"`
	MaxMP uint64 `protobuf:"varint,4,opt,name=MaxMP,proto3" json:"MaxMP,omitempty"`
	// #Spatial & graphic parameters
	AssetID github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,5,opt,name=AssetID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"AssetID"`
	// #In game external ids
	SpawnID github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,6,opt,name=SpawnID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"SpawnID"`
}

func NewPopulatedTemplate

func NewPopulatedTemplate(r randyTemplate, easy bool) *Template

func (*Template) Descriptor

func (*Template) Descriptor() ([]byte, []int)

func (*Template) Equal

func (this *Template) Equal(that interface{}) bool

func (*Template) GetMaxHP

func (m *Template) GetMaxHP() uint64

func (*Template) GetMaxMP

func (m *Template) GetMaxMP() uint64

func (*Template) GetName

func (m *Template) GetName() string

func (*Template) GoString

func (this *Template) GoString() string

func (*Template) Marshal

func (m *Template) Marshal() (dAtA []byte, err error)

func (*Template) MarshalTo

func (m *Template) MarshalTo(dAtA []byte) (int, error)

func (*Template) MarshalToSizedBuffer

func (m *Template) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Template) ProtoMessage

func (*Template) ProtoMessage()

func (*Template) Reset

func (m *Template) Reset()

func (*Template) Size

func (m *Template) Size() (n int)

func (*Template) String

func (this *Template) String() string

func (*Template) Unmarshal

func (m *Template) Unmarshal(dAtA []byte) error

func (*Template) XXX_DiscardUnknown

func (m *Template) XXX_DiscardUnknown()

func (*Template) XXX_Marshal

func (m *Template) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Template) XXX_Merge

func (m *Template) XXX_Merge(src proto.Message)

func (*Template) XXX_Size

func (m *Template) XXX_Size() int

func (*Template) XXX_Unmarshal

func (m *Template) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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