Unify detecting old version of MT.

This commit is contained in:
Aaron Suen 2019-03-03 12:08:47 -05:00
parent 9951114b7f
commit 3bef72b665
3 changed files with 10 additions and 10 deletions

View File

@ -1,10 +1,12 @@
-- LUALOCALS < --------------------------------------------------------- -- LUALOCALS < ---------------------------------------------------------
local ItemStack, ipairs, math, minetest, nodecore, pairs, type local ItemStack, ipairs, math, minetest, nodecore, pairs, string, type
= ItemStack, ipairs, math, minetest, nodecore, pairs, type = ItemStack, ipairs, math, minetest, nodecore, pairs, string, type
local math_random local math_random
= math.random = math.random
-- LUALOCALS > --------------------------------------------------------- -- LUALOCALS > ---------------------------------------------------------
nodecore.mt_old = minetest.get_version().string:sub(1, 2) == "0."
for k, v in pairs(minetest) do for k, v in pairs(minetest) do
if type(v) == "function" then if type(v) == "function" then
-- Late-bind in case minetest methods overridden. -- Late-bind in case minetest methods overridden.

View File

@ -1,6 +1,6 @@
-- LUALOCALS < --------------------------------------------------------- -- LUALOCALS < ---------------------------------------------------------
local math, minetest, nodecore, pairs, string, table local math, minetest, nodecore, pairs, table
= math, minetest, nodecore, pairs, string, table = math, minetest, nodecore, pairs, table
local math_floor, table_concat local math_floor, table_concat
= math.floor, table.concat = math.floor, table.concat
-- LUALOCALS > --------------------------------------------------------- -- LUALOCALS > ---------------------------------------------------------
@ -73,11 +73,10 @@ local function updatevisuals(player)
end end
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local isold = minetest.get_version().string:sub(1, 2) == "0."
player:set_properties({ player:set_properties({
visual = "mesh", visual = "mesh",
visual_size = {x = 0.9, y = 0.9, z = 0.9}, visual_size = {x = 0.9, y = 0.9, z = 0.9},
mesh = modname .. (isold and "_old" or "") .. ".b3d" mesh = modname .. (nodecore.mt_old and "_old" or "") .. ".b3d"
}) })
player:set_local_animation( player:set_local_animation(
anim.stand, anim.stand,

View File

@ -1,6 +1,6 @@
-- LUALOCALS < --------------------------------------------------------- -- LUALOCALS < ---------------------------------------------------------
local minetest, string, table local minetest, nodecore, table
= minetest, string, table = minetest, nodecore, table
local table_remove local table_remove
= table.remove = table.remove
-- LUALOCALS > --------------------------------------------------------- -- LUALOCALS > ---------------------------------------------------------
@ -103,10 +103,9 @@ minetest.register_on_joinplayer(function(player)
addslot(0, "Arm_Right", -2.5, 8, 0, 2, 178, 60) addslot(0, "Arm_Right", -2.5, 8, 0, 2, 178, 60)
local isold = minetest.get_version().string:sub(1, 2) == "0."
local function cslot(n, x, z) local function cslot(n, x, z)
return addslot(n, nil, x * 1.6, return addslot(n, nil, x * 1.6,
(isold and -4 or 5.5) + x / 2, (nodecore.mt_old and -4 or 5.5) + x / 2,
z * 2.1) z * 2.1)
end end