aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_camera.cpp3
-rw-r--r--src/script/lua_api/l_object.cpp14
2 files changed, 11 insertions, 6 deletions
diff --git a/src/script/lua_api/l_camera.cpp b/src/script/lua_api/l_camera.cpp
index bfa60be67..40251154c 100644
--- a/src/script/lua_api/l_camera.cpp
+++ b/src/script/lua_api/l_camera.cpp
@@ -63,7 +63,8 @@ int LuaCamera::l_set_camera_mode(lua_State *L)
return 0;
camera->setCameraMode((CameraMode)((int)lua_tonumber(L, 2)));
- playercao->setVisible(camera->getCameraMode() > CAMERA_MODE_FIRST);
+ // Make the player visible depending on camera mode.
+ playercao->updateMeshCulling();
playercao->setChildrenVisible(camera->getCameraMode() > CAMERA_MODE_FIRST);
return 0;
}
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 303b1175b..fead4e849 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -664,7 +664,7 @@ int ObjectRef::l_get_bone_position(lua_State *L)
return 2;
}
-// set_attach(self, parent, bone, position, rotation)
+// set_attach(self, parent, bone, position, rotation, force_visible)
int ObjectRef::l_set_attach(lua_State *L)
{
GET_ENV_PTR;
@@ -687,7 +687,8 @@ int ObjectRef::l_set_attach(lua_State *L)
std::string bone;
v3f position = v3f(0, 0, 0);
v3f rotation = v3f(0, 0, 0);
- co->getAttachment(&parent_id, &bone, &position, &rotation);
+ bool force_visible;
+ co->getAttachment(&parent_id, &bone, &position, &rotation, &force_visible);
if (parent_id) {
ServerActiveObject *old_parent = env->getActiveObject(parent_id);
old_parent->removeAttachmentChild(co->getId());
@@ -702,7 +703,8 @@ int ObjectRef::l_set_attach(lua_State *L)
rotation = v3f(0, 0, 0);
if (!lua_isnil(L, 5))
rotation = read_v3f(L, 5);
- co->setAttachment(parent->getId(), bone, position, rotation);
+ force_visible = readParam<bool>(L, 6, false);
+ co->setAttachment(parent->getId(), bone, position, rotation, force_visible);
parent->addAttachmentChild(co->getId());
return 0;
}
@@ -722,7 +724,8 @@ int ObjectRef::l_get_attach(lua_State *L)
std::string bone;
v3f position = v3f(0, 0, 0);
v3f rotation = v3f(0, 0, 0);
- co->getAttachment(&parent_id, &bone, &position, &rotation);
+ bool force_visible;
+ co->getAttachment(&parent_id, &bone, &position, &rotation, &force_visible);
if (!parent_id)
return 0;
ServerActiveObject *parent = env->getActiveObject(parent_id);
@@ -731,7 +734,8 @@ int ObjectRef::l_get_attach(lua_State *L)
lua_pushlstring(L, bone.c_str(), bone.size());
push_v3f(L, position);
push_v3f(L, rotation);
- return 4;
+ lua_pushboolean(L, force_visible);
+ return 5;
}
// set_detach(self)