Fix beds & wieldview armor dependency
This commit is contained in:
parent
67795ccf0c
commit
359601fc42
|
@ -47,13 +47,24 @@ function beds.register_bed(name, def)
|
|||
return itemstack
|
||||
end
|
||||
|
||||
local node_def = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
if not node_def or not node_def.buildable_to then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local pos_front = vector.new(pos)
|
||||
local dir = placer and placer:get_look_dir() and
|
||||
minetest.dir_to_facedir(placer:get_look_dir()) or 0
|
||||
minetest.dir_to_facedir(placer:get_look_dir()) % 4 or 0
|
||||
if dir == 1 then
|
||||
pos_front.x = pos_front.x + 1
|
||||
elseif dir == 2 then
|
||||
pos_front.z = pos_front.z - 1
|
||||
elseif dir == 3 then
|
||||
pos_front.x = pos_front.x - 1
|
||||
else
|
||||
pos_front.z = pos_front.z + 1
|
||||
end
|
||||
for _, p in pairs({pos_front, pos}) do
|
||||
local node_def = minetest.registered_nodes[minetest.get_node(p).name]
|
||||
if not node_def or not node_def.buildable_to then
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
|
||||
minetest.set_node(pos, {name = name, param2 = dir})
|
||||
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
3d_armor
|
||||
player_api
|
||||
3d_armor?
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
local has_armor = minetest.get_modpath("3d_armor")
|
||||
local time = 0
|
||||
local update_time = tonumber(minetest.settings:get("wieldview_update_time"))
|
||||
if not update_time then
|
||||
|
@ -17,6 +18,19 @@ wieldview = {
|
|||
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/transform.lua")
|
||||
|
||||
local function update_player_visuals(player, wield_image)
|
||||
local name = player:get_player_name()
|
||||
if has_armor then
|
||||
armor.textures[name].wielditem = wield_image
|
||||
armor:update_player_visuals(player)
|
||||
return
|
||||
end
|
||||
local animation = player_api.get_animation(player) or {}
|
||||
local textures = animation.textures or {}
|
||||
local skin = textures[1] and textures[1] or "character.png"
|
||||
player_api.set_textures(player, {skin, "blank.png", wield_image})
|
||||
end
|
||||
|
||||
wieldview.get_item_texture = function(self, item)
|
||||
local texture = "blank.png"
|
||||
if item ~= "" then
|
||||
|
@ -57,8 +71,7 @@ wieldview.update_wielded_item = function(self, player)
|
|||
if self.wielded_item[name] == item then
|
||||
return
|
||||
end
|
||||
armor.textures[name].wielditem = self:get_item_texture(item)
|
||||
armor:update_player_visuals(player)
|
||||
update_player_visuals(player, self:get_item_texture(item))
|
||||
end
|
||||
self.wielded_item[name] = item
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue