colonies actually drain systems of money now

slack
Jordan Orelli 10 years ago
parent d84419532c
commit 69c0706be4

@ -54,9 +54,10 @@ type MakeBombState struct {
func MakeBomb(s *System) ConnectionState { func MakeBomb(s *System) ConnectionState {
m := &MakeBombState{System: s} m := &MakeBombState{System: s}
m.CommandSuite = CommandSet{ m.CommandSuite = CommandSet{
BroadcastCommand(s),
balCommand, balCommand,
BroadcastCommand(s),
helpCommand, helpCommand,
NearbyCommand(s),
playersCommand, playersCommand,
} }
return m return m

@ -14,6 +14,13 @@ func MakeColony(c *Connection, sys *System) {
c.money -= options.colonyCost c.money -= options.colonyCost
m := &MakeColonyState{ m := &MakeColonyState{
System: sys, System: sys,
CommandSuite: CommandSet{
balCommand,
BroadcastCommand(sys),
helpCommand,
NearbyCommand(sys),
playersCommand,
},
} }
c.SetState(m) c.SetState(m)
} }

@ -137,7 +137,7 @@ func NearbyCommand(sys *System) Command {
c.Printf("--------------------------------------------------------------------------------\n") c.Printf("--------------------------------------------------------------------------------\n")
for _, neighbor := range neighbors { for _, neighbor := range neighbors {
other := index[neighbor.id] other := index[neighbor.id]
c.Printf("%-4d %-20s %v\n", other.id, other.name, neighbor.distance) c.Printf("%-4d %-20s %-5.6v\n", other.id, other.name, neighbor.distance)
} }
c.Printf("--------------------------------------------------------------------------------\n") c.Printf("--------------------------------------------------------------------------------\n")
} }

@ -107,6 +107,7 @@ func (i *IdleState) mine(c *Connection, args ...string) {
func (i *IdleState) info(c *Connection, args ...string) { func (i *IdleState) info(c *Connection, args ...string) {
c.Printf("Currently idle on system %v\n", i.System) c.Printf("Currently idle on system %v\n", i.System)
c.Printf("Space duckets available: %v\n", i.money)
} }
func (i *IdleState) scan(c *Connection, args ...string) { func (i *IdleState) scan(c *Connection, args ...string) {

@ -42,8 +42,9 @@ func GetSystem(id string) (*System, error) {
} }
func (s *System) Tick(frame int64) { func (s *System) Tick(frame int64) {
if s.colonizedBy != nil { if s.colonizedBy != nil && s.money > 0 {
s.colonizedBy.Deposit(1) s.colonizedBy.Deposit(1)
s.money -= 1
} }
} }

Loading…
Cancel
Save