mirror of
https://github.com/minetest-mods/stained_glass.git
synced 2025-01-09 07:10:23 +01:00
convert to use extended UD palette
This commit is contained in:
parent
e78c0a8b15
commit
d980d1ef79
197
init.lua
197
init.lua
@ -45,7 +45,8 @@ minetest.register_node("stained_glass:stained_glass", {
|
|||||||
tiles = { "stained_glass.png" },
|
tiles = { "stained_glass.png" },
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
place_param2 = 240,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
light_source = myglow,
|
light_source = myglow,
|
||||||
@ -55,80 +56,26 @@ minetest.register_node("stained_glass:stained_glass", {
|
|||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
drop = "moreblocks:super_glow_glass",
|
drop = "moreblocks:super_glow_glass",
|
||||||
after_dig_node = unifieddyes.after_dig_node,
|
after_dig_node = unifieddyes.after_dig_node,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
||||||
local name = itemstack:get_name()
|
|
||||||
if name == "moreblocks:sweeper" then
|
|
||||||
minetest.swap_node(pos, { name = "stained_glass:pastel_stained_glass", param2 = node.param2 })
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
drop = "moreblocks:super_glow_glass"
|
drop = "moreblocks:super_glow_glass"
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.override_item("moreblocks:super_glow_glass", {
|
minetest.override_item("moreblocks:super_glow_glass", {
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
place_param2 = 240,
|
||||||
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},
|
||||||
ud_replacement_node = "stained_glass:stained_glass"
|
ud_replacement_node = "stained_glass:stained_glass"
|
||||||
})
|
})
|
||||||
|
|
||||||
-- pastel and faint
|
|
||||||
|
|
||||||
minetest.register_node("stained_glass:pastel_stained_glass", {
|
|
||||||
description = "Stained Glass",
|
|
||||||
drawtype = "glasslike",
|
|
||||||
tiles = { "stained_glass.png" },
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "color",
|
|
||||||
palette = "stained_glass_pastels_palette.png",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
use_texture_alpha = true,
|
|
||||||
light_source = myglow,
|
|
||||||
is_ground_content = true,
|
|
||||||
walkable = true,
|
|
||||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
after_dig_node = unifieddyes.after_dig_node,
|
|
||||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
||||||
local name = itemstack:get_name()
|
|
||||||
if name == "moreblocks:sweeper" then
|
|
||||||
minetest.swap_node(pos, { name = "stained_glass:faint_stained_glass", param2 = node.param2 })
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
drop = "moreblocks:super_glow_glass"
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("stained_glass:faint_stained_glass", {
|
|
||||||
description = "Stained Glass",
|
|
||||||
drawtype = "glasslike",
|
|
||||||
tiles = { "stained_glass.png" },
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "color",
|
|
||||||
palette = "stained_glass_faint_palette.png",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
use_texture_alpha = true,
|
|
||||||
light_source = myglow,
|
|
||||||
is_ground_content = true,
|
|
||||||
walkable = true,
|
|
||||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
after_dig_node = unifieddyes.after_dig_node,
|
|
||||||
drop = "moreblocks:super_glow_glass"
|
|
||||||
})
|
|
||||||
|
|
||||||
-- trap glass
|
-- trap glass
|
||||||
|
|
||||||
minetest.override_item("moreblocks:trap_super_glow_glass", {
|
|
||||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
|
|
||||||
ud_replacement_node = "stained_glass:stained_trap_glass"
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("stained_glass:stained_trap_glass", {
|
minetest.register_node("stained_glass:stained_trap_glass", {
|
||||||
description = "Stained Trap-glass",
|
description = "Stained Trap-glass",
|
||||||
drawtype = "glasslike",
|
drawtype = "glasslike",
|
||||||
tiles = { "stained_glass.png" },
|
tiles = { "stained_glass.png" },
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
place_param2 = 240,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
light_source = myglow,
|
light_source = myglow,
|
||||||
@ -138,58 +85,14 @@ minetest.register_node("stained_glass:stained_trap_glass", {
|
|||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
drop = "moreblocks:trap_super_glow_glass",
|
drop = "moreblocks:trap_super_glow_glass",
|
||||||
after_dig_node = unifieddyes.after_dig_node,
|
after_dig_node = unifieddyes.after_dig_node,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
||||||
local name = itemstack:get_name()
|
|
||||||
if name == "moreblocks:sweeper" then
|
|
||||||
minetest.swap_node(pos, { name = "stained_glass:pastel_stained_trap_glass", param2 = node.param2 })
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
drop = "moreblocks:trap_super_glow_glass"
|
drop = "moreblocks:trap_super_glow_glass"
|
||||||
})
|
})
|
||||||
|
|
||||||
-- pastel and faint trap
|
minetest.override_item("moreblocks:trap_super_glow_glass", {
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
minetest.register_node("stained_glass:pastel_stained_trap_glass", {
|
place_param2 = 240,
|
||||||
description = "Stained Glass",
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
|
||||||
drawtype = "glasslike",
|
ud_replacement_node = "stained_glass:stained_trap_glass"
|
||||||
tiles = { "stained_glass.png" },
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "color",
|
|
||||||
palette = "stained_glass_pastels_palette.png",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
use_texture_alpha = true,
|
|
||||||
light_source = myglow,
|
|
||||||
is_ground_content = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
after_dig_node = unifieddyes.after_dig_node,
|
|
||||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
||||||
local name = itemstack:get_name()
|
|
||||||
if name == "moreblocks:sweeper" then
|
|
||||||
minetest.swap_node(pos, { name = "stained_glass:faint_stained_trap_glass", param2 = node.param2 })
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
drop = "moreblocks:trap_super_glow_glass"
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("stained_glass:faint_stained_trap_glass", {
|
|
||||||
description = "Stained Glass",
|
|
||||||
drawtype = "glasslike",
|
|
||||||
tiles = { "stained_glass.png" },
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "color",
|
|
||||||
palette = "stained_glass_faint_palette.png",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
use_texture_alpha = true,
|
|
||||||
light_source = myglow,
|
|
||||||
is_ground_content = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
drop = "moreblocks:trap_super_glow_glass"
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function stainedglass.makenode(arg)
|
function stainedglass.makenode(arg)
|
||||||
@ -449,7 +352,7 @@ end
|
|||||||
-- convert in-map static nodes to use param2 coloring
|
-- convert in-map static nodes to use param2 coloring
|
||||||
|
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
name = "stained_glass:convert_brickblocks",
|
name = "stained_glass:convert_glass",
|
||||||
label = "Convert static glass blocks to use param2 color",
|
label = "Convert static glass blocks to use param2 color",
|
||||||
run_at_every_load = false,
|
run_at_every_load = false,
|
||||||
nodenames = stainedglass.old_static_nodes,
|
nodenames = stainedglass.old_static_nodes,
|
||||||
@ -462,52 +365,44 @@ minetest.register_lbm({
|
|||||||
if string.find(name, "trap") then
|
if string.find(name, "trap") then
|
||||||
n = string.find(color, "_")
|
n = string.find(color, "_")
|
||||||
color = string.sub(color, n + 1)
|
color = string.sub(color, n + 1)
|
||||||
|
local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended")
|
||||||
if string.find(color, "pastel") then
|
minetest.set_node(pos, { name = "stained_glass:stained_trap_glass", param2 = paletteidx })
|
||||||
n = string.find(color, "_")
|
|
||||||
color = string.sub(color, n + 1)
|
|
||||||
local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color)
|
|
||||||
minetest.set_node(pos, { name = "stained_glass:pastel_stained_trap_glass", param2 = paletteidx })
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("dye", "unifieddyes:"..v..h..s)
|
|
||||||
elseif string.find(color, "faint") then
|
|
||||||
n = string.find(color, "_")
|
|
||||||
color = string.sub(color, n + 1)
|
|
||||||
local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color)
|
|
||||||
minetest.set_node(pos, { name = "stained_glass:faint_stained_trap_glass", param2 = paletteidx })
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("dye", "unifieddyes:"..v..h..s)
|
|
||||||
else
|
|
||||||
local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color)
|
|
||||||
minetest.set_node(pos, { name = "stained_glass:stained_trap_glass", param2 = paletteidx })
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("dye", "unifieddyes:"..v..h..s)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if string.find(color, "pastel") then
|
local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color "extended")
|
||||||
n = string.find(color, "_")
|
minetest.set_node(pos, { name = "stained_glass:stained_glass", param2 = paletteidx })
|
||||||
color = string.sub(color, n + 1)
|
end
|
||||||
local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color)
|
local meta = minetest.get_meta(pos)
|
||||||
minetest.set_node(pos, { name = "stained_glass:pastel_stained_glass", param2 = paletteidx })
|
meta:set_string("dye", "unifieddyes:"..v..h..s)
|
||||||
local meta = minetest.get_meta(pos)
|
meta:set_string("palette", "ext")
|
||||||
meta:set_string("dye", "unifieddyes:"..v..h..s)
|
end
|
||||||
elseif string.find(color, "faint") then
|
})
|
||||||
n = string.find(color, "_")
|
|
||||||
color = string.sub(color, n + 1)
|
minetest.register_lbm({
|
||||||
local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color)
|
name = "stained_glass:recolor_glass",
|
||||||
minetest.set_node(pos, { name = "stained_glass:faint_stained_glass", param2 = paletteidx })
|
label = "Convert glass to use UD extended palette",
|
||||||
local meta = minetest.get_meta(pos)
|
run_at_every_load = false,
|
||||||
meta:set_string("dye", "unifieddyes:"..v..h..s)
|
nodenames = {
|
||||||
else
|
"stained_glass:stained_glass",
|
||||||
local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color)
|
"stained_glass:stained_trap_glass",
|
||||||
minetest.set_node(pos, { name = "stained_glass:stained_glass", param2 = paletteidx })
|
"stained_glass:faint_stained_glass",
|
||||||
local meta = minetest.get_meta(pos)
|
"stained_glass:faint_stained_trap_glass",
|
||||||
meta:set_string("dye", "unifieddyes:"..v..h..s)
|
"stained_glass:pastel_stained_glass",
|
||||||
|
"stained_glass:pastel_stained_trap_glass"
|
||||||
|
},
|
||||||
|
action = function(pos, node)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if meta:get_string("palette") ~= "ext" then
|
||||||
|
|
||||||
|
local newcolor = unifieddyes.convert_classic_palette[node.param2]
|
||||||
|
if string.find(node.name, "faint") then
|
||||||
|
newcolor = newcolor - 4*24
|
||||||
|
elseif string.find(node.name, "pastel") then
|
||||||
|
newcolor = newcolor - 3*24
|
||||||
end
|
end
|
||||||
|
minetest.swap_node(pos, { name = "stained_glass:stained_glass", param2 = newcolor })
|
||||||
|
meta:set_string("palette", "ext")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
print("[stained_glass] Loaded!")
|
print("[stained_glass] Loaded!")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user