Skip to content

Commit

Permalink
Make Facility have an arbitrary connection distance
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVartanov committed Jul 19, 2015
1 parent c6b154e commit a9b446c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/connectable.rb
Expand Up @@ -3,8 +3,6 @@

module GeekGame
module Connectable
CONNECTION_DISTANCE = 10

attr_reader :connection

def connect_to(facility)
Expand All @@ -31,7 +29,7 @@ def can_connect_to?(facility)
end

def close_enough_to?(facility)
position.distance_to(facility.position) <= CONNECTION_DISTANCE
position.distance_to(facility.position) <= facility.connection_distance
end

def directed_towards?(facility)
Expand Down
1 change: 1 addition & 0 deletions lib/engineer_factory.rb
@@ -1,5 +1,6 @@
module GeekGame
class EngineerFactory < Factory
facility_properties connection_distance: 20
factory_properties production_time: 5.0, bot_class: Engineer, production_cost: 5
end
end
1 change: 1 addition & 0 deletions lib/facility.rb
@@ -1,5 +1,6 @@
module GeekGame
class Facility < GameObject
define_properties :connection_distance
attr_reader :connections

def initialize(*args)
Expand Down
2 changes: 2 additions & 0 deletions lib/metal_derrick.rb
@@ -1,6 +1,8 @@
module GeekGame
class MetalDerrick < Facility
define_properties :metal_bars_per_chunk, :cooldown_period

facility_properties connection_distance: 20
metal_derrick_properties metal_bars_per_chunk: 5, cooldown_period: 2.0

attr_reader :metal_bars_available
Expand Down
1 change: 1 addition & 0 deletions lib/pew_pew_factory.rb
@@ -1,5 +1,6 @@
module GeekGame
class PewPewFactory < Factory
facility_properties connection_distance: 30
factory_properties production_time: 5.0, bot_class: PewPew, production_cost: 15
end
end

0 comments on commit a9b446c

Please sign in to comment.