aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_object.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 77e1e7dc2..dcaee10b2 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -1249,7 +1249,7 @@ int ObjectRef::l_set_look_yaw(lua_State *L)
return 1;
}
-// set_fov(self, degrees[, is_multiplier])
+// set_fov(self, degrees[, is_multiplier, transition_time])
int ObjectRef::l_set_fov(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
@@ -1258,7 +1258,11 @@ int ObjectRef::l_set_fov(lua_State *L)
if (!player)
return 0;
- player->setFov({ static_cast<f32>(luaL_checknumber(L, 2)), readParam<bool>(L, 3) });
+ player->setFov({
+ static_cast<f32>(luaL_checknumber(L, 2)),
+ readParam<bool>(L, 3, false),
+ lua_isnumber(L, 4) ? static_cast<f32>(luaL_checknumber(L, 4)) : 0.0f
+ });
getServer(L)->SendPlayerFov(player->getPeerId());
return 0;
@@ -1276,8 +1280,9 @@ int ObjectRef::l_get_fov(lua_State *L)
PlayerFovSpec fov_spec = player->getFov();
lua_pushnumber(L, fov_spec.fov);
lua_pushboolean(L, fov_spec.is_multiplier);
+ lua_pushnumber(L, fov_spec.transition_time);
- return 2;
+ return 3;
}
// set_breath(self, breath)