summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--homedecor/depends.txt1
-rw-r--r--homedecor/doors_and_gates.lua5
-rw-r--r--steel/init.lua1
-rw-r--r--unifieddyes/API.md4
-rw-r--r--unifieddyes/init.lua38
-rw-r--r--unifiedmesecons/init.lua29
6 files changed, 58 insertions, 20 deletions
diff --git a/homedecor/depends.txt b/homedecor/depends.txt
index 5a37ef6..1c71e74 100644
--- a/homedecor/depends.txt
+++ b/homedecor/depends.txt
@@ -13,3 +13,4 @@ beds?
flowers?
3d_armor?
skinsdb?
+mesecons?
diff --git a/homedecor/doors_and_gates.lua b/homedecor/doors_and_gates.lua
index f29ea24..34ba017 100644
--- a/homedecor/doors_and_gates.lua
+++ b/homedecor/doors_and_gates.lua
@@ -4,6 +4,8 @@ local S = homedecor_i18n.gettext
local function N_(x) return x end
+local m_rules = mesecon and mesecon.rules and mesecon.rules.pplate
+
-- doors
local function isSolid(pos, adjust)
@@ -264,6 +266,7 @@ for i, side in ipairs(sides) do
drop = "homedecor:door_"..doorname.."_left",
mesecons = {
effector = {
+ rules = m_rules,
action_on = function(pos,node)
local isClosed = getClosed(pos)
if isClosed then
@@ -405,6 +408,7 @@ for i, g in ipairs(gate_list) do
end,
mesecons = {
effector = {
+ rules = m_rules,
action_on = function(pos,node) homedecor.flip_gate(pos,node,nil,gate, "closed") end
}
}
@@ -433,6 +437,7 @@ for i, g in ipairs(gate_list) do
return itemstack
end
def.mesecons.effector = {
+ rules = m_rules,
action_off = function(pos,node) homedecor.flip_gate(pos,node,nil,gate, "open") end
}
diff --git a/steel/init.lua b/steel/init.lua
index 83a1c1d..ca0af13 100644
--- a/steel/init.lua
+++ b/steel/init.lua
@@ -377,6 +377,7 @@ if minetest.get_modpath("unifieddyes") then
minetest.override_item("default:steelblock", {
palette = "unifieddyes_palette_extended.png",
+ airbrush_replacement_node = "steel:steel_block",
groups = {cracky=1, level=2, ud_param2_colorable=1},
})
diff --git a/unifieddyes/API.md b/unifieddyes/API.md
index c8abd8b..bd06164 100644
--- a/unifieddyes/API.md
+++ b/unifieddyes/API.md
@@ -28,7 +28,9 @@ minetest.register_node("mymod:colored_node", {
- "unifieddyes_palette_colorwallmounted.png"
- or one of the "split" hues palettes (see below).
-`groups`: If your node can be colored by punching it with dye, its groups entry must contain the key ud_param2_colorable = 1, among whatever else you'd normally put there. If the node is software-controlled, as might be the case for some mesecons-digilines aware node, then this group key should be omitted.
+`groups`: If your node can be colored by using the airbrush, its groups entry must contain the key ud_param2_colorable = 1, among whatever else you'd normally put there. If the node is software-controlled, as might be the case for some mesecons-digilines aware node, then this group key should be omitted.
+
+If your node if of the kind where you need the split palette, but you need to put the *full color name* into the node name, as opposed to just the hue, then add the keys `ud_color_start` and `ud_color_end` and set them to the positions of the first and last characters of the color name (where 1 is the first character of the mod name at the start of the node name, i.e. "mymod:foo_bar_orange_baz" would have the start set to 15 and the end at 20).
`on_construct`: see below.
diff --git a/unifieddyes/init.lua b/unifieddyes/init.lua
index 77d42d3..8eeb133 100644
--- a/unifieddyes/init.lua
+++ b/unifieddyes/init.lua
@@ -665,7 +665,7 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
return
end
- if not def.palette then
+ if not def.palette or not (def.groups and def.groups.ud_param2_colorable > 0) then
minetest.chat_send_player(player_name, "*** That node can't be colored.")
return
end
@@ -699,29 +699,41 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
end
local oldidx = node.param2 - fdir
-
local name = def.airbrush_replacement_node or node.name
if palette == true then
- local s = string.sub(def.palette, 21)
- local oldcolor = string.sub(s, 1, string.find(s, "s.png")-1)
-
local modname = string.sub(name, 1, string.find(name, ":")-1)
local nodename2 = string.sub(name, string.find(name, ":")+1)
+ local oldcolor = "snozzberry"
+ local newcolor = "razzberry" -- intentionally misspelled ;-)
+
+ if def.ud_color_start and def.ud_color_end then
+ oldcolor = string.sub(node.name, def.ud_color_start, def.ud_color_end)
+ newcolor = string.sub(painting_with, 5)
+ else
+ if hue ~= 0 then
+ newcolor = unifieddyes.HUES[hue]
+ else
+ newcolor = "grey"
+ end
- local a,b
+ local s = string.sub(def.palette, 21)
+ oldcolor = string.sub(s, 1, string.find(s, "s.png")-1)
+ end
- local newcolor = "grey"
- if hue ~= 0 then
- newcolor = unifieddyes.HUES[hue]
+ if newcolor == "spring" then newcolor = "aqua"
+ elseif newcolor == "azure" then newcolor = "skyblue"
+ elseif newcolor == "rose" then newcolor = "redviolet"
end
- local a,b = string.gsub(nodename2, oldcolor, newcolor)
- name = modname..":"..a
+ name = modname..":"..string.gsub(nodename2, oldcolor, newcolor)
+ if not minetest.registered_items[name] then
+ minetest.chat_send_player(player_name, "*** "..string.sub(painting_with, 5).." can't be applied to that node.")
+ return
+ end
elseif idx == oldidx then
return
end
-
minetest.swap_node(pos, {name = name, param2 = fdir + idx})
if not creative or not creative.is_enabled_for(player_name) then
inv:remove_item("main", painting_with)
@@ -969,7 +981,7 @@ function unifieddyes.show_airbrush_form(player)
if dye == painting_with then
overlay = "^unifieddyes_select_overlay.png"
- slindic = "unifieddyes_white_square.png"..colorize..overlay.."]"..
+ selindic = "unifieddyes_white_square.png"..colorize..overlay.."]"..
"tooltip["..grey2..";"..grey2.."]"
end
diff --git a/unifiedmesecons/init.lua b/unifiedmesecons/init.lua
index 195eab0..2c1994d 100644
--- a/unifiedmesecons/init.lua
+++ b/unifiedmesecons/init.lua
@@ -66,6 +66,9 @@ minetest.register_alias("mesecons_extrawires:corner_off", "mesecons_extrawires:i
minetest.register_alias("mesecons_extrawires:tjunction_off", "mesecons_extrawires:insulated_tjunction_white_off")
for _,color in pairs(hues) do
+ local cstart = 30
+ local cend = cstart + string.len(color) - 1
+
local palettecolor = color
if color == "black" or string.find(color, "grey") or color == "white" then
palettecolor = "grey"
@@ -86,6 +89,8 @@ for _,color in pairs(hues) do
on_place = minetest.rotate_node,
drop = "mesecons_insulated:insulated_white_off",
palette = "unifieddyes_palette_"..palettecolor.."s.png",
+ ud_color_start = cstart,
+ ud_color_end = cend,
selection_box = {
type = "fixed",
fixed = { -16/32-0.001, -18/32, -7/32, 16/32+0.001, -12/32, 7/32 }
@@ -96,7 +101,7 @@ for _,color in pairs(hues) do
},
},
{
- groups = {dig_immediate = 3,not_in_creative_inventory = (color~="white" and 1 or nil)},
+ groups = {ud_param2_colorable = 1, dig_immediate = 3,not_in_creative_inventory = (color~="white" and 1 or nil)},
mesecons = {conductor = {
state = mesecon.state.off,
onstate = "mesecons_insulated:insulated_"..color.."_on",
@@ -112,7 +117,7 @@ for _,color in pairs(hues) do
},
},
{
- groups = {dig_immediate = 3,not_in_creative_inventory = 1},
+ groups = {ud_param2_colorable = 1, dig_immediate = 3,not_in_creative_inventory = 1},
mesecons = {conductor = {
state = mesecon.state.on,
offstate = "mesecons_insulated:insulated_"..color.."_off",
@@ -127,6 +132,10 @@ for _,color in pairs(hues) do
"unifiedmesecons_wire_on.png",
},
})
+
+ cstart = 38
+ cend = cstart + string.len(color) - 1
+
mesecon.register_node(":mesecons_extrawires:insulated_corner_"..color, {
drawtype = "nodebox",
description = "Insulated Mesecon Corner",
@@ -137,6 +146,8 @@ for _,color in pairs(hues) do
on_place = minetest.rotate_node,
drop = "mesecons_extrawires:insulated_corner_white_off",
palette = "unifieddyes_palette_"..palettecolor.."s.png",
+ ud_color_start = cstart,
+ ud_color_end = cend,
selection_box = {
type = "fixed",
fixed = { -16/32-0.001, -18/32, -16/32, 5/32, -12/32, 5/32 },
@@ -148,7 +159,7 @@ for _,color in pairs(hues) do
},
},
{
- groups = {dig_immediate = 3,not_in_creative_inventory = (color~="white" and 1 or nil)},
+ groups = {ud_param2_colorable = 1, dig_immediate = 3,not_in_creative_inventory = (color~="white" and 1 or nil)},
mesecons = {conductor = {
state = mesecon.state.off,
onstate = "mesecons_extrawires:insulated_corner_"..color.."_on",
@@ -164,7 +175,7 @@ for _,color in pairs(hues) do
},
},
{
- groups = {dig_immediate = 3,not_in_creative_inventory = 1},
+ groups = {ud_param2_colorable = 1, dig_immediate = 3,not_in_creative_inventory = 1},
mesecons = {conductor = {
state = mesecon.state.on,
offstate = "mesecons_extrawires:insulated_corner_"..color.."_off",
@@ -179,6 +190,10 @@ for _,color in pairs(hues) do
"unifiedmesecons_wire_end_on.png",
},
})
+
+ cstart = 41
+ cend = cstart + string.len(color) - 1
+
mesecon.register_node(":mesecons_extrawires:insulated_tjunction_"..color, {
drawtype = "nodebox",
description = "Insulated Mesecon T-Junction",
@@ -189,6 +204,8 @@ for _,color in pairs(hues) do
on_place = minetest.rotate_node,
drop = "mesecons_extrawires:insulated_tjunction_white_off",
palette = "unifieddyes_palette_"..palettecolor.."s.png",
+ ud_color_start = cstart,
+ ud_color_end = cend,
node_box = {
type = "fixed",
fixed = {{ -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 },
@@ -200,7 +217,7 @@ for _,color in pairs(hues) do
},
},
{
- groups = {dig_immediate = 3,not_in_creative_inventory = (color~="white" and 1 or nil)},
+ groups = {ud_param2_colorable = 1, dig_immediate = 3,not_in_creative_inventory = (color~="white" and 1 or nil)},
mesecons = {conductor = {
state = mesecon.state.off,
onstate = "mesecons_extrawires:insulated_tjunction_"..color.."_on",
@@ -216,7 +233,7 @@ for _,color in pairs(hues) do
},
},
{
- groups = {dig_immediate = 3,not_in_creative_inventory = 1},
+ groups = {ud_param2_colorable = 1, dig_immediate = 3,not_in_creative_inventory = 1},
mesecons = {conductor = {
state = mesecon.state.on,
offstate = "mesecons_extrawires:insulated_tjunction_"..color.."_off",