aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorANAND <ClobberXD@gmail.com>2020-05-02 16:22:11 +0530
committerGitHub <noreply@github.com>2020-05-02 12:52:11 +0200
commite0ea87f1f32273dba2eb5421c2a8c890479ba078 (patch)
treef4a64ef33340f60707f7cbe7b937bc183d0562c3 /src/script
parentac368af4fe27f61f5a4209cdfe90956ff745993c (diff)
downloadminetest-e0ea87f1f32273dba2eb5421c2a8c890479ba078.tar.gz
minetest-e0ea87f1f32273dba2eb5421c2a8c890479ba078.tar.bz2
minetest-e0ea87f1f32273dba2eb5421c2a8c890479ba078.zip
set_fov: Add support for time-based transitions (#9705)
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)