maybe you should set the player

slack
Jordan Orelli 10 years ago
parent 0d37b9c98b
commit 24907f1644

@ -63,10 +63,11 @@ func (c *Connection) Login() {
log_error("could not read player: %v", err) log_error("could not read player: %v", err)
player = &Player{name: name} player = &Player{name: name}
if err := player.Create(); err != nil { if err := player.Create(); err != nil {
log_error("unable to create player record: %v", err)
} }
fmt.Fprintf(c, "you look new around these parts, %s.\n", player.name) fmt.Fprintf(c, "you look new around these parts, %s.\n", player.name)
fmt.Fprintf(c, `if you'd like a description of how to play, type the "help" command`) fmt.Fprintf(c, `if you'd like a description of how to play, type the "help" command`)
c.player = player
} else { } else {
c.player = player c.player = player
fmt.Fprintf(c, "welcome back, %s.\n", player.name) fmt.Fprintf(c, "welcome back, %s.\n", player.name)

@ -29,6 +29,14 @@ func (p *Player) Create() error {
return nil return nil
} }
func (p *Player) Dead() bool {
return false
}
func (p *Player) Tick(frame int64) {
}
func playersTable() { func playersTable() {
stmnt := `create table if not exists players ( stmnt := `create table if not exists players (
id integer not null primary key autoincrement, id integer not null primary key autoincrement,

@ -246,4 +246,3 @@ func randomSystem() (*System, error) {
planet := index[pick] planet := index[pick]
return planet, nil return planet, nil
} }

Loading…
Cancel
Save