add unifieddyes support

This commit is contained in:
BuckarooBanzay 2020-05-23 20:03:36 +02:00 committed by Buckaroo Banzai
parent a3b8ec1522
commit 8a8e566d27
4 changed files with 25 additions and 7 deletions

View File

@ -19,6 +19,7 @@ read_globals = {
"xpanes", "xpanes",
"screwdriver", "screwdriver",
"minetest", "minetest",
"mesecon" "mesecon",
"unifieddyes"
} }

View File

@ -7,8 +7,9 @@
Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets. Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
# Changes log # Changelog
* Added support for unifieddyes
* 14/08/2019 : retrocompatibility fixed (aliases in doors.lua) * 14/08/2019 : retrocompatibility fixed (aliases in doors.lua)
* 13/08/2019 : * 13/08/2019 :
* added mod option doors_open_with_mesecon_only (default = false) * added mod option doors_open_with_mesecon_only (default = false)

View File

@ -1,4 +1,4 @@
name = scifi_nodes name = scifi_nodes
description = Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets. description = Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
depends = default,dye depends = default,dye
optional_depends = xpanes,mesecons,moreblocks,mesecons_microcontroller,mesecons_button,mesecons_torch,mesecons_receiver,basic_materials optional_depends = xpanes,mesecons,moreblocks,mesecons_microcontroller,mesecons_button,mesecons_torch,mesecons_receiver,basic_materials,unifieddyes

View File

@ -500,6 +500,7 @@ minetest.register_node("scifi_nodes:whtlightbnd", {
-- colors available. When crafting, the last recipes will be checked first. -- colors available. When crafting, the last recipes will be checked first.
--add new block using texture name(without "scifi_nodes_" prefix) then the description, and then the name of the block --add new block using texture name(without "scifi_nodes_" prefix) then the description, and then the name of the block
local nodetypes = { local nodetypes = {
-- { name, description, shortname?, light, colorable }
{"blue", "blue lines", "blue"}, {"blue", "blue lines", "blue"},
{"holes", "metal with holes","holes"}, {"holes", "metal with holes","holes"},
{"white2", "plastic", "white2"}, {"white2", "plastic", "white2"},
@ -531,7 +532,7 @@ local nodetypes = {
{"white", "plastic wall", "white"}, {"white", "plastic wall", "white"},
{"pipe", "wall pipe", "pipe2"}, {"pipe", "wall pipe", "pipe2"},
{"pipeside", "side pipe", "pipe3"}, {"pipeside", "side pipe", "pipe3"},
{"tile", "white tile", "tile"}, {"tile", "white tile", "tile", 0, true},
{"whiteoct", "white octagon", "whiteoct"}, {"whiteoct", "white octagon", "whiteoct"},
{"whitetile", "white tile2", "whttl"}, {"whitetile", "white tile2", "whttl"},
{"black_detail", "black detail", "blckdtl"}, {"black_detail", "black detail", "blckdtl"},
@ -586,12 +587,16 @@ local nodetypes = {
{"blackplate", "Black plate", "", 0}, {"blackplate", "Black plate", "", 0},
} }
local has_unifieddyes_mod = minetest.get_modpath("unifieddyes")
for _, row in ipairs(nodetypes) do for _, row in ipairs(nodetypes) do
local name = row[1] local name = row[1]
local desc = row[2] local desc = row[2]
local light = row[4] local light = row[4]
local is_colorable = row[5]
-- Node Definition -- Node Definition
minetest.register_node("scifi_nodes:"..name, { local node_def = {
description = desc, description = desc,
tiles = {"scifi_nodes_"..name..".png"}, tiles = {"scifi_nodes_"..name..".png"},
groups = {cracky=1}, groups = {cracky=1},
@ -599,5 +604,16 @@ for _, row in ipairs(nodetypes) do
paramtype2 = "facedir", paramtype2 = "facedir",
light_source = light, light_source = light,
sounds = default.node_sound_glass_defaults() sounds = default.node_sound_glass_defaults()
}) }
end
if is_colorable and has_unifieddyes_mod then
-- add unifieddyes specific attributes
node_def.paramtype2 = "color"
node_def.palette = "unifieddyes_palette_extended.png"
node_def.groups.ud_param2_colorable = 1
node_def.on_construct = unifieddyes.on_construct
node_def.on_dig = unifieddyes.on_dig
end
minetest.register_node("scifi_nodes:"..name, node_def)
end