Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
l_mapgen.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include "lua_api/l_base.h"
8#include "irr_v3d.h"
9
10typedef u16 biome_t; // copy from mg_biome.h to avoid an unnecessary include
11
12class MMVManip;
13class BiomeManager;
14class BiomeGen;
15class Mapgen;
16
18{
19 friend class LuaVoxelManip;
20private:
21 // get_biome_id(biomename)
22 // returns the biome id as used in biomemap and returned by 'get_biome_data()'
23 static int l_get_biome_id(lua_State *L);
24
25 // get_biome_name(biome_id)
26 // returns the biome name string
27 static int l_get_biome_name(lua_State *L);
28
29 // get_heat(pos)
30 // returns the heat at the position
31 static int l_get_heat(lua_State *L);
33 // get_humidity(pos)
34 // returns the humidity at the position
35 static int l_get_humidity(lua_State *L);
36
37 // get_biome_data(pos)
38 // returns a table containing the biome id, heat and humidity at the position
39 static int l_get_biome_data(lua_State *L);
41 // get_mapgen_object(objectname)
42 // returns the requested object used during map generation
43 static int l_get_mapgen_object(lua_State *L);
44
45 // get_spawn_level(x = num, z = num)
46 static int l_get_spawn_level(lua_State *L);
47
48 // get_mapgen_params()
49 // returns the currently active map generation parameter set
50 static int l_get_mapgen_params(lua_State *L);
52 // set_mapgen_params(params)
53 // set mapgen parameters
54 static int l_set_mapgen_params(lua_State *L);
55
56 // get_mapgen_edges([mapgen_limit[, chunksize]])
57 static int l_get_mapgen_edges(lua_State *L);
58
59 // get_seed([add])
60 static int l_get_seed(lua_State *L);
61
62 // get_mapgen_setting(name)
63 static int l_get_mapgen_setting(lua_State *L);
64
65 // set_mapgen_setting(name, value, override_meta)
66 static int l_set_mapgen_setting(lua_State *L);
67
68 // get_mapgen_setting_noiseparams(name)
69 static int l_get_mapgen_setting_noiseparams(lua_State *L);
70
71 // set_mapgen_setting_noiseparams(name, value, override_meta)
72 static int l_set_mapgen_setting_noiseparams(lua_State *L);
73
74 // set_noiseparam_defaults(name, noiseparams, set_default)
75 static int l_set_noiseparams(lua_State *L);
76
77 // get_noiseparam_defaults(name)
78 static int l_get_noiseparams(lua_State *L);
79
80 // set_gen_notify(flags, {deco_ids}, {ud_ids})
81 static int l_set_gen_notify(lua_State *L);
82
83 // get_gen_notify()
84 static int l_get_gen_notify(lua_State *L);
85
86 // save_gen_notify(ud_id, data)
87 static int l_save_gen_notify(lua_State *L);
88
89 // get_decoration_id(decoration_name)
90 // returns the decoration ID as used in gennotify
91 static int l_get_decoration_id(lua_State *L);
92
93 // register_biome({lots of stuff})
94 static int l_register_biome(lua_State *L);
95
96 // register_decoration({lots of stuff})
97 static int l_register_decoration(lua_State *L);
98
99 // register_ore({lots of stuff})
100 static int l_register_ore(lua_State *L);
101
102 // register_schematic({schematic}, replacements={})
103 static int l_register_schematic(lua_State *L);
104
105 // clear_registered_biomes()
106 static int l_clear_registered_biomes(lua_State *L);
107
108 // clear_registered_decorations()
109 static int l_clear_registered_decorations(lua_State *L);
110
111 // clear_registered_schematics()
112 static int l_clear_registered_schematics(lua_State *L);
113
114 // generate_ores(vm, p1, p2)
115 static int l_generate_ores(lua_State *L);
116
117 // generate_decorations(vm, p1, p2)
118 static int l_generate_decorations(lua_State *L);
119
120 // clear_registered_ores
121 static int l_clear_registered_ores(lua_State *L);
122
123 // create_schematic(p1, p2, probability_list, filename)
124 static int l_create_schematic(lua_State *L);
125
126 // place_schematic(p, schematic, rotation,
127 // replacements, force_placement, flagstring)
128 static int l_place_schematic(lua_State *L);
129
130 // place_schematic_on_vmanip(vm, p, schematic, rotation,
131 // replacements, force_placement, flagstring)
132 static int l_place_schematic_on_vmanip(lua_State *L);
133
134 // serialize_schematic(schematic, format, options={...})
135 static int l_serialize_schematic(lua_State *L);
136
137 // read_schematic(schematic, options={...})
138 static int l_read_schematic(lua_State *L);
139
140 // Foreign implementations
141 /*
142 * In this case the API functions belong to LuaVoxelManip (so l_vmanip.cpp),
143 * but the implementations are so deeply connected to mapgen-related code
144 * that they are better off being here.
145 */
146
147 static int update_liquids(lua_State *L, MMVManip *vm);
148
149 static int calc_lighting(lua_State *L, MMVManip *vm,
150 v3s16 pmin, v3s16 pmax, bool propagate_shadow);
151
152 static int set_lighting(lua_State *L, MMVManip *vm,
153 v3s16 pmin, v3s16 pmax, u8 light);
154
155 // Helpers
156
157 // get a read-only(!) EmergeManager
158 static const EmergeManager *getEmergeManager(lua_State *L);
159 // get the thread-local or global BiomeGen (still read-only)
160 static const BiomeGen *getBiomeGen(lua_State *L);
161 // get the thread-local mapgen
162 static Mapgen *getMapgen(lua_State *L);
163
164public:
165 static void Initialize(lua_State *L, int top);
166 static void InitializeEmerge(lua_State *L, int top);
167
168 static struct EnumString es_BiomeTerrainType[];
169 static struct EnumString es_DecorationType[];
170 static struct EnumString es_MapgenObject[];
171 static struct EnumString es_OreType[];
172 static struct EnumString es_Rotation[];
173 static struct EnumString es_SchematicFormatType[];
175};
Definition mg_biome.h:80
Definition mg_biome.h:203
Definition emerge.h:117
Definition l_vmanip.h:18
Definition map.h:305
Definition mapgen.h:153
Definition l_base.h:28
Definition l_mapgen.h:18
static Mapgen * getMapgen(lua_State *L)
Definition l_mapgen.cpp:1978
static int l_set_mapgen_setting(lua_State *L)
Definition l_mapgen.cpp:907
static int l_get_spawn_level(lua_State *L)
Definition l_mapgen.cpp:713
static struct EnumString es_SchematicFormatType[]
Definition l_mapgen.h:72
static int l_get_biome_name(lua_State *L)
Definition l_mapgen.cpp:489
static int l_place_schematic(lua_State *L)
Definition l_mapgen.cpp:1678
static int l_clear_registered_decorations(lua_State *L)
Definition l_mapgen.cpp:1506
static int l_clear_registered_schematics(lua_State *L)
Definition l_mapgen.cpp:1530
static int l_get_biome_id(lua_State *L)
Definition l_mapgen.cpp:467
static int l_register_biome(lua_State *L)
Definition l_mapgen.cpp:1113
static int l_set_mapgen_params(lua_State *L)
Definition l_mapgen.cpp:799
static int set_lighting(lua_State *L, MMVManip *vm, v3s16 pmin, v3s16 pmax, u8 light)
Definition l_mapgen.cpp:1947
static const BiomeGen * getBiomeGen(lua_State *L)
Definition l_mapgen.cpp:1967
static const EmergeManager * getEmergeManager(lua_State *L)
Definition l_mapgen.cpp:1959
static int l_serialize_schematic(lua_State *L)
Definition l_mapgen.cpp:1778
static int l_clear_registered_ores(lua_State *L)
Definition l_mapgen.cpp:1518
static struct EnumString es_MapgenObject[]
Definition l_mapgen.h:40
static struct EnumString es_NodeResolveMethod[]
Definition l_mapgen.h:174
static int l_register_schematic(lua_State *L)
Definition l_mapgen.cpp:1466
static int l_get_heat(lua_State *L)
Definition l_mapgen.cpp:508
static void InitializeEmerge(lua_State *L, int top)
Definition l_mapgen.cpp:2030
static int l_get_seed(lua_State *L)
Definition l_mapgen.cpp:734
static int l_register_ore(lua_State *L)
Definition l_mapgen.cpp:1314
static int l_generate_decorations(lua_State *L)
Definition l_mapgen.cpp:1577
static int l_get_mapgen_edges(lua_State *L)
Definition l_mapgen.cpp:836
static int l_get_gen_notify(lua_State *L)
Definition l_mapgen.cpp:1037
static struct EnumString es_DecorationType[]
Definition l_mapgen.h:32
static int l_register_decoration(lua_State *L)
Definition l_mapgen.cpp:1139
static struct EnumString es_Rotation[]
Definition l_mapgen.h:62
static int l_set_noiseparams(lua_State *L)
Definition l_mapgen.cpp:958
static int l_save_gen_notify(lua_State *L)
Definition l_mapgen.cpp:1065
static int l_get_noiseparams(lua_State *L)
Definition l_mapgen.cpp:980
static int l_create_schematic(lua_State *L)
Definition l_mapgen.cpp:1612
static int l_get_biome_data(lua_State *L)
Definition l_mapgen.cpp:548
static int l_get_mapgen_setting(lua_State *L)
Definition l_mapgen.cpp:872
static int l_clear_registered_biomes(lua_State *L)
Definition l_mapgen.cpp:1494
static void Initialize(lua_State *L, int top)
Definition l_mapgen.cpp:1988
static int l_get_humidity(lua_State *L)
Definition l_mapgen.cpp:528
static int l_read_schematic(lua_State *L)
Definition l_mapgen.cpp:1828
static int l_get_mapgen_params(lua_State *L)
Definition l_mapgen.cpp:758
static int l_generate_ores(lua_State *L)
Definition l_mapgen.cpp:1542
static int update_liquids(lua_State *L, MMVManip *vm)
Definition l_mapgen.cpp:1908
static int l_place_schematic_on_vmanip(lua_State *L)
Definition l_mapgen.cpp:1726
static int l_set_gen_notify(lua_State *L)
Definition l_mapgen.cpp:996
static int calc_lighting(lua_State *L, MMVManip *vm, v3s16 pmin, v3s16 pmax, bool propagate_shadow)
Definition l_mapgen.cpp:1929
static struct EnumString es_OreType[]
Definition l_mapgen.h:51
static struct EnumString es_BiomeTerrainType[]
Definition l_mapgen.h:26
static int l_set_mapgen_setting_noiseparams(lua_State *L)
Definition l_mapgen.cpp:929
static int l_get_mapgen_setting_noiseparams(lua_State *L)
Definition l_mapgen.cpp:889
static int l_get_mapgen_object(lua_State *L)
Definition l_mapgen.cpp:584
static int l_get_decoration_id(lua_State *L)
Definition l_mapgen.cpp:1088
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
u16 biome_t
Definition l_mapgen.h:10
Definition c_types.h:16