From f470cb7270560a26afff0a0eadfc69070236c109 Mon Sep 17 00:00:00 2001 From: paramat Date: Mon, 20 Nov 2017 01:45:57 +0000 Subject: Zoom: Set zoom FOV per-player using a player object property Remove player object property 'can zoom'. Add player object property 'zoom fov'. Remove clientside setting for 'zoom fov'. Object property default is 15 degrees in creative mode, zoom disabled in survival mode. Needed due to zoom now loading and/or generating distant world according to zoom FOV. Update object properties serialisation version to 3. --- src/script/common/c_content.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/script') diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index a9ff1be44..af54a8b31 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -265,7 +265,6 @@ void read_object_properties(lua_State *L, int index, getboolfield(L, -1, "makes_footstep_sound", prop->makes_footstep_sound); if (getfloatfield(L, -1, "stepheight", prop->stepheight)) prop->stepheight *= BS; - getboolfield(L, -1, "can_zoom", prop->can_zoom); getfloatfield(L, -1, "eye_height", prop->eye_height); getfloatfield(L, -1, "automatic_rotate", prop->automatic_rotate); @@ -303,6 +302,8 @@ void read_object_properties(lua_State *L, int index, if (!lua_isnil(L, -1)) prop->wield_item = read_item(L, -1, idef).getItemString(); lua_pop(L, 1); + + getfloatfield(L, -1, "zoom_fov", prop->zoom_fov); } /******************************************************************************/ @@ -358,8 +359,6 @@ void push_object_properties(lua_State *L, ObjectProperties *prop) lua_setfield(L, -2, "makes_footstep_sound"); lua_pushnumber(L, prop->stepheight / BS); lua_setfield(L, -2, "stepheight"); - lua_pushboolean(L, prop->can_zoom); - lua_setfield(L, -2, "can_zoom"); lua_pushnumber(L, prop->eye_height); lua_setfield(L, -2, "eye_height"); lua_pushnumber(L, prop->automatic_rotate); @@ -385,6 +384,8 @@ void push_object_properties(lua_State *L, ObjectProperties *prop) lua_setfield(L, -2, "static_save"); lua_pushlstring(L, prop->wield_item.c_str(), prop->wield_item.size()); lua_setfield(L, -2, "wield_item"); + lua_pushnumber(L, prop->zoom_fov); + lua_setfield(L, -2, "zoom_fov"); } /******************************************************************************/ -- cgit v1.2.3