You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
899 B
Go

4 years ago
package sim
import (
"time"
"github.com/jordanorelli/astro-domu/internal/wire"
"github.com/jordanorelli/blammo"
)
4 years ago
// player represents a player character in the simulation
type player struct {
*blammo.Log
sessionID int
outbox chan wire.Response
entityID int
pending []Request
4 years ago
}
func (p *player) update(dt time.Duration) {}
func (p *player) id() int { return p.entityID }
type Move [2]int
func (Move) NetTag() string { return "move" }
// SpawnPlayer is a request to spawn a player
type SpawnPlayer struct {
Outbox chan wire.Response
}
func (s SpawnPlayer) exec(w *World, from string) {
w.Info("spawn player requested for: %s", from)
}
func (SpawnPlayer) NetTag() string { return "player/spawn" }
// PlayerSpawned is an announcement that a player has spawned
type PlayerSpawned struct {
Name string
}
func init() {
wire.Register(func() wire.Value { return new(Move) })
}