mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add MapSettingsManager and new mapgen setting script API functions
This commit refactors the majority of the Mapgen settings system. - MapgenParams is now owned by MapSettingsManager, itself a part of ServerMap, instead of the EmergeManager. - New Script API functions added: core.get_mapgen_setting core.get_mapgen_setting_noiseparams, core.set_mapgen_setting, and core.set_mapgen_setting_noiseparams. - minetest.get/set_mapgen_params are deprecated by the above new functions. - It is now possible to view and modify any arbitrary mapgen setting from a mod, rather than the base MapgenParams structure. - MapgenSpecificParams has been removed.
This commit is contained in:
parent
92705306bf
commit
3c63c3044d
31 changed files with 890 additions and 315 deletions
20
src/mapgen.h
20
src/mapgen.h
|
@ -119,37 +119,29 @@ enum MapgenType {
|
|||
MAPGEN_INVALID,
|
||||
};
|
||||
|
||||
struct MapgenSpecificParams {
|
||||
virtual void readParams(const Settings *settings) = 0;
|
||||
virtual void writeParams(Settings *settings) const = 0;
|
||||
virtual ~MapgenSpecificParams() {}
|
||||
};
|
||||
|
||||
struct MapgenParams {
|
||||
std::string mg_name;
|
||||
MapgenType mgtype;
|
||||
s16 chunksize;
|
||||
u64 seed;
|
||||
s16 water_level;
|
||||
u32 flags;
|
||||
|
||||
BiomeParams *bparams;
|
||||
MapgenSpecificParams *sparams;
|
||||
|
||||
MapgenParams() :
|
||||
mg_name(MAPGEN_DEFAULT_NAME),
|
||||
mgtype(MAPGEN_DEFAULT),
|
||||
chunksize(5),
|
||||
seed(0),
|
||||
water_level(1),
|
||||
flags(MG_CAVES | MG_LIGHT | MG_DECORATIONS),
|
||||
bparams(NULL),
|
||||
sparams(NULL)
|
||||
bparams(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~MapgenParams();
|
||||
|
||||
void load(const Settings &settings);
|
||||
void save(Settings &settings) const;
|
||||
virtual void readParams(const Settings *settings);
|
||||
virtual void writeParams(Settings *settings) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -217,7 +209,7 @@ public:
|
|||
static const char *getMapgenName(MapgenType mgtype);
|
||||
static Mapgen *createMapgen(MapgenType mgtype, int mgid,
|
||||
MapgenParams *params, EmergeManager *emerge);
|
||||
static MapgenSpecificParams *createMapgenParams(MapgenType mgtype);
|
||||
static MapgenParams *createMapgenParams(MapgenType mgtype);
|
||||
static void getMapgenNames(std::vector<const char *> *mgnames, bool include_hidden);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue