diff options
75 files changed, 1762 insertions, 91 deletions
diff --git a/blox/init.lua b/blox/init.lua index 2313d13..81009ca 100644 --- a/blox/init.lua +++ b/blox/init.lua @@ -430,7 +430,7 @@ end minetest.register_lbm({
name = "blox:convert",
label = "Convert blox blocks to use param2 color",
- run_at_every_load = true,
+ run_at_every_load = false,
nodenames = blox.old_static_list,
action = function(pos, node)
local basename = string.sub(node.name, 6)
diff --git a/bobblocks/blocks.lua b/bobblocks/blocks.lua index 3c9ef40..85c5782 100644 --- a/bobblocks/blocks.lua +++ b/bobblocks/blocks.lua @@ -239,7 +239,7 @@ end minetest.register_lbm({ name = "bobblocks:convert", label = "Convert bobblocks nodes to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = bobblocks.old_static_nodes, action = function(pos, node) local basename = node.name diff --git a/castle/tapestry.lua b/castle/tapestry.lua index 4a90c93..59b94b4 100644 --- a/castle/tapestry.lua +++ b/castle/tapestry.lua @@ -147,7 +147,7 @@ end minetest.register_lbm({ name = "castle:convert_tapestries", label = "Convert tapestries to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = castle.old_static_tapestries, action = function(pos, node) local oldname = node.name diff --git a/chains/init.lua b/chains/init.lua index 4a0f500..0820f3f 100644 --- a/chains/init.lua +++ b/chains/init.lua @@ -77,7 +77,6 @@ minetest.register_node("chains:chandelier", { walkable = false, climbable = true, sunlight_propagates = true, - paramtype = "light", tiles = { "chains_wrought_iron.png", "chains_candle.png", @@ -104,7 +103,6 @@ minetest.register_node("chains:chandelier_brass", { walkable = false, climbable = true, sunlight_propagates = true, - paramtype = "light", tiles = { "chains_brass.png", "chains_candle.png", diff --git a/coloredwood/init.lua b/coloredwood/init.lua index 4f6be8d..05a513d 100644 --- a/coloredwood/init.lua +++ b/coloredwood/init.lua @@ -296,7 +296,7 @@ end minetest.register_lbm({ name = "coloredwood:convert", label = "Convert wood blocks, fences, stairsplus stuff, etc to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = coloredwood.old_static_nodes, action = function(pos, node) local meta = minetest.get_meta(pos) diff --git a/digistuff/README b/digistuff/README new file mode 100644 index 0000000..8247ce7 --- /dev/null +++ b/digistuff/README @@ -0,0 +1,41 @@ +Digilines Stuff +=============== + + +License: +Code - LGPL v3 or later (contains some code from mesecons and digilines) +Textures WITHOUT "adwaita" in the file name - CC BY-SA 3.0 Generic (contains modified versions of textures from mesecons and digilines) +Textures WITH "adwaita" in the file name - These are icons by the GNOME Project, licensed under GNU LGPL v3 or CC BY-SA 3.0. + + +Depends: +Required: digilines (base only) and mesecons (base only) +Only needed for craft recipes: default, mesecons_luacontroller, homedecor + + +How to use digilines buttons: +Connect to a digiline (or digimese), right-click, and set a channel and message. +When the button is pressed (right-click), it will send that message on that channel, over digilines. +Note that the settings cannot be changed after setting - you must dig and re-place the button to do so. + + +How to use digimese: +It conducts digilines signals (like digilines) in all directions (like mese). That's about it, really. + + +How to use the digilines player detector: +Set a channel and radius (radius must be a number >0 and <10 - anything invalid will be ignored and "6" used instead). +Every second while a player is within the radius, a table listing the players in range will be sent via digilines on the chosen channel. + + +How to use the digilines control panel: +Once a channel is set, any messages sent on that channel will be shown on the "LCD". The buttons, when pressed, send the messages "up", "down", "left", "right", "back", and "enter" on the same channel. If the panel is placed in a protected area (all standard protection mods are supported), only the owner of the area (and players with the protection_bypass privilege) can set the channel. There is also a "lock" function in the bottom-right of the "LCD" area. Click the padlock icon to lock/unlock it. If locked, only the owner of the area is allowed to use the buttons. If unlocked, anyone can use the buttons, although channel setting and (for reasons that shuld be obvious) locking/unlocking is still limited to the area owner and players with protection_bypass. + + +How to use the NIC: +Send a digilines signal with the URL you want to download. The HTTPRequestResult table will be sent back on the same channel. + + +How to use the camera: +Set the channel, distance, and radius. The camera will search for a node "distance" meters away and up to 10m down. +Every second while a player is within "radius" meters of that point, a table listing the players in range will be sent via digilines on the chosen channel. diff --git a/digistuff/depends.txt b/digistuff/depends.txt new file mode 100644 index 0000000..39f4fe0 --- /dev/null +++ b/digistuff/depends.txt @@ -0,0 +1,2 @@ +digilines +mesecons? diff --git a/digistuff/init.lua b/digistuff/init.lua new file mode 100644 index 0000000..bcb7ce7 --- /dev/null +++ b/digistuff/init.lua @@ -0,0 +1,930 @@ +digistuff = {} +digistuff.sounds_playing = {} + +digistuff.update_panel_formspec = function (pos,dispstr) + local meta = minetest.get_meta(pos) + local locked = meta:get_int("locked") == 1 + local fs = "size[10,8]".. + "background[0,0;0,0;digistuff_panel_bg.png;true]".. + "label[0,0;%s]".. + (locked and "image_button[9,3;1,1;digistuff_panel_locked.png;unlock;]" or "image_button[9,3;1,1;digistuff_panel_unlocked.png;lock;]").. + "image_button[2,4.5;1,1;digistuff_adwaita_go-up.png;up;]".. + "image_button[1,5;1,1;digistuff_adwaita_go-previous.png;left;]".. + "image_button[3,5;1,1;digistuff_adwaita_go-next.png;right;]".. + "image_button[2,5.5;1,1;digistuff_adwaita_go-down.png;down;]".. + "image_button[1,6.5;1,1;digistuff_adwaita_edit-undo.png;back;]".. + "image_button[3,6.5;1,1;digistuff_adwaita_emblem-default.png;enter;]".. + "field[6,5.75;2,1;channel;Channel;${channel}]".. + "button[8,5.5;1,1;savechan;Set]" + fs = fs:format(minetest.formspec_escape(dispstr)):gsub("|","\n") + meta:set_string("formspec",fs) + meta:set_string("text",dispstr) +end + +digistuff.update_ts_formspec = function (pos) + local meta = minetest.get_meta(pos) + local fs = "size[10,8]".. + "background[0,0;0,0;digistuff_ts_bg.png;true]" + if meta:get_int("init") == 0 then + fs = fs.."field[3.75,3;3,1;channel;Channel;]".. + "button_exit[4,3.75;2,1;save;Save]" + else + local data = minetest.deserialize(meta:get_string("data")) or {} + for _,field in pairs(data) do + if field.type == "image" then + fs = fs..string.format("image[%s,%s;%s,%s;%s]",field.X,field.Y,field.W,field.H,field.texture_name) + elseif field.type == "field" then + fs = fs..string.format("field[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label,field.default) + elseif field.type == "pwdfield" then + fs = fs..string.format("pwdfield[%s,%s;%s,%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label) + elseif field.type == "textarea" then + fs = fs..string.format("textarea[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label,field.default) + elseif field.type == "label" then + fs = fs..string.format("label[%s,%s;%s]",field.X,field.Y,field.label) + elseif field.type == "vertlabel" then + fs = fs..string.format("vertlabel[%s,%s;%s]",field.X,field.Y,field.label) + elseif field.type == "button" then + fs = fs..string.format("button[%s,%s;%s,%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label) + elseif field.type == "button_exit" then + fs = fs..string.format("button_exit[%s,%s;%s,%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label) + elseif field.type == "image_button" then + fs = fs..string.format("image_button[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.image,field.name,field.label) + elseif field.type == "image_button_exit" then + fs = fs..string.format("image_button_exit[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.image,field.name,field.label) + elseif field.type == "dropdown" then + local choices = "" + for _,i in ipairs(field.choices) do + if type(i) == "string" then + choices = choices..minetest.formspec_escape(i).."," + end + end + choices = string.sub(choices,1,-2) + fs = fs..string.format("dropdown[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,choices,field.selected_id) + end + end + end + meta:set_string("formspec",fs) +end + +digistuff.ts_on_receive_fields = function (pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + local playername = sender:get_player_name() + local locked = meta:get_int("locked") == 1 + local can_bypass = minetest.check_player_privs(playername,{protection_bypass=true}) + local is_protected = minetest.is_protected(pos,playername) + if (locked and is_protected) and not can_bypass then + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this screen.") + return + end + local init = meta:get_int("init") == 1 + if not init then + if fields.save then + meta:set_string("channel",fields.channel) + meta:set_int("init",1) + digistuff.update_ts_formspec(pos) + end + else + digiline:receptor_send(pos, digiline.rules.default, setchan, fields) + end +end + +digistuff.process_command = function (meta, data, msg) + if msg.command == "clear" then + data = {} + elseif msg.command == "addimage" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + if not msg.texture_name or type(msg.texture_name) ~= "string" then + return + end + local field = {type="image",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,texture_name=minetest.formspec_escape(msg.texture_name)} + table.insert(data,field) + elseif msg.command == "addfield" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"name","label","default"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="field",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label),default=minetest.formspec_escape(msg.default)} + table.insert(data,field) + elseif msg.command == "addpwdfield" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"name","label"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="pwdfield",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addtextarea" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"name","label","default"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="textarea",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label),default=minetest.formspec_escape(msg.default)} + table.insert(data,field) + elseif msg.command == "addlabel" then + for _,i in pairs({"X","Y"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + if not msg.label or type(msg.label) ~= "string" then + return + end + local field = {type="label",X=msg.X,Y=msg.Y,label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addvertlabel" then + for _,i in pairs({"X","Y"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + if not msg.label or type(msg.label) ~= "string" then + return + end + local field = {type="vertlabel",X=msg.X,Y=msg.Y,label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addbutton" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"name","label"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="button",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addbutton_exit" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"name","label"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="button_exit",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addimage_button" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"image","name","label"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="image_button",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,image=minetest.formspec_escape(msg.image),name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addimage_button_exit" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"image","name","label"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="image_button_exit",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,image=minetest.formspec_escape(msg.image),name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "adddropdown" then + for _,i in pairs({"X","Y","W","H","selected_id"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + if not msg.name or type(msg.name) ~= "string" then + return + end + if not msg.choices or type(msg.choices) ~= "table" or #msg.choices < 1 then + return + end + local field = {type="dropdown",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=msg.name,selected_id=msg.selected_id,choices=msg.choices} + table.insert(data,field) + elseif msg.command == "lock" then + meta:set_int("locked",1) + elseif msg.command == "unlock" then + meta:set_int("locked",0) + end + return data +end + +digistuff.ts_on_digiline_receive = function (pos, node, channel, msg) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + if channel ~= setchan then return end + if type(msg) ~= "table" then return end + local data = minetest.deserialize(meta:get_string("data")) or {} + if msg.command then + data = digistuff.process_command(meta,data,msg) + else + for _,i in ipairs(msg) do + if i.command then + data = digistuff.process_command(meta,data,i) or data + end + end + end + meta:set_string("data",minetest.serialize(data)) + digistuff.update_ts_formspec(pos) +end + +digistuff.panel_on_digiline_receive = function (pos, node, channel, msg) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + if channel ~= setchan then return end + if type(msg) ~= "string" then return end + digistuff.update_panel_formspec(pos,msg) +end + +digistuff.panel_on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + local playername = sender:get_player_name() + local locked = meta:get_int("locked") == 1 + local can_bypass = minetest.check_player_privs(playername,{protection_bypass=true}) + local is_protected = minetest.is_protected(pos,playername) + if fields.savechan then + if can_bypass or not is_protected then + meta:set_string("channel",fields.channel) + local helpmsg = "Channel has been set. Waiting for data..." + digistuff.update_panel_formspec(pos,helpmsg) + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to change the channel of this panel.") + end + elseif fields.up then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "up") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.down then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "down") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.left then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "left") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.right then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "right") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.back then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "back") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.enter then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "enter") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.lock then + if can_bypass or not is_protected then + meta:set_int("locked",1) + minetest.chat_send_player(playername,"This panel has been locked. Access will now be controlled according to area protection.") + digistuff.update_panel_formspec(pos,meta:get_string("text")) + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to lock this panel.") + end + elseif fields.unlock then + if can_bypass or not is_protected then + meta:set_int("locked",0) + minetest.chat_send_player(playername,"This panel has been unlocked. It can now be used (but not locked or have the channel changed) by anyone.") + digistuff.update_panel_formspec(pos,meta:get_string("text")) + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to unlock this panel.") + end + end +end + +digistuff.button_turnoff = function (pos) + local node = minetest.get_node(pos) + if node.name=="digistuff:button_on" then --has not been dug + minetest.swap_node(pos, {name = "digistuff:button_off", param2=node.param2}) + if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_pop", {pos=pos}) end + end +end + +minetest.register_node("digistuff:digimese", { + description = "Digimese", + tiles = {"digistuff_digimese.png"}, + paramtype = "light", + light_source = 3, + groups = {cracky = 3, level = 2}, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + digiline = { wire = { rules = { + {x = 1, y = 0, z = 0}, + {x =-1, y = 0, z = 0}, + {x = 0, y = 1, z = 0}, + {x = 0, y =-1, z = 0}, + {x = 0, y = 0, z = 1}, + {x = 0, y = 0, z =-1}}}} +}) + +minetest.register_node("digistuff:button", { + drawtype = "nodebox", + tiles = { + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_off.png" + }, + paramtype = "light", + paramtype2 = "facedir", + legacy_wallmounted = true, + walkable = false, + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 } + }, + node_box = { + type = "fixed", + fixed = { + { -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, -- the thin plate behind the button + { -4/16, -2/16, 4/16, 4/16, 2/16, 6/16 } -- the button itself + } + }, + digiline = + { + receptor = {} + }, + groups = {dig_immediate=2}, + description = "Digilines Button", + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","size[8,4;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;msg;Message;${msg}]button_exit[2.25,3;3,1;submit;Save]") + end, + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + if fields.channel and fields.msg and fields.channel ~= "" and fields.msg ~= "" then + meta:set_string("channel",fields.channel) + meta:set_string("msg",fields.msg) + meta:set_string("formspec","") + minetest.swap_node(pos, {name = "digibutton:button_off", param2=minetest.get_node(pos).param2}) + else + minetest.chat_send_player(sender:get_player_name(),"Channel and message must both be set!") + end + end, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("digistuff:button_off", { + drawtype = "nodebox", + tiles = { + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_off.png" + }, + paramtype = "light", + paramtype2 = "facedir", + legacy_wallmounted = true, + walkable = false, + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 } + }, + node_box = { + type = "fixed", + fixed = { + { -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, -- the thin plate behind the button + { -4/16, -2/16, 4/16, 4/16, 2/16, 6/16 } -- the button itself + } + }, + digiline = + { + receptor = {} + }, + groups = {dig_immediate=2, not_in_creative_inventory=1}, + drop = "digistuff:button", + description = "Digilines Button (off state - you hacker you!)", + on_rightclick = function (pos, node, clicker) + local meta = minetest.get_meta(pos) + digiline:receptor_send(pos, digiline.rules.default, meta:get_string("channel"), meta:get_string("msg")) + minetest.swap_node(pos, {name = "digistuff:button_on", param2=node.param2}) + if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end + minetest.after(0.5, digistuff.button_turnoff, pos) + end, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("digistuff:button_on", { + drawtype = "nodebox", + tiles = { + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_on.png" + }, + paramtype = "light", + paramtype2 = "facedir", + legacy_wallmounted = true, + walkable = false, + light_source = default.LIGHT_MAX-7, + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 } + }, + node_box = { + type = "fixed", + fixed = { + { -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, + { -4/16, -2/16, 11/32, 4/16, 2/16, 6/16 } + } + }, + digiline = + { + receptor = {} + }, + groups = {dig_immediate=2, not_in_creative_inventory=1}, + drop = 'digistuff:button', + on_rightclick = function (pos, node, clicker) + local meta = minetest.get_meta(pos) + digiline:receptor_send(pos, digiline.rules.default, meta:get_string("channel"), meta:get_string("msg")) + if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end + end, + description = "Digilines Button (on state - you hacker you!)", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_craft({ + output = "digistuff:digimese", + recipe = { + {"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000"}, + {"digilines:wire_std_00000000","default:mese","digilines:wire_std_00000000"}, + {"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000"} + } +}) + +minetest.register_craft({ + output = "digistuff:button", + recipe = { + {"mesecons_button:button_off"}, + {"mesecons_luacontroller:luacontroller0000"}, + {"digilines:wire_std_00000000"} + } +}) + +minetest.register_alias("digibutton:button","digistuff:button") +minetest.register_alias("digibutton:button_off","digistuff:button_off") +minetest.register_alias("digibutton:button_on","digistuff:button_on") +minetest.register_alias("digibutton:digimese","digistuff:digimese") + +minetest.register_node("digistuff:detector", { + tiles = { + "digistuff_digidetector.png" + }, + digiline = + { + receptor = {} + }, + groups = {cracky=2}, + description = "Digilines Player Detector", + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","size[8,4;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;radius;Radius;${radius}]button_exit[2.25,3;3,1;submit;Save]") + end, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + if fields.msg then meta:set_string("msg",fields.msg) end + if fields.radius then meta:set_string("radius",fields.radius) end + end, + sounds = default.node_sound_stone_defaults() +}) + +minetest.register_abm({ + nodenames = {"digistuff:detector"}, + interval = 1.0, + chance = 1, + action = function(pos) + local meta = minetest.get_meta(pos) + local channel = meta:get_string("channel") + local radius = meta:get_string("radius") + local found_any = false + local players_found = {} + if not radius or not tonumber(radius) or tonumber(radius) < 1 or tonumber(radius) > 10 then radius = 6 end + local objs = minetest.get_objects_inside_radius(pos, radius) + if objs then + local _,obj + for _,obj in ipairs(objs) do + if obj:is_player() then + table.insert(players_found,obj:get_player_name()) + found_any = true + end + end + if found_any then + digiline:receptor_send(pos, digiline.rules.default, channel, players_found) + end + end + end +}) + +minetest.register_node("digistuff:panel", { + description = "Digilines Control Panel", + groups = {cracky=3}, + on_construct = function(pos) + local helpmsg = "Please set a channel." + digistuff.update_panel_formspec(pos,helpmsg) + minetest.get_meta(pos):set_int("locked",0) + end, + drawtype = "nodebox", + tiles = { + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_front.png" + }, + paramtype = "light", + paramtype2 = "facedir", + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 } + } + }, + on_receive_fields = digistuff.panel_on_receive_fields, + digiline = + { + receptor = {}, + effector = { + action = digistuff.panel_on_digiline_receive + }, + }, +}) + +minetest.register_craft({ + output = "digistuff:detector", + recipe = { + {"mesecons_detector:object_detector_off"}, + {"mesecons_luacontroller:luacontroller0000"}, + {"digilines:wire_std_00000000"} + } +}) + +minetest.register_craft({ + output = "digistuff:panel", + recipe = { + {"","digistuff:button",""}, + {"digistuff:button","digilines:lcd","digistuff:button"}, + {"","digistuff:button",""} + } +}) + +minetest.register_craft({ + output = "digistuff:touchscreen", + recipe = { + {"mesecons_luacontroller:luacontroller0000","default:glass","default:glass"}, + {"default:glass","digilines:lcd","default:glass"}, + {"default:glass","default:glass","default:glass"} + } +}) + +minetest.register_node("digistuff:touchscreen", { + description = "Digilines Touchscreen", + groups = {cracky=3}, + on_construct = function(pos) + digistuff.update_ts_formspec(pos,true) + end, + drawtype = "nodebox", + tiles = { + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_ts_front.png" + }, + paramtype = "light", + paramtype2 = "facedir", + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 } + } + }, + on_receive_fields = digistuff.ts_on_receive_fields, + digiline = + { + receptor = {}, + effector = { + action = digistuff.ts_on_digiline_receive + }, + }, +}) + +minetest.register_node("digistuff:piezo", { + description = "Digilines Piezoelectric Beeper", + groups = {cracky=3}, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","field[channel;Channel;${channel}") + end, + on_destruct = function(pos) + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + end, + tiles = { + "digistuff_piezo_top.png", + "digistuff_piezo_sides.png", + "digistuff_piezo_sides.png", + "digistuff_piezo_sides.png", + "digistuff_piezo_sides.png", + "digistuff_piezo_sides.png" + }, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + end, + digiline = + { + receptor = {}, + effector = { + action = function(pos,node,channel,msg) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + if channel ~= setchan then return end + if msg == "shortbeep" then + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + minetest.sound_play({name = "digistuff_piezo_short_single",gain = 0.2},{pos = pos,max_hear_distance = 16}) + elseif msg == "longbeep" then + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + minetest.sound_play({name = "digistuff_piezo_long_single",gain = 0.2},{pos = pos,max_hear_distance = 16}) + elseif msg == "fastrepeat" then + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + digistuff.sounds_playing[pos_hash] = minetest.sound_play({name = "digistuff_piezo_fast_repeat",gain = 0.2},{pos = pos,max_hear_distance = 16,loop = true}) + elseif msg == "slowrepeat" then + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + digistuff.sounds_playing[pos_hash] = minetest.sound_play({name = "digistuff_piezo_slow_repeat",gain = 0.2},{pos = pos,max_hear_distance = 16,loop = true}) + elseif msg == "stop" then + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + end + end + }, + }, +}) + +local http = minetest.request_http_api() + +if http then + minetest.register_node("digistuff:nic", { + description = "Digilines NIC", + groups = {cracky=3}, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","field[channel;Channel;${channel}") + end, + tiles = { + "digistuff_nic_top.png", + "jeija_microcontroller_bottom.png", + "jeija_microcontroller_sides.png", + "jeija_microcontroller_sides.png", + "jeija_microcontroller_sides.png", + "jeija_microcontroller_sides.png" + }, + drawtype = "nodebox", + selection_box = { + --From luacontroller + type = "fixed", + fixed = { -8/16, -8/16, -8/16, 8/16, -5/16, 8/16 }, + }, + node_box = { + --From Luacontroller + type = "fixed", + fixed = { + {-8/16, -8/16, -8/16, 8/16, -7/16, 8/16}, -- Bottom slab + {-5/16, -7/16, -5/16, 5/16, -6/16, 5/16}, -- Circuit board + {-3/16, -6/16, -3/16, 3/16, -5/16, 3/16}, -- IC + } + }, + paramtype = "light", + sunlight_propagates = true, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + end, + digiline = + { + receptor = {}, + effector = { + action = function(pos,node,channel,msg) + local meta = minetest.get_meta(pos) + if meta:get_string("channel") ~= channel then return end + if type(msg) ~= "string" then return end + http.fetch({ + url = msg, + timeout = 5, + user_agent = "Minetest Digilines Modem", + }, + function(res) + digiline:receptor_send(pos, digiline.rules.default, channel, res) + end) + end + }, + }, + }) + minetest.register_craft({ + output = "digistuff:nic", + recipe = { + {"","","mesecons:wire_00000000_off"}, + {"digilines:wire_std_00000000","mesecons_luacontroller:luacontroller0000","mesecons:wire_00000000_off"} + } + }) +end + +minetest.register_node("digistuff:camera", { + tiles = { + "digistuff_camera_top.png", + "digistuff_camera_bottom.png", + "digistuff_camera_right.png", + "digistuff_camera_left.png", + "digistuff_camera_back.png", + "digistuff_camera_front.png", + }, + digiline = + { + receptor = {} + }, + groups = {cracky=2}, + paramtype = "light", + paramtype2 = "facedir", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.1,-0.5,-0.28,0.1,-0.3,0.3}, --Camera Body + {-0.045,-0.42,-0.34,0.045,-0.36,-0.28}, -- Lens + {-0.05,-0.9,-0.05,0.05,-0.5,0.05}, --Pole + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.1,-0.5,-0.34,0.1,-0.3,0.3}, --Camera Body + } + }, + description = "Digilines Camera", + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","size[8,6;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;radius;Radius (max 10);${radius}]field[1,3;6,2;distance;Distance (max 20);${distance}]button_exit[2.25,4;3,1;submit;Save]") + end, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + if fields.distance and tonumber(fields.distance) then meta:set_int("distance",math.max(math.min(20,fields.distance),0)) end + if fields.radius and tonumber(fields.radius) then meta:set_int("radius",math.max(math.min(10,fields.radius),1)) end + end, + sounds = default.node_sound_stone_defaults() +}) + +minetest.register_abm({ + nodenames = {"digistuff:camera"}, + interval = 1.0, + chance = 1, + action = function(pos,node) + local meta = minetest.get_meta(pos) + local channel = meta:get_string("channel") + local radius = meta:get_int("radius") + local distance = meta:get_int("distance") + local dir = vector.multiply(minetest.facedir_to_dir(node.param2),-1) + local spot = vector.add(pos,vector.multiply(dir,distance)) + local i = 0 + while i <= 10 and minetest.get_node(spot).name == "air" do + --Downward search for ground level + spot = vector.add(spot,vector.new(0,-1,0)) + i = i + 1 + end + if minetest.get_node(spot).name == "air" or minetest.get_node(spot).name == "ignore" then + --Ground not in range + return + end + + local found_any = false + local players_found = {} + local objs = minetest.get_objects_inside_radius(spot,radius) + if objs then + local _,obj + for _,obj in ipairs(objs) do + if obj:is_player() then + table.insert(players_found,obj:get_player_name()) + found_any = true + end + end + if found_any then + digiline:receptor_send({x=pos.x,y=pos.y-1,z=pos.z}, digiline.rules.default, channel, players_found) + end + end + end +}) + +minetest.register_craft({ + output = "digistuff:camera", + recipe = { + {"homedecor:plastic_sheeting","homedecor:plastic_sheeting","homedecor:plastic_sheeting"}, + {"default:glass","homedecor:ic","mesecons_luacontroller:luacontroller0000"}, + {"homedecor:plastic_sheeting","homedecor:plastic_sheeting","homedecor:plastic_sheeting"}, + } +}) diff --git a/digistuff/sounds/digistuff_piezo_fast_repeat.ogg b/digistuff/sounds/digistuff_piezo_fast_repeat.ogg Binary files differnew file mode 100644 index 0000000..be035da --- /dev/null +++ b/digistuff/sounds/digistuff_piezo_fast_repeat.ogg diff --git a/digistuff/sounds/digistuff_piezo_long_single.ogg b/digistuff/sounds/digistuff_piezo_long_single.ogg Binary files differnew file mode 100644 index 0000000..435ac61 --- /dev/null +++ b/digistuff/sounds/digistuff_piezo_long_single.ogg diff --git a/digistuff/sounds/digistuff_piezo_short_single.ogg b/digistuff/sounds/digistuff_piezo_short_single.ogg Binary files differnew file mode 100644 index 0000000..0178f15 --- /dev/null +++ b/digistuff/sounds/digistuff_piezo_short_single.ogg diff --git a/digistuff/sounds/digistuff_piezo_slow_repeat.ogg b/digistuff/sounds/digistuff_piezo_slow_repeat.ogg Binary files differnew file mode 100644 index 0000000..1b35343 --- /dev/null +++ b/digistuff/sounds/digistuff_piezo_slow_repeat.ogg diff --git a/digistuff/textures/digistuff_adwaita_edit-undo.png b/digistuff/textures/digistuff_adwaita_edit-undo.png Binary files differnew file mode 100644 index 0000000..ab01729 --- /dev/null +++ b/digistuff/textures/digistuff_adwaita_edit-undo.png diff --git a/digistuff/textures/digistuff_adwaita_emblem-default.png b/digistuff/textures/digistuff_adwaita_emblem-default.png Binary files differnew file mode 100644 index 0000000..4caba38 --- /dev/null +++ b/digistuff/textures/digistuff_adwaita_emblem-default.png diff --git a/digistuff/textures/digistuff_adwaita_go-down.png b/digistuff/textures/digistuff_adwaita_go-down.png Binary files differnew file mode 100644 index 0000000..53cedf0 --- /dev/null +++ b/digistuff/textures/digistuff_adwaita_go-down.png diff --git a/digistuff/textures/digistuff_adwaita_go-next.png b/digistuff/textures/digistuff_adwaita_go-next.png Binary files differnew file mode 100644 index 0000000..3b7d049 --- /dev/null +++ b/digistuff/textures/digistuff_adwaita_go-next.png diff --git a/digistuff/textures/digistuff_adwaita_go-previous.png b/digistuff/textures/digistuff_adwaita_go-previous.png Binary files differnew file mode 100644 index 0000000..0df44ef --- /dev/null +++ b/digistuff/textures/digistuff_adwaita_go-previous.png diff --git a/digistuff/textures/digistuff_adwaita_go-up.png b/digistuff/textures/digistuff_adwaita_go-up.png Binary files differnew file mode 100644 index 0000000..e13742a --- /dev/null +++ b/digistuff/textures/digistuff_adwaita_go-up.png diff --git a/digistuff/textures/digistuff_camera_back.png b/digistuff/textures/digistuff_camera_back.png Binary files differnew file mode 100644 index 0000000..61653a7 --- /dev/null +++ b/digistuff/textures/digistuff_camera_back.png diff --git a/digistuff/textures/digistuff_camera_bottom.png b/digistuff/textures/digistuff_camera_bottom.png Binary files differnew file mode 100644 index 0000000..72bce61 --- /dev/null +++ b/digistuff/textures/digistuff_camera_bottom.png diff --git a/digistuff/textures/digistuff_camera_front.png b/digistuff/textures/digistuff_camera_front.png Binary files differnew file mode 100644 index 0000000..4981c98 --- /dev/null +++ b/digistuff/textures/digistuff_camera_front.png diff --git a/digistuff/textures/digistuff_camera_left.png b/digistuff/textures/digistuff_camera_left.png Binary files differnew file mode 100644 index 0000000..0243ad1 --- /dev/null +++ b/digistuff/textures/digistuff_camera_left.png diff --git a/digistuff/textures/digistuff_camera_pole.png b/digistuff/textures/digistuff_camera_pole.png Binary files differnew file mode 100644 index 0000000..49a5ef8 --- /dev/null +++ b/digistuff/textures/digistuff_camera_pole.png diff --git a/digistuff/textures/digistuff_camera_right.png b/digistuff/textures/digistuff_camera_right.png Binary files differnew file mode 100644 index 0000000..5dca35f --- /dev/null +++ b/digistuff/textures/digistuff_camera_right.png diff --git a/digistuff/textures/digistuff_camera_top.png b/digistuff/textures/digistuff_camera_top.png Binary files differnew file mode 100644 index 0000000..fca75f8 --- /dev/null +++ b/digistuff/textures/digistuff_camera_top.png diff --git a/digistuff/textures/digistuff_digibutton_off.png b/digistuff/textures/digistuff_digibutton_off.png Binary files differnew file mode 100644 index 0000000..9e4506b --- /dev/null +++ b/digistuff/textures/digistuff_digibutton_off.png diff --git a/digistuff/textures/digistuff_digibutton_on.png b/digistuff/textures/digistuff_digibutton_on.png Binary files differnew file mode 100644 index 0000000..1466179 --- /dev/null +++ b/digistuff/textures/digistuff_digibutton_on.png diff --git a/digistuff/textures/digistuff_digibutton_sides.png b/digistuff/textures/digistuff_digibutton_sides.png Binary files differnew file mode 100644 index 0000000..9b79b57 --- /dev/null +++ b/digistuff/textures/digistuff_digibutton_sides.png diff --git a/digistuff/textures/digistuff_digidetector.png b/digistuff/textures/digistuff_digidetector.png Binary files differnew file mode 100644 index 0000000..42902f3 --- /dev/null +++ b/digistuff/textures/digistuff_digidetector.png diff --git a/digistuff/textures/digistuff_digimese.png b/digistuff/textures/digistuff_digimese.png Binary files differnew file mode 100644 index 0000000..aa6b97b --- /dev/null +++ b/digistuff/textures/digistuff_digimese.png diff --git a/digistuff/textures/digistuff_nic_top.png b/digistuff/textures/digistuff_nic_top.png Binary files differnew file mode 100644 index 0000000..da49613 --- /dev/null +++ b/digistuff/textures/digistuff_nic_top.png diff --git a/digistuff/textures/digistuff_panel_back.png b/digistuff/textures/digistuff_panel_back.png Binary files differnew file mode 100644 index 0000000..b1a5344 --- /dev/null +++ b/digistuff/textures/digistuff_panel_back.png diff --git a/digistuff/textures/digistuff_panel_bg.png b/digistuff/textures/digistuff_panel_bg.png Binary files differnew file mode 100644 index 0000000..d357b1b --- /dev/null +++ b/digistuff/textures/digistuff_panel_bg.png diff --git a/digistuff/textures/digistuff_panel_front.png b/digistuff/textures/digistuff_panel_front.png Binary files differnew file mode 100644 index 0000000..d3083fa --- /dev/null +++ b/digistuff/textures/digistuff_panel_front.png diff --git a/digistuff/textures/digistuff_panel_locked.png b/digistuff/textures/digistuff_panel_locked.png Binary files differnew file mode 100644 index 0000000..5e523a6 --- /dev/null +++ b/digistuff/textures/digistuff_panel_locked.png diff --git a/digistuff/textures/digistuff_panel_unlocked.png b/digistuff/textures/digistuff_panel_unlocked.png Binary files differnew file mode 100644 index 0000000..c94f26c --- /dev/null +++ b/digistuff/textures/digistuff_panel_unlocked.png diff --git a/digistuff/textures/digistuff_piezo_sides.png b/digistuff/textures/digistuff_piezo_sides.png Binary files differnew file mode 100644 index 0000000..7d66228 --- /dev/null +++ b/digistuff/textures/digistuff_piezo_sides.png diff --git a/digistuff/textures/digistuff_piezo_top.png b/digistuff/textures/digistuff_piezo_top.png Binary files differnew file mode 100644 index 0000000..44f8e07 --- /dev/null +++ b/digistuff/textures/digistuff_piezo_top.png diff --git a/digistuff/textures/digistuff_ts_bg.png b/digistuff/textures/digistuff_ts_bg.png Binary files differnew file mode 100644 index 0000000..87c54f2 --- /dev/null +++ b/digistuff/textures/digistuff_ts_bg.png diff --git a/digistuff/textures/digistuff_ts_front.png b/digistuff/textures/digistuff_ts_front.png Binary files differnew file mode 100644 index 0000000..bd4c326 --- /dev/null +++ b/digistuff/textures/digistuff_ts_front.png diff --git a/homedecor/bathroom_furniture.lua b/homedecor/bathroom_furniture.lua index 585327b..0e839fd 100644 --- a/homedecor/bathroom_furniture.lua +++ b/homedecor/bathroom_furniture.lua @@ -137,13 +137,13 @@ local old_to_color = { minetest.register_lbm({ name = "homedecor:convert_bathroom_tiles", label = "Convert bathroom tiles to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = homedecor.old_static_bathroom_tiles, action = function(pos, node) local name = node.name local newname = "homedecor:bathroom_tiles_light" - local a,b = string.find(node.name, "_") - local color = string.sub(node.name, a + 1) + local a = string.find(name, "_") + local color = string.sub(name, a + 1) if color == "tan" then color = "yellow_s50" diff --git a/homedecor/bedroom.lua b/homedecor/bedroom.lua index 8e29ee3..1a7e42f 100644 --- a/homedecor/bedroom.lua +++ b/homedecor/bedroom.lua @@ -228,12 +228,14 @@ end minetest.register_lbm({ name = "homedecor:convert_beds", label = "Convert homedecor static bed nodes to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = homedecor.old_bed_nodes, action = function(pos, node) local name = node.name local color = string.sub(name, string.find(name, "_") + 1) - local color = string.sub(color, 1, string.find(color, "_", -10) - 1) -- -10 puts us near the end of the color field + + -- -10 puts us near the end of the color field + color = string.sub(color, 1, string.find(color, "_", -10) - 1) if color == "darkgrey" then color = "dark_grey" diff --git a/homedecor/books.lua b/homedecor/books.lua index 27127e3..a2213ac 100644 --- a/homedecor/books.lua +++ b/homedecor/books.lua @@ -1,8 +1,6 @@ local S = homedecor_i18n.gettext -local function N_(x) return x end - local BOOK_FORMNAME = "homedecor:book_form" local player_current_book = { } @@ -189,7 +187,7 @@ end minetest.register_lbm({ name = "homedecor:convert_books", label = "Convert homedecor books to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = homedecor.old_static_books, action = function(pos, node) local name = node.name diff --git a/homedecor/crafts.lua b/homedecor/crafts.lua index 9877f84..e2570cb 100644 --- a/homedecor/crafts.lua +++ b/homedecor/crafts.lua @@ -2476,18 +2476,6 @@ minetest.register_craft( { }, }) -local bedcolors = { - { "red", "red"}, - { "orange", "orange" }, - { "yellow", "yellow"}, - { "green", "dark_green"}, - { "blue", "blue"}, - { "violet", "violet"}, - { "pink", "pink"}, - { "darkgrey", "dark_grey"}, - { "brown", "brown" }, -} - minetest.register_craft( { output = "homedecor:bed_regular", recipe = { diff --git a/homedecor/fences.lua b/homedecor/fences.lua index 642b7c9..3affefe 100644 --- a/homedecor/fences.lua +++ b/homedecor/fences.lua @@ -16,8 +16,6 @@ end local S = homedecor_i18n.gettext -local function N_(x) return x end - local materials = { { S("brass"), "brass" }, { S("wrought iron"), "wrought_iron" }, diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua index d1e24a9..30e8e06 100644 --- a/homedecor/furniture.lua +++ b/homedecor/furniture.lua @@ -32,16 +32,6 @@ for _, t in ipairs(table_colors) do }) end -local chaircolors = { - { "", S("plain") }, - { "black", S("black") }, - { "red", S("red") }, - { "pink", S("pink") }, - { "violet", S("violet") }, - { "blue", S("blue") }, - { "dark_green", S("dark green") }, -} - local kc_cbox = { type = "fixed", fixed = { -0.3125, -0.5, -0.3125, 0.3125, 0.5, 0.3125 }, @@ -93,7 +83,6 @@ homedecor.register("kitchen_chair_padded", { after_place_node = homedecor.fix_rotation_nsew, after_dig_node = unifieddyes.after_dig_node, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() pos.y = pos.y+0 -- where do I put my ass ? homedecor.sit(pos, node, clicker) return itemstack @@ -179,7 +168,7 @@ table.insert(homedecor.old_static_chairs, "homedecor:chair") minetest.register_lbm({ name = "homedecor:convert_chairs", label = "Convert homedecor chairs to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = homedecor.old_static_chairs, action = function(pos, node) local name = node.name @@ -200,7 +189,7 @@ minetest.register_lbm({ color = "dark_grey" end - paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted") + paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted") end local old_fdir = math.floor(node.param2 % 32) diff --git a/homedecor/handlers/expansion.lua b/homedecor/handlers/expansion.lua index 13c69f9..17d6d31 100644 --- a/homedecor/handlers/expansion.lua +++ b/homedecor/handlers/expansion.lua @@ -230,18 +230,9 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks end local toppos = {x=pos.x, y=pos.y+1.0, z=pos.z} - local botpos = {x=pos.x, y=pos.y-1.0, z=pos.z} - local topposfwd = {x=toppos.x+fxd, y=toppos.y, z=toppos.z+fzd} - local topnodefwd = minetest.get_node(topposfwd) - - local topnode = minetest.get_node(toppos) - local bottomnode = minetest.get_node(botpos) - - print(topnode.name, thisnode.name, bottomnode.name, itemstack:get_name(), dump(trybunks)) if trybunks and is_buildable_to(placer_name, toppos, topposfwd) then - print("want to stack beds, top seems to be clear") local newname = string.gsub(thisnode.name, "_regular", "_extended") minetest.set_node(toppos, { name = thisnode.name, param2 = fdir}) minetest.set_node(pos, { name = newname, param2 = fdir}) diff --git a/homedecor/lighting.lua b/homedecor/lighting.lua index f7314d0..62a88a9 100644 --- a/homedecor/lighting.lua +++ b/homedecor/lighting.lua @@ -1,13 +1,7 @@ -- This file supplies glowlights -local dirs2 = { 9, 18, 7, 12 } - local S = homedecor_i18n.gettext -local function N_(x) return x end - -local colors = { N_("yellow"), N_("white") } - local glowlight_nodebox = { half = homedecor.nodebox.slab_y(1/2), quarter = homedecor.nodebox.slab_y(1/4), @@ -563,7 +557,7 @@ end minetest.register_lbm({ name = "homedecor:convert_lighting", label = "Convert homedecor glowlights, table lamps, and standing lamps to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = homedecor.old_static_nodes, action = function(pos, node) local name = node.name @@ -579,7 +573,7 @@ minetest.register_lbm({ end local lampname - if string.find(name, "standing_lamp") then + if string.find(name, "standing_lamp") then lampname = "homedecor:standing_lamp" elseif string.find(name, "table_lamp") then lampname = "homedecor:table_lamp" @@ -617,7 +611,6 @@ minetest.register_lbm({ local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, false) - local old_node = node.name local old_fdir local new_node = newname local new_fdir = 1 @@ -664,11 +657,10 @@ homedecor.old_static_desk_lamps = { minetest.register_lbm({ name = "homedecor:convert_desk_lamps", label = "Convert homedecor desk lamps to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = homedecor.old_static_desk_lamps, action = function(pos, node) local name = node.name - local newname local color = string.sub(name, string.find(name, "_", -8) + 1) if color == "green" then diff --git a/homedecor/shutters.lua b/homedecor/shutters.lua index 8feb0e7..ab1321d 100644 --- a/homedecor/shutters.lua +++ b/homedecor/shutters.lua @@ -73,7 +73,7 @@ end minetest.register_lbm({ name = "homedecor:convert_shutters", label = "Convert shutter static nodes to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = homedecor.old_shutter_nodes, action = function(pos, node) local name = node.name diff --git a/homedecor/tables.lua b/homedecor/tables.lua index d0aa812..70ced41 100644 --- a/homedecor/tables.lua +++ b/homedecor/tables.lua @@ -4,7 +4,7 @@ local S = homedecor_i18n.gettext -- Various kinds of tables local materials = { - { "glass", + { "glass", S("Small square glass table"), S("Small round glass table"), S("Large glass table piece"), diff --git a/homedecor/window_treatments.lua b/homedecor/window_treatments.lua index 3b98123..06328d3 100644 --- a/homedecor/window_treatments.lua +++ b/homedecor/window_treatments.lua @@ -1,8 +1,6 @@ local S = homedecor_i18n.gettext -local function N_(x) return x end - homedecor.register("window_quartered", { description = S("Window (quartered)"), tiles = { @@ -117,7 +115,6 @@ minetest.register_node("homedecor:curtain_closed", { after_dig_node = unifieddyes.after_dig_node, after_place_node = homedecor.fix_rotation, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}) if string.find(topnode.name, "homedecor:curtainrod") then -- Open the curtains @@ -144,7 +141,6 @@ minetest.register_node("homedecor:curtain_open", { after_dig_node = unifieddyes.after_dig_node, after_place_node = homedecor.fix_rotation, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}) if string.find(topnode.name, "homedecor:curtainrod") then -- Close the curtains @@ -216,18 +212,17 @@ homedecor.register("stained_glass", { -- Convert old curtain nodes to param2-colorization local curtaincolors = { - { N_("red"), "ad2323" }, - { N_("green"), "27a927" }, - { N_("blue"), "2626c6" }, - { N_("white"), "ffffff" }, - { N_("pink"), "ff8fb7" }, - { N_("violet"), "7f29d7" }, + "red", + "green", + "blue", + "white", + "pink", + "violet", } homedecor.old_static_curtain_nodes = {} -for _, i in ipairs(curtaincolors) do - local color,hue = unpack(i) +for _, color in ipairs(curtaincolors) do table.insert(homedecor.old_static_curtain_nodes, "homedecor:curtain_"..color) table.insert(homedecor.old_static_curtain_nodes, "homedecor:curtain_open_"..color) end @@ -235,7 +230,7 @@ end minetest.register_lbm({ name = "homedecor:convert_curtains", label = "Convert static curtain nodes to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = homedecor.old_static_curtain_nodes, action = function(pos, node) local name = node.name diff --git a/ilights/init.lua b/ilights/init.lua index b94f916..bc58629 100644 --- a/ilights/init.lua +++ b/ilights/init.lua @@ -109,7 +109,7 @@ end minetest.register_lbm({ name = "ilights:convert", label = "Convert ilights static nodes to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = ilights.old_static_nodes, action = function(pos, node) local name = node.name diff --git a/lavalamp/init.lua b/lavalamp/init.lua index 42b70af..bac1616 100644 --- a/lavalamp/init.lua +++ b/lavalamp/init.lua @@ -34,7 +34,6 @@ minetest.register_node("lavalamp:lavalamp", { sounds = default.node_sound_glass_defaults(), after_dig_node = unifieddyes.after_dig_node, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() node.name = "lavalamp:lavalamp_off" minetest.swap_node(pos, node) return itemstack @@ -98,11 +97,10 @@ end minetest.register_lbm({ name = "lavalamp:convert", label = "Convert lava lamps to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = lavalamp.old_static_nodes, action = function(pos, node) local name = node.name - local newname local color if string.find(name, "red") then diff --git a/lrfurn/armchairs.lua b/lrfurn/armchairs.lua index e471267..4fdb512 100644 --- a/lrfurn/armchairs.lua +++ b/lrfurn/armchairs.lua @@ -13,7 +13,7 @@ minetest.register_node("lrfurn:armchair", { drawtype = "mesh", mesh = "lrfurn_armchair.obj", tiles = { - "lrfurn_upholstery.png", + "lrfurn_upholstery.png", { name = "lrfurn_sofa_bottom.png", color = 0xffffffff } }, paramtype = "light", @@ -26,7 +26,6 @@ minetest.register_node("lrfurn:armchair", { after_place_node = lrfurn.fix_rotation, after_dig_node = unifieddyes.after_dig_node, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() if not clicker:is_player() then return itemstack end @@ -67,7 +66,7 @@ end minetest.register_lbm({ name = "lrfurn:convert_armchairs", label = "Convert lrfurn armchairs to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = lrfurn.old_static_armchairs, action = function(pos, node) local name = node.name diff --git a/lrfurn/init.lua b/lrfurn/init.lua index 6434136..1074482 100644 --- a/lrfurn/init.lua +++ b/lrfurn/init.lua @@ -1,6 +1,4 @@ -local S = homedecor_i18n.gettext - lrfurn = {} screwdriver = screwdriver or {} diff --git a/lrfurn/longsofas.lua b/lrfurn/longsofas.lua index b5216c2..3aec132 100644 --- a/lrfurn/longsofas.lua +++ b/lrfurn/longsofas.lua @@ -39,7 +39,6 @@ minetest.register_node("lrfurn:longsofa", { end, after_dig_node = unifieddyes.after_dig_node, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() if not clicker:is_player() then return itemstack end @@ -79,7 +78,7 @@ end minetest.register_lbm({ name = "lrfurn:convert_longsofas", label = "Convert lrfurn long sofas to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = lrfurn.old_static_longsofas, action = function(pos, node) local name = node.name diff --git a/lrfurn/sofas.lua b/lrfurn/sofas.lua index 57d4904..6bdc317 100644 --- a/lrfurn/sofas.lua +++ b/lrfurn/sofas.lua @@ -39,7 +39,6 @@ minetest.register_node("lrfurn:sofa", { end, after_dig_node = unifieddyes.after_dig_node, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - local itemname = itemstack:get_name() if not clicker:is_player() then return itemstack end @@ -79,7 +78,7 @@ end minetest.register_lbm({ name = "lrfurn:convert_sofas", label = "Convert lrfurn short sofas to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = lrfurn.old_static_sofas, action = function(pos, node) local name = node.name diff --git a/rgblightstone/README b/rgblightstone/README new file mode 100644 index 0000000..1b042a0 --- /dev/null +++ b/rgblightstone/README @@ -0,0 +1,43 @@ +RGB Lightstones for Minetest + +License: +---Code: WTFPL +---Textures: "white" image by VanessaE (WTFPL), "palette" image is from here: https://commons.wikimedia.org/wiki/File:256colour.png + +Depends: mesecons_lightstone, digilines +(neither is in depends.txt since the order doesn't matter) + +Instructions: + +* Grab one from the creative inventory, or craft one: + nothing green lightstone nothing + red lightstone luacontroller blue lightstone + nothing digiline nothing + +* Place the thing +* Right-click and set a channel +* Send a digilines message to it on that channel with the color you want (choices listed below) + +Colors available: Any 6-digit hex color, such as "FF0000", "#c0ffee", "123456"... (will be set to the nearest color available) + +Group addressing mode: + +If you are building something with large numbers of these things, set them all to the same channel, set X and Y addresses on each, and send nested tables (Y on the outside) with colors for all of them. +For example, given this display: + +X=1 Y=1 X=2 Y=1 + +X=1 Y=2 X=2 Y=2 + +to make it show: + +red green +blue yellow + +send this: + +{{"red","green"}, +{"blue","yellow"}} + +Note that if you are using group addressing mode, if there is an already-configured RGB lightstone node directly above the one you are setting up, +punching the one you are setting up (or right-clicking and selecting the Auto-Fill option) will attempt to auto-fill it (incrementing the Y address) from the one above. diff --git a/rgblightstone/depends.txt b/rgblightstone/depends.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/rgblightstone/depends.txt diff --git a/rgblightstone/init.lua b/rgblightstone/init.lua new file mode 100644 index 0000000..a26f7ab --- /dev/null +++ b/rgblightstone/init.lua @@ -0,0 +1,145 @@ +rgblightstone = {} + +if type(minetest.colorize) == "function" then + rgblightstone.colorize = minetest.colorize +else + rgblightstone.colorize = function(color,text) + return text + end +end + +function rgblightstone.autofill(pos, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, { protection_bypass = true }) then + minetest.record_protection_violation(pos, name) + return + end + local meta = minetest.get_meta(pos) + if (not meta:get_string("channel")) or meta:get_string("channel")=="" then + local pos_above = {x=pos.x,y=pos.y+1,z=pos.z} + local node_above = minetest.get_node(pos_above) + local meta_above = minetest.get_meta(pos_above) + if string.match(node_above.name,"rgblightstone") and + meta_above:get_string("channel") and + tonumber(meta_above:get_string("addrx")) and + tonumber(meta_above:get_string("addry")) then + local channel = meta_above:get_string("channel") + local addrx = meta_above:get_string("addrx") + local addry = tostring(1+tonumber(meta_above:get_string("addry"))) + meta:set_string("channel",channel) + meta:set_string("addrx",addrx) + meta:set_string("addry",addry) + minetest.chat_send_player(player:get_player_name(),rgblightstone.colorize("#55FF55","Success: ").."Auto-filled with channel "..rgblightstone.colorize("#00FFFF",channel)..", X address "..rgblightstone.colorize("#00FFFF",addrx)..", and Y address "..rgblightstone.colorize("#00FFFF",addry)..".") + meta:set_string("infotext","") + else + minetest.chat_send_player(player:get_player_name(),rgblightstone.colorize("#FF0000","ERROR: ").."Node above is not RGB Lightstone or is not configured correctly!") + end + end +end + +minetest.register_node("rgblightstone:rgblightstone", { + tiles = {"rgblightstone_white.png"}, + palette = "rgblightstone_palette.png", + groups = {cracky=2}, + description = "RGB Lightstone", + paramtype2 = "color", + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "size[8,5;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;2,2;addrx;X Address;${addrx}]field[5,2;2,2;addry;Y Address;${addry}]button_exit[2.25,3;3,1;submit;Save]button_exit[2.25,4;3,1;autofill;Auto-Fill From Node Above]label[3,2;Leave address blank\nfor individual mode]") + meta:set_string("infotext","Not configured! Right-click to set up manually, or punch to auto-fill from the node above.") + meta:set_string("color","000000") + end, + on_punch = function(pos, node, player, pointed_thing) + rgblightstone.autofill(pos,player) + end, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, { protection_bypass = true }) then + minetest.record_protection_violation(pos, name) + return + end + local meta = minetest.get_meta(pos) + if fields.autofill then + rgblightstone.autofill(pos,sender) + else + if fields.channel then + meta:set_string("channel", fields.channel) + meta:set_string("infotext","") + end + if fields.addrx then meta:set_string("addrx",fields.addrx) end + if fields.addry then meta:set_string("addry",fields.addry) end + end + end, + light_source = 0, + digiline = { + receptor = {}, + effector = { + action = function(pos, node, channel, msg) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + if channel ~= setchan then + return + end + + local addrx = tonumber(meta:get_string("addrx")) + local addry = tonumber(meta:get_string("addry")) + + if type(msg) == "table" then + if not (addrx and addry and type(msg[addry]) == "table" and msg[addry][addrx]) then + return + end + msg = msg[addry][addrx] + end + + --Validation starts here + if type(msg) ~= "string" then + return + end + msg = string.upper(msg) + --Drop a leading # if present (e.g. "#FF55AA") + if string.sub(msg,1,1) == "#" then + msg = string.sub(msg,2) + end + --Check length + if string.len(msg) ~= 6 then + return + end + --Make sure there aren't any invalid chars + local acceptable_chars = {["0"]=true,["1"]=true,["2"]=true,["3"]=true,["4"]=true,["5"]=true,["6"]=true,["7"]=true,["8"]=true,["9"]=true,["A"]=true,["B"]=true,["C"]=true,["D"]=true,["E"]=true,["F"]=true} + for i = 1,6,1 do + if not acceptable_chars[string.sub(msg,i,i)] then + return + else + end + end + --Should be a valid hex color by this point + + --Split into three colors + local r = tonumber(string.sub(msg,1,2),16) + local g = tonumber(string.sub(msg,3,4),16) + local b = tonumber(string.sub(msg,5,6),16) + + --Round to nearest available values and convert to a pixel count in the palette + r = math.floor(r/32) + g = math.floor(g/32) + b = math.floor(b/64) --Blue has one fewer bit + + local paletteidx = 32*g+4*r+b + + --Set the color + node.param2 = paletteidx + minetest.swap_node(pos,node) + end + } + } +}) + + +minetest.register_craft({ + output = "rgblightstone:rgblightstone", + recipe = { + {"","mesecons_lightstone:lightstone_green_off",""}, + {"mesecons_lightstone:lightstone_red_off","mesecons_luacontroller:luacontroller0000","mesecons_lightstone:lightstone_blue_off"}, + {"","digilines:wire_std_00000000",""} + } +}) diff --git a/rgblightstone/textures/rgblightstone_palette.png b/rgblightstone/textures/rgblightstone_palette.png Binary files differnew file mode 100644 index 0000000..6043ff1 --- /dev/null +++ b/rgblightstone/textures/rgblightstone_palette.png diff --git a/rgblightstone/textures/rgblightstone_white.png b/rgblightstone/textures/rgblightstone_white.png Binary files differnew file mode 100644 index 0000000..095ca8f --- /dev/null +++ b/rgblightstone/textures/rgblightstone_white.png diff --git a/solidcolor/LICENSE b/solidcolor/LICENSE new file mode 100644 index 0000000..68a49da --- /dev/null +++ b/solidcolor/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to <http://unlicense.org/> diff --git a/solidcolor/depends.txt b/solidcolor/depends.txt new file mode 100644 index 0000000..0a013b1 --- /dev/null +++ b/solidcolor/depends.txt @@ -0,0 +1,2 @@ +unifieddyes +default? diff --git a/solidcolor/init.lua b/solidcolor/init.lua new file mode 100644 index 0000000..0334340 --- /dev/null +++ b/solidcolor/init.lua @@ -0,0 +1,18 @@ +minetest.register_node("solidcolor:block", { + description = "Solid Color Block", + tiles = {"solidcolor_white.png"}, + is_ground_content = false, + groups = {dig_immediate=2,ud_param2_colorable=1}, + sounds = (default and default.node_sound_stone_defaults()), + paramtype2 = "color", + palette = "unifieddyes_palette.png", + after_dig_node = unifieddyes.after_dig_node, +}) + +minetest.register_craft( { + output = "solidcolor:block", + recipe = { + { "dye:white", "dye:white"}, + { "dye:white", "dye:white"}, + }, +}) diff --git a/solidcolor/textures/solidcolor_white.png b/solidcolor/textures/solidcolor_white.png Binary files differnew file mode 100644 index 0000000..002b4a9 --- /dev/null +++ b/solidcolor/textures/solidcolor_white.png diff --git a/stained_glass/init.lua b/stained_glass/init.lua index 32ee83b..f68876b 100644 --- a/stained_glass/init.lua +++ b/stained_glass/init.lua @@ -451,7 +451,7 @@ end minetest.register_lbm({ name = "stained_glass:convert_brickblocks", label = "Convert static glass blocks to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = stainedglass.old_static_nodes, action = function(pos, node) local name = node.name diff --git a/unifiedbricks/init.lua b/unifiedbricks/init.lua index bc42dc4..a4c9758 100644 --- a/unifiedbricks/init.lua +++ b/unifiedbricks/init.lua @@ -280,7 +280,7 @@ end minetest.register_lbm({ name = "unifiedbricks:convert_brickblocks", label = "Convert clay blocks and single-color brick blocks to use param2 color", - run_at_every_load = true, + run_at_every_load = false, nodenames = unifiedbricks.old_static_list, action = function(pos, node) diff --git a/unifiedmesecons/LICENSE b/unifiedmesecons/LICENSE new file mode 100644 index 0000000..143510c --- /dev/null +++ b/unifiedmesecons/LICENSE @@ -0,0 +1,195 @@ +The code in this project is based on code from mesecons by Jeija, and is therefore under the following license: + + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + + +All textures in this mod are by cheapie, and are under the following license: + +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to <http://unlicense.org/> diff --git a/unifiedmesecons/depends.txt b/unifiedmesecons/depends.txt new file mode 100644 index 0000000..568ac19 --- /dev/null +++ b/unifiedmesecons/depends.txt @@ -0,0 +1,3 @@ +mesecons_insulated +mesecons_extrawires +unifieddyes diff --git a/unifiedmesecons/init.lua b/unifiedmesecons/init.lua new file mode 100644 index 0000000..cd8af5a --- /dev/null +++ b/unifiedmesecons/init.lua @@ -0,0 +1,324 @@ +local hues = { + "red", + "orange", + "yellow", + "lime", + "green", + "aqua", + "cyan", + "skyblue", + "blue", + "violet", + "magenta", + "redviolet", + "grey" +} + +local function insulated_wire_get_rules(node) + local rules = {{x = 1, y = 0, z = 0}, + {x =-1, y = 0, z = 0}} + if node.param2%32 == 1 or node.param2%32 == 3 then + return mesecon.rotate_rules_right(rules) + end + return rules +end + +local tjunction_get_rules = function (node) + local rules = + {{x = 0, y = 0, z = 1}, + {x = 1, y = 0, z = 0}, + {x = 0, y = 0, z = -1}} + + for i = 0, node.param2%32 do + rules = mesecon.rotate_rules_left(rules) + end + + return rules +end + +local corner_get_rules = function (node) + local rules = + {{x = 1, y = 0, z = 0}, + {x = 0, y = 0, z = -1}} + + for i = 0, node.param2%32 do + rules = mesecon.rotate_rules_left(rules) + end + + return rules +end + +minetest.unregister_item("mesecons_insulated:insulated_off") +minetest.unregister_item("mesecons_insulated:insulated_on") +minetest.unregister_item("mesecons_extrawires:corner_off") +minetest.unregister_item("mesecons_extrawires:corner_on") +minetest.unregister_item("mesecons_extrawires:tjunction_off") +minetest.unregister_item("mesecons_extrawires:tjunction_on") + +for _,color in pairs(hues) do + mesecon.register_node(":mesecons_insulated:insulated_"..color, { + drawtype = "nodebox", + description = "Insulated Mesecon", + paramtype = "light", + paramtype2 = "colorfacedir", + walkable = false, + sunlight_propagates = true, + on_place = minetest.rotate_node, + drop = "mesecons_insulated:insulated_grey_off", + palette = "unifieddyes_palette_"..color.."s.png", + selection_box = { + type = "fixed", + fixed = { -16/32-0.001, -18/32, -7/32, 16/32+0.001, -12/32, 7/32 } + }, + node_box = { + type = "fixed", + fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 } + }, + }, + { + groups = {dig_immediate = 3,ud_param2_colorable = 1,not_in_creative_inventory = (color~="grey" and 1 or nil)}, + mesecons = {conductor = { + state = mesecon.state.off, + onstate = "mesecons_insulated:insulated_"..color.."_on", + rules = insulated_wire_get_rules + }}, + tiles = { + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_end_off.png", + "unifiedmesecons_wire_end_off.png", + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_off.png", + }, + }, + { + groups = {dig_immediate = 3,not_in_creative_inventory = 1,ud_param2_colorable = 1}, + mesecons = {conductor = { + state = mesecon.state.on, + offstate = "mesecons_insulated:insulated_"..color.."_off", + rules = insulated_wire_get_rules + }}, + tiles = { + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_end_on.png", + "unifiedmesecons_wire_end_on.png", + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_on.png", + }, + }) + mesecon.register_node(":mesecons_extrawires:insulated_corner_"..color, { + drawtype = "nodebox", + description = "Insulated Mesecon Corner", + paramtype = "light", + paramtype2 = "colorfacedir", + walkable = false, + sunlight_propagates = true, + on_place = minetest.rotate_node, + drop = "mesecons_extrawires:insulated_corner_grey_off", + palette = "unifieddyes_palette_"..color.."s.png", + selection_box = { + type = "fixed", + fixed = { -16/32-0.001, -18/32, -16/32, 5/32, -12/32, 5/32 }, + }, + node_box = { + type = "fixed", + fixed = {{ -16/32-0.001, -17/32, -3/32, 0, -13/32, 3/32 }, + { -3/32, -17/32, -16/32+0.001, 3/32, -13/32, 3/32}}, + }, + }, + { + groups = {dig_immediate = 3,ud_param2_colorable = 1,not_in_creative_inventory = (color~="grey" and 1 or nil)}, + mesecons = {conductor = { + state = mesecon.state.off, + onstate = "mesecons_extrawires:insulated_corner_"..color.."_on", + rules = corner_get_rules + }}, + tiles = { + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_end_off.png", + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_end_off.png", + }, + }, + { + groups = {dig_immediate = 3,not_in_creative_inventory = 1,ud_param2_colorable = 1}, + mesecons = {conductor = { + state = mesecon.state.on, + offstate = "mesecons_extrawires:insulated_corner_"..color.."_off", + rules = corner_get_rules + }}, + tiles = { + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_end_on.png", + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_end_on.png", + }, + }) + mesecon.register_node(":mesecons_extrawires:insulated_tjunction_"..color, { + drawtype = "nodebox", + description = "Insulated Mesecon T-Junction", + paramtype = "light", + paramtype2 = "colorfacedir", + walkable = false, + sunlight_propagates = true, + on_place = minetest.rotate_node, + drop = "mesecons_extrawires:insulated_tjunction_grey_off", + palette = "unifieddyes_palette_"..color.."s.png", + node_box = { + type = "fixed", + fixed = {{ -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }, + { -3/32, -17/32, -16/32+0.001, 3/32, -13/32, -3/32},}, + }, + selection_box = { + type = "fixed", + fixed = { -16/32-0.001, -18/32, -16/32, 16/32+0.001, -12/32, 7/32 }, + }, + }, + { + groups = {dig_immediate = 3,ud_param2_colorable = 1,not_in_creative_inventory = (color~="grey" and 1 or nil)}, + mesecons = {conductor = { + state = mesecon.state.off, + onstate = "mesecons_extrawires:insulated_tjunction_"..color.."_on", + rules = tjunction_get_rules + }}, + tiles = { + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_end_off.png", + "unifiedmesecons_wire_end_off.png", + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_end_off.png", + }, + }, + { + groups = {dig_immediate = 3,not_in_creative_inventory = 1,ud_param2_colorable = 1}, + mesecons = {conductor = { + state = mesecon.state.on, + offstate = "mesecons_extrawires:insulated_tjunction_"..color.."_off", + rules = tjunction_get_rules + }}, + tiles = { + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_end_on.png", + "unifiedmesecons_wire_end_on.png", + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_end_on.png", + }, + }) +end + +minetest.override_item("mesecons_extrawires:crossover_off",{ + tiles = { + "unifiedmesecons_wire_end_off.png", + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_end_off.png", + }, +}) + +minetest.override_item("mesecons_extrawires:crossover_01",{ + tiles = { + "unifiedmesecons_wire_end_on.png", + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_end_off.png", + }, +}) + +minetest.override_item("mesecons_extrawires:crossover_10",{ + tiles = { + "unifiedmesecons_wire_end_off.png", + "unifiedmesecons_wire_off.png", + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_end_on.png", + }, +}) + +minetest.override_item("mesecons_extrawires:crossover_on",{ + tiles = { + "unifiedmesecons_wire_end_on.png", + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_on.png", + "unifiedmesecons_wire_end_on.png", + }, +}) + +minetest.register_lbm({ + name = "unifiedmesecons:convert", + label = "Convert insulated mesecons to use param2 coloring", + nodenames = { + "mesecons_insulated:insulated_off", + "mesecons_insulated:insulated_on", + "mesecons_extrawires:corner_off", + "mesecons_extrawires:corner_on", + "mesecons_extrawires:tjunction_off", + "mesecons_extrawires:tjunction_on", + }, + action = function(pos,node) + local name = node.name + if string.find(name,"insulated") then + name = "mesecons_insulated:insulated_blue_" + elseif string.find(name,"corner") then + name = "mesecons_extrawires:insulated_corner_blue_" + elseif string.find(name,"tjunction") then + name = "mesecons_extrawires:insulated_tjunction_blue_" + end + if string.sub(node.name,-3,-1) == "_on" then + node.name = name.."on" + else + node.name = name.."off" + end + node.param2 = (node.param2 % 32) + 128 + minetest.swap_node(pos,node) + end, +}) + +minetest.register_craft({ + output = "mesecons_extrawires:insulated_corner_grey_off 3", + recipe = { + {"", "", ""}, + {"mesecons_insulated:insulated_grey_off", "mesecons_insulated:insulated_grey_off", ""}, + {"", "mesecons_insulated:insulated_grey_off", ""}, + } +}) + +minetest.register_craft({ + output = "mesecons_extrawires:insulated_tjunction_grey_off 3", + recipe = { + {"", "", ""}, + {"mesecons_insulated:insulated_grey_off", "mesecons_insulated:insulated_grey_off", "mesecons_insulated:insulated_grey_off"}, + {"", "mesecons_insulated:insulated_grey_off", ""}, + } +}) + +minetest.register_craft({ + output = "mesecons_insulated:insulated_grey_off 3", + recipe = { + {"mesecons_materials:fiber", "mesecons_materials:fiber", "mesecons_materials:fiber"}, + {"mesecons:wire_00000000_off", "mesecons:wire_00000000_off", "mesecons:wire_00000000_off"}, + {"mesecons_materials:fiber", "mesecons_materials:fiber", "mesecons_materials:fiber"}, + } +}) + +minetest.register_craft({ + type = "shapeless", + output = "mesecons_extrawires:crossover_off", + recipe = { + "mesecons_insulated:insulated_grey_off", + "mesecons_insulated:insulated_grey_off", + }, +}) + +minetest.register_craft({ + type = "shapeless", + output = "mesecons_insulated:insulated_grey_off 2", + recipe = { + "mesecons_extrawires:crossover_off", + }, +}) diff --git a/unifiedmesecons/textures/unifiedmesecons_wire_end_off.png b/unifiedmesecons/textures/unifiedmesecons_wire_end_off.png Binary files differnew file mode 100644 index 0000000..36807c4 --- /dev/null +++ b/unifiedmesecons/textures/unifiedmesecons_wire_end_off.png diff --git a/unifiedmesecons/textures/unifiedmesecons_wire_end_on.png b/unifiedmesecons/textures/unifiedmesecons_wire_end_on.png Binary files differnew file mode 100644 index 0000000..3294f56 --- /dev/null +++ b/unifiedmesecons/textures/unifiedmesecons_wire_end_on.png diff --git a/unifiedmesecons/textures/unifiedmesecons_wire_off.png b/unifiedmesecons/textures/unifiedmesecons_wire_off.png Binary files differnew file mode 100644 index 0000000..57eff63 --- /dev/null +++ b/unifiedmesecons/textures/unifiedmesecons_wire_off.png diff --git a/unifiedmesecons/textures/unifiedmesecons_wire_on.png b/unifiedmesecons/textures/unifiedmesecons_wire_on.png Binary files differnew file mode 100644 index 0000000..429753f --- /dev/null +++ b/unifiedmesecons/textures/unifiedmesecons_wire_on.png |