5 Commits

Author SHA1 Message Date
1280300a4a Empêche la perte de couleur à la récolte du bloc éteint 2020-01-04 15:00:40 +01:00
7ad7a5e842 Use Unified Dyes on_dig where needed (#3)
Requires Unified Dyes commit 9ff40a7f or later
2019-07-21 12:36:41 +02:00
eed93cbc5d get rid of old 89->256 color LBM
(it'll only crash now, and is obsolete)
also fixed a wrong/outdated color translation.
2018-09-30 20:54:27 -07:00
31f5af2c58 switch to colored itemstacks
with full crafting recipes
(requires Unified Dyes commit 2a816534 or later)
2018-09-30 20:54:27 -07:00
0f2b5b7b2f use unified dyes auto-recolor feature 2017-03-18 05:50:11 -04:00

View File

@ -18,7 +18,7 @@ bobblocks.colorlist = {
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
if string.find(newnode.name, "_off") then
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,})
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
minetest.register_node("bobblocks:block", {
@ -40,7 +47,6 @@ minetest.register_node("bobblocks:block", {
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
sunlight_propagates = true,
is_ground_content = false,
sounds = default.node_sound_glass_defaults(),
@ -51,9 +57,9 @@ minetest.register_node("bobblocks:block", {
offstate = "bobblocks:block_off"
}
},
on_rightclick = bobblocks.update_bobblock,
on_rightclick = update_bobblock,
on_construct = unifieddyes.on_construct,
after_dig_node = unifieddyes.after_dig_node
on_dig = unifieddyes.on_dig,
})
minetest.register_node("bobblocks:block_off", {
@ -62,19 +68,17 @@ minetest.register_node("bobblocks:block_off", {
tiles = {"bobblocks_block.png^[opacity:"..bobblocks.opacity},
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
is_ground_content = false,
use_texture_alpha = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
drop = "bobblocks:block",
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:block"
}
},
on_rightclick = bobblocks.update_bobblock,
on_rightclick = update_bobblock,
on_construct = unifieddyes.on_construct,
after_dig_node = unifieddyes.after_dig_node
on_dig = dig_block,
})
-- Block Poles
@ -86,7 +90,6 @@ minetest.register_node("bobblocks:pole", {
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
sunlight_propagates = true,
is_ground_content = false,
sounds = default.node_sound_glass_defaults(),
@ -97,9 +100,9 @@ minetest.register_node("bobblocks:pole", {
offstate = "bobblocks:pole_off"
}
},
on_rightclick = bobblocks.update_bobblock,
on_rightclick = update_bobblock,
on_construct = unifieddyes.on_construct,
after_dig_node = unifieddyes.after_dig_node
on_dig = unifieddyes.on_dig,
})
minetest.register_node("bobblocks:pole_off", {
@ -109,25 +112,23 @@ minetest.register_node("bobblocks:pole_off", {
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
sunlight_propagates = true,
is_ground_content = false,
use_texture_alpha = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-10,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
drop = 'bobblocks:pole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:pole"
}
},
on_rightclick = bobblocks.update_bobblock,
on_rightclick = update_bobblock,
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", {
description = "Bobs TransMorgifier v5",
@ -146,7 +147,6 @@ minetest.register_node("bobblocks:wavyblock", {
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
sunlight_propagates = true,
is_ground_content = false,
sounds = default.node_sound_glass_defaults(),
@ -158,9 +158,9 @@ minetest.register_node("bobblocks:wavyblock", {
offstate = "bobblocks:wavyblock_off"
}
},
on_rightclick = bobblocks.update_bobblock,
on_rightclick = update_bobblock,
on_construct = unifieddyes.on_construct,
after_dig_node = unifieddyes.after_dig_node
on_dig = unifieddyes.on_dig,
})
minetest.register_node("bobblocks:wavyblock_off", {
@ -169,20 +169,18 @@ minetest.register_node("bobblocks:wavyblock_off", {
tiles = {"bobblocks_wavyblock.png^[opacity:"..bobblocks.opacity},
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
is_ground_content = false,
use_texture_alpha = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
drop = "bobblocks:wavyblock",
mesecons = {conductor=
{
state = mesecon.state.off,
onstate = "bobblocks:wavyblock"
}
},
on_rightclick = bobblocks.update_bobblock,
on_rightclick = update_bobblock,
on_construct = unifieddyes.on_construct,
after_dig_node = unifieddyes.after_dig_node
on_dig = dig_block,
})
minetest.register_node("bobblocks:wavypole", {
@ -193,13 +191,12 @@ minetest.register_node("bobblocks:wavypole", {
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
sunlight_propagates = true,
is_ground_content = false,
sounds = default.node_sound_glass_defaults(),
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
on_construct = unifieddyes.on_construct,
after_dig_node = unifieddyes.after_dig_node,
on_dig = unifieddyes.on_dig,
--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({
output = "bobblocks:pole",
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({
output = "bobblocks:wavyblock 2",
type = "shapeless",
recipe = {
"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({
output = "bobblocks:wavypole",
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
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
if color == "blue" then
newcolor = "medium_skyblue"
newcolor = "medium_azure"
end
if color == "indigo" then
newcolor = "light_violet"
@ -313,24 +367,3 @@ minetest.register_lbm({
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
})