]> git.lizzy.rs Git - Crafter.git/blob - mods/redstone/wire.lua
Fix repeaters
[Crafter.git] / mods / redstone / wire.lua
1 --8 power levels 8 being the highest
2 local color = 0
3 for i = 0,8 do
4         local coloring = math.floor(color)
5
6         minetest.register_node("redstone:wire_"..i,{
7                 description = "Redstone Wire",
8                 --wield_image = "redstone_wire.png^[colorize:red:"..coloring,
9                 paramtype = "light",
10                 drawtype = "nodebox",
11                 power = i,
12                 --paramtype2 = "wallmounted",
13                 walkable = false,
14                 node_box = {
15                         type = "connected",
16                         --{xmin, ymin, zmin, xmax, ymax, zmax}
17
18                         fixed = {-1/16, -1/2, -1/16, 1/16, -7/16, 1/16},
19                         
20                         disconnected_sides  = {-1/16, -1/2, -1/16, 1/16, 1/2, 1/16},
21
22                         connect_top = {-1/16, -1/2, -1/16, 1/16, 1/2, 1/16},
23                         -- connect_bottom =
24                         connect_front = {-1/16, -1/2, -1/2, 1/16, -7/16, 1/16},
25                         connect_left =  {-1/2, -1/2, -1/16, 1/16, -7/16, 1/16},
26                         connect_back =  {-1/16, -1/2, -1/16, 1/16, -7/16, 1/2},
27                         connect_right = {-1/16, -1/2, -1/16, 1/2, -7/16, 1/16},
28                 },
29                 collision_box = {
30                         type = "connected",
31                         --{xmin, ymin, zmin, xmax, ymax, zmax}
32
33                         fixed = {-1/16, -1/2, -1/16, 1/16, -7/16, 1/16},
34                         -- connect_top =
35                         -- connect_bottom =
36                         connect_front = {-1/16, -1/2, -1/2, 1/16, -7/16, 1/16},
37                         connect_left =  {-1/2, -1/2, -1/16, 1/16, -7/16, 1/16},
38                         connect_back =  {-1/16, -1/2, -1/16, 1/16, -7/16, 1/2},
39                         connect_right = {-1/16, -1/2, -1/16, 1/2, -7/16, 1/16},
40                 },
41                 connects_to = {"group:redstone"},
42                 inventory_image = "dirt.png",
43                 wield_image = "dirt.png",
44                 tiles = {"redstone_wire.png^[colorize:red:"..coloring},
45                 sunlight_propagates = true,
46                 is_ground_content = false,
47                 groups = {redstone =1, instant=1,redstone=1,redstone_wire=1},
48                 on_place = function(itemstack, placer, pointed_thing)
49                         minetest.item_place_node(itemstack, placer, pointed_thing)
50                         redstone.update(pointed_thing.above)
51                 end,
52                 on_dig = function(pos, node, digger)
53                         minetest.node_dig(pos, node, digger)
54                         redstone.update(pos,node)
55                 end,
56         })
57         color= color +31.875
58 end