-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreets.lua
139 lines (133 loc) · 4.02 KB
/
streets.lua
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
128
129
130
131
132
133
134
135
136
137
138
139
local MP = minetest.get_modpath(minetest.get_current_modname())
local has_street_signs_mod = minetest.get_modpath("street_signs")
local content_street_sign = -1
if has_street_signs_mod then
content_street_sign = minetest.get_content_id("street_signs:sign_basic")
end
mapblock_tileset.register_tileset("street", {
catalog = MP .. "/schematics/street.zip",
groups = {
street = true
},
disable_orientation = {
["moreblocks:iron_stone_bricks"] = true,
["street_signs:sign_basic"] = true
},
on_metadata = function(pos, content_id, meta)
if content_id == content_street_sign then
-- write street name
local mapblock_pos = mapblock_lib.get_mapblock(pos)
local z_streetname = mapblock_tileset_city.get_street_name(mapblock_pos.x * 3)
local x_streetname = mapblock_tileset_city.get_street_name((mapblock_pos.z * 3) + 2048)
local txt = z_streetname .. "\n" .. x_streetname
meta:set_string("infotext", txt)
meta:set_string("text", txt)
end
end,
tiles = {
{
-- all sides
positions = {{x=1,y=0,z=0}},
rules = {
["1,0,0"] = { groups = {"street"} },
["-1,0,0"] = { groups = {"street"} },
["0,0,1"] = { groups = {"street"} },
["0,0,-1"] = { groups = {"street"} }
},
fallback = true,
rotations = {0}
},{
-- straight
positions = {{x=2,y=0,z=0}},
rules = {
["1,0,0"] = { groups = {"street"} },
["-1,0,0"] = { groups = {"street"} }
},
rotations = {0,90}
},{
-- T crossing
positions = {{x=3,y=0,z=0}},
rules = {
["1,0,0"] = { groups = {"street"} },
["-1,0,0"] = { groups = {"street"} },
["0,0,1"] = { groups = {"street"} }
},
rotations = {0,90,180,270}
},{
-- corner
positions = {{x=4,y=0,z=0}},
rules = {
["-1,0,0"] = { groups = {"street"} },
["0,0,1"] = { groups = {"street"} }
},
rotations = {0,90,180,270}
}
}
})
mapblock_tileset.register_tileset("street_slope", {
catalog = MP .. "/schematics/street.zip",
groups = {
street_slope = true,
street = true
},
tiles = {
{
-- lower slope
positions = {{x=0,y=0,z=0}},
rules = {
["1,0,0"] = { groups = {"street"} },
["-1,1,0"] = { groups = {"street"} }
},
fallback = true,
rotations = {0,90,180,270}
},{
-- upper slope
positions = {{x=0,y=1,z=0}},
rules = {
["1,-1,0"] = { groups = {"street"} },
["-1,0,0"] = { groups = {"street"} }
},
rotations = {0,90,180,270}
}
}
})
mapblock_tileset.register_tileset("street_crossing", {
catalog = MP .. "/schematics/street.zip",
groups = {
street = true
},
disable_orientation = {
["moreblocks:iron_stone_bricks"] = true
},
tiles = {
{
positions = {{x=2,y=0,z=1}},
rules = {
["1,0,0"] = { groups = {"street"} },
["-1,0,0"] = { groups = {"street"} }
},
fallback = true,
rotations = {0,90}
}
}
})
mapblock_tileset.register_tileset("street_tunnel", {
catalog = MP .. "/schematics/street.zip",
groups = {
street = true
},
disable_orientation = {
["moreblocks:iron_stone_bricks"] = true
},
tiles = {
{
positions = {{x=2,y=0,z=2}},
rules = {
["1,0,0"] = { groups = {"street"} },
["-1,0,0"] = { groups = {"street"} }
},
fallback = true,
rotations = {0,90}
}
}
})