Class: MapConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/map_config.rb

Defined Under Namespace

Classes: AllPerlinConfigs, PerlinConfig, RoadConfig, TownConfig

Constant Summary collapse

DEFAULT_TILE_COUNT =
128
DEFAULT_GENERATE_FLORA =
true
DEFAULT_HEIGHT_SEED =
10
DEFAULT_HEIGHT_OCTAVES =
3
DEFAULT_HEIGHT_X_FREQUENCY =
2.5
DEFAULT_HEIGHT_Y_FREQUENCY =
2.5
DEFAULT_HEIGHT_PERSISTANCE =
1.0
DEFAULT_HEIGHT_ADJUSTMENT =
0.0
DEFAULT_MOIST_SEED =
300
DEFAULT_MOIST_OCTAVES =
3
DEFAULT_MOIST_X_FREQUENCY =
2.5
DEFAULT_MOIST_Y_FREQUENCY =
2.5
DEFAULT_MOIST_PERSISTANCE =
1.0
DEFAULT_MOIST_ADJUSTMENT =
0.0
DEFAULT_TEMP_SEED =
3000
DEFAULT_TEMP_OCTAVES =
3
DEFAULT_TEMP_PERSISTANCE =
1.0
DEFAULT_TEMP_Y_FREQUENCY =
2.5
DEFAULT_TEMP_X_FREQUENCY =
2.5
DEFAULT_TEMP_ADJUSTMENT =
0.0
DEFAULT_ROAD_SEED =
100
DEFAULT_NUM_OF_ROADS =
0
DEFAULT_ROAD_EXCLUDE_WATER_PATH =
true
DEFAULT_ROAD_EXCLUDE_MOUNTAIN_PATH =
true
DEFAULT_ROAD_EXCLUDE_FLORA_PATH =
true
DEFAULT_ROADS_TO_MAKE =
[].freeze
DEFAULT_TOWN_SEED =
500
DEFAULT_NUM_OF_TOWNS =
0
DEFAULT_TOWNS_TO_MAKE =
[].freeze
DEFAULT_VERBOSE =
false
PERLIN_CONFIG_OPTIONS =
%i[width height noise_seed octaves x_frequency y_frequency persistance adjustment].freeze
ALL_PERLIN_CONFIGS =
%i[perlin_height_config perlin_moist_config perlin_temp_config].freeze
ROAD_CONFIG_OPTIONS =
%i[road_seed roads road_exclude_water_path road_exclude_mountain_path road_exclude_flora_path roads_to_make verbose].freeze
TOWN_CONFIG_OPTIONS =
%i[town_seed towns towns_to_make verbose].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(all_perlin_configs: default_perlin_configs, width: DEFAULT_TILE_COUNT, height: DEFAULT_TILE_COUNT, generate_flora: DEFAULT_GENERATE_FLORA, road_config: default_road_config, town_config: default_town_config, verbose: DEFAULT_VERBOSE) ⇒ MapConfig

rubocop:disable Metrics/ParameterLists:



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/map_config.rb', line 54

def initialize(all_perlin_configs: default_perlin_configs, width: DEFAULT_TILE_COUNT,
               height: DEFAULT_TILE_COUNT, generate_flora: DEFAULT_GENERATE_FLORA, road_config: default_road_config, town_config: default_town_config, verbose: DEFAULT_VERBOSE)
  validate(all_perlin_configs)
  @generate_flora = generate_flora
  @perlin_height_config = all_perlin_configs.perlin_height_config
  @perlin_moist_config = all_perlin_configs.perlin_moist_config
  @perlin_temp_config = all_perlin_configs.perlin_temp_config
  @width = width
  @height = height
  @road_config = road_config
  @town_config = town_config
  @verbose = verbose
  town_config.verbose = verbose
  road_config.verbose = verbose
end

Instance Attribute Details

#generate_floraObject (readonly)

Returns the value of attribute generate_flora.



51
52
53
# File 'lib/map_config.rb', line 51

def generate_flora
  @generate_flora
end

#heightObject (readonly)

Returns the value of attribute height.



51
52
53
# File 'lib/map_config.rb', line 51

def height
  @height
end

#perlin_height_configObject (readonly)

Returns the value of attribute perlin_height_config.



51
52
53
# File 'lib/map_config.rb', line 51

def perlin_height_config
  @perlin_height_config
end

#perlin_moist_configObject (readonly)

Returns the value of attribute perlin_moist_config.



51
52
53
# File 'lib/map_config.rb', line 51

def perlin_moist_config
  @perlin_moist_config
end

#perlin_temp_configObject (readonly)

Returns the value of attribute perlin_temp_config.



51
52
53
# File 'lib/map_config.rb', line 51

def perlin_temp_config
  @perlin_temp_config
end

#road_configObject (readonly)

Returns the value of attribute road_config.



51
52
53
# File 'lib/map_config.rb', line 51

def road_config
  @road_config
end

#town_configObject (readonly)

Returns the value of attribute town_config.



51
52
53
# File 'lib/map_config.rb', line 51

def town_config
  @town_config
end

#verboseObject (readonly)

Returns the value of attribute verbose.



51
52
53
# File 'lib/map_config.rb', line 51

def verbose
  @verbose
end

#widthObject (readonly)

Returns the value of attribute width.



51
52
53
# File 'lib/map_config.rb', line 51

def width
  @width
end