72 lines
2.6 KiB
Plaintext
72 lines
2.6 KiB
Plaintext
minetest.register_node("redstone:wire",{
|
|
description = "Redstone Dust",
|
|
wield_image = "redstone_dust_item.png",
|
|
paramtype = "light",
|
|
drawtype = "nodebox",
|
|
--paramtype2 = "wallmounted",
|
|
walkable = false,
|
|
node_box = {
|
|
type = "connected",
|
|
--{xmin, ymin, zmin, xmax, ymax, zmax}
|
|
|
|
fixed = {-1/16, -1/2, -1/16, 1/16, -7/16, 1/16},
|
|
|
|
disconnected_sides = {-1/16, -1/2, -1/16, 1/16, 1/2, 1/16},
|
|
|
|
connect_top = {-1/16, -1/2, -1/16, 1/16, 1/2, 1/16},
|
|
-- connect_bottom =
|
|
connect_front = {-1/16, -1/2, -1/2, 1/16, -7/16, 1/16},
|
|
connect_left = {-1/2, -1/2, -1/16, 1/16, -7/16, 1/16},
|
|
connect_back = {-1/16, -1/2, -1/16, 1/16, -7/16, 1/2},
|
|
connect_right = {-1/16, -1/2, -1/16, 1/2, -7/16, 1/16},
|
|
},
|
|
collision_box = {
|
|
type = "connected",
|
|
--{xmin, ymin, zmin, xmax, ymax, zmax}
|
|
|
|
fixed = {-1/16, -1/2, -1/16, 1/16, -7/16, 1/16},
|
|
-- connect_top =
|
|
-- connect_bottom =
|
|
connect_front = {-1/16, -1/2, -1/2, 1/16, -7/16, 1/16},
|
|
connect_left = {-1/2, -1/2, -1/16, 1/16, -7/16, 1/16},
|
|
connect_back = {-1/16, -1/2, -1/16, 1/16, -7/16, 1/2},
|
|
connect_right = {-1/16, -1/2, -1/16, 1/2, -7/16, 1/16},
|
|
},
|
|
connects_to = {"group:redstone"},
|
|
inventory_image = fence_texture,
|
|
wield_image = fence_texture,
|
|
tiles = {"redstone_dust.png"},
|
|
sunlight_propagates = true,
|
|
is_ground_content = false,
|
|
groups = {redstone =1, instant=1},
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
if pointed_thing.type ~= "node" then
|
|
return itemstack
|
|
end
|
|
|
|
local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
|
|
|
|
local fakestack = itemstack
|
|
local retval = false
|
|
if wdir < 1 then
|
|
return itemstack
|
|
elseif wdir == 1 then
|
|
retval = fakestack:set_name("redstone:dust")
|
|
else
|
|
retval = fakestack:set_name("redstone:dust")
|
|
end
|
|
if not retval then
|
|
return itemstack
|
|
end
|
|
itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir)
|
|
itemstack:set_name("redstone:dust")
|
|
|
|
if retval then
|
|
minetest.sound_play("stone", {pos=pointed_thing.above, gain = 1.0})
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
})
|