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 /******************************************************************************/
37 #include "irrlichttypes_bloated.h"
38 #include "util/string.h"
39 #include "itemgroup.h"
43 namespace Json { class Value; }
46 class INodeDefManager;
49 struct ItemDefinition;
50 struct ToolCapabilities;
51 struct ObjectProperties;
52 struct SimpleSoundSpec;
53 struct ServerSoundParams;
56 struct ContentFeatures;
66 ContentFeatures read_content_features (lua_State *L, int index);
67 void push_content_features (lua_State *L,
68 const ContentFeatures &c);
70 void push_nodebox (lua_State *L,
72 void push_box (lua_State *L,
73 const std::vector<aabb3f> &box);
75 void push_palette (lua_State *L,
76 const std::vector<video::SColor> *palette);
78 TileDef read_tiledef (lua_State *L, int index,
81 void read_soundspec (lua_State *L, int index,
82 SimpleSoundSpec &spec);
83 NodeBox read_nodebox (lua_State *L, int index);
85 void read_server_sound_params (lua_State *L, int index,
86 ServerSoundParams ¶ms);
88 void push_dig_params (lua_State *L,
89 const DigParams ¶ms);
90 void push_hit_params (lua_State *L,
91 const HitParams ¶ms);
93 ItemStack read_item (lua_State *L, int index, IItemDefManager *idef);
95 struct TileAnimationParams read_animation_definition(lua_State *L, int index);
97 ToolCapabilities read_tool_capabilities (lua_State *L, int table);
98 void push_tool_capabilities (lua_State *L,
99 const ToolCapabilities &prop);
101 void read_item_definition (lua_State *L, int index, const ItemDefinition &default_def,
102 ItemDefinition &def);
103 void push_item_definition (lua_State *L,
104 const ItemDefinition &i);
105 void push_item_definition_full (lua_State *L,
106 const ItemDefinition &i);
108 void read_object_properties (lua_State *L, int index,
109 ObjectProperties *prop,
110 IItemDefManager *idef);
111 void push_object_properties (lua_State *L,
112 ObjectProperties *prop);
114 void push_inventory_list (lua_State *L,
117 void read_inventory_list (lua_State *L, int tableindex,
118 Inventory *inv, const char *name,
119 Server *srv, int forcesize=-1);
121 MapNode readnode (lua_State *L, int index,
122 INodeDefManager *ndef);
123 void pushnode (lua_State *L, const MapNode &n,
124 INodeDefManager *ndef);
127 void read_groups (lua_State *L, int index,
128 ItemGroupList &result);
130 void push_groups (lua_State *L,
131 const ItemGroupList &groups);
133 //TODO rename to "read_enum_field"
134 int getenumfield (lua_State *L, int table,
135 const char *fieldname,
136 const EnumString *spec,
139 bool getflagsfield (lua_State *L, int table,
140 const char *fieldname,
142 u32 *flags, u32 *flagmask);
144 bool read_flags (lua_State *L, int index,
146 u32 *flags, u32 *flagmask);
148 void push_flags_string (lua_State *L, FlagDesc *flagdesc,
149 u32 flags, u32 flagmask);
151 u32 read_flags_table (lua_State *L, int table,
152 FlagDesc *flagdesc, u32 *flagmask);
154 void push_items (lua_State *L,
155 const std::vector<ItemStack> &items);
157 std::vector<ItemStack> read_items (lua_State *L,
161 void push_soundspec (lua_State *L,
162 const SimpleSoundSpec &spec);
164 bool string_to_enum (const EnumString *spec,
166 const std::string &str);
168 bool read_noiseparams (lua_State *L, int index,
170 void push_noiseparams (lua_State *L, NoiseParams *np);
172 void luaentity_get (lua_State *L,u16 id);
174 bool push_json_value (lua_State *L,
175 const Json::Value &value,
177 void read_json_value (lua_State *L, Json::Value &root,
178 int index, u8 recursion = 0);
180 void push_pointed_thing (lua_State *L, const PointedThing &pointed, bool csm = false);
182 void push_objectRef (lua_State *L, const u16 id);
184 extern struct EnumString es_TileAnimationType[];