Example #1
0
package server

import (
	"github.com/Nightgunner5/gogame/engine/message"
	"github.com/Nightgunner5/gogame/shared/packet"
)

var (
	MsgSendLocation = message.NewKind("SendLocation")
	MsgMoveIntoView = message.NewKind("MoveIntoView")
)

type SendLocation struct {
	*Player
}

type MoveIntoView struct {
	*packet.Packet
}

func (SendLocation) Kind() message.Kind {
	return MsgSendLocation
}

func (MoveIntoView) Kind() message.Kind {
	return MsgMoveIntoView
}
Example #2
0
package actor

import (
	"github.com/Nightgunner5/gogame/engine/message"
)

var (
	MsgAddSubscriber    = message.NewKind("AddSubscriber")
	MsgRemoveSubscriber = message.NewKind("RemoveSubscriber")
)

// Add a Subscriber to an Actor. Subscribers are described in the documentation
// of Subscribe.
type AddSubscriber struct {
	Subscriber
}

// Returns MsgAddSubscriber.
func (AddSubscriber) Kind() message.Kind {
	return MsgAddSubscriber
}

// Remove a Subscriber from an Actor. Subscribers are described in the
// documentation of Subscribe.
type RemoveSubscriber struct {
	Subscriber
}

// Returns MsgRemoveSubscriber.
func (RemoveSubscriber) Kind() message.Kind {
	return MsgRemoveSubscriber
Example #3
0
package actor

import (
	"github.com/Nightgunner5/gogame/engine/message"
	"sync"
)

var (
	MsgAddHeld    = message.NewKind("AddHeld")
	MsgRemoveHeld = message.NewKind("RemoveHeld")
)

type AddHeld struct {
	*Actor
}

// Returns MsgAddHeld.
func (AddHeld) Kind() message.Kind {
	return MsgAddHeld
}

type RemoveHeld struct {
	*Actor
}

// Returns MsgRemoveHeld.
func (RemoveHeld) Kind() message.Kind {
	return MsgRemoveHeld
}

type Holder struct {
Example #4
0
package packet

import (
	"github.com/Nightgunner5/gogame/engine/message"
)

var (
	MsgDespawn = message.NewKind("Despawn")
)

type Despawn struct {
	ID uint64
}

func (Despawn) Kind() message.Kind {
	return MsgDespawn
}
Example #5
0
package packet

import (
	"github.com/Nightgunner5/gogame/engine/message"
	"github.com/Nightgunner5/gogame/shared/layout"
)

var (
	MsgLocation = message.NewKind("Location")
)

type Location struct {
	ID    uint64
	Coord layout.Coord
	Flags uint32
}

const (
	FlagNone       uint32 = 0
	FlagSpriteMask uint32 = 7
	FlagSuit       uint32 = 1
	FlagSuitHelm   uint32 = 2
	FlagMonkey     uint32 = 3
	FlagSecurity   uint32 = 4
	FlagEngineer   uint32 = 5
	FlagMedic      uint32 = 6
	_              uint32 = 7
)

func (Location) Kind() message.Kind {
	return MsgLocation
Example #6
0
	player := new(Player)
	player.isLocalPlayer = isLocalPlayer
	player.paint = new(PaintContext)
	if monkey {
		player.paint.Sprite = res.Monkey
	} else {
		player.paint.Sprite = res.HumanSuit
	}
	if isLocalPlayer {
		player.paint.Changed = time.Now()
	}
	paintLock.Lock()
	paintContexts[&player.Actor] = player.paint
	paintLock.Unlock()
	actor.Init("client:player", &player.Actor, player)
	return player
}

var (
	MsgSetLocation = message.NewKind("SetLocation")
)

type SetLocation struct {
	layout.Coord
	Flags uint32
}

func (SetLocation) Kind() message.Kind {
	return MsgSetLocation
}
Example #7
0
package packet

import (
	"github.com/Nightgunner5/gogame/engine/message"
	"github.com/Nightgunner5/gogame/shared/layout"
)

var (
	MsgInteract = message.NewKind("Interact")
)

type Interact struct {
	layout.Coord
}

func (Interact) Kind() message.Kind {
	return MsgInteract
}