LastMUD/internal/game/player.go
Miroslav Vasilev 87f5c2f842 ECS
2025-06-24 16:37:26 +03:00

39 lines
630 B
Go

package game
import "github.com/google/uuid"
type Player struct {
id uuid.UUID
state PlayerState
currentRoom *Room
}
func CreateJoiningPlayer(identity uuid.UUID) *Player {
return &Player{
id: identity,
state: PlayerStateJoining,
currentRoom: nil,
}
}
func CreatePlayer(identity uuid.UUID, state PlayerState, room *Room) *Player {
return &Player{
id: identity,
state: state,
currentRoom: room,
}
}
func (p *Player) Identity() uuid.UUID {
return p.id
}
func (p *Player) SetRoom(r *Room) {
p.currentRoom = r
}
func (p *Player) CurrentRoom() *Room {
return p.currentRoom
}