1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-18 00:08:25 +01:00

Fixed texture, and animation bug in 3dchest

- 3dChests can't be open if the two nodes standing behing them are not air
 - 3dChests now use our textures in inventory, wield, and entity
 - Solves #221
This commit is contained in:
LeMagnesium 2015-08-16 14:41:03 +02:00
parent 7f211b53cc
commit 195a0822a2
6 changed files with 35 additions and 21 deletions

1
mods/3dchest/depends.txt Normal file
View File

@ -0,0 +1 @@
default

View File

@ -77,27 +77,26 @@ local tdc = {
minetest.register_entity('3dchest:3dchest', tdc) -- normal minetest.register_entity('3dchest:3dchest', tdc) -- normal
minetest.register_node("3dchest:chest", { minetest.register_node("3dchest:chest", {
description = "Chest", description = "Chest",
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}, "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
-- temporary workaround wield_image = minetest.inventorycube("default_chest_top.png", "default_chest_front.png", "default_chest_side.png"),
wield_image = "default_chest_front.png", --minetest.inventorycube("default_chest_top.png", "default_chest_side.png", "default_chest_front.png"), inventory_image = minetest.inventorycube("default_chest_top.png", "default_chest_front.png", "default_chest_side.png"),
inventory_image = minetest.inventorycube("default_chest_top.png", "default_chest_front.png", "default_chest_side.png"), drawtype = "nodebox",
drawtype = "nodebox", node_box = {
node_box = { type = "fixed",
fixed = {-0.01, -0.01, -0.01, 0.01, 0.01, 0.01},
},
selection_box = {
type = "fixed", type = "fixed",
fixed = {-0.01, -0.01, -0.01, 0.01, 0.01, 0.01}, fixed = {
}, {-0.501, -0.501, -0.501, 0.501, 0.501, 0.501},
selection_box = { }
type = "fixed", },
fixed = { paramtype = "light",
{-0.501, -0.501, -0.501, 0.501, 0.501, 0.501}, walkable = false,
} groups = {choppy=2, dig_immediate = 2},
},
paramtype = "light",
walkable = false,
groups = {choppy=2, dig_immediate = 2},
legacy_facedir_simple = true, legacy_facedir_simple = true,
on_construct = function(pos) on_construct = function(pos)
@ -212,7 +211,7 @@ minetest.register_node("3dchest:chest", {
" takes stuff from chest at "..minetest.pos_to_string(pos)) " takes stuff from chest at "..minetest.pos_to_string(pos))
end, end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local selves = minetest.get_objects_inside_radius(pos, 0.1) local selves = minetest.get_objects_inside_radius(pos, 0.1)
local self local self
for _,obj in pairs(selves) do for _,obj in pairs(selves) do
@ -225,6 +224,20 @@ minetest.register_node("3dchest:chest", {
local name = '3dchest:3dchest' local name = '3dchest:3dchest'
local pll = clicker:get_player_name() local pll = clicker:get_player_name()
local formspec = meta:get_string('formspect') local formspec = meta:get_string('formspect')
local dir = (meta:get_int("dir")+2)%4
local directions = {
[0] = {x = pos.x, y = pos.y, z = pos.z + 1},
[1] = {x = pos.x - 1, y = pos.y, z = pos.z},
[2] = {x = pos.x, y = pos.y, z = pos.z - 1},
[3] = {x = pos.x + 1, y = pos.y, z = pos.z}
}
local backnode = minetest.get_node(directions[dir])
local upnode = minetest.get_node({x = directions[dir].x, y = directions[dir].y + 1, z = directions[dir].z})
if (not backnode or (backnode and backnode.name ~= "air"))
or (not upnode or (upnode and upnode.name ~= "air")) then
minetest.chat_send_player(clicker:get_player_name(), "Cannot open chest's lid, move it.")
return
end
if not self then if not self then
minetest.show_formspec(pll, name..'_'..minetest.serialize(pos), formspec) minetest.show_formspec(pll, name..'_'..minetest.serialize(pos), formspec)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B