feat: players interpolation & add hud.set_allow_pause(...)
This commit is contained in:
@@ -130,6 +130,22 @@ static int l_set_color(lua::State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_is_interpolated(lua::State* L) {
|
||||
if (auto entity = get_entity(L, 1)) {
|
||||
auto& skeleton = entity->getSkeleton();
|
||||
return lua::pushboolean(L, skeleton.interpolation.isEnabled());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_set_interpolated(lua::State* L) {
|
||||
if (auto entity = get_entity(L, 1)) {
|
||||
auto& skeleton = entity->getSkeleton();
|
||||
skeleton.interpolation.setEnabled(lua::toboolean(L, 2));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg skeletonlib[] = {
|
||||
{"get_model", lua::wrap<l_get_model>},
|
||||
{"set_model", lua::wrap<l_set_model>},
|
||||
@@ -142,4 +158,6 @@ const luaL_Reg skeletonlib[] = {
|
||||
{"set_visible", lua::wrap<l_set_visible>},
|
||||
{"get_color", lua::wrap<l_get_color>},
|
||||
{"set_color", lua::wrap<l_set_color>},
|
||||
{"is_interpolated", lua::wrap<l_is_interpolated>},
|
||||
{"set_interpolated", lua::wrap<l_set_interpolated>},
|
||||
{NULL, NULL}};
|
||||
|
||||
@@ -170,6 +170,11 @@ static int l_set_debug_cheats(lua::State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_set_allow_pause(lua::State* L) {
|
||||
hud->setAllowPause(lua::toboolean(L, 1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg hudlib[] = {
|
||||
{"open_inventory", lua::wrap<l_open_inventory>},
|
||||
{"close_inventory", lua::wrap<l_close_inventory>},
|
||||
@@ -187,5 +192,6 @@ const luaL_Reg hudlib[] = {
|
||||
{"_is_content_access", lua::wrap<l_is_content_access>},
|
||||
{"_set_content_access", lua::wrap<l_set_content_access>},
|
||||
{"_set_debug_cheats", lua::wrap<l_set_debug_cheats>},
|
||||
{"set_allow_pause", lua::wrap<l_set_allow_pause>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -61,7 +61,7 @@ static int l_set_vel(lua::State* L) {
|
||||
|
||||
static int l_get_rot(lua::State* L) {
|
||||
if (auto player = get_player(L, 1)) {
|
||||
return lua::pushvec_stack(L, player->rotation);
|
||||
return lua::pushvec_stack(L, player->getRotation(lua::toboolean(L, 2)));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ static int l_set_rot(lua::State* L) {
|
||||
if (!player) {
|
||||
return 0;
|
||||
}
|
||||
glm::vec3& rotation = player->rotation;
|
||||
glm::vec3 rotation = player->getRotation();
|
||||
|
||||
auto x = lua::tonumber(L, 2);
|
||||
auto y = lua::tonumber(L, 3);
|
||||
@@ -82,6 +82,7 @@ static int l_set_rot(lua::State* L) {
|
||||
rotation.x = x;
|
||||
rotation.y = y;
|
||||
rotation.z = z;
|
||||
player->setRotation(rotation);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user