message: Refactor createWeather
diff: -
  -setup.createWeather = function (town, biome, weather, season, time) {
  +/**
  + * This weather function is pretty complex.
  + * Basically, temperature, precipitation,
  + * and precipitation intensity are each independently tracked.
  + */
  +setup.createWeather = (town, biome, weather, season, time) => {
  console.groupCollapsed('Creating weather...')
  - // this weather function is pretty complex. Basically, temperature, precipitation, and precipitation intensity are each independently tracked.
  console.log({ biome, weather, season, time })
  if (biome) {
  @@ -19,7 +22,7 @@ setup.createWeather = function (town, biome, weather, season, time) {
  biome = biome || town.terrain
  time = time || 8
  season = season || weather.season || 'spring'
  - console.log('biome: ' + biome)
  + console.log(`biome: ${biome}`)
  if (weather) {
  // if it's passed the weather object (i.e. if it isn't the first time the user has clicked on the button, it doesn't need to set up everything.)
  console.log('Weather was already defined.')
  @@ -30,8 +33,10 @@ setup.createWeather = function (town, biome, weather, season, time) {
  weather.timer.cloud -= time
  }
  } else {
  + const seasonData = setup.townData.terrain[biome].weather.season[season]
  +
  weather = {
  - temperature: setup.townData.terrain[biome].weather.season[season].baseTemp || setup.townData.terrain['temperate'].weather.season['summer'].baseTemp,
  + temperature: seasonData.baseTemp || setup.townData.terrain.temperate.weather.season.summer.baseTemp,
  tempVariation: dice(2, 50),
  season,
  timer: {
  @@ -49,8 +54,8 @@ setup.createWeather = function (town, biome, weather, season, time) {
  cloud: '',
  temperature: ''
  },
  - precipitationLevel: setup.townData.terrain[biome].weather.season[season].precipitationLevel,
  - precipitationIntensity: setup.townData.terrain[biome].weather.season[season].precipitationIntensity
  + precipitationLevel: seasonData.precipitationLevel,
  + precipitationIntensity: seasonData.precipitationIntensity
  }
  }
  // console.log('weather:')
  