1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
--[[
StreetsMod: Poles
]]
-- Simple pole
minetest.register_node(":streets:pole_bottom",{
description = streets.S("Pole"),
tiles = {"streets_pole.png"},
groups = {cracky=2},
inventory_image = "streets_pole_inv.png",
wield_image = "streets_pole_inv.png",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.1,-0.5,-0.5,0.1,0.5,-0.4},
{-0.125,-0.5,-0.525,0.125,-0.3,-0.375}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.1,-0.5,-0.5,0.1,0.5,-0.4}
}
},
after_place_node = function(pos,placer,itemstack)
pos.y = pos.y +1
if minetest.get_node(pos).name == "air" then
minetest.add_node(pos,{name = "streets:pole_top", param2 = minetest.dir_to_facedir(placer:get_look_dir())})
else
minetest.chat_send_player(placer:get_player_name(),"Not enough free space! A pole has a height of 2 blocks!")
pos.y = pos.y -1
minetest.remove_node(pos)
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y +1
if minetest.get_node(pos).name == "streets:pole_top" then
minetest.remove_node(pos)
end
end
})
minetest.register_node(":streets:pole_top",{
description = streets.S("Y u no play minetest without cheating?"),
tiles = {"streets_pole.png"},
groups = {cracky=2,not_in_creative_inventory=1},
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
drop = "",
can_dig = function()
return false
end,
node_box = {
type = "fixed",
fixed = {
{-0.1,-0.5,-0.5,0.1,0.5,-0.4}
}
}
})
minetest.register_craft({
output = "streets:pole_bottom 3",
recipe = {
{"","default:steel_ingot",""},
{"","default:steel_ingot",""},
{"","default:steel_ingot",""}
}
})
-- Big pole
local rules_pole = {
{x= 0, y= 0, z=-1},
{x= 1, y= 0, z= 0},
{x=-1, y= 0, z= 0},
{x= 0, y= 0, z= 1},
{x= 1, y= 1, z= 0},
{x= 1, y=-1, z= 0},
{x=-1, y= 1, z= 0},
{x=-1, y=-1, z= 0},
{x= 0, y= 1, z= 1},
{x= 0, y=-1, z= 1},
{x= 0, y= 1, z=-1},
{x= 0, y=-1, z=-1},
{x= 0, y=-1, z= 0},
{x= 0, y= 1, z= 0}
}
minetest.register_node(":streets:bigpole", {
description = "Pole",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
tiles = {"streets_pole.png"},
groups = {cracky = 1, level = 2, bigpole = 1},
node_box = {
type = "fixed",
fixed = {
{-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
}
},
on_place = minetest.rotate_node,
digiline = {
wire = {
rules = rules_pole
}
}
})
minetest.register_node(":streets:bigpole_edge", {
drop = "streets:bigpole",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
tiles = {"streets_pole.png"},
groups = {cracky = 1, level = 2, not_in_creative_inventory = 1, bigpole = 1},
node_box = {
type = "fixed",
fixed = {
{-0.15,-0.5,-0.15,0.15,0.15,0.15},
{-0.15,-0.15,-0.125,0.15,0.15,-0.5}
}
},
})
|