Class: Astromapper::Builder::Volume
- Defined in:
- lib/astromapper/builder/volume.rb
Instance Attribute Summary collapse
-
#gas_giant ⇒ Object
Returns the value of attribute gas_giant.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Base
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(c, r) ⇒ Volume
constructor
A new instance of Volume.
- #location ⇒ Object
- #star_dm ⇒ Object
- #to_ascii ⇒ Object
Methods inherited from Base
#config, constitute, #names, #spawn_command, #toss
Constructor Details
#initialize(c, r) ⇒ Volume
Returns a new instance of Volume.
7 8 9 10 11 12 13 14 15 |
# File 'lib/astromapper/builder/volume.rb', line 7 def initialize(c,r) @name = (config['named']) ? Astromapper.names.sample : "%02d%02d" % [c,r] @column = c @row = r @star = Star.new(self) [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2][toss(2,0)].times do |i| @star.companions = Star.new(self, @star,i) end end |
Instance Attribute Details
#gas_giant ⇒ Object
Returns the value of attribute gas_giant.
5 6 7 |
# File 'lib/astromapper/builder/volume.rb', line 5 def gas_giant @gas_giant end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/astromapper/builder/volume.rb', line 5 def name @name end |
Instance Method Details
#empty? ⇒ Boolean
29 30 31 |
# File 'lib/astromapper/builder/volume.rb', line 29 def empty? return true if @star.world.nil? or @star.world.empty? or !@star.world? end |
#location ⇒ Object
33 34 35 |
# File 'lib/astromapper/builder/volume.rb', line 33 def location "%02d%02d" % [@column,@row] end |
#star_dm ⇒ Object
17 18 19 20 |
# File 'lib/astromapper/builder/volume.rb', line 17 def star_dm return 0 if @atmo.nil? or @popx.nil? ((4..9).include?(@atmo) or @popx > 7) ? 4 : 0 end |
#to_ascii ⇒ Object
22 23 24 25 26 27 |
# File 'lib/astromapper/builder/volume.rb', line 22 def to_ascii w = @star.world sumy = "%s %s %s %s %s\t%-15s\t%-8s\t%s\t%s" % [location, w.uwp, w.temp, w.bases, w.travel_code, w.trade_codes.join(','), w.factions.join(','), @star.crib, @name] sumy += @star.orbits_to_ascii return sumy end |