interaction

package
v0.0.0-...-83cae81 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Dumb   model.PlayerID = `DumbNPC`
	Simple model.PlayerID = `SimpleNPC`
	Calc   model.PlayerID = `CalculatedNPC`
)

Variables

View Source
var (
	ErrUnknownNPCType = errors.New(`unknown NPC type`)
)

Functions

This section is empty.

Types

type ActionHandler

type ActionHandler interface {
	Handle(action model.PlayerAction) error
}

type Means

type Means struct {
	Mode Mode        `protobuf:"-" json:"-" bson:"mode"`
	Info interface{} `protobuf:"-" json:"-" bson:"info"`
}

func (*Means) AddSerializedInfo

func (m *Means) AddSerializedInfo(serInfo []byte) error

func (*Means) GetSerializedInfo

func (m *Means) GetSerializedInfo() ([]byte, error)

type Mock

type Mock struct {
	mock.Mock
}

func (*Mock) ID

func (m *Mock) ID() model.PlayerID

func (*Mock) NotifyBlocking

func (m *Mock) NotifyBlocking(b model.Blocker, g model.Game, s string) error

func (*Mock) NotifyMessage

func (m *Mock) NotifyMessage(g model.Game, s string) error

func (*Mock) NotifyScoreUpdate

func (m *Mock) NotifyScoreUpdate(g model.Game, msgs ...string) error

type Mode

type Mode int
const (
	UnsetMode Mode = 0
	Localhost Mode = 1
	NPC       Mode = 2
	Unknown   Mode = 3
)

type NPCPlayer

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

func (*NPCPlayer) ID

func (npc *NPCPlayer) ID() model.PlayerID

func (*NPCPlayer) NotifyBlocking

func (npc *NPCPlayer) NotifyBlocking(b model.Blocker, g model.Game, s string) error

func (*NPCPlayer) NotifyMessage

func (npc *NPCPlayer) NotifyMessage(g model.Game, s string) error

The NPC doesn't care about messages or score updates

func (*NPCPlayer) NotifyScoreUpdate

func (npc *NPCPlayer) NotifyScoreUpdate(g model.Game, msgs ...string) error

type Player

type Player interface {
	ID() model.PlayerID

	NotifyBlocking(model.Blocker, model.Game, string) error
	NotifyMessage(model.Game, string) error
	NotifyScoreUpdate(g model.Game, msgs ...string) error
}

func Empty

func Empty(pID model.PlayerID) Player

func FromPlayerMeans

func FromPlayerMeans(pm PlayerMeans) (Player, error)

func NewNPCPlayer

func NewNPCPlayer(pID model.PlayerID, ah ActionHandler) (Player, error)

NewNPCPlayer creates a new NPC with specified type

type PlayerMeans

type PlayerMeans struct {
	PlayerID      model.PlayerID `protobuf:"-" json:"-" bson:"playerID"`
	PreferredMode Mode           `protobuf:"-" json:"-" bson:"preferredMode"`
	Interactions  []Means        `protobuf:"-" json:"-" bson:"interactions"`
}

func New

func New(pID model.PlayerID, m Means) PlayerMeans

Jump to

Keyboard shortcuts

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