]> git.lizzy.rs Git - dragonfireclient.git/blob - src/script/common/c_content.h
Allow setting chunksize in core.set_mapgen_params
[dragonfireclient.git] / src / script / common / c_content.h
1 /*
2 Minetest
3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20
21 /******************************************************************************/
22 /******************************************************************************/
23 /* WARNING!!!! do NOT add this header in any include file or any code file    */
24 /*             not being a script/modapi file!!!!!!!!                         */
25 /******************************************************************************/
26 /******************************************************************************/
27
28 #ifndef C_CONTENT_H_
29 #define C_CONTENT_H_
30
31 extern "C" {
32 #include <lua.h>
33 }
34
35 #include <iostream>
36 #include <map>
37 #include <vector>
38
39 #include "irrlichttypes_bloated.h"
40 #include "util/string.h"
41
42 namespace Json { class Value; }
43
44 struct MapNode;
45 class INodeDefManager;
46 struct PointedThing;
47 struct ItemStack;
48 struct ItemDefinition;
49 struct ToolCapabilities;
50 struct ObjectProperties;
51 struct SimpleSoundSpec;
52 struct ServerSoundParams;
53 class Inventory;
54 struct NodeBox;
55 struct ContentFeatures;
56 struct TileDef;
57 class Server;
58 struct DigParams;
59 struct HitParams;
60 struct EnumString;
61 struct NoiseParams;
62 class Schematic;
63
64
65 ContentFeatures    read_content_features     (lua_State *L, int index);
66 TileDef            read_tiledef              (lua_State *L, int index,
67                                               u8 drawtype);
68 void               read_soundspec            (lua_State *L, int index,
69                                               SimpleSoundSpec &spec);
70 NodeBox            read_nodebox              (lua_State *L, int index);
71
72 void               read_server_sound_params  (lua_State *L, int index,
73                                               ServerSoundParams &params);
74
75 void               push_dig_params           (lua_State *L,
76                                               const DigParams &params);
77 void               push_hit_params           (lua_State *L,
78                                               const HitParams &params);
79
80 ItemStack          read_item                 (lua_State *L, int index, Server *srv);
81
82
83 ToolCapabilities   read_tool_capabilities    (lua_State *L, int table);
84 void               push_tool_capabilities    (lua_State *L,
85                                               const ToolCapabilities &prop);
86
87 ItemDefinition     read_item_definition      (lua_State *L, int index,
88                                               ItemDefinition default_def);
89 void               read_object_properties    (lua_State *L, int index,
90                                               ObjectProperties *prop);
91 void               push_object_properties    (lua_State *L,
92                                               ObjectProperties *prop);
93
94 void               push_inventory_list       (lua_State *L,
95                                               Inventory *inv,
96                                               const char *name);
97 void               read_inventory_list       (lua_State *L, int tableindex,
98                                               Inventory *inv, const char *name,
99                                               Server *srv, int forcesize=-1);
100
101 MapNode            readnode                  (lua_State *L, int index,
102                                               INodeDefManager *ndef);
103 void               pushnode                  (lua_State *L, const MapNode &n,
104                                               INodeDefManager *ndef);
105
106 NodeBox            read_nodebox              (lua_State *L, int index);
107
108 void               read_groups               (lua_State *L, int index,
109                                               std::map<std::string, int> &result);
110
111 void               push_groups               (lua_State *L,
112                                               const std::map<std::string, int> &groups);
113
114 //TODO rename to "read_enum_field"
115 int                getenumfield              (lua_State *L, int table,
116                                               const char *fieldname,
117                                               const EnumString *spec,
118                                               int default_);
119
120 bool               getflagsfield             (lua_State *L, int table,
121                                               const char *fieldname,
122                                               FlagDesc *flagdesc,
123                                               u32 *flags, u32 *flagmask);
124
125 bool               read_flags                (lua_State *L, int index,
126                                               FlagDesc *flagdesc,
127                                               u32 *flags, u32 *flagmask);
128
129 void               push_flags_string         (lua_State *L, FlagDesc *flagdesc,
130                                               u32 flags, u32 flagmask);
131
132 u32                read_flags_table          (lua_State *L, int table,
133                                               FlagDesc *flagdesc, u32 *flagmask);
134
135 void               push_items                (lua_State *L,
136                                               const std::vector<ItemStack> &items);
137
138 std::vector<ItemStack> read_items            (lua_State *L,
139                                               int index,
140                                               Server* srv);
141
142 void               read_soundspec            (lua_State *L,
143                                               int index,
144                                               SimpleSoundSpec &spec);
145
146 bool               string_to_enum            (const EnumString *spec,
147                                               int &result,
148                                               const std::string &str);
149
150 bool               read_noiseparams          (lua_State *L, int index,
151                                               NoiseParams *np);
152 void               push_noiseparams          (lua_State *L, NoiseParams *np);
153
154 void               luaentity_get             (lua_State *L,u16 id);
155
156 bool               push_json_value           (lua_State *L,
157                                               const Json::Value &value,
158                                               int nullindex);
159 void               read_json_value           (lua_State *L, Json::Value &root,
160                                               int index, u8 recursion = 0);
161
162 extern struct EnumString es_TileAnimationType[];
163
164 #endif /* C_CONTENT_H_ */