update coloredwood, homedecor, signs_lib, and simple_streetlights

This commit is contained in:
Vanessa Dannenberg 2019-05-31 15:06:42 -04:00
parent eae97e458c
commit e622c96c26
7 changed files with 89 additions and 13 deletions

View File

@ -51,6 +51,10 @@ end
-- the actual nodes! -- the actual nodes!
local groups = table.copy(minetest.registered_items["default:wood"].groups)
groups.ud_param2_colorable = 1
groups.not_in_creative_inventory=1
minetest.register_node("coloredwood:wood_block", { minetest.register_node("coloredwood:wood_block", {
description = "Colored wooden planks", description = "Colored wooden planks",
tiles = { "coloredwood_base.png" }, tiles = { "coloredwood_base.png" },
@ -59,7 +63,7 @@ minetest.register_node("coloredwood:wood_block", {
palette = "unifieddyes_palette_extended.png", palette = "unifieddyes_palette_extended.png",
walkable = true, walkable = true,
sunlight_propagates = false, sunlight_propagates = false,
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2, not_in_creative_inventory=1, ud_param2_colorable = 1}, groups = groups,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
@ -147,10 +151,13 @@ for _, mname in ipairs(coloredwood_cuts) do
}) })
end end
groups = table.copy(minetest.registered_items["default:wood"].groups)
groups.ud_param2_colorable = 1
minetest.override_item("default:wood", { minetest.override_item("default:wood", {
palette = "unifieddyes_palette_extended.png", palette = "unifieddyes_palette_extended.png",
airbrush_replacement_node = "coloredwood:wood_block", airbrush_replacement_node = "coloredwood:wood_block",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1, ud_param2_colorable = 1}, groups = groups,
}) })
default.register_fence("coloredwood:fence", { default.register_fence("coloredwood:fence", {
@ -163,10 +170,13 @@ default.register_fence("coloredwood:fence", {
material = "coloredwood:wood_block" material = "coloredwood:wood_block"
}) })
groups = table.copy(minetest.registered_items["default:fence_wood"].groups)
groups.ud_param2_colorable = 1
minetest.override_item("default:fence_wood", { minetest.override_item("default:fence_wood", {
palette = "unifieddyes_palette_extended.png", palette = "unifieddyes_palette_extended.png",
airbrush_replacement_node = "coloredwood:fence", airbrush_replacement_node = "coloredwood:fence",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, ud_param2_colorable = 1} groups = groups
}) })
-- Crafts -- Crafts

View File

@ -2,9 +2,10 @@
local S = homedecor.gettext local S = homedecor.gettext
function homedecor.toggle_switch(pos, node, clicker, itemstack, pointed_thing) function homedecor.toggle_switch(pos, node, clicker, itemstack, pointed_thing)
if minetest.is_protected(pos, clicker:get_player_name()) then if not clicker then return false end
minetest.record_protection_violation(pos, local playername = clicker:get_player_name()
sender:get_player_name()) if minetest.is_protected(pos, playername) then
minetest.record_protection_violation(pos, playername)
return false return false
end end
local sep = string.find(node.name, "_o", -5) local sep = string.find(node.name, "_o", -5)

View File

@ -1109,7 +1109,6 @@ function signs_lib.register_fence_with_sign(fencename, fencewithsignname)
def_sign.on_rotate = signs_lib.facedir_rotate_simple def_sign.on_rotate = signs_lib.facedir_rotate_simple
def_sign.drop = default_sign def_sign.drop = default_sign
minetest.register_node(":"..fencename, def)
minetest.register_node(":"..fencewithsignname, def_sign) minetest.register_node(":"..fencewithsignname, def_sign)
table.insert(signs_lib.sign_node_list, fencewithsignname) table.insert(signs_lib.sign_node_list, fencewithsignname)
minetest.log("verbose", S("Registered @1 and @2", fencename, fencewithsignname)) minetest.log("verbose", S("Registered @1 and @2", fencename, fencewithsignname))

View File

@ -6,4 +6,6 @@ gloopblocks?
homedecor_fences? homedecor_fences?
homedecor_lighting? homedecor_lighting?
streetspoles? streetspoles?
streets_trafficlight?
trafficlight?
digilines? digilines?

View File

@ -75,11 +75,11 @@ local function place(itemstack,player,pointed)
elseif facedir.z == 1 then schemDir = 90 elseif facedir.z == 1 then schemDir = 90
elseif facedir.z == -1 then schemDir = 270 end elseif facedir.z == -1 then schemDir = 270 end
local offset = offsets[isDouble and "double" or "single"][schemDir] local offset = offsets[isDouble and "double" or "single"][schemDir]
local pos = vector.add(pos,offset)
minetest.place_schematic(pos,isDouble and schems.double or schems.single,schemDir,nil,false)
if sneak and streetlights.basic_materials then if sneak and streetlights.basic_materials then
minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name = streetlights.concrete}) minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name = streetlights.concrete})
end end
local pos = vector.add(pos,offset)
minetest.place_schematic(pos,isDouble and schems.double or schems.single,schemDir,nil,false)
end end
minetest.register_tool(":minedot_streetlights:spawner_single",{ minetest.register_tool(":minedot_streetlights:spawner_single",{

View File

@ -65,7 +65,7 @@ minetest.register_privilege("streetlight", {
give_to_singleplayer = true give_to_singleplayer = true
}) })
local function check_and_place(itemstack, placer, pointed_thing, pole, light, param2, needs_digiline_wire) local function check_and_place(itemstack, placer, pointed_thing, pole, light, param2, needs_digiline_wire, needs_distributor)
local controls = placer:get_player_control() local controls = placer:get_player_control()
if not placer then return end if not placer then return end
local playername = placer:get_player_name() local playername = placer:get_player_name()
@ -117,7 +117,7 @@ local function check_and_place(itemstack, placer, pointed_thing, pole, light, pa
if minetest.is_protected(pos4, player_name) or not (def3 and def4.buildable_to) then return end if minetest.is_protected(pos4, player_name) or not (def3 and def4.buildable_to) then return end
if controls.sneak and minetest.is_protected(pos1, player_name) then return end if controls.sneak and minetest.is_protected(pos1, player_name) then return end
if controls.aux1 and minetest.is_protected(pos0, player_name) then return end if needs_distributor and minetest.is_protected(pos0, player_name) then return end
if not creative.is_enabled_for(player_name) then if not creative.is_enabled_for(player_name) then
local inv = placer:get_inventory() local inv = placer:get_inventory()
@ -145,7 +145,7 @@ local function check_and_place(itemstack, placer, pointed_thing, pole, light, pa
end end
end end
if controls.aux1 and needs_digiline_wire then if needs_distributor and needs_digiline_wire then
if not inv:contains_item("main", streetlights.distributor) then if not inv:contains_item("main", streetlights.distributor) then
minetest.chat_send_player(playername, "*** You don't have any Digiline distributors in your inventory!") minetest.chat_send_player(playername, "*** You don't have any Digiline distributors in your inventory!")
return return
@ -163,7 +163,7 @@ local function check_and_place(itemstack, placer, pointed_thing, pole, light, pa
end end
if controls.aux1 and needs_digiline_wire then if needs_distributor and needs_digiline_wire then
minetest.set_node(pos0, { name = streetlights.distributor }) minetest.set_node(pos0, { name = streetlights.distributor })
end end
@ -250,6 +250,9 @@ for _, pole in ipairs(poles_tab) do
{items = { matnode.."_digilines" } }, {items = { matnode.."_digilines" } },
} }
} }
def.palette = nil -- if the coloredwood mod exists and loads first, it'll create these
def.groups.ud_param2_colorable = nil -- settings, which we don't want in the cloned node.
minetest.register_node(":"..matnode.."_digilines", def) minetest.register_node(":"..matnode.."_digilines", def)
minetest.register_craft({ minetest.register_craft({
@ -290,6 +293,7 @@ for _, pole in ipairs(poles_tab) do
}) })
if enable_digilines and minetest.registered_nodes[lightnode].digiline then if enable_digilines and minetest.registered_nodes[lightnode].digiline then
minetest.register_tool("simple_streetlights:spawner_"..matname.."_"..lightname.."_digilines", { minetest.register_tool("simple_streetlights:spawner_"..matname.."_"..lightname.."_digilines", {
description = "Streetlight spawner ("..matname.." pole, with "..lightname..", digilines conducting pole)", description = "Streetlight spawner ("..matname.." pole, with "..lightname..", digilines conducting pole)",
inventory_image = "simple_streetlights_inv_pole_"..matname..".png".. inventory_image = "simple_streetlights_inv_pole_"..matname..".png"..
@ -317,6 +321,66 @@ for _, pole in ipairs(poles_tab) do
digiline_wire_node, digiline_wire_node,
} }
}) })
minetest.register_craft({
output = "simple_streetlights:spawner_"..matname.."_"..lightname.."_digilines",
type = "shapeless",
recipe = {
"simple_streetlights:spawner_"..matname.."_"..lightname,
digiline_wire_node
}
})
if minetest.registered_items[streetlights.distributor] then
minetest.register_tool("simple_streetlights:spawner_"..matname.."_"..lightname.."_digilines_distributor", {
description = "Streetlight spawner ("..matname.." pole, with "..lightname..", digilines conducting pole, with distributor 2m below)",
inventory_image = "simple_streetlights_inv_pole_"..matname..".png"..
"^simple_streetlights_inv_pole_digiline_overlay.png"..
"^simple_streetlights_inv_pole_distributor_overlay.png"..
"^simple_streetlights_inv_light_source_"..lightname..".png",
use_texture_alpha = true,
tool_capabilities = { full_punch_interval=0.1 },
on_place = function(itemstack, placer, pointed_thing)
check_and_place(itemstack, placer, pointed_thing, matnode, lightnode, lightparam2, true, true)
end,
on_use = ilights.digiline_on_use
})
minetest.register_craft({
output = "simple_streetlights:spawner_"..matname.."_"..lightname.."_digilines_distributor",
type = "shapeless",
recipe = {
matnode,
matnode,
matnode,
matnode,
matnode,
matnode,
lightnode,
digiline_wire_node,
streetlights.distributor
}
})
minetest.register_craft({
output = "simple_streetlights:spawner_"..matname.."_"..lightname.."_digilines_distributor",
type = "shapeless",
recipe = {
"simple_streetlights:spawner_"..matname.."_"..lightname,
digiline_wire_node,
streetlights.distributor
}
})
minetest.register_craft({
output = "simple_streetlights:spawner_"..matname.."_"..lightname.."_digilines_distributor",
type = "shapeless",
recipe = {
"simple_streetlights:spawner_"..matname.."_"..lightname.."_digilines",
streetlights.distributor
}
})
end
end end
end end
end end

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B