Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarBiomeDatabase.hpp
blob: 9b8ecf3540f03b2f1ecf9757687791900168013c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once

#include "StarBiome.hpp"
#include "StarWeatherTypes.hpp"
#include "StarSkyTypes.hpp"

namespace Star {

STAR_CLASS(BiomeDatabase);

class BiomeDatabase {
public:
  BiomeDatabase();

  StringList biomeNames() const;

  float biomeHueShift(String const& biomeName, uint64_t seed) const;
  WeatherPool biomeWeathers(String const& biomeName, uint64_t seed, float threatLevel) const;
  bool biomeIsAirless(String const& biomeName) const;
  SkyColoring biomeSkyColoring(String const& biomeName, uint64_t seed) const;
  String biomeFriendlyName(String const& biomeName) const;
  StringList biomeStatusEffects(String const& biomeName) const;
  StringList biomeOres(String const& biomeName, float threatLevel) const;

  StringList weatherNames() const;
  WeatherType weatherType(String const& weatherName) const;

  BiomePtr createBiome(String const& biomeName, uint64_t seed, float verticalMidPoint, float threatLevel) const;

private:
  struct Config {
    String path;
    String name;
    Json parameters;
  };
  typedef StringMap<Config> ConfigMap;

  static float pickHueShiftFromJson(Json source, uint64_t seed, String const& key);

  BiomePlaceables readBiomePlaceables(Json const& config, uint64_t seed, float biomeHueShift) const;
  List<pair<ModId, float>> readOres(Json const& oreDistribution, float threatLevel) const;

  ConfigMap m_biomes;
  ConfigMap m_weathers;
};

}