2013-05-25 00:51:02 +02:00
|
|
|
/*
|
|
|
|
Minetest
|
|
|
|
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
|
/* WARNING!!!! do NOT add this header in any include file or any code file */
|
|
|
|
/* not being a script/modapi file!!!!!!!! */
|
|
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef C_CONTENT_H_
|
|
|
|
#define C_CONTENT_H_
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <lua.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "irrlichttypes_bloated.h"
|
|
|
|
#include "util/string.h"
|
2016-10-05 09:03:55 +02:00
|
|
|
#include "itemgroup.h"
|
2017-01-31 14:18:52 +01:00
|
|
|
#include "itemdef.h"
|
2013-05-25 00:51:02 +02:00
|
|
|
|
2013-09-02 02:01:49 +02:00
|
|
|
namespace Json { class Value; }
|
|
|
|
|
2013-06-06 22:57:38 +02:00
|
|
|
struct MapNode;
|
2013-05-25 00:51:02 +02:00
|
|
|
class INodeDefManager;
|
2013-06-06 22:57:38 +02:00
|
|
|
struct PointedThing;
|
|
|
|
struct ItemStack;
|
|
|
|
struct ItemDefinition;
|
|
|
|
struct ToolCapabilities;
|
|
|
|
struct ObjectProperties;
|
|
|
|
struct SimpleSoundSpec;
|
|
|
|
struct ServerSoundParams;
|
2013-05-25 00:51:02 +02:00
|
|
|
class Inventory;
|
2013-06-06 22:57:38 +02:00
|
|
|
struct NodeBox;
|
|
|
|
struct ContentFeatures;
|
|
|
|
struct TileDef;
|
2013-05-25 00:51:02 +02:00
|
|
|
class Server;
|
|
|
|
struct DigParams;
|
|
|
|
struct HitParams;
|
|
|
|
struct EnumString;
|
|
|
|
struct NoiseParams;
|
2014-11-13 05:01:13 +01:00
|
|
|
class Schematic;
|
2013-05-25 00:51:02 +02:00
|
|
|
|
|
|
|
|
2015-07-03 05:14:30 +02:00
|
|
|
ContentFeatures read_content_features (lua_State *L, int index);
|
2015-08-05 22:52:32 +02:00
|
|
|
TileDef read_tiledef (lua_State *L, int index,
|
|
|
|
u8 drawtype);
|
2015-07-03 05:14:30 +02:00
|
|
|
void read_soundspec (lua_State *L, int index,
|
|
|
|
SimpleSoundSpec &spec);
|
|
|
|
NodeBox read_nodebox (lua_State *L, int index);
|
2013-05-25 00:51:02 +02:00
|
|
|
|
2015-07-03 05:14:30 +02:00
|
|
|
void read_server_sound_params (lua_State *L, int index,
|
|
|
|
ServerSoundParams ¶ms);
|
2013-05-25 00:51:02 +02:00
|
|
|
|
2015-07-03 05:14:30 +02:00
|
|
|
void push_dig_params (lua_State *L,
|
|
|
|
const DigParams ¶ms);
|
|
|
|
void push_hit_params (lua_State *L,
|
|
|
|
const HitParams ¶ms);
|
2013-05-25 00:51:02 +02:00
|
|
|
|
2017-01-31 14:18:52 +01:00
|
|
|
ItemStack read_item (lua_State *L, int index, IItemDefManager *idef);
|
2013-05-25 00:51:02 +02:00
|
|
|
|
2017-01-14 16:48:49 +01:00
|
|
|
struct TileAnimationParams read_animation_definition(lua_State *L, int index);
|
2013-05-25 00:51:02 +02:00
|
|
|
|
2015-07-03 05:14:30 +02:00
|
|
|
ToolCapabilities read_tool_capabilities (lua_State *L, int table);
|
2013-05-25 00:51:02 +02:00
|
|
|
void push_tool_capabilities (lua_State *L,
|
|
|
|
const ToolCapabilities &prop);
|
|
|
|
|
2017-04-19 23:02:07 +02:00
|
|
|
void read_item_definition (lua_State *L, int index, const ItemDefinition &default_def,
|
|
|
|
ItemDefinition &def);
|
2017-04-29 12:08:16 +02:00
|
|
|
void push_item_definition (lua_State *L,
|
|
|
|
const ItemDefinition &i);
|
2015-07-03 05:14:30 +02:00
|
|
|
void read_object_properties (lua_State *L, int index,
|
2017-03-10 18:25:58 +01:00
|
|
|
ObjectProperties *prop,
|
|
|
|
IItemDefManager *idef);
|
2015-07-03 05:14:30 +02:00
|
|
|
void push_object_properties (lua_State *L,
|
2013-05-25 00:51:02 +02:00
|
|
|
ObjectProperties *prop);
|
|
|
|
|
2013-08-11 04:09:45 +02:00
|
|
|
void push_inventory_list (lua_State *L,
|
|
|
|
Inventory *inv,
|
|
|
|
const char *name);
|
2015-07-03 05:14:30 +02:00
|
|
|
void read_inventory_list (lua_State *L, int tableindex,
|
|
|
|
Inventory *inv, const char *name,
|
|
|
|
Server *srv, int forcesize=-1);
|
2013-05-25 00:51:02 +02:00
|
|
|
|
2015-07-03 05:14:30 +02:00
|
|
|
MapNode readnode (lua_State *L, int index,
|
2013-05-25 00:51:02 +02:00
|
|
|
INodeDefManager *ndef);
|
2015-07-03 05:14:30 +02:00
|
|
|
void pushnode (lua_State *L, const MapNode &n,
|
2013-05-25 00:51:02 +02:00
|
|
|
INodeDefManager *ndef);
|
|
|
|
|
|
|
|
NodeBox read_nodebox (lua_State *L, int index);
|
|
|
|
|
2015-07-03 05:14:30 +02:00
|
|
|
void read_groups (lua_State *L, int index,
|
2016-10-05 09:03:55 +02:00
|
|
|
ItemGroupList &result);
|
2013-05-25 00:51:02 +02:00
|
|
|
|
2015-07-03 05:14:30 +02:00
|
|
|
void push_groups (lua_State *L,
|
2016-10-05 09:03:55 +02:00
|
|
|
const ItemGroupList &groups);
|
2015-07-03 05:14:30 +02:00
|
|
|
|
2013-05-25 00:51:02 +02:00
|
|
|
//TODO rename to "read_enum_field"
|
2015-07-03 05:14:30 +02:00
|
|
|
int getenumfield (lua_State *L, int table,
|
2013-05-25 00:51:02 +02:00
|
|
|
const char *fieldname,
|
|
|
|
const EnumString *spec,
|
|
|
|
int default_);
|
|
|
|
|
2014-03-08 17:34:46 +01:00
|
|
|
bool getflagsfield (lua_State *L, int table,
|
2013-05-25 00:51:02 +02:00
|
|
|
const char *fieldname,
|
2014-03-08 17:34:46 +01:00
|
|
|
FlagDesc *flagdesc,
|
|
|
|
u32 *flags, u32 *flagmask);
|
|
|
|
|
|
|
|
bool read_flags (lua_State *L, int index,
|
|
|
|
FlagDesc *flagdesc,
|
|
|
|
u32 *flags, u32 *flagmask);
|
2015-07-03 05:14:30 +02:00
|
|
|
|
|
|
|
void push_flags_string (lua_State *L, FlagDesc *flagdesc,
|
|
|
|
u32 flags, u32 flagmask);
|
2013-05-25 00:51:02 +02:00
|
|
|
|
2014-02-09 18:38:50 +01:00
|
|
|
u32 read_flags_table (lua_State *L, int table,
|
|
|
|
FlagDesc *flagdesc, u32 *flagmask);
|
|
|
|
|
2013-05-25 00:51:02 +02:00
|
|
|
void push_items (lua_State *L,
|
|
|
|
const std::vector<ItemStack> &items);
|
|
|
|
|
|
|
|
std::vector<ItemStack> read_items (lua_State *L,
|
|
|
|
int index,
|
|
|
|
Server* srv);
|
|
|
|
|
|
|
|
void read_soundspec (lua_State *L,
|
|
|
|
int index,
|
|
|
|
SimpleSoundSpec &spec);
|
|
|
|
|
|
|
|
bool string_to_enum (const EnumString *spec,
|
|
|
|
int &result,
|
|
|
|
const std::string &str);
|
|
|
|
|
2014-12-08 03:57:12 +01:00
|
|
|
bool read_noiseparams (lua_State *L, int index,
|
2014-02-16 00:20:15 +01:00
|
|
|
NoiseParams *np);
|
2015-07-03 05:14:30 +02:00
|
|
|
void push_noiseparams (lua_State *L, NoiseParams *np);
|
2013-06-22 06:29:44 +02:00
|
|
|
|
2013-05-25 00:51:02 +02:00
|
|
|
void luaentity_get (lua_State *L,u16 id);
|
|
|
|
|
2013-09-02 02:01:49 +02:00
|
|
|
bool push_json_value (lua_State *L,
|
|
|
|
const Json::Value &value,
|
|
|
|
int nullindex);
|
2015-07-03 05:14:30 +02:00
|
|
|
void read_json_value (lua_State *L, Json::Value &root,
|
|
|
|
int index, u8 recursion = 0);
|
2013-09-02 02:01:49 +02:00
|
|
|
|
2017-04-29 12:08:16 +02:00
|
|
|
void push_pointed_thing (lua_State *L, const PointedThing &pointed);
|
|
|
|
|
|
|
|
void push_objectRef (lua_State *L, const u16 id);
|
|
|
|
|
2016-11-14 15:28:06 +01:00
|
|
|
extern struct EnumString es_TileAnimationType[];
|
2013-05-25 00:51:02 +02:00
|
|
|
|
|
|
|
#endif /* C_CONTENT_H_ */
|