forked from minetest-mods/BobBlocks
Compare commits
5 Commits
a16e960ac1
...
nalc-1.2.0
Author | SHA1 | Date | |
---|---|---|---|
1280300a4a | |||
7ad7a5e842 | |||
eed93cbc5d | |||
31f5af2c58 | |||
0f2b5b7b2f |
129
blocks.lua
129
blocks.lua
@ -18,7 +18,7 @@ bobblocks.colorlist = {
|
|||||||
|
|
||||||
bobblocks.opacity = 150 -- Opacity: 0-255; 0 Full transparent, 255 Full opaque
|
bobblocks.opacity = 150 -- Opacity: 0-255; 0 Full transparent, 255 Full opaque
|
||||||
|
|
||||||
bobblocks.update_bobblock = function (pos, node)
|
local function update_bobblock(pos, node)
|
||||||
local newnode = node
|
local newnode = node
|
||||||
if string.find(newnode.name, "_off") then
|
if string.find(newnode.name, "_off") then
|
||||||
newnode.name = string.sub(newnode.name, 1, -5)
|
newnode.name = string.sub(newnode.name, 1, -5)
|
||||||
@ -31,6 +31,13 @@ bobblocks.update_bobblock = function (pos, node)
|
|||||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
bobblocks.update_bobblock = update_bobblock
|
||||||
|
|
||||||
|
local function dig_block(pos, node, digger)
|
||||||
|
update_bobblock(pos, node)
|
||||||
|
return unifieddyes.on_dig(pos, node, digger)
|
||||||
|
end
|
||||||
|
|
||||||
-- Nodes
|
-- Nodes
|
||||||
|
|
||||||
minetest.register_node("bobblocks:block", {
|
minetest.register_node("bobblocks:block", {
|
||||||
@ -40,7 +47,6 @@ minetest.register_node("bobblocks:block", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette_extended.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
place_param2 = 240,
|
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
@ -51,9 +57,9 @@ minetest.register_node("bobblocks:block", {
|
|||||||
offstate = "bobblocks:block_off"
|
offstate = "bobblocks:block_off"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_rightclick = bobblocks.update_bobblock,
|
on_rightclick = update_bobblock,
|
||||||
on_construct = unifieddyes.on_construct,
|
on_construct = unifieddyes.on_construct,
|
||||||
after_dig_node = unifieddyes.after_dig_node
|
on_dig = unifieddyes.on_dig,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("bobblocks:block_off", {
|
minetest.register_node("bobblocks:block_off", {
|
||||||
@ -62,19 +68,17 @@ minetest.register_node("bobblocks:block_off", {
|
|||||||
tiles = {"bobblocks_block.png^[opacity:"..bobblocks.opacity},
|
tiles = {"bobblocks_block.png^[opacity:"..bobblocks.opacity},
|
||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette_extended.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
place_param2 = 240,
|
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
|
||||||
drop = "bobblocks:block",
|
|
||||||
mesecons = {conductor={
|
mesecons = {conductor={
|
||||||
state = mesecon.state.off,
|
state = mesecon.state.off,
|
||||||
onstate = "bobblocks:block"
|
onstate = "bobblocks:block"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_rightclick = bobblocks.update_bobblock,
|
on_rightclick = update_bobblock,
|
||||||
on_construct = unifieddyes.on_construct,
|
on_construct = unifieddyes.on_construct,
|
||||||
after_dig_node = unifieddyes.after_dig_node
|
on_dig = dig_block,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Block Poles
|
-- Block Poles
|
||||||
@ -86,7 +90,6 @@ minetest.register_node("bobblocks:pole", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette_extended.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
place_param2 = 240,
|
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
@ -97,9 +100,9 @@ minetest.register_node("bobblocks:pole", {
|
|||||||
offstate = "bobblocks:pole_off"
|
offstate = "bobblocks:pole_off"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_rightclick = bobblocks.update_bobblock,
|
on_rightclick = update_bobblock,
|
||||||
on_construct = unifieddyes.on_construct,
|
on_construct = unifieddyes.on_construct,
|
||||||
after_dig_node = unifieddyes.after_dig_node
|
on_dig = unifieddyes.on_dig,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("bobblocks:pole_off", {
|
minetest.register_node("bobblocks:pole_off", {
|
||||||
@ -109,25 +112,23 @@ minetest.register_node("bobblocks:pole_off", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette_extended.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
place_param2 = 240,
|
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
light_source = LIGHT_MAX-10,
|
light_source = LIGHT_MAX-10,
|
||||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
|
||||||
drop = 'bobblocks:pole',
|
|
||||||
mesecons = {conductor={
|
mesecons = {conductor={
|
||||||
state = mesecon.state.off,
|
state = mesecon.state.off,
|
||||||
onstate = "bobblocks:pole"
|
onstate = "bobblocks:pole"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_rightclick = bobblocks.update_bobblock,
|
on_rightclick = update_bobblock,
|
||||||
on_construct = unifieddyes.on_construct,
|
on_construct = unifieddyes.on_construct,
|
||||||
after_dig_node = unifieddyes.after_dig_node
|
on_dig = dig_block,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- old static nodes grandfathered-in because they have a different texture or usage than the colored ones.
|
-- old nodes grandfathered-in because they have a different texture or usage than the colored ones.
|
||||||
|
|
||||||
minetest.register_node("bobblocks:btm", {
|
minetest.register_node("bobblocks:btm", {
|
||||||
description = "Bobs TransMorgifier v5",
|
description = "Bobs TransMorgifier v5",
|
||||||
@ -146,7 +147,6 @@ minetest.register_node("bobblocks:wavyblock", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette_extended.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
place_param2 = 240,
|
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
@ -158,9 +158,9 @@ minetest.register_node("bobblocks:wavyblock", {
|
|||||||
offstate = "bobblocks:wavyblock_off"
|
offstate = "bobblocks:wavyblock_off"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_rightclick = bobblocks.update_bobblock,
|
on_rightclick = update_bobblock,
|
||||||
on_construct = unifieddyes.on_construct,
|
on_construct = unifieddyes.on_construct,
|
||||||
after_dig_node = unifieddyes.after_dig_node
|
on_dig = unifieddyes.on_dig,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("bobblocks:wavyblock_off", {
|
minetest.register_node("bobblocks:wavyblock_off", {
|
||||||
@ -169,20 +169,18 @@ minetest.register_node("bobblocks:wavyblock_off", {
|
|||||||
tiles = {"bobblocks_wavyblock.png^[opacity:"..bobblocks.opacity},
|
tiles = {"bobblocks_wavyblock.png^[opacity:"..bobblocks.opacity},
|
||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette_extended.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
place_param2 = 240,
|
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
|
||||||
drop = "bobblocks:wavyblock",
|
|
||||||
mesecons = {conductor=
|
mesecons = {conductor=
|
||||||
{
|
{
|
||||||
state = mesecon.state.off,
|
state = mesecon.state.off,
|
||||||
onstate = "bobblocks:wavyblock"
|
onstate = "bobblocks:wavyblock"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_rightclick = bobblocks.update_bobblock,
|
on_rightclick = update_bobblock,
|
||||||
on_construct = unifieddyes.on_construct,
|
on_construct = unifieddyes.on_construct,
|
||||||
after_dig_node = unifieddyes.after_dig_node
|
on_dig = dig_block,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("bobblocks:wavypole", {
|
minetest.register_node("bobblocks:wavypole", {
|
||||||
@ -193,13 +191,12 @@ minetest.register_node("bobblocks:wavypole", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette_extended.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
place_param2 = 240,
|
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
|
||||||
on_construct = unifieddyes.on_construct,
|
on_construct = unifieddyes.on_construct,
|
||||||
after_dig_node = unifieddyes.after_dig_node,
|
on_dig = unifieddyes.on_dig,
|
||||||
--light_source = LIGHT_MAX-0,
|
--light_source = LIGHT_MAX-0,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -224,6 +221,17 @@ minetest.register_craft({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
unifieddyes.register_color_craft({
|
||||||
|
output = "bobblocks:block",
|
||||||
|
palette = "extended",
|
||||||
|
type = "shapeless",
|
||||||
|
neutral_node = "bobblocks:block",
|
||||||
|
recipe = {
|
||||||
|
"NEUTRAL_NODE",
|
||||||
|
"MAIN_DYE"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "bobblocks:pole",
|
output = "bobblocks:pole",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -231,15 +239,50 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
unifieddyes.register_color_craft({
|
||||||
|
output = "bobblocks:pole",
|
||||||
|
palette = "extended",
|
||||||
|
type = "shapeless",
|
||||||
|
neutral_node = "bobblocks:pole",
|
||||||
|
recipe = {
|
||||||
|
"NEUTRAL_NODE",
|
||||||
|
"MAIN_DYE"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "bobblocks:wavyblock 2",
|
output = "bobblocks:wavyblock 2",
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
recipe = {
|
recipe = {
|
||||||
"bobblocks:block",
|
"bobblocks:block",
|
||||||
"bobblocks:block"
|
"default:cobble"
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
unifieddyes.register_color_craft({
|
||||||
|
output = "bobblocks:wavyblock 2",
|
||||||
|
palette = "extended",
|
||||||
|
type = "shapeless",
|
||||||
|
neutral_node = "bobblocks:block",
|
||||||
|
recipe = {
|
||||||
|
"MAIN_DYE",
|
||||||
|
"NEUTRAL_NODE",
|
||||||
|
"default:cobble"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
unifieddyes.register_color_craft({
|
||||||
|
output = "bobblocks:wavyblock",
|
||||||
|
palette = "extended",
|
||||||
|
type = "shapeless",
|
||||||
|
neutral_node = "bobblocks:wavyblock",
|
||||||
|
recipe = {
|
||||||
|
"MAIN_DYE",
|
||||||
|
"NEUTRAL_NODE"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "bobblocks:wavypole",
|
output = "bobblocks:wavypole",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -247,6 +290,17 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
unifieddyes.register_color_craft({
|
||||||
|
output = "bobblocks:wavypole",
|
||||||
|
palette = "extended",
|
||||||
|
type = "shapeless",
|
||||||
|
neutral_node = "bobblocks:wavypole",
|
||||||
|
recipe = {
|
||||||
|
"NEUTRAL_NODE",
|
||||||
|
"MAIN_DYE"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
-- Convert old static nodes to the param2 scheme
|
-- Convert old static nodes to the param2 scheme
|
||||||
|
|
||||||
for _, i in ipairs(bobblocks.colorlist) do
|
for _, i in ipairs(bobblocks.colorlist) do
|
||||||
@ -278,7 +332,7 @@ minetest.register_lbm({
|
|||||||
|
|
||||||
-- custom re-mappings to use unified dyes' colors that are most similar to the originals
|
-- custom re-mappings to use unified dyes' colors that are most similar to the originals
|
||||||
if color == "blue" then
|
if color == "blue" then
|
||||||
newcolor = "medium_skyblue"
|
newcolor = "medium_azure"
|
||||||
end
|
end
|
||||||
if color == "indigo" then
|
if color == "indigo" then
|
||||||
newcolor = "light_violet"
|
newcolor = "light_violet"
|
||||||
@ -313,24 +367,3 @@ minetest.register_lbm({
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_lbm({
|
|
||||||
name = "bobblocks:recolor_stuff",
|
|
||||||
label = "Convert 89-color fences to use UD extended palette",
|
|
||||||
run_at_every_load = false,
|
|
||||||
nodenames = {
|
|
||||||
"bobblocks:block",
|
|
||||||
"bobblocks:block_off",
|
|
||||||
"bobblocks:pole",
|
|
||||||
"bobblocks:pole_off",
|
|
||||||
"bobblocks:wavyblock",
|
|
||||||
"bobblocks:wavyblock_off",
|
|
||||||
"bobblocks:wavypole"
|
|
||||||
},
|
|
||||||
action = function(pos, node)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
if meta:get_string("palette") ~= "ext" then
|
|
||||||
minetest.swap_node(pos, { name = node.name, param2 = unifieddyes.convert_classic_palette[node.param2] })
|
|
||||||
meta:set_string("palette", "ext")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
Reference in New Issue
Block a user