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

39 lines
727 B

package main
import (
"log"
)
type melee struct {
respawn map[*Robot]float64
respawn_timer float64
}
func (g *melee) setup(gg *game) {
g.respawn_timer = 5000
}
func (g *melee) gameOver(gg *game) (bool, *GameOver) {
return false, &GameOver{}
}
func (g *melee) tick(gg *game, payload *Boardstate) {
for p := range gg.players {
for _, r := range p.Robots {
_, ok := g.respawn[r]
if r.Health <= 0 && !ok {
g.respawn[r] = g.respawn_timer
log.Printf("%v Died, Respawn in %v", r.Name, g.respawn_timer)
}
}
}
for r, _ := range g.respawn {
g.respawn[r] -= float64(gg.tick_duration)
if g.respawn[r] <= 0 {
log.Printf("%v Respawned", r.Name)
r.reset(gg)
delete(g.respawn, r)
}
}
}