aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2019-01-03 17:04:26 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2019-01-03 17:04:26 +0100
commitbba4563d89b6708d75a4053c69873dff0d747538 (patch)
tree8ae0c939a8b5c194f300be79e1369ad8ef4675b7 /src/script
parentceacff13a666779d75ac48f2cc5c11bc2ce5c6e1 (diff)
downloadminetest-bba4563d89b6708d75a4053c69873dff0d747538.tar.gz
minetest-bba4563d89b6708d75a4053c69873dff0d747538.tar.bz2
minetest-bba4563d89b6708d75a4053c69873dff0d747538.zip
Proselytize the network. Use IEEE F32 (#8030)
* Proselytize the network. Use IEEE F32 * Remove unused V2F1000 functions
Diffstat (limited to 'src/script')
-rw-r--r--src/script/common/c_content.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index 1d62ad98a..033549475 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -218,8 +218,18 @@ void read_object_properties(lua_State *L, int index,
getstringfield(L, -1, "mesh", prop->mesh);
lua_getfield(L, -1, "visual_size");
- if(lua_istable(L, -1))
- prop->visual_size = read_v2f(L, -1);
+ if (lua_istable(L, -1)) {
+ // Backwards compatibility: Also accept { x = ?, y = ? }
+ v2f scale_xy = read_v2f(L, -1);
+
+ f32 scale_z = scale_xy.X;
+ lua_getfield(L, -1, "z");
+ if (lua_isnumber(L, -1))
+ scale_z = lua_tonumber(L, -1);
+ lua_pop(L, 1);
+
+ prop->visual_size = v3f(scale_xy.X, scale_xy.Y, scale_z);
+ }
lua_pop(L, 1);
lua_getfield(L, -1, "textures");
@@ -331,7 +341,7 @@ void push_object_properties(lua_State *L, ObjectProperties *prop)
lua_setfield(L, -2, "visual");
lua_pushlstring(L, prop->mesh.c_str(), prop->mesh.size());
lua_setfield(L, -2, "mesh");
- push_v2f(L, prop->visual_size);
+ push_v3f(L, prop->visual_size);
lua_setfield(L, -2, "visual_size");
lua_newtable(L);