1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add third person view

This commit is contained in:
BlockMen 2014-01-08 13:47:53 +01:00
parent e149d1ad9a
commit a1db9242ec
19 changed files with 270 additions and 22 deletions

View file

@ -406,6 +406,31 @@ int ObjectRef::l_set_animation(lua_State *L)
return 0;
}
// set_local_animation(self, {stand/ilde}, {walk}, {dig}, {walk+dig}, frame_speed)
int ObjectRef::l_set_local_animation(lua_State *L)
{
//NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
Player *player = getplayer(ref);
if (player == NULL)
return 0;
// Do it
v2f frames[4];
for (int i=0;i<4;i++) {
if(!lua_isnil(L, 2+1))
frames[i] = read_v2f(L, 2+i);
}
float frame_speed = 30;
if(!lua_isnil(L, 6))
frame_speed = lua_tonumber(L, 6);
if (!getServer(L)->setLocalPlayerAnimations(player, frames, frame_speed))
return 0;
lua_pushboolean(L, true);
return 0;
}
// set_bone_position(self, std::string bone, v3f position, v3f rotation)
int ObjectRef::l_set_bone_position(lua_State *L)
{
@ -1270,5 +1295,6 @@ const luaL_reg ObjectRef::methods[] = {
luamethod(ObjectRef, hud_set_hotbar_selected_image),
luamethod(ObjectRef, set_sky),
luamethod(ObjectRef, override_day_night_ratio),
luamethod(ObjectRef, set_local_animation),
{0,0}
};

View file

@ -231,6 +231,9 @@ private:
// override_day_night_ratio(self, type, list)
static int l_override_day_night_ratio(lua_State *L);
// set_local_animation(self, {stand/ilde}, {walk}, {dig}, {walk+dig}, frame_speed)
static int l_set_local_animation(lua_State *L);
public:
ObjectRef(ServerActiveObject *object);