3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
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.
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.
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.
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 /******************************************************************************/
38 #include "irrlichttypes_bloated.h"
39 #include "util/string.h"
40 #include "itemgroup.h"
42 namespace Json { class Value; }
45 class INodeDefManager;
48 struct ItemDefinition;
49 struct ToolCapabilities;
50 struct ObjectProperties;
51 struct SimpleSoundSpec;
52 struct ServerSoundParams;
55 struct ContentFeatures;
65 ContentFeatures read_content_features (lua_State *L, int index);
66 TileDef read_tiledef (lua_State *L, int index,
68 void read_soundspec (lua_State *L, int index,
69 SimpleSoundSpec &spec);
70 NodeBox read_nodebox (lua_State *L, int index);
72 void read_server_sound_params (lua_State *L, int index,
73 ServerSoundParams ¶ms);
75 void push_dig_params (lua_State *L,
76 const DigParams ¶ms);
77 void push_hit_params (lua_State *L,
78 const HitParams ¶ms);
80 ItemStack read_item (lua_State *L, int index, Server *srv);
82 struct TileAnimationParams read_animation_definition(lua_State *L, int index);
84 ToolCapabilities read_tool_capabilities (lua_State *L, int table);
85 void push_tool_capabilities (lua_State *L,
86 const ToolCapabilities &prop);
88 ItemDefinition read_item_definition (lua_State *L, int index,
89 ItemDefinition default_def);
90 void read_object_properties (lua_State *L, int index,
91 ObjectProperties *prop);
92 void push_object_properties (lua_State *L,
93 ObjectProperties *prop);
95 void push_inventory_list (lua_State *L,
98 void read_inventory_list (lua_State *L, int tableindex,
99 Inventory *inv, const char *name,
100 Server *srv, int forcesize=-1);
102 MapNode readnode (lua_State *L, int index,
103 INodeDefManager *ndef);
104 void pushnode (lua_State *L, const MapNode &n,
105 INodeDefManager *ndef);
107 NodeBox read_nodebox (lua_State *L, int index);
109 void read_groups (lua_State *L, int index,
110 ItemGroupList &result);
112 void push_groups (lua_State *L,
113 const ItemGroupList &groups);
115 //TODO rename to "read_enum_field"
116 int getenumfield (lua_State *L, int table,
117 const char *fieldname,
118 const EnumString *spec,
121 bool getflagsfield (lua_State *L, int table,
122 const char *fieldname,
124 u32 *flags, u32 *flagmask);
126 bool read_flags (lua_State *L, int index,
128 u32 *flags, u32 *flagmask);
130 void push_flags_string (lua_State *L, FlagDesc *flagdesc,
131 u32 flags, u32 flagmask);
133 u32 read_flags_table (lua_State *L, int table,
134 FlagDesc *flagdesc, u32 *flagmask);
136 void push_items (lua_State *L,
137 const std::vector<ItemStack> &items);
139 std::vector<ItemStack> read_items (lua_State *L,
143 void read_soundspec (lua_State *L,
145 SimpleSoundSpec &spec);
147 bool string_to_enum (const EnumString *spec,
149 const std::string &str);
151 bool read_noiseparams (lua_State *L, int index,
153 void push_noiseparams (lua_State *L, NoiseParams *np);
155 void luaentity_get (lua_State *L,u16 id);
157 bool push_json_value (lua_State *L,
158 const Json::Value &value,
160 void read_json_value (lua_State *L, Json::Value &root,
161 int index, u8 recursion = 0);
163 extern struct EnumString es_TileAnimationType[];
165 #endif /* C_CONTENT_H_ */