ao

package
v0.0.0-...-ef9d94b Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalAOIDmax = mt.AOID(2 ^ 32)
	GlobalAOIDmin = mt.AOID(1)
)
View Source
const (
	Client aoidType = true
	Global          = false
)

Variables

View Source
var (
	ReleventDistance float32 = 100 // in nodes; distance around player their still informed about AOs
)

Functions

func AOMsg

func AOMsg(msgs ...mt.IDAOMsg)

func Distance

func Distance(a, b mt.Vec) float32

func FilterRelevantAdds

func FilterRelevantAdds(pos mt.Pos, adds []mt.AOAdd) (r []mt.AOAdd)

func FilterRelevantMsgs

func FilterRelevantMsgs(pos mt.Pos, msgs []mt.IDAOMsg) (r []mt.IDAOMsg)

func FilterRelevantRms

func FilterRelevantRms(pos mt.Pos, rms []mt.AOID) (r []mt.AOID)

func FreeAOID

func FreeAOID(id mt.AOID)

func GetAOID

func GetAOID() mt.AOID

func GetAOPos

func GetAOPos(id mt.AOID) (bool, mt.AOPos)

func JoinHook

func JoinHook(clt *minetest.Client)

func LeaveHook

func LeaveHook(l *minetest.Leave)

leave player clear aoids

func ProcessPkt

func ProcessPkt(clt *minetest.Client, pkt *mt.Pkt)

func RegisterAO

func RegisterAO(ao ActiveObject) mt.AOID

RegisterAO registers a initialized ActiveObject

func RegisterAO0Maker

func RegisterAO0Maker(f func(clt *minetest.Client) mt.AOInitData)

Register player AO0 / self RegisterSelfAOMaker is used to register the AO maker for each client

func RmAO

func RmAO(ids ...mt.AOID)

func SendPkts

func SendPkts()

DO NOT CALL IF YOU DONT KNOW WHAT YOUR DOING

func Tick

func Tick()

Types

type AOInteract

type AOInteract struct {
	Player *minetest.Client

	Action   mt.Interaction
	ItemSlot uint16
	Pos      mt.PlayerPos
}

AOInteract describes a interaction with a active object

type AOPhys

type AOPhys struct {
	Walk, Jump, Gravety float32
}

func (AOPhys) NotDefault

func (p AOPhys) NotDefault() bool

returns true if Walk|Jump|Gravety is not 1

func (AOPhys) Pkt

func (p AOPhys) Pkt() *mt.AOCmdPhysOverride

pkt returns a mt.ToCltAOPhysOverride

type AOState

type AOState struct {
	Anim AnimState

	Pos mt.AOPos

	Armor  []mt.Group
	Attach mt.AOAttach

	Phys  AOPhys
	Bones map[string]mt.AOBonePos

	HP uint16

	TextureMod mt.Texture
}

func (*AOState) GetAnimState

func (s *AOState) GetAnimState() AnimState

func (*AOState) GetArmor

func (s *AOState) GetArmor() []mt.Group

func (*AOState) GetAttach

func (s *AOState) GetAttach() mt.AOAttach

func (*AOState) GetBones

func (s *AOState) GetBones() map[string]mt.AOBonePos

func (*AOState) GetHP

func (s *AOState) GetHP() uint16

func (*AOState) GetPhys

func (s *AOState) GetPhys() AOPhys

func (*AOState) GetPos

func (s *AOState) GetPos() mt.AOPos

func (*AOState) GetTextureMod

func (s *AOState) GetTextureMod() mt.Texture

type ActiveObject

type ActiveObject interface {
	SetID(mt.AOID)
	GetID() mt.AOID

	GetPos() mt.AOPos
	GetBonePos(string) (mt.AOBonePos, bool)
	GetBones() map[string]mt.AOBonePos

	GetProps() mt.AOProps
	GetArmor() []mt.Group

	InitPkt(mt.AOID, *minetest.Client) mt.AOInitData

	Interact(AOInteract)

	Delete(DelReason)
}

ActiveObject describes a active object. an example struct is located in example.go (`ActiveObjectS`)

func GetAO

func GetAO(id mt.AOID) ActiveObject

type ActiveObjectS

type ActiveObjectS struct {
	AOState

	ID mt.AOID

	AnimSpeed float32
	Attach    mt.AOAttach
	Props     mt.AOProps
}

ActiveObjectS is a example for a ActiveObject interface

func (*ActiveObjectS) Delete

func (ao *ActiveObjectS) Delete(DelReason)

func (*ActiveObjectS) GetBonePos

func (ao *ActiveObjectS) GetBonePos(str string) (p mt.AOBonePos, ok bool)

func (*ActiveObjectS) GetID

func (ao *ActiveObjectS) GetID() mt.AOID

func (*ActiveObjectS) GetProps

func (ao *ActiveObjectS) GetProps() mt.AOProps

func (*ActiveObjectS) InitPkt

func (ao *ActiveObjectS) InitPkt(id mt.AOID, clt *minetest.Client) mt.AOInitData

func (*ActiveObjectS) Interact

func (ao *ActiveObjectS) Interact(AOInteract)

func (*ActiveObjectS) SetID

func (ao *ActiveObjectS) SetID(id mt.AOID)

type AnimState

type AnimState struct {
	Active bool

	mt.AOAnim
	Speed float32
}

type ClientData

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

Data kept per client

func (*ClientData) QueueAdd

func (cd *ClientData) QueueAdd(adds ...mt.AOID)

type DelReason

type DelReason uint8
const (
	ClearObjects DelReason = iota
	ForceKill
)

Jump to

Keyboard shortcuts

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