aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/common/c_content.cpp99
-rw-r--r--src/script/common/c_content.h5
-rw-r--r--src/script/common/c_converter.cpp35
-rw-r--r--src/script/common/c_converter.h5
-rw-r--r--src/script/lua_api/l_mapgen.cpp35
-rw-r--r--src/script/lua_api/l_mapgen.h6
-rw-r--r--src/script/lua_api/l_object.cpp262
-rw-r--r--src/script/lua_api/l_object.h41
8 files changed, 486 insertions, 2 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index c0728177f..94fcdecbb 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -200,6 +200,64 @@ void read_object_properties(lua_State *L, int index,
}
/******************************************************************************/
+void push_object_properties(lua_State *L, ObjectProperties *prop)
+{
+ lua_newtable(L);
+ lua_pushnumber(L, prop->hp_max);
+ lua_setfield(L, -2, "hp_max");
+ lua_pushboolean(L, prop->physical);
+ lua_setfield(L, -2, "physical");
+ lua_pushboolean(L, prop->collideWithObjects);
+ lua_setfield(L, -2, "collide_with_objects");
+ lua_pushnumber(L, prop->weight);
+ lua_setfield(L, -2, "weight");
+ push_aabb3f(L, prop->collisionbox);
+ lua_setfield(L, -2, "collisionbox");
+ lua_pushlstring(L, prop->visual.c_str(), prop->visual.size());
+ lua_setfield(L, -2, "visual");
+ lua_pushlstring(L, prop->mesh.c_str(), prop->mesh.size());
+ lua_setfield(L, -2, "mesh");
+ push_v2f(L, prop->visual_size);
+ lua_setfield(L, -2, "visual_size");
+
+ lua_newtable(L);
+ u16 i = 1;
+ for (std::vector<std::string>::iterator it = prop->textures.begin();
+ it != prop->textures.end(); ++it) {
+ lua_pushlstring(L, it->c_str(), it->size());
+ lua_rawseti(L, -2, i);
+ }
+ lua_setfield(L, -2, "textures");
+
+ lua_newtable(L);
+ i = 1;
+ for (std::vector<video::SColor>::iterator it = prop->colors.begin();
+ it != prop->colors.end(); ++it) {
+ push_ARGB8(L, *it);
+ lua_rawseti(L, -2, i);
+ }
+ lua_setfield(L, -2, "colors");
+
+ push_v2s16(L, prop->spritediv);
+ lua_setfield(L, -2, "spritediv");
+ push_v2s16(L, prop->initial_sprite_basepos);
+ lua_setfield(L, -2, "initial_sprite_basepos");
+ lua_pushboolean(L, prop->is_visible);
+ lua_setfield(L, -2, "is_visible");
+ lua_pushboolean(L, prop->makes_footstep_sound);
+ lua_setfield(L, -2, "makes_footstep_sound");
+ lua_pushnumber(L, prop->automatic_rotate);
+ lua_setfield(L, -2, "automatic_rotate");
+ lua_pushnumber(L, prop->stepheight / BS);
+ lua_setfield(L, -2, "stepheight");
+ if (prop->automatic_face_movement_dir)
+ lua_pushnumber(L, prop->automatic_face_movement_dir_offset);
+ else
+ lua_pushboolean(L, false);
+ lua_setfield(L, -2, "automatic_face_movement_dir");
+}
+
+/******************************************************************************/
TileDef read_tiledef(lua_State *L, int index)
{
if(index < 0)
@@ -896,6 +954,12 @@ u32 read_flags_table(lua_State *L, int table, FlagDesc *flagdesc, u32 *flagmask)
return flags;
}
+void push_flags_string(lua_State *L, FlagDesc *flagdesc, u32 flags, u32 flagmask)
+{
+ std::string flagstring = writeFlagString(flags, flagdesc, flagmask);
+ lua_pushlstring(L, flagstring.c_str(), flagstring.size());
+}
+
/******************************************************************************/
/* Lua Stored data! */
/******************************************************************************/
@@ -921,6 +985,17 @@ void read_groups(lua_State *L, int index,
}
/******************************************************************************/
+void push_groups(lua_State *L, std::map<std::string, int> groups)
+{
+ lua_newtable(L);
+ for (std::map<std::string, int>::iterator it = groups.begin();
+ it != groups.end(); ++it) {
+ lua_pushnumber(L, it->second);
+ lua_setfield(L, -2, it->first.c_str());
+ }
+}
+
+/******************************************************************************/
void push_items(lua_State *L, const std::vector<ItemStack> &items)
{
// Create and fill table
@@ -997,6 +1072,30 @@ bool read_noiseparams(lua_State *L, int index, NoiseParams *np)
return true;
}
+void push_noiseparams(lua_State *L, NoiseParams *np)
+{
+ lua_newtable(L);
+ lua_pushnumber(L, np->offset);
+ lua_setfield(L, -2, "offset");
+ lua_pushnumber(L, np->scale);
+ lua_setfield(L, -2, "scale");
+ lua_pushnumber(L, np->persist);
+ lua_setfield(L, -2, "persistence");
+ lua_pushnumber(L, np->lacunarity);
+ lua_setfield(L, -2, "lacunarity");
+ lua_pushnumber(L, np->seed);
+ lua_setfield(L, -2, "seed");
+ lua_pushnumber(L, np->octaves);
+ lua_setfield(L, -2, "octaves");
+
+ push_flags_string(L, flagdesc_noiseparams, np->flags,
+ np->flags);
+ lua_setfield(L, -2, "flags");
+
+ push_v3f(L, np->spread);
+ lua_setfield(L, -2, "spread");
+}
+
/******************************************************************************/
// Returns depth of json value tree
static int push_json_value_getdepth(const Json::Value &value)
diff --git a/src/script/common/c_content.h b/src/script/common/c_content.h
index 241b1ca76..69b2a8355 100644
--- a/src/script/common/c_content.h
+++ b/src/script/common/c_content.h
@@ -88,6 +88,8 @@ ItemDefinition read_item_definition (lua_State *L,
void read_object_properties (lua_State *L,
int index,
ObjectProperties *prop);
+void push_object_properties (lua_State *L,
+ ObjectProperties *prop);
void push_inventory_list (lua_State *L,
Inventory *inv,
@@ -127,6 +129,8 @@ bool getflagsfield (lua_State *L, int table,
bool read_flags (lua_State *L, int index,
FlagDesc *flagdesc,
u32 *flags, u32 *flagmask);
+void push_flags_string (lua_State *L, FlagDesc *flagdesc,
+ u32 flags, u32 flagmask);
u32 read_flags_table (lua_State *L, int table,
FlagDesc *flagdesc, u32 *flagmask);
@@ -149,6 +153,7 @@ bool string_to_enum (const EnumString *spec,
bool read_noiseparams (lua_State *L, int index,
NoiseParams *np);
+void push_noiseparams (lua_State *L, NoiseParams *np);
void luaentity_get (lua_State *L,u16 id);
diff --git a/src/script/common/c_converter.cpp b/src/script/common/c_converter.cpp
index 211121552..f1d3cc421 100644
--- a/src/script/common/c_converter.cpp
+++ b/src/script/common/c_converter.cpp
@@ -88,6 +88,24 @@ v2s16 check_v2s16(lua_State *L, int index)
return p;
}
+void push_v2s16(lua_State *L, v2s16 p)
+{
+ lua_newtable(L);
+ lua_pushnumber(L, p.X);
+ lua_setfield(L, -2, "x");
+ lua_pushnumber(L, p.Y);
+ lua_setfield(L, -2, "y");
+}
+
+void push_v2s32(lua_State *L, v2s32 p)
+{
+ lua_newtable(L);
+ lua_pushnumber(L, p.X);
+ lua_setfield(L, -2, "x");
+ lua_pushnumber(L, p.Y);
+ lua_setfield(L, -2, "y");
+}
+
v2s32 read_v2s32(lua_State *L, int index)
{
v2s32 p;
@@ -277,6 +295,23 @@ aabb3f read_aabb3f(lua_State *L, int index, f32 scale)
return box;
}
+void push_aabb3f(lua_State *L, aabb3f box)
+{
+ lua_newtable(L);
+ lua_pushnumber(L, box.MinEdge.X);
+ lua_rawseti(L, -2, 1);
+ lua_pushnumber(L, box.MinEdge.Y);
+ lua_rawseti(L, -2, 2);
+ lua_pushnumber(L, box.MinEdge.Z);
+ lua_rawseti(L, -2, 3);
+ lua_pushnumber(L, box.MaxEdge.X);
+ lua_rawseti(L, -2, 4);
+ lua_pushnumber(L, box.MaxEdge.Y);
+ lua_rawseti(L, -2, 5);
+ lua_pushnumber(L, box.MaxEdge.Z);
+ lua_rawseti(L, -2, 6);
+}
+
std::vector<aabb3f> read_aabb3f_vector(lua_State *L, int index, f32 scale)
{
std::vector<aabb3f> boxes;
diff --git a/src/script/common/c_converter.h b/src/script/common/c_converter.h
index e4466d97f..8a49c7a73 100644
--- a/src/script/common/c_converter.h
+++ b/src/script/common/c_converter.h
@@ -96,11 +96,16 @@ std::vector<aabb3f> read_aabb3f_vector (lua_State *L, int index, f32 scale);
size_t read_stringlist (lua_State *L, int index,
std::vector<std::string> *result);
+void push_v2s16 (lua_State *L, v2s16 p);
+void push_v2s32 (lua_State *L, v2s32 p);
void push_v3s16 (lua_State *L, v3s16 p);
+void push_aabb3f (lua_State *L, aabb3f box);
void push_ARGB8 (lua_State *L, video::SColor color);
void pushFloatPos (lua_State *L, v3f p);
void push_v3f (lua_State *L, v3f p);
void push_v2f (lua_State *L, v2f p);
+void push_groups (lua_State *L,
+ std::map<std::string, int> groups);
void warn_if_field_exists(lua_State *L, int table,
const char *fieldname,
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index 76e94e97e..57090a58f 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -637,6 +637,20 @@ int ModApiMapgen::l_set_noiseparams(lua_State *L)
}
+// get_noiseparams(name)
+int ModApiMapgen::l_get_noiseparams(lua_State *L)
+{
+ std::string name = luaL_checkstring(L, 1);
+
+ NoiseParams np;
+ if (!g_settings->getNoiseParams(name, np))
+ return 0;
+
+ push_noiseparams(L, &np);
+ return 1;
+}
+
+
// set_gen_notify(flags, {deco_id_table})
int ModApiMapgen::l_set_gen_notify(lua_State *L)
{
@@ -661,6 +675,25 @@ int ModApiMapgen::l_set_gen_notify(lua_State *L)
}
+// get_gen_notify()
+int ModApiMapgen::l_get_gen_notify(lua_State *L)
+{
+ EmergeManager *emerge = getServer(L)->getEmergeManager();
+ push_flags_string(L, flagdesc_gennotify, emerge->gen_notify_on,
+ emerge->gen_notify_on);
+
+ lua_newtable(L);
+ int i = 1;
+ for (std::set<u32>::iterator it = emerge->gen_notify_on_deco_ids.begin();
+ it != emerge->gen_notify_on_deco_ids.end(); ++it) {
+ lua_pushnumber(L, *it);
+ lua_rawseti(L, -2, i);
+ i++;
+ }
+ return 2;
+}
+
+
// register_biome({lots of stuff})
int ModApiMapgen::l_register_biome(lua_State *L)
{
@@ -1187,7 +1220,9 @@ void ModApiMapgen::Initialize(lua_State *L, int top)
API_FCT(get_mapgen_params);
API_FCT(set_mapgen_params);
API_FCT(set_noiseparams);
+ API_FCT(get_noiseparams);
API_FCT(set_gen_notify);
+ API_FCT(get_gen_notify);
API_FCT(register_biome);
API_FCT(register_decoration);
diff --git a/src/script/lua_api/l_mapgen.h b/src/script/lua_api/l_mapgen.h
index 84e556f63..7440d1285 100644
--- a/src/script/lua_api/l_mapgen.h
+++ b/src/script/lua_api/l_mapgen.h
@@ -39,9 +39,15 @@ private:
// set_noiseparam_defaults(name, noiseparams, set_default)
static int l_set_noiseparams(lua_State *L);
+ // get_noiseparam_defaults(name)
+ static int l_get_noiseparams(lua_State *L);
+
// set_gen_notify(flagstring)
static int l_set_gen_notify(lua_State *L);
+ // set_gen_notify(flagstring)
+ static int l_get_gen_notify(lua_State *L);
+
// register_biome({lots of stuff})
static int l_register_biome(lua_State *L);
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index c83c8c747..48d054dcd 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -29,7 +29,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "content_sao.h"
#include "server.h"
#include "hud.h"
+#include "scripting_game.h"
+#define GET_ENV_PTR ServerEnvironment* env = \
+ dynamic_cast<ServerEnvironment*>(getEnv(L)); \
+ if (env == NULL) return 0
struct EnumString es_HudElementType[] =
{
@@ -376,6 +380,20 @@ int ObjectRef::l_set_armor_groups(lua_State *L)
return 0;
}
+// get_armor_groups(self)
+int ObjectRef::l_get_armor_groups(lua_State *L)
+{
+ NO_MAP_LOCK_REQUIRED;
+ ObjectRef *ref = checkobject(L, 1);
+ ServerActiveObject *co = getobject(ref);
+ if (co == NULL)
+ return 0;
+ // Do it
+ ItemGroupList groups = co->getArmorGroups();
+ push_groups(L, groups);
+ return 1;
+}
+
// set_physics_override(self, physics_override_speed, physics_override_jump,
// physics_override_gravity, sneak, sneak_glitch)
int ObjectRef::l_set_physics_override(lua_State *L)
@@ -409,6 +427,28 @@ int ObjectRef::l_set_physics_override(lua_State *L)
return 0;
}
+// get_physics_override(self)
+int ObjectRef::l_get_physics_override(lua_State *L)
+{
+ ObjectRef *ref = checkobject(L, 1);
+ PlayerSAO *co = (PlayerSAO *)getobject(ref);
+ if (co == NULL)
+ return 0;
+ // Do it
+ lua_newtable(L);
+ lua_pushnumber(L, co->m_physics_override_speed);
+ lua_setfield(L, -2, "speed");
+ lua_pushnumber(L, co->m_physics_override_jump);
+ lua_setfield(L, -2, "jump");
+ lua_pushnumber(L, co->m_physics_override_gravity);
+ lua_setfield(L, -2, "gravity");
+ lua_pushboolean(L, co->m_physics_override_sneak);
+ lua_setfield(L, -2, "sneak");
+ lua_pushboolean(L, co->m_physics_override_sneak_glitch);
+ lua_setfield(L, -2, "sneak_glitch");
+ return 1;
+}
+
// set_animation(self, frame_range, frame_speed, frame_blend)
int ObjectRef::l_set_animation(lua_State *L)
{
@@ -430,6 +470,26 @@ int ObjectRef::l_set_animation(lua_State *L)
return 0;
}
+// get_animation(self)
+int ObjectRef::l_get_animation(lua_State *L)
+{
+ NO_MAP_LOCK_REQUIRED;
+ ObjectRef *ref = checkobject(L, 1);
+ ServerActiveObject *co = getobject(ref);
+ if (co == NULL)
+ return 0;
+ // Do it
+ v2f frames = v2f(1,1);
+ float frame_speed = 15;
+ float frame_blend = 0;
+ co->getAnimation(&frames, &frame_speed, &frame_blend);
+
+ push_v2f(L, frames);
+ lua_pushnumber(L, frame_speed);
+ lua_pushnumber(L, frame_blend);
+ return 3;
+}
+
// set_local_animation(self, {stand/idle}, {walk}, {dig}, {walk+dig}, frame_speed)
int ObjectRef::l_set_local_animation(lua_State *L)
{
@@ -455,6 +515,27 @@ int ObjectRef::l_set_local_animation(lua_State *L)
return 0;
}
+// get_local_animation(self)
+int ObjectRef::l_get_local_animation(lua_State *L)
+{
+ //NO_MAP_LOCK_REQUIRED
+ ObjectRef *ref = checkobject(L, 1);
+ Player *player = getplayer(ref);
+ if (player == NULL)
+ return 0;
+
+ v2s32 frames[4];
+ float frame_speed;
+ player->getLocalAnimations(frames, &frame_speed);
+
+ for (int i = 0; i < 4; i++) {
+ push_v2s32(L, frames[i]);
+ }
+
+ lua_pushnumber(L, frame_speed);
+ return 5;
+}
+
// set_eye_offset(self, v3f first pv, v3f third pv)
int ObjectRef::l_set_eye_offset(lua_State *L)
{
@@ -485,6 +566,20 @@ int ObjectRef::l_set_eye_offset(lua_State *L)
return 0;
}
+// get_eye_offset(self)
+int ObjectRef::l_get_eye_offset(lua_State *L)
+{
+ //NO_MAP_LOCK_REQUIRED;
+ ObjectRef *ref = checkobject(L, 1);
+ Player *player = getplayer(ref);
+ if (player == NULL)
+ return 0;
+ // Do it
+ push_v3f(L, player->eye_offset_first);
+ push_v3f(L, player->eye_offset_third);
+ return 2;
+}
+
// set_bone_position(self, std::string bone, v3f position, v3f rotation)
int ObjectRef::l_set_bone_position(lua_State *L)
{
@@ -506,6 +601,28 @@ int ObjectRef::l_set_bone_position(lua_State *L)
return 0;
}
+// get_bone_position(self, bone)
+int ObjectRef::l_get_bone_position(lua_State *L)
+{
+ NO_MAP_LOCK_REQUIRED;
+ ObjectRef *ref = checkobject(L, 1);
+ ServerActiveObject *co = getobject(ref);
+ if (co == NULL)
+ return 0;
+ // Do it
+ std::string bone = "";
+ if(!lua_isnil(L, 2))
+ bone = lua_tostring(L, 2);
+
+ v3f position = v3f(0, 0, 0);
+ v3f rotation = v3f(0, 0, 0);
+ co->getBonePosition(bone, &position, &rotation);
+
+ push_v3f(L, position);
+ push_v3f(L, rotation);
+ return 2;
+}
+
// set_attach(self, parent, bone, position, rotation)
int ObjectRef::l_set_attach(lua_State *L)
{
@@ -530,6 +647,34 @@ int ObjectRef::l_set_attach(lua_State *L)
return 0;
}
+// get_attach(self)
+int ObjectRef::l_get_attach(lua_State *L)
+{
+ NO_MAP_LOCK_REQUIRED;
+ GET_ENV_PTR;
+
+ ObjectRef *ref = checkobject(L, 1);
+ ServerActiveObject *co = getobject(ref);
+ if (co == NULL)
+ return 0;
+
+ // Do it
+ int parent_id = 0;
+ std::string bone = "";
+ v3f position = v3f(0, 0, 0);
+ v3f rotation = v3f(0, 0, 0);
+ co->getAttachment(&parent_id, &bone, &position, &rotation);
+ if (!parent_id)
+ return 0;
+ ServerActiveObject *parent = env->getActiveObject(parent_id);
+
+ getScriptApiBase(L)->objectrefGetOrCreate(L, parent);
+ lua_pushlstring(L, bone.c_str(), bone.size());
+ push_v3f(L, position);
+ push_v3f(L, rotation);
+ return 4;
+}
+
// set_detach(self)
int ObjectRef::l_set_detach(lua_State *L)
{
@@ -557,6 +702,21 @@ int ObjectRef::l_set_properties(lua_State *L)
return 0;
}
+// get_properties(self)
+int ObjectRef::l_get_properties(lua_State *L)
+{
+ NO_MAP_LOCK_REQUIRED;
+ ObjectRef *ref = checkobject(L, 1);
+ ServerActiveObject *co = getobject(ref);
+ if (co == NULL)
+ return 0;
+ ObjectProperties *prop = co->accessObjectProperties();
+ if (!prop)
+ return 0;
+ push_object_properties(L, prop);
+ return 1;
+}
+
// is_player(self)
int ObjectRef::l_is_player(lua_State *L)
{
@@ -1185,6 +1345,20 @@ int ObjectRef::l_hud_set_hotbar_itemcount(lua_State *L)
return 1;
}
+// hud_get_hotbar_itemcount(self)
+int ObjectRef::l_hud_get_hotbar_itemcount(lua_State *L)
+{
+ ObjectRef *ref = checkobject(L, 1);
+ Player *player = getplayer(ref);
+ if (player == NULL)
+ return 0;
+
+ s32 hotbar_itemcount = getServer(L)->hudGetHotbarItemcount(player);
+
+ lua_pushnumber(L, hotbar_itemcount);
+ return 1;
+}
+
// hud_set_hotbar_image(self, name)
int ObjectRef::l_hud_set_hotbar_image(lua_State *L)
{
@@ -1199,6 +1373,19 @@ int ObjectRef::l_hud_set_hotbar_image(lua_State *L)
return 1;
}
+// hud_get_hotbar_image(self)
+int ObjectRef::l_hud_get_hotbar_image(lua_State *L)
+{
+ ObjectRef *ref = checkobject(L, 1);
+ Player *player = getplayer(ref);
+ if (player == NULL)
+ return 0;
+
+ std::string name = getServer(L)->hudGetHotbarImage(player);
+ lua_pushlstring(L, name.c_str(), name.size());
+ return 1;
+}
+
// hud_set_hotbar_selected_image(self, name)
int ObjectRef::l_hud_set_hotbar_selected_image(lua_State *L)
{
@@ -1213,6 +1400,19 @@ int ObjectRef::l_hud_set_hotbar_selected_image(lua_State *L)
return 1;
}
+// hud_get_hotbar_selected_image(self)
+int ObjectRef::l_hud_get_hotbar_selected_image(lua_State *L)
+{
+ ObjectRef *ref = checkobject(L, 1);
+ Player *player = getplayer(ref);
+ if (player == NULL)
+ return 0;
+
+ std::string name = getServer(L)->hudGetHotbarSelectedImage(player);
+ lua_pushlstring(L, name.c_str(), name.size());
+ return 1;
+}
+
// set_sky(self, bgcolor, type, list)
int ObjectRef::l_set_sky(lua_State *L)
{
@@ -1251,6 +1451,33 @@ int ObjectRef::l_set_sky(lua_State *L)
return 1;
}
+// get_sky(self)
+int ObjectRef::l_get_sky(lua_State *L)
+{
+ ObjectRef *ref = checkobject(L, 1);
+ Player *player = getplayer(ref);
+ if (player == NULL)
+ return 0;
+ video::SColor bgcolor(255, 255, 255, 255);
+ std::string type;
+ std::vector<std::string> params;
+
+ player->getSky(&bgcolor, &type, &params);
+ type = type == "" ? "regular" : type;
+
+ push_ARGB8(L, bgcolor);
+ lua_pushlstring(L, type.c_str(), type.size());
+ lua_newtable(L);
+ s16 i = 1;
+ for (std::vector<std::string>::iterator it = params.begin();
+ it != params.end(); ++it) {
+ lua_pushlstring(L, it->c_str(), it->size());
+ lua_rawseti(L, -2, i);
+ i++;
+ }
+ return 3;
+}
+
// override_day_night_ratio(self, brightness=0...1)
int ObjectRef::l_override_day_night_ratio(lua_State *L)
{
@@ -1273,6 +1500,26 @@ int ObjectRef::l_override_day_night_ratio(lua_State *L)
return 1;
}
+// get_day_night_ratio(self)
+int ObjectRef::l_get_day_night_ratio(lua_State *L)
+{
+ ObjectRef *ref = checkobject(L, 1);
+ Player *player = getplayer(ref);
+ if (player == NULL)
+ return 0;
+
+ bool do_override;
+ float ratio;
+ player->getDayNightRatio(&do_override, &ratio);
+
+ if (do_override)
+ lua_pushnumber(L, ratio);
+ else
+ lua_pushnil(L);
+
+ return 1;
+}
+
// set_nametag_attributes(self, attributes)
int ObjectRef::l_set_nametag_attributes(lua_State *L)
{
@@ -1389,12 +1636,16 @@ const luaL_reg ObjectRef::methods[] = {
luamethod(ObjectRef, get_wielded_item),
luamethod(ObjectRef, set_wielded_item),
luamethod(ObjectRef, set_armor_groups),
- luamethod(ObjectRef, set_physics_override),
+ luamethod(ObjectRef, get_armor_groups),
luamethod(ObjectRef, set_animation),
+ luamethod(ObjectRef, get_animation),
luamethod(ObjectRef, set_bone_position),
+ luamethod(ObjectRef, get_bone_position),
luamethod(ObjectRef, set_attach),
+ luamethod(ObjectRef, get_attach),
luamethod(ObjectRef, set_detach),
luamethod(ObjectRef, set_properties),
+ luamethod(ObjectRef, get_properties),
// LuaEntitySAO-only
luamethod(ObjectRef, setvelocity),
luamethod(ObjectRef, getvelocity),
@@ -1421,6 +1672,8 @@ const luaL_reg ObjectRef::methods[] = {
luamethod(ObjectRef, get_inventory_formspec),
luamethod(ObjectRef, get_player_control),
luamethod(ObjectRef, get_player_control_bits),
+ luamethod(ObjectRef, set_physics_override),
+ luamethod(ObjectRef, get_physics_override),
luamethod(ObjectRef, hud_add),
luamethod(ObjectRef, hud_remove),
luamethod(ObjectRef, hud_change),
@@ -1428,12 +1681,19 @@ const luaL_reg ObjectRef::methods[] = {
luamethod(ObjectRef, hud_set_flags),
luamethod(ObjectRef, hud_get_flags),
luamethod(ObjectRef, hud_set_hotbar_itemcount),
+ luamethod(ObjectRef, hud_get_hotbar_itemcount),
luamethod(ObjectRef, hud_set_hotbar_image),
+ luamethod(ObjectRef, hud_get_hotbar_image),
luamethod(ObjectRef, hud_set_hotbar_selected_image),
+ luamethod(ObjectRef, hud_get_hotbar_selected_image),
luamethod(ObjectRef, set_sky),
+ luamethod(ObjectRef, get_sky),
luamethod(ObjectRef, override_day_night_ratio),
+ luamethod(ObjectRef, get_day_night_ratio),
luamethod(ObjectRef, set_local_animation),
+ luamethod(ObjectRef, get_local_animation),
luamethod(ObjectRef, set_eye_offset),
+ luamethod(ObjectRef, get_eye_offset),
luamethod(ObjectRef, set_nametag_attributes),
luamethod(ObjectRef, get_nametag_attributes),
{0,0}
diff --git a/src/script/lua_api/l_object.h b/src/script/lua_api/l_object.h
index af3ed5ef0..02bb06ecc 100644
--- a/src/script/lua_api/l_object.h
+++ b/src/script/lua_api/l_object.h
@@ -101,25 +101,43 @@ private:
// set_armor_groups(self, groups)
static int l_set_armor_groups(lua_State *L);
+ // get_armor_groups(self)
+ static int l_get_armor_groups(lua_State *L);
+
// set_physics_override(self, physics_override_speed, physics_override_jump,
// physics_override_gravity, sneak, sneak_glitch)
static int l_set_physics_override(lua_State *L);
+ // get_physics_override(self)
+ static int l_get_physics_override(lua_State *L);
+
// set_animation(self, frame_range, frame_speed, frame_blend)
static int l_set_animation(lua_State *L);
+ // get_animation(self)
+ static int l_get_animation(lua_State *L);
+
// set_bone_position(self, std::string bone, v3f position, v3f rotation)
static int l_set_bone_position(lua_State *L);
+ // get_bone_position(self, bone)
+ static int l_get_bone_position(lua_State *L);
+
// set_attach(self, parent, bone, position, rotation)
static int l_set_attach(lua_State *L);
+ // get_attach(self)
+ static int l_get_attach(lua_State *L);
+
// set_detach(self)
static int l_set_detach(lua_State *L);
// set_properties(self, properties)
static int l_set_properties(lua_State *L);
+ // get_properties(self)
+ static int l_get_properties(lua_State *L);
+
// is_player(self)
static int l_is_player(lua_State *L);
@@ -222,24 +240,45 @@ private:
// hud_set_hotbar_itemcount(self, hotbar_itemcount)
static int l_hud_set_hotbar_itemcount(lua_State *L);
+ // hud_get_hotbar_itemcount(self)
+ static int l_hud_get_hotbar_itemcount(lua_State *L);
+
// hud_set_hotbar_image(self, name)
static int l_hud_set_hotbar_image(lua_State *L);
+ // hud_get_hotbar_image(self)
+ static int l_hud_get_hotbar_image(lua_State *L);
+
// hud_set_hotbar_selected_image(self, name)
static int l_hud_set_hotbar_selected_image(lua_State *L);
+ // hud_get_hotbar_selected_image(self)
+ static int l_hud_get_hotbar_selected_image(lua_State *L);
+
// set_sky(self, type, list)
static int l_set_sky(lua_State *L);
- // override_day_night_ratio(self, type, list)
+ // get_sky(self, type, list)
+ static int l_get_sky(lua_State *L);
+
+ // override_day_night_ratio(self, type)
static int l_override_day_night_ratio(lua_State *L);
+ // get_day_night_ratio(self)
+ static int l_get_day_night_ratio(lua_State *L);
+
// set_local_animation(self, {stand/idle}, {walk}, {dig}, {walk+dig}, frame_speed)
static int l_set_local_animation(lua_State *L);
+ // get_local_animation(self)
+ static int l_get_local_animation(lua_State *L);
+
// set_eye_offset(self, v3f first pv, v3f third pv)
static int l_set_eye_offset(lua_State *L);
+ // get_eye_offset(self)
+ static int l_get_eye_offset(lua_State *L);
+
// set_nametag_attributes(self, attributes)
static int l_set_nametag_attributes(lua_State *L);