1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Settings: Add get_flags API for mapgen flags (mg_flags, mgv6_spflags, ...) (#9284)

Unified flags handling in C++ and Lua Settings API
     -> Reading only, for now. Writing can be implemented later, if needed.
API function to read the currently active flags
     -> was impossible from Lua

Co-authored-by: Wuzzy <wuzzy2@mail.ru>
This commit is contained in:
SmallJoker 2020-01-25 16:56:54 +01:00 committed by GitHub
parent 9cb3219f34
commit cde2a7f6f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 222 additions and 39 deletions

View file

@ -124,7 +124,9 @@ struct MapgenParams {
u64 seed = 0;
s16 water_level = 1;
s16 mapgen_limit = MAX_MAP_GENERATION_LIMIT;
u32 flags = MG_CAVES | MG_LIGHT | MG_DECORATIONS | MG_BIOMES;
// Flags set in readParams
u32 flags = 0;
u32 spflags = 0;
BiomeParams *bparams = nullptr;
@ -133,6 +135,8 @@ struct MapgenParams {
virtual void readParams(const Settings *settings);
virtual void writeParams(Settings *settings) const;
// Default settings for g_settings such as flags
virtual void setDefaultSettings(Settings *settings) {};
s32 getSpawnRangeMax();
@ -214,6 +218,7 @@ public:
EmergeManager *emerge);
static MapgenParams *createMapgenParams(MapgenType mgtype);
static void getMapgenNames(std::vector<const char *> *mgnames, bool include_hidden);
static void setDefaultSettings(Settings *settings);
private:
// isLiquidHorizontallyFlowable() is a helper function for updateLiquid()