]> git.lizzy.rs Git - dragonfireclient.git/blob - src/script/common/c_content.h
Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu
[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 struct MapNode;
43 class INodeDefManager;
44 struct PointedThing;
45 struct ItemStack;
46 struct ItemDefinition;
47 struct ToolCapabilities;
48 struct ObjectProperties;
49 struct SimpleSoundSpec;
50 struct ServerSoundParams;
51 class Inventory;
52 struct NodeBox;
53 struct ContentFeatures;
54 struct TileDef;
55 class Server;
56 struct DigParams;
57 struct HitParams;
58 struct EnumString;
59 struct NoiseParams;
60 class DecoSchematic;
61
62
63 ContentFeatures    read_content_features         (lua_State *L, int index);
64 TileDef            read_tiledef                  (lua_State *L, int index);
65 void               read_soundspec                (lua_State *L, int index,
66                                                   SimpleSoundSpec &spec);
67 NodeBox            read_nodebox                  (lua_State *L, int index);
68
69 void               read_server_sound_params      (lua_State *L, int index,
70                                                   ServerSoundParams &params);
71
72 void          push_dig_params           (lua_State *L,const DigParams &params);
73 void          push_hit_params           (lua_State *L,const HitParams &params);
74
75 ItemStack     read_item                 (lua_State *L, int index, Server* srv);
76
77
78 ToolCapabilities   read_tool_capabilities    (lua_State *L,
79                                               int table);
80 void               push_tool_capabilities    (lua_State *L,
81                                               const ToolCapabilities &prop);
82
83 ItemDefinition     read_item_definition      (lua_State *L,
84                                               int index,
85                                               ItemDefinition default_def);
86 void               read_object_properties    (lua_State *L,
87                                               int index,
88                                               ObjectProperties *prop);
89
90 void               push_inventory_list       (lua_State *L,
91                                               Inventory *inv,
92                                               const char *name);
93 void               read_inventory_list       (lua_State *L,
94                                               int tableindex,
95                                               Inventory *inv,
96                                               const char *name,
97                                               Server* srv,
98                                               int forcesize=-1);
99
100 MapNode            readnode                  (lua_State *L,
101                                               int index,
102                                               INodeDefManager *ndef);
103 void               pushnode                  (lua_State *L,
104                                               const MapNode &n,
105                                               INodeDefManager *ndef);
106
107 NodeBox            read_nodebox              (lua_State *L, int index);
108
109 void               read_groups               (lua_State *L,
110                                               int index,
111                                               std::map<std::string, int> &result);
112
113 //TODO rename to "read_enum_field"
114 int                getenumfield              (lua_State *L,
115                                               int table,
116                                               const char *fieldname,
117                                               const EnumString *spec,
118                                               int default_);
119
120 u32                getflagsfield             (lua_State *L, int table,
121                                               const char *fieldname,
122                                               FlagDesc *flagdesc);
123
124 void               push_items                (lua_State *L,
125                                               const std::vector<ItemStack> &items);
126
127 std::vector<ItemStack> read_items            (lua_State *L,
128                                               int index,
129                                               Server* srv);
130
131 void               read_soundspec            (lua_State *L,
132                                               int index,
133                                               SimpleSoundSpec &spec);
134
135
136 bool               string_to_enum            (const EnumString *spec,
137                                               int &result,
138                                               const std::string &str);
139
140 NoiseParams*       read_noiseparams          (lua_State *L, int index);
141
142 bool               read_schematic            (lua_State *L, int index,
143                                               DecoSchematic *dschem,
144                                               Server *server);
145
146 void               luaentity_get             (lua_State *L,u16 id);
147
148 extern struct EnumString es_TileAnimationType[];
149
150 #endif /* C_CONTENT_H_ */