field

package
v0.0.0-...-e57d4e3 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	ID int32

	Data nx.Map

	Dispatch chan func()
	// contains filtered or unexported fields
}

Field data

func (*Field) CalculateFieldLimits

func (f *Field) CalculateFieldLimits()

CalculateFieldLimits for mob spawning

func (*Field) ChangePlayerInstance

func (f *Field) ChangePlayerInstance(player player, id int) error

ChangePlayerInstance id

func (*Field) CreateInstance

func (f *Field) CreateInstance() int

CreateInstance for this field

func (*Field) DeleteInstance

func (f *Field) DeleteInstance(id int) error

DeleteInstance from id

func (*Field) GetInstance

func (f *Field) GetInstance(id int) (*Instance, error)

GetInstance from id

func (*Field) Instances

func (f *Field) Instances() []*Instance

Instances in field

type Instance

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

Instance data for a field

func (*Instance) AddPlayer

func (inst *Instance) AddPlayer(plr player) error

AddPlayer to the instance

func (*Instance) AddRoom

func (inst *Instance) AddRoom(r room.Room)

AddRoom to the instance

func (Instance) CalculateNearestSpawnPortalID

func (inst Instance) CalculateNearestSpawnPortalID(pos pos.Data) (byte, error)

CalculateNearestSpawnPortalID from a given position

func (Instance) FindController

func (inst Instance) FindController() interface{}

FindController in instance, need to return interface for casting

func (Instance) GetPlayerFromID

func (inst Instance) GetPlayerFromID(id int32) (player, error)

GetPlayerFromID from the instance

func (*Instance) GetPlayerRoom

func (inst *Instance) GetPlayerRoom(id int32) (room.Room, error)

GetPlayerRoom the room the player belongs to

func (Instance) GetPortalFromID

func (inst Instance) GetPortalFromID(id byte) (Portal, error)

GetPortalFromID in the current instance

func (Instance) GetPortalFromName

func (inst Instance) GetPortalFromName(name string) (Portal, error)

GetPortalFromName in the current instance

func (Instance) GetRandomSpawnPortal

func (inst Instance) GetRandomSpawnPortal() (Portal, error)

GetRandomSpawnPortal returns a spawn potal at random

func (*Instance) GetRoomID

func (inst *Instance) GetRoomID(id int32) (room.Room, error)

GetRoomID the room with the passed in id

func (Instance) ID

func (inst Instance) ID() int

ID of the instance within the field

func (*Instance) LifePool

func (inst *Instance) LifePool() *lifepool.Data

LifePool pointer for instance

func (Instance) MovePlayer

func (inst Instance) MovePlayer(id int32, moveBytes []byte, plr player)

MovePlayer for other players

func (*Instance) NextID

func (inst *Instance) NextID() int32

NextID - gets the next available id to be used by the instance

func (*Instance) RemovePlayer

func (inst *Instance) RemovePlayer(plr player) error

RemovePlayer from instance

func (*Instance) RemoveRoom

func (inst *Instance) RemoveRoom(r room.Room) error

RemoveRoom from instance

func (Instance) Send

func (inst Instance) Send(p mpacket.Packet) error

Send packet to instance

func (Instance) SendExcept

func (inst Instance) SendExcept(p mpacket.Packet, exception mnet.Client) error

SendExcept - sends packet to instance except a particular player

func (Instance) String

func (inst Instance) String() string

func (*Instance) UpdateGameBox

func (inst *Instance) UpdateGameBox(r room.Room)

UpdateGameBox above player head in map

type Portal

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

Portal that can be plaed in a field

func (Portal) DestFieldID

func (p Portal) DestFieldID() int32

DestFieldID the portal takes the player

func (Portal) DestName

func (p Portal) DestName() string

DestName of the portal on the other side

func (Portal) ID

func (p Portal) ID() byte

ID of portal

func (Portal) Pos

func (p Portal) Pos() pos.Data

Pos the portal takes on the map

Directories

Path Synopsis
mob
npc

Jump to

Keyboard shortcuts

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