making bombs costs time and money

slack
Jordan Orelli 10 years ago
parent ac92962ef8
commit dcd444cbd1

@ -53,11 +53,15 @@ type MakeBombState struct {
func MakeBomb(s *System) ConnectionState {
m := &MakeBombState{System: s}
m.CommandSuite = CommandSet{
balCommand,
}
return m
}
func (m *MakeBombState) Enter(c *Connection) {
c.Printf("Making a bomb...\n")
c.money -= options.bombCost
}
func (m *MakeBombState) Tick(c *Connection, frame int64) ConnectionState {

@ -140,6 +140,10 @@ func (i *IdleState) scan(c *Connection, args ...string) {
func (i *IdleState) maek(c *Connection, args ...string) {
switch args[0] {
case "bomb":
if c.money < options.bombCost {
c.Printf("Not enough money! Bombs costs %v but you only have %v space duckets. Mine more space duckets!\n", options.bombCost, c.money)
return
}
c.SetState(MakeBomb(i.System))
default:
c.Printf("I don't know how to make a %v.\n", args[0])

@ -11,18 +11,19 @@ import (
)
var options struct {
bombCost int
bombSpeed float64
debug bool
economic int
frameRate int
frameLength time.Duration
frameRate int
lightSpeed float64
makeBombTime time.Duration
moneyMean float64
moneySigma float64
playerSpeed float64
respawnTime time.Duration
respawnFrames int64
respawnTime time.Duration
speckPath string
}
@ -116,4 +117,5 @@ func init() {
flag.StringVar(&options.speckPath, "speck-path", "/projects/exo/expl.speck", "path to exoplanet speck file")
flag.DurationVar(&options.respawnTime, "respawn-time", 60*time.Second, "time for player respawn")
flag.DurationVar(&options.makeBombTime, "bomb-time", 5*time.Second, "time it takes to make a bomb")
flag.IntVar(&options.bombCost, "bomb-cost", 500, "price of a bomb")
}

Loading…
Cancel
Save