forked from VoxeLibre/VoxeLibre
Fixes to `mcl_meshhand`
- fix actual crash when placing hand in world (undefined function) - remove node fields redundant with default values - remove support for `use_texture_alpha_string_modes` - type annotation - more explicit functions
This commit is contained in:
parent
daa455c41b
commit
4acee8e64e
|
@ -1,22 +1,20 @@
|
||||||
local mcl_skins_enabled = minetest.global_exists("mcl_skins")
|
local mcl_skins_enabled = minetest.global_exists("mcl_skins")
|
||||||
|
|
||||||
-- This is a fake node that should never be placed in the world
|
---This is a fake node that should never be placed in the world
|
||||||
|
---@type node_definition
|
||||||
local node_def = {
|
local node_def = {
|
||||||
description = "",
|
use_texture_alpha = "opaque",
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
|
||||||
visual_scale = 1,
|
|
||||||
wield_scale = {x=1,y=1,z=1},
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local name = get_node(pos).name
|
local name = minetest.get_node(pos).name
|
||||||
local message = "[mcl_meshhand] Trying to construct " .. name .. " at " .. minetest.pos_to_string(pos)
|
local message = "[mcl_meshhand] Trying to construct " .. name .. " at " .. minetest.pos_to_string(pos)
|
||||||
minetest.log("error", message)
|
minetest.log("error", message)
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
drop = "",
|
drop = "",
|
||||||
on_drop = function() return "" end,
|
on_drop = function(_, _, _) return ItemStack() end,
|
||||||
groups = { dig_immediate = 3, not_in_creative_inventory = 1 },
|
groups = { dig_immediate = 3, not_in_creative_inventory = 1 },
|
||||||
range = minetest.registered_items[""].range
|
range = minetest.registered_items[""].range
|
||||||
}
|
}
|
||||||
|
@ -54,6 +52,6 @@ if mcl_skins_enabled then
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
player:get_inventory():set_stack("hand", 1, "mcl_meshhand:hand")
|
player:get_inventory():set_stack("hand", 1, ItemStack("mcl_meshhand:hand"))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue