Add queue command descriptions
This commit is contained in:
@ -4,6 +4,7 @@ module Game
|
||||
abstract class Command
|
||||
abstract def start(world : World) : Int32
|
||||
abstract def finish(world : World)
|
||||
abstract def desc : String
|
||||
end
|
||||
|
||||
class BuildCrystalHarvesterCommand < Command
|
||||
@ -21,6 +22,10 @@ module Game
|
||||
world.map.set(CrystalHarvesterTile.new(@point))
|
||||
world.push(HarvestCrystalCommand.new(@point))
|
||||
end
|
||||
|
||||
def desc : String
|
||||
sprintf "Build harvester site at %d,%d", @point.x, @point.y
|
||||
end
|
||||
end
|
||||
|
||||
class HarvestCrystalCommand < Command
|
||||
@ -50,6 +55,10 @@ module Game
|
||||
world.push(HarvestCrystalCommand.new(@point))
|
||||
end
|
||||
|
||||
def desc : String
|
||||
sprintf "Harvest crystals at %d,%d", @point.x, @point.y
|
||||
end
|
||||
|
||||
private def nearest_deposit(world : World)
|
||||
world.map.nearest_tile @point do |tile|
|
||||
tile.has_role(TileRole::CrystalDeposits) && tile.cur > 0
|
||||
@ -80,6 +89,10 @@ module Game
|
||||
world.map.set(CrystalRestorerTile.new(@point))
|
||||
world.push(RestoreCrystalCommand.new(@point))
|
||||
end
|
||||
|
||||
def desc : String
|
||||
sprintf "Build crystal restorer at %d,%d", @point.x, @point.y
|
||||
end
|
||||
end
|
||||
|
||||
class RestoreCrystalCommand < Command
|
||||
@ -109,6 +122,10 @@ module Game
|
||||
world.push(RestoreCrystalCommand.new(@point))
|
||||
end
|
||||
|
||||
def desc : String
|
||||
sprintf "Restore crystals at %d,%d", @point.x, @point.y
|
||||
end
|
||||
|
||||
private def nearest_deposit(world : World)
|
||||
world.map.nearest_tile @point do |tile|
|
||||
tile.has_role(TileRole::CrystalDeposits) && tile.cur < tile.cap
|
||||
@ -133,6 +150,10 @@ module Game
|
||||
world.map.set(TerraformerTile.new(@point))
|
||||
world.push(TerraformCommand.new(@point))
|
||||
end
|
||||
|
||||
def desc : String
|
||||
sprintf "Build terraformer at %d,%d", @point.x, @point.y
|
||||
end
|
||||
end
|
||||
|
||||
class TerraformCommand < Command
|
||||
@ -146,6 +167,10 @@ module Game
|
||||
PRODUCTION_TIME
|
||||
end
|
||||
|
||||
def desc : String
|
||||
"Terraform planet"
|
||||
end
|
||||
|
||||
def finish(world : World)
|
||||
world.resources.inc(ResourceType::Terraformation, PRODUCTION_VALUE)
|
||||
world.push(TerraformCommand.new(@point))
|
||||
|
Reference in New Issue
Block a user