fix node names for workshop list

This commit is contained in:
webdesigner97 2016-05-20 11:20:00 +02:00
parent 26ab949b39
commit a9d768658d
4 changed files with 109 additions and 11 deletions

View File

@ -119,7 +119,7 @@ minetest.after(0, function()
-- Register roadwork markings
for marking_suffix, marking_data in pairs(marking_list) do
if marking_data.register_rw == true then
minetest.register_node(":streets:rw_" .. marking_data.suffix,{
minetest.register_node(":streets:rw_" .. marking_data.suffix .. "_yellow",{
description = "Roadworks: " .. marking_data.friendly_suffix:gsub("^%l", string.upper),
tiles = {marking_data.overlay:split(".")[1] .. "_yellow.png", "streets_transparent.png"},
drawtype = "nodebox",
@ -139,6 +139,26 @@ minetest.after(0, function()
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}
}
})
minetest.register_node(":streets:rw_" .. marking_data.suffix .. "_white",{
description = "Roadworks: " .. marking_data.friendly_suffix:gsub("^%l", string.upper),
tiles = {marking_data.overlay, "streets_transparent.png"},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 3,attached_node = 1,oddly_breakable_by_hand = 1},
sunlight_propagates = true,
walkable = false,
inventory_image = marking_data.overlay,
wield_image = marking_data.overlay,
node_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.499, 0.5}}
},
selection_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}
}
})
end
end
end)

View File

@ -21,6 +21,20 @@ local function workshop_form(tab, color, progress)
})
end
local function workshop_list(color, tab)
local markings = {
{
"streets:rw_line_dashed_white"
}
}
if color == "yellow" then
for k, v in ipairs(r) do
r[k] = v .. "_yellow"
end
end
return markings[tab]
end
minetest.register_node(":streets:asphalt_workshop", {
tiles = {"default_wood.png",},
drawtype = "nodebox",
@ -52,12 +66,22 @@ minetest.register_node(":streets:asphalt_workshop", {
type = "regular"
},
on_receive_fields = function(pos, formname, fields, sender)
minetest.chat_send_all(minetest.write_json(fields))
if fields.asphalt_workshop_tabs then
if fields.asphalt_workshop_tabs == "1" then
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory(pos)
minetest.chat_send_all(minetest.write_json(workshop_list(meta:get_string("color"), meta:get_int("tab") or 1)))
inv:set_list("asphalt_workshop_list", workshop_list(meta:get_string("color"), meta:get_int("tab") or 1))
end
end
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory(pos)
meta:set_string("formspec", workshop_form(1, "white", 0))
meta:set_string("color", "white")
meta:set_int("progress", 0)
meta:set_int("tab", 1)
inv:set_size("asphalt_workshop_list", 16)
inv:set_size("asphalt_workshop_template", 1)
inv:set_size("asphalt_workshop_surface", 1)

View File

@ -4,7 +4,61 @@
Optional: true
]]
minetest.register_node(":streets:rw_cross",{
minetest.register_node(":streets:rw_cross_yellow",{
description = "Roadworks: Cross",
tiles = {"streets_cross_yellow.png", "streets_transparent.png"},
drawtype = "nodebox",
paramtype = "light",
groups = {snappy = 3,attached_node = 1,oddly_breakable_by_hand = 1},
sunlight_propagates = true,
walkable = false,
inventory_image = "streets_cross_yellow.png",
wield_image = "streets_cross_yellow.png",
node_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.499, 0.5}}
},
selection_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}
}
})
minetest.register_node(":streets:rw_line_solid_yellow",{
description = "Roadworks: Solid line",
tiles = {"streets_line_solid_yellow.png", "streets_rw_solid_curve.png", "streets_rw_solid_tjunction.png", "streets_rw_solid_crossing.png"},
drawtype = "raillike",
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 3,attached_node = 1,oddly_breakable_by_hand = 1},
sunlight_propagates = true,
walkable = false,
inventory_image = "streets_line_solid_yellow.png",
wield_image = "streets_line_solid_yellow.png",
selection_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}
}
})
minetest.register_node(":streets:rw_line_dashed_yellow",{
description = "Roadworks: Dashed line",
tiles = {"streets_line_dashed_yellow.png", "streets_rw_solid_curve.png", "streets_rw_solid_tjunction.png", "streets_rw_solid_crossing.png"},
drawtype = "raillike",
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 3,attached_node = 1,oddly_breakable_by_hand = 1},
sunlight_propagates = true,
walkable = false,
inventory_image = "streets_line_dashed_yellow.png",
wield_image = "streets_line_dashed_yellow.png",
selection_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}
}
})
minetest.register_node(":streets:rw_cross_white",{
description = "Roadworks: Cross",
tiles = {"streets_cross.png", "streets_transparent.png"},
drawtype = "nodebox",
@ -24,34 +78,34 @@ minetest.register_node(":streets:rw_cross",{
}
})
minetest.register_node(":streets:rw_line_solid",{
minetest.register_node(":streets:rw_line_solid_white",{
description = "Roadworks: Solid line",
tiles = {"streets_line_solid_yellow.png", "streets_rw_solid_curve.png", "streets_rw_solid_tjunction.png", "streets_rw_solid_crossing.png"},
tiles = {"streets_line_solid.png", "streets_rw_solid_curve.png", "streets_rw_solid_tjunction.png", "streets_rw_solid_crossing.png"},
drawtype = "raillike",
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 3,attached_node = 1,oddly_breakable_by_hand = 1},
sunlight_propagates = true,
walkable = false,
inventory_image = "streets_line_solid_yellow.png",
wield_image = "streets_line_solid_yellow.png",
inventory_image = "streets_line_solid.png",
wield_image = "streets_line_solid.png",
selection_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}
}
})
minetest.register_node(":streets:rw_line_dashed",{
minetest.register_node(":streets:rw_line_dashed_white",{
description = "Roadworks: Dashed line",
tiles = {"streets_line_dashed_yellow.png", "streets_rw_solid_curve.png", "streets_rw_solid_tjunction.png", "streets_rw_solid_crossing.png"},
tiles = {"streets_line_dashed.png", "streets_rw_solid_curve.png", "streets_rw_solid_tjunction.png", "streets_rw_solid_crossing.png"},
drawtype = "raillike",
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 3,attached_node = 1,oddly_breakable_by_hand = 1},
sunlight_propagates = true,
walkable = false,
inventory_image = "streets_line_dashed_yellow.png",
wield_image = "streets_line_dashed_yellow.png",
inventory_image = "streets_line_dashed.png",
wield_image = "streets_line_dashed.png",
selection_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}

View File

Before

Width:  |  Height:  |  Size: 353 B

After

Width:  |  Height:  |  Size: 353 B