From 6885943d0491db83268f8bb4743bfd82ed725ea2 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Tue, 14 Mar 2017 00:04:17 -0400 Subject: update coloredwood, digilines, technic, gloopblocks, homedecor, mesecons, pipeworks, player_textures, signs_lib, unifieddyes, and worldedit --- coloredwood/init.lua | 85 +++++----- digilines/settingtypes.txt | 13 ++ extranodes/depends.txt | 1 + extranodes/init.lua | 70 +++++++++ extranodes/models/technic_insulator_clip.obj | 173 +++++++++++++++++++++ extranodes/textures/technic_insulator_clip.png | Bin 0 -> 226 bytes gloopblocks/crafts.lua | 9 ++ homedecor/crafts.lua | 10 +- homedecor/furniture.lua | 20 ++- mesecons_extrawires/vertical.lua | 2 +- mesecons_gates/doc/and/description.html | 2 +- mesecons_gates/doc/diode/description.html | 2 +- mesecons_gates/doc/nand/description.html | 2 +- mesecons_gates/doc/nor/description.html | 2 +- mesecons_gates/doc/not/description.html | 2 +- mesecons_gates/doc/or/description.html | 2 +- mesecons_gates/init.lua | 25 +-- mesecons_insulated/init.lua | 4 +- mesecons_lamp/doc/lamp/description.html | 2 +- mesecons_lamp/init.lua | 2 +- mesecons_lightstone/init.lua | 19 ++- .../doc/luacontroller/description.html | 4 +- mesecons_luacontroller/init.lua | 14 +- mesecons_stickyblocks/init.lua | 2 +- pipeworks/filter-injector.lua | 1 + player_textures/init.lua | 7 +- signs_lib/init.lua | 4 +- technic/README.md | 8 + technic/locale/it.txt | 48 +++--- technic/machines/HV/quarry.lua | 13 +- technic/machines/init.lua | 1 + technic/machines/other/constructor.lua | 2 +- technic/machines/power_monitor.lua | 67 ++++++++ technic/machines/register/cables.lua | 108 ++++++++++++- technic/machines/supply_converter.lua | 61 +++++++- technic/machines/switching_station.lua | 79 +++++++--- ...echnic_hv_nuclear_reactor_siren_danger_loop.ogg | Bin 13059 -> 36524 bytes .../textures/technic_power_monitor_bottom_back.png | Bin 0 -> 506 bytes technic/textures/technic_power_monitor_front.png | Bin 0 -> 428 bytes technic/textures/technic_power_monitor_sides.png | Bin 0 -> 456 bytes technic/tools/mining_drill.lua | 26 ++-- technic_chests/common.lua | 23 +-- technic_chests/register.lua | 35 ++++- technic_worldgen/oregen.lua | 10 +- unifieddyes/init.lua | 2 + worldedit_commands/wand.lua | 10 -- worldedit_gui/depends.txt | 3 +- worldedit_gui/functionality.lua | 109 +++++++++---- worldedit_gui/init.lua | 30 ++++ worldedit_gui/textures/worldedit_gui_unknown.png | Bin 0 -> 597 bytes 50 files changed, 887 insertions(+), 227 deletions(-) create mode 100644 digilines/settingtypes.txt create mode 100644 extranodes/models/technic_insulator_clip.obj create mode 100644 extranodes/textures/technic_insulator_clip.png create mode 100644 technic/machines/power_monitor.lua create mode 100644 technic/textures/technic_power_monitor_bottom_back.png create mode 100644 technic/textures/technic_power_monitor_front.png create mode 100644 technic/textures/technic_power_monitor_sides.png create mode 100644 worldedit_gui/textures/worldedit_gui_unknown.png diff --git a/coloredwood/init.lua b/coloredwood/init.lua index a68c388..1e3b008 100644 --- a/coloredwood/init.lua +++ b/coloredwood/init.lua @@ -114,35 +114,36 @@ table.insert(coloredwood.hues_plus_greys, "grey") -- helper functions -local function is_stairsplus(name) - local s1, s2 - - local a,b = string.find(name, ":stair") - if a then s1 = string.sub(name, a+1, b) end - - a,b = string.find(name, ":slab") - if a then s1 = string.sub(name, a+1, b) end - - a,b = string.find(name, ":panel") - if a then s1 = string.sub(name, a+1, b) end - - a,b = string.find(name, ":micro") - if a then s1 = string.sub(name, a+1, b) end - - a,b = string.find(name, ":slope") - if a then s1 = string.sub(name, a+1, b) end - - local h, s, v = unifieddyes.get_hsv(name) - - a,b = string.find(name, "wood") - if b then - s2 = string.sub(name, b+1) - local a,b = string.find(name, "grey") - if not a then - a,b = string.find(name, "_"..h..s) +local function is_stairsplus(name, colorized) + + -- the format of a coloredwood stairsplus node is: + -- moreblocks:class_wood_color_shape + -- where class is "slab", "stair", etc. and shape is "three quarter", "alt", etc. + + local a = string.find(name, ":") + local b = string.find(name, "_") + + local class = string.sub(name, a+1, b-1) -- from colon to underscore is the class + local shape = "" + local rest + + if class == "stair" + or class == "slab" + or class == "panel" + or class == "micro" + or class == "slope" then + + if colorized then + colorshape = string.sub(name, b+6) + local c = string.find(colorshape, "_") or 0 -- first word after "_wood_" is color + shape = string.sub(colorshape, c) -- everything after the color is the shape + if colorshape == shape then shape = "" end -- if there was no shape + else + shape = string.sub(name, b+5) -- everything after "_wood_" is the shape end - return s1, string.sub(s2, 5) end + print(name, class, shape) + return class, shape end -- the actual nodes! @@ -187,22 +188,25 @@ for _, color in ipairs(coloredwood.hues_plus_greys) do end end --- force on_rightclick for stairsplus default wood stair/slab/etc nodes +-- force replacement node type for stairsplus default wood stair/slab/etc nodes if coloredwood.enable_stairsplus then for _, i in pairs(minetest.registered_nodes) do if string.find(i.name, "moreblocks:stair_wood") - or string.find(i.name, "moreblocks:slab_wood") - or string.find(i.name, "moreblocks:panel_wood") - or string.find(i.name, "moreblocks:micro_wood") - or string.find(i.name, "moreblocks:slope_wood") then - local s1, s2 = is_stairsplus(i.name) - minetest.override_item(i.name, { - ud_replacement_node = "coloredwood:"..s1.."_wood_grey", - paramtype2 = "colorfacedir", - groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1, not_in_creative_inventory=1, ud_param2_colorable = 1}, - }) + or string.find(i.name, "moreblocks:slab_wood") + or string.find(i.name, "moreblocks:panel_wood") + or string.find(i.name, "moreblocks:micro_wood") + or string.find(i.name, "moreblocks:slope_wood") then + local a,b = string.find(i.name, "wood_tile") + if not a then + local s1, s2 = is_stairsplus(i.name, false) + minetest.override_item(i.name, { + ud_replacement_node = "coloredwood:"..s1.."_wood_grey"..s2, + paramtype2 = "colorfacedir", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1, not_in_creative_inventory=1, ud_param2_colorable = 1}, + }) + end end end @@ -217,8 +221,7 @@ end then mname = string.gsub(i.name, "coloredwood:", "moreblocks:") - local s1, s2 = is_stairsplus(mname) - + local s1, s2 = is_stairsplus(mname, true) minetest.override_item(i.name, { drop = "moreblocks:"..s1.."_wood"..s2 }) @@ -332,7 +335,7 @@ minetest.register_lbm({ local name = node.name local hue, sat, val = unifieddyes.get_hsv(name) local color = val..hue..sat - local s1, s2 = is_stairsplus(name) + local s1, s2 = is_stairsplus(name, true) if meta and (meta:get_string("dye") ~= "") then return end -- node has already been converted before. diff --git a/digilines/settingtypes.txt b/digilines/settingtypes.txt new file mode 100644 index 0000000..ad16ac8 --- /dev/null +++ b/digilines/settingtypes.txt @@ -0,0 +1,13 @@ + +# If enabled, makes some nodes with inventories (like chests) send signals +# when items are moved in the inventory. +digilines_enable_inventory (Enable inventory signals) bool true + +# Enable or disable the LCD panel with visible text. +digilines_enable_lcd (Enable LCD) bool true + +# Enable or disable the light sensor component. +digilines_enable_lightsensor (Enable light sensor) bool true + +# Enable or disable the real time clock component. +digilines_enable_rtc (Enable RTC) bool true diff --git a/extranodes/depends.txt b/extranodes/depends.txt index 6335bfd..3f123b0 100644 --- a/extranodes/depends.txt +++ b/extranodes/depends.txt @@ -1,5 +1,6 @@ default technic_worldgen concrete +unifieddyes intllib? moreblocks? diff --git a/extranodes/init.lua b/extranodes/init.lua index 22a1d9f..74fb028 100644 --- a/extranodes/init.lua +++ b/extranodes/init.lua @@ -101,3 +101,73 @@ if minetest.get_modpath("moreblocks") then register_technic_stairs_alias("stairsplus", "marble_bricks", "technic", "marble_bricks") end + +minetest.register_node(":technic:insulator_clip", { + description = "Insulator/cable clip", + drawtype = "mesh", + mesh = "technic_insulator_clip.obj", + tiles = {"technic_insulator_clip.png"}, + is_ground_content = false, + groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1}, + sounds = default.node_sound_stone_defaults(), + paramtype2 = "colorwallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + after_place_node = unifieddyes.fix_rotation, + after_dig_node = unifieddyes.after_dig_node, +}) + +minetest.register_node(":technic:insulator_clip_fencepost", { + description = "Insulator/cable clip", + tiles = {"technic_insulator_clip.png"}, + is_ground_content = false, + paramtype = "light", + paramtype2 = "color", + palette = "unifieddyes_palette_extended.png", + after_dig_node = unifieddyes.after_dig_node, + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = { + { -0.25, 0.75, -0.25, 0.25, 1.25, 0.25 }, -- the clip on top + { -0.125, 0.6875, -0.125, 0.125, 0.75, 0.125 }, + { -0.1875, 0.625, -0.1875, 0.1875, 0.6875, 0.1875 }, + { -0.125, 0.5625, -0.125, 0.125, 0.625, 0.125 }, + { -0.1875, 0.5, -0.1875, 0.1875, 0.5625, 0.1875 }, + { -0.125, 0.4375, -0.125, 0.125, 0.5, 0.125 }, + { -0.1875, 0.375, -0.1875, 0.1875, 0.4375, 0.1875 }, + { -0.125, -0.5, -0.125, 0.125, 0.375, 0.125 }, -- the post, slightly short + }, + -- connect_top = + -- connect_bottom = + connect_front = {{-1/16,3/16,-1/2,1/16,5/16,-1/8}, + {-1/16,-5/16,-1/2,1/16,-3/16,-1/8}}, + connect_left = {{-1/2,3/16,-1/16,-1/8,5/16,1/16}, + {-1/2,-5/16,-1/16,-1/8,-3/16,1/16}}, + connect_back = {{-1/16,3/16,1/8,1/16,5/16,1/2}, + {-1/16,-5/16,1/8,1/16,-3/16,1/2}}, + connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16}, + {1/8,-5/16,-1/16,1/2,-3/16,1/16}}, + }, + connects_to = {"group:fence", "group:wood", "group:tree"}, + groups = {fence=1, choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1}, + sounds = default.node_sound_stone_defaults(), + place_param2 = 171 -- medium amber, low saturation, closest color to default:wood +}) + +minetest.register_craft({ + output = "technic:insulator_clip", + recipe = { + { "", "dye:white", ""}, + { "", "technic:raw_latex", ""}, + { "technic:raw_latex", "default:stone", "technic:raw_latex"}, + } +}) + +minetest.register_craft({ + output = "technic:insulator_clip_fencepost 2", + recipe = { + { "", "dye:white", ""}, + { "", "technic:raw_latex", ""}, + { "technic:raw_latex", "default:fence_wood", "technic:raw_latex"}, + } +}) diff --git a/extranodes/models/technic_insulator_clip.obj b/extranodes/models/technic_insulator_clip.obj new file mode 100644 index 0000000..1da5e88 --- /dev/null +++ b/extranodes/models/technic_insulator_clip.obj @@ -0,0 +1,173 @@ +# Blender v2.72 (sub 0) OBJ File: '' +# www.blender.org +o Cube +v -0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 0.500000 +v -0.249997 0.500000 0.249997 +v -0.249997 0.500000 -0.249997 +v 0.249997 0.500000 -0.249997 +v 0.249997 0.500000 0.249997 +v -0.187500 0.500000 0.187500 +v -0.187500 0.500000 -0.187500 +v 0.187500 0.500000 -0.187500 +v 0.187500 0.500000 0.187500 +v -0.187500 0.750000 0.187500 +v -0.187500 0.750000 -0.187500 +v 0.187500 0.750000 -0.187500 +v 0.187500 0.750000 0.187500 +v -0.250000 0.750000 0.250000 +v -0.250000 0.750000 -0.250000 +v 0.250000 0.750000 -0.250000 +v 0.250000 0.750000 0.250000 +v -0.250000 1.250000 0.250000 +v -0.250000 1.250000 -0.250000 +v 0.250000 1.250000 -0.250000 +v 0.250000 1.250000 0.250000 +v -0.500000 0.312500 0.500000 +v -0.500000 0.312500 -0.500000 +v 0.500000 0.312500 -0.500000 +v 0.500000 0.312500 0.500000 +v 0.187500 0.625000 0.187500 +v 0.187500 0.625000 -0.187500 +v -0.187500 0.625000 -0.187500 +v -0.187500 0.625000 0.187500 +v 0.187500 0.562500 0.187500 +v 0.187500 0.687500 -0.187500 +v -0.187500 0.687500 -0.187500 +v -0.187500 0.562500 0.187500 +v 0.187500 0.687500 0.187500 +v 0.187500 0.562500 -0.187500 +v -0.187500 0.562500 -0.187500 +v -0.187500 0.687500 0.187500 +v 0.168668 0.531250 0.168668 +v 0.168668 0.718750 -0.168668 +v -0.168668 0.718750 -0.168668 +v -0.168668 0.531250 0.168668 +v 0.168668 0.656250 0.168668 +v 0.168668 0.593750 -0.168668 +v -0.168668 0.593750 -0.168668 +v -0.168668 0.656250 0.168668 +v 0.168668 0.593750 0.168668 +v 0.168668 0.656250 -0.168668 +v -0.168668 0.656250 -0.168668 +v -0.168668 0.593750 0.168668 +v 0.168668 0.718750 0.168668 +v 0.168668 0.531250 -0.168668 +v -0.168668 0.531250 -0.168668 +v -0.168668 0.718750 0.168668 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 0.749997 0.749997 +vt 0.749997 0.250003 +vt 0.250003 0.250003 +vt 0.250003 0.749997 +vt 0.000000 0.812500 +vt 1.000000 0.812500 +vt 0.312500 0.312500 +vt 0.312500 0.687500 +vt 0.687500 0.312500 +vt 0.687500 0.687500 +vt 0.331332 1.218750 +vt 0.668668 1.218750 +vt 0.687500 1.250000 +vt 0.312500 1.250000 +vt 0.750000 1.250000 +vt 0.750000 1.750000 +vt 0.250000 1.750000 +vt 0.250000 1.250000 +vt 0.331332 1.093750 +vt 0.668668 1.093750 +vt 0.687500 1.125000 +vt 0.312500 1.125000 +vt 0.331332 1.093750 +vt 0.668668 1.093750 +vt 0.331332 1.156250 +vt 0.668668 1.156250 +vt 0.687500 1.187500 +vt 0.312500 1.187500 +vt 0.331332 1.156250 +vt 0.668668 1.156250 +vt 0.331332 1.031250 +vt 0.668668 1.031250 +vt 0.687500 1.062500 +vt 0.312500 1.062500 +vt 0.312500 1.000000 +vt 0.687500 1.000000 +vn 0.000000 -1.000000 -0.000000 +vn -0.600000 0.800000 -0.000000 +vn 0.000000 0.800000 -0.600000 +vn 0.600000 0.800000 0.000000 +vn -0.000000 0.000000 1.000000 +vn 0.000000 1.000000 0.000000 +vn 0.856500 -0.516200 0.000000 +vn 0.000000 -0.516200 -0.856500 +vn -0.000000 -0.516200 0.856500 +vn -0.856500 -0.516200 -0.000000 +vn -1.000000 0.000000 -0.000000 +vn 0.000000 -0.000000 -1.000000 +vn 1.000000 -0.000000 0.000000 +vn -0.000000 0.800000 0.600000 +vn 0.856500 0.516200 0.000000 +vn 0.000000 0.516200 -0.856500 +vn -0.000000 0.516200 0.856500 +vn -0.856500 0.516200 -0.000000 +g Cube_Cube_Material +s off +f 1/1/1 2/2/1 3/3/1 4/4/1 +f 25/2/2 5/5/2 6/6/2 26/1/2 +f 26/1/3 6/6/3 7/7/3 27/4/3 +f 27/4/4 7/7/4 8/8/4 28/3/4 +f 25/9/5 1/4/5 4/1/5 28/10/5 +f 8/8/6 7/7/6 11/11/6 12/12/6 +f 7/7/6 6/6/6 10/13/6 11/11/6 +f 5/5/6 8/8/6 12/12/6 9/14/6 +f 6/6/6 5/5/6 9/14/6 10/13/6 +f 53/15/7 42/16/7 15/17/7 16/18/7 +f 42/15/8 43/16/8 14/17/8 15/18/8 +f 56/15/9 53/16/9 16/17/9 13/18/9 +f 43/15/10 56/16/10 13/17/10 14/18/10 +f 14/4/1 18/4/1 19/4/1 15/4/1 +f 17/19/11 21/20/11 22/21/11 18/22/11 +f 18/19/12 22/20/12 23/21/12 19/22/12 +f 19/19/13 23/20/13 24/21/13 20/22/13 +f 21/21/5 17/22/5 20/19/5 24/20/5 +f 21/5/6 24/8/6 23/7/6 22/6/6 +f 15/4/1 19/4/1 20/4/1 16/4/1 +f 16/4/1 20/4/1 17/4/1 13/4/1 +f 13/4/1 17/4/1 18/4/1 14/4/1 +f 1/1/11 25/10/11 26/9/11 2/4/11 +f 2/1/12 26/10/12 27/9/12 3/4/12 +f 3/1/13 27/10/13 28/9/13 4/4/13 +f 5/5/14 25/2/14 28/3/14 8/8/14 +f 49/23/7 46/24/7 30/25/7 29/26/7 +f 46/27/8 47/28/8 31/25/8 30/26/8 +f 52/23/9 49/24/9 29/25/9 32/26/9 +f 47/23/10 52/24/10 32/25/10 31/26/10 +f 45/29/7 50/30/7 34/31/7 37/32/7 +f 50/33/8 51/34/8 35/31/8 34/32/8 +f 48/33/9 45/34/9 37/31/9 40/32/9 +f 51/29/10 48/30/10 40/31/10 35/32/10 +f 41/35/7 54/36/7 38/37/7 33/38/7 +f 54/35/8 55/36/8 39/37/8 38/38/8 +f 44/35/9 41/36/9 33/37/9 36/38/9 +f 55/35/10 44/36/10 36/37/10 39/38/10 +f 37/32/15 34/31/15 42/16/15 53/15/15 +f 34/32/16 35/31/16 43/16/16 42/15/16 +f 40/32/17 37/31/17 53/16/17 56/15/17 +f 35/32/18 40/31/18 56/16/18 43/15/18 +f 33/38/15 38/37/15 46/24/15 49/23/15 +f 38/38/16 39/37/16 47/28/16 46/27/16 +f 36/38/17 33/37/17 49/24/17 52/23/17 +f 39/38/18 36/37/18 52/24/18 47/23/18 +f 29/26/15 30/25/15 50/30/15 45/29/15 +f 30/26/16 31/25/16 51/34/16 50/33/16 +f 32/26/17 29/25/17 45/34/17 48/33/17 +f 31/26/18 32/25/18 48/30/18 51/29/18 +f 12/39/15 11/40/15 54/36/15 41/35/15 +f 11/39/16 10/40/16 55/36/16 54/35/16 +f 9/39/17 12/40/17 41/36/17 44/35/17 +f 10/39/18 9/40/18 44/36/18 55/35/18 diff --git a/extranodes/textures/technic_insulator_clip.png b/extranodes/textures/technic_insulator_clip.png new file mode 100644 index 0000000..44cdc6a Binary files /dev/null and b/extranodes/textures/technic_insulator_clip.png differ diff --git a/gloopblocks/crafts.lua b/gloopblocks/crafts.lua index d404621..3906da1 100644 --- a/gloopblocks/crafts.lua +++ b/gloopblocks/crafts.lua @@ -376,4 +376,13 @@ minetest.register_craft({ if minetest.get_modpath("technic") then technic.register_grinder_recipe({input={"gloopblocks:pumice"},output="default:sand"}) technic.register_grinder_recipe({input={"gloopblocks:basalt"},output="default:cobble"}) + minetest.register_craft({ + type = "shapeless", + output = "technic:concrete 3", + recipe = { + "gloopblocks:wet_cement", + "group:sand", + "default:gravel", + } + }) end diff --git a/homedecor/crafts.lua b/homedecor/crafts.lua index 98c44ac..7df8695 100644 --- a/homedecor/crafts.lua +++ b/homedecor/crafts.lua @@ -1298,15 +1298,7 @@ minetest.register_craft( { -- other types of fences minetest.register_craft( { - output = "homedecor:fence_wrought_iron_2 2", - recipe = { - { "homedecor:pole_wrought_iron", "default:iron_lump" }, - { "homedecor:pole_wrought_iron", "default:iron_lump" }, - }, -}) - -minetest.register_craft( { - output = "homedecor:fence_wrought_iron_2 2", + output = "homedecor:fence_wrought_iron_2 4", recipe = { { "homedecor:pole_wrought_iron", "default:iron_lump" }, { "homedecor:pole_wrought_iron", "default:iron_lump" }, diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua index 2f3d5ee..a7258bc 100644 --- a/homedecor/furniture.lua +++ b/homedecor/furniture.lua @@ -162,7 +162,25 @@ minetest.register_alias('armchair', 'homedecor:armchair') homedecor.old_static_chairs = {} -for _, color in ipairs(lrfurn.colors) do +local chair_colors = { + "black", + "brown", + "blue", + "cyan", + "dark_grey", + "dark_green", + "green", + "grey", + "magenta", + "orange", + "pink", + "red", + "violet", + "white", + "yellow", +} + +for _, color in ipairs(chair_colors) do table.insert(homedecor.old_static_chairs, "homedecor:chair_"..color) table.insert(homedecor.old_static_chairs, "homedecor:armchair_"..color) end diff --git a/mesecons_extrawires/vertical.lua b/mesecons_extrawires/vertical.lua index f3232d8..9fabee0 100644 --- a/mesecons_extrawires/vertical.lua +++ b/mesecons_extrawires/vertical.lua @@ -77,7 +77,7 @@ end -- Vertical wire mesecon.register_node("mesecons_extrawires:vertical", { - description = "Vertical mesecon", + description = "Vertical Mesecon", drawtype = "nodebox", walkable = false, paramtype = "light", diff --git a/mesecons_gates/doc/and/description.html b/mesecons_gates/doc/and/description.html index eafbeda..528839c 100644 --- a/mesecons_gates/doc/and/description.html +++ b/mesecons_gates/doc/and/description.html @@ -1 +1 @@ -And gates power their output if both inputs (from left and right) are powered. +AND gates power their output if both inputs (from left and right) are powered. diff --git a/mesecons_gates/doc/diode/description.html b/mesecons_gates/doc/diode/description.html index 174fd64..5f82706 100644 --- a/mesecons_gates/doc/diode/description.html +++ b/mesecons_gates/doc/diode/description.html @@ -1 +1 @@ -Mesecon diodes, just like real ones, only transfer power (signals) in one direction only. +Diodes conduct signals in one direction only. diff --git a/mesecons_gates/doc/nand/description.html b/mesecons_gates/doc/nand/description.html index a520fd2..69c1d4f 100644 --- a/mesecons_gates/doc/nand/description.html +++ b/mesecons_gates/doc/nand/description.html @@ -1 +1 @@ -Nand gates do not power their output if both inputs (from left and right) are powered, but power it in every other case. +NAND gates do not power their output if both inputs (from left and right) are powered, but power it in every other case. diff --git a/mesecons_gates/doc/nor/description.html b/mesecons_gates/doc/nor/description.html index cfcd4c0..28d66a4 100644 --- a/mesecons_gates/doc/nor/description.html +++ b/mesecons_gates/doc/nor/description.html @@ -1 +1 @@ -Nor gates only power their output if none of their two inputs is powered. They are basically or gates with a not gate at their output. +NOR gates only power their output if none of their two inputs is powered. They are basically OR gates with a NOT gate at their output. diff --git a/mesecons_gates/doc/not/description.html b/mesecons_gates/doc/not/description.html index 8bd6795..7538dc9 100644 --- a/mesecons_gates/doc/not/description.html +++ b/mesecons_gates/doc/not/description.html @@ -1 +1 @@ -Not gates invert signals, just like a mesecon torch does, but faster. The input is at the opposite side of the output. +NOT gates invert signals, just like a mesecon torch does, but faster. The input is at the opposite side of the output. diff --git a/mesecons_gates/doc/or/description.html b/mesecons_gates/doc/or/description.html index 0a74abd..f7f5539 100644 --- a/mesecons_gates/doc/or/description.html +++ b/mesecons_gates/doc/or/description.html @@ -1 +1 @@ -Or gates power their output if either of their inputs (or both) are powered. You could basically get the same behaviour with two diodes, but or gates save some space. +OR gates power their output if either of their inputs (or both) are powered. You could basically get the same behaviour with two diodes, but OR gates save some space. diff --git a/mesecons_gates/init.lua b/mesecons_gates/init.lua index 57815ef..13e583b 100644 --- a/mesecons_gates/init.lua +++ b/mesecons_gates/init.lua @@ -54,10 +54,10 @@ local function update_gate(pos, node, link, newstate) end end -local function register_gate(name, inputnumber, assess, recipe) +local function register_gate(name, inputnumber, assess, recipe, description) local get_inputrules = inputnumber == 2 and gate_get_input_rules_twoinputs or gate_get_input_rules_oneinput - local description = "Mesecons Logic Gate: "..name + description = "Logic Gate: "..name local basename = "mesecons_gates:"..name mesecon.register_node(basename, { @@ -103,32 +103,39 @@ local function register_gate(name, inputnumber, assess, recipe) end register_gate("diode", 1, function (input) return input end, - {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons_torch:mesecon_torch_on"}}) + {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons_torch:mesecon_torch_on"}}, + "Diode") register_gate("not", 1, function (input) return not input end, - {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons:mesecon"}}) + {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons:mesecon"}}, + "NOT Gate") register_gate("and", 2, function (val1, val2) return val1 and val2 end, {{"mesecons:mesecon", "", ""}, {"", "mesecons_materials:silicon", "mesecons:mesecon"}, - {"mesecons:mesecon", "", ""}}) + {"mesecons:mesecon", "", ""}}, + "AND Gate") register_gate("nand", 2, function (val1, val2) return not (val1 and val2) end, {{"mesecons:mesecon", "", ""}, {"", "mesecons_materials:silicon", "mesecons_torch:mesecon_torch_on"}, - {"mesecons:mesecon", "", ""}}) + {"mesecons:mesecon", "", ""}}, + "NAND Gate") register_gate("xor", 2, function (val1, val2) return (val1 or val2) and not (val1 and val2) end, {{"mesecons:mesecon", "", ""}, {"", "mesecons_materials:silicon", "mesecons_materials:silicon"}, - {"mesecons:mesecon", "", ""}}) + {"mesecons:mesecon", "", ""}}, + "XOR Gate") register_gate("nor", 2, function (val1, val2) return not (val1 or val2) end, {{"mesecons:mesecon", "", ""}, {"", "mesecons:mesecon", "mesecons_torch:mesecon_torch_on"}, - {"mesecons:mesecon", "", ""}}) + {"mesecons:mesecon", "", ""}}, + "NOR Gate") register_gate("or", 2, function (val1, val2) return (val1 or val2) end, {{"mesecons:mesecon", "", ""}, {"", "mesecons:mesecon", "mesecons:mesecon"}, - {"mesecons:mesecon", "", ""}}) + {"mesecons:mesecon", "", ""}}, + "OR Gate") diff --git a/mesecons_insulated/init.lua b/mesecons_insulated/init.lua index 15b916b..891b5d3 100644 --- a/mesecons_insulated/init.lua +++ b/mesecons_insulated/init.lua @@ -9,7 +9,7 @@ end minetest.register_node("mesecons_insulated:insulated_on", { drawtype = "nodebox", - description = "Insulated Mesecon", + description = "Straight Insulated Mesecon", tiles = { "jeija_insulated_wire_sides_on.png", "jeija_insulated_wire_sides_on.png", @@ -41,7 +41,7 @@ minetest.register_node("mesecons_insulated:insulated_on", { minetest.register_node("mesecons_insulated:insulated_off", { drawtype = "nodebox", - description = "Insulated Mesecon", + description = "Straight Insulated Mesecon", tiles = { "jeija_insulated_wire_sides_off.png", "jeija_insulated_wire_sides_off.png", diff --git a/mesecons_lamp/doc/lamp/description.html b/mesecons_lamp/doc/lamp/description.html index 5bfe6c5..72f24ed 100644 --- a/mesecons_lamp/doc/lamp/description.html +++ b/mesecons_lamp/doc/lamp/description.html @@ -1 +1 @@ -Lamps are effectors that if powered emit light. +Mesecon lamps are effectors that if powered emit light. diff --git a/mesecons_lamp/init.lua b/mesecons_lamp/init.lua index 811e659..6f38b27 100644 --- a/mesecons_lamp/init.lua +++ b/mesecons_lamp/init.lua @@ -42,7 +42,7 @@ minetest.register_node("mesecons_lamp:lamp_off", { node_box = mesecon_lamp_box, selection_box = mesecon_lamp_box, groups = {dig_immediate=3, mesecon_receptor_off = 1, mesecon_effector_off = 1}, - description="Meselamp", + description="Mesecon Lamp", sounds = default.node_sound_glass_defaults(), mesecons = {effector = { action_on = function (pos, node) diff --git a/mesecons_lightstone/init.lua b/mesecons_lightstone/init.lua index da7cc41..ab820bf 100644 --- a/mesecons_lightstone/init.lua +++ b/mesecons_lightstone/init.lua @@ -14,11 +14,14 @@ local lightstone_rules = { {x=0, y=-1, z=0}, } -function mesecon.lightstone_add(name, base_item, texture_off, texture_on) +function mesecon.lightstone_add(name, base_item, texture_off, texture_on, desc) + if not desc then + desc = name .. " Lightstone" + end minetest.register_node("mesecons_lightstone:lightstone_" .. name .. "_off", { tiles = {texture_off}, groups = {cracky=2, mesecon_effector_off = 1, mesecon = 2}, - description=name.." Lightstone", + description = desc, sounds = default.node_sound_stone_defaults(), mesecons = {effector = { rules = lightstone_rules, @@ -52,9 +55,9 @@ function mesecon.lightstone_add(name, base_item, texture_off, texture_on) end -mesecon.lightstone_add("red", "dye:red", "jeija_lightstone_red_off.png", "jeija_lightstone_red_on.png") -mesecon.lightstone_add("green", "dye:green", "jeija_lightstone_green_off.png", "jeija_lightstone_green_on.png") -mesecon.lightstone_add("blue", "dye:blue", "jeija_lightstone_blue_off.png", "jeija_lightstone_blue_on.png") -mesecon.lightstone_add("gray", "dye:grey", "jeija_lightstone_gray_off.png", "jeija_lightstone_gray_on.png") -mesecon.lightstone_add("darkgray", "dye:dark_grey", "jeija_lightstone_darkgray_off.png", "jeija_lightstone_darkgray_on.png") -mesecon.lightstone_add("yellow", "dye:yellow", "jeija_lightstone_yellow_off.png", "jeija_lightstone_yellow_on.png") +mesecon.lightstone_add("red", "dye:red", "jeija_lightstone_red_off.png", "jeija_lightstone_red_on.png", "Red Lightstone") +mesecon.lightstone_add("green", "dye:green", "jeija_lightstone_green_off.png", "jeija_lightstone_green_on.png", "Green Lightstone") +mesecon.lightstone_add("blue", "dye:blue", "jeija_lightstone_blue_off.png", "jeija_lightstone_blue_on.png", "Blue Lightstone") +mesecon.lightstone_add("gray", "dye:grey", "jeija_lightstone_gray_off.png", "jeija_lightstone_gray_on.png", "Grey Lightstone") +mesecon.lightstone_add("darkgray", "dye:dark_grey", "jeija_lightstone_darkgray_off.png", "jeija_lightstone_darkgray_on.png", "Dark Grey Lightstone") +mesecon.lightstone_add("yellow", "dye:yellow", "jeija_lightstone_yellow_off.png", "jeija_lightstone_yellow_on.png", "Yellow Lightstone") diff --git a/mesecons_luacontroller/doc/luacontroller/description.html b/mesecons_luacontroller/doc/luacontroller/description.html index ca14615..e549ffe 100644 --- a/mesecons_luacontroller/doc/luacontroller/description.html +++ b/mesecons_luacontroller/doc/luacontroller/description.html @@ -1,5 +1,5 @@ -The luacontroller is an advanced programmable component. -You can simply code it in the language mesecons uses itself: Lua! +The Luacontroller is an advanced programmable component. +You can simply code it in the language Mesecons uses itself: Lua! All the code runs in a sandbox, so it's completely safe (but I won't guarantee that for absolute certainty!). Documentation is available here! diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua index d874fdf..c754eda 100644 --- a/mesecons_luacontroller/init.lua +++ b/mesecons_luacontroller/init.lua @@ -12,7 +12,7 @@ -- ports = get_real_port_states(pos): gets if inputs are powered from outside -- newport = merge_port_states(state1, state2): just does result = state1 or state2 for every port -- set_port(pos, rule, state): activates/deactivates the mesecons according to the port states --- set_port_states(pos, ports): Applies new port states to a LuaController at pos +-- set_port_states(pos, ports): Applies new port states to a Luacontroller at pos -- run(pos): runs the code in the controller at pos -- reset_meta(pos, code, errmsg): performs a software-reset, installs new code and prints error messages -- resetn(pos): performs a hardware reset, turns off all ports @@ -219,7 +219,7 @@ end local function safe_string_find(...) if (select(4, ...)) ~= true then debug.sethook() -- Clear hook - error("string.find: 'plain' (fourth parameter) must always be true in a LuaController") + error("string.find: 'plain' (fourth parameter) must always be true in a Luacontroller") end return string.find(...) @@ -232,7 +232,7 @@ local function remove_functions(x) end -- Make sure to not serialize the same table multiple times, otherwise - -- writing mem.test = mem in the LuaController will lead to infinite recursion + -- writing mem.test = mem in the Luacontroller will lead to infinite recursion local seen = {} local function rfuncs(x) @@ -308,8 +308,8 @@ local function create_environment(pos, mem, event) for k, v in pairs(vports) do vports_copy[k] = v end local rports = get_real_port_states(pos) - -- Create new library tables on each call to prevent one LuaController - -- from breaking a library and messing up other LuaControllers. + -- Create new library tables on each call to prevent one Luacontroller + -- from breaking a library and messing up other Luacontrollers. local env = { pin = merge_port_states(vports, rports), port = vports_copy, @@ -595,7 +595,7 @@ for d = 0, 1 do } minetest.register_node(node_name, { - description = "LuaController", + description = "Luacontroller", drawtype = "nodebox", tiles = { top, @@ -636,7 +636,7 @@ end end ------------------------------ --- Overheated LuaController -- +-- Overheated Luacontroller -- ------------------------------ minetest.register_node(BASENAME .. "_burnt", { diff --git a/mesecons_stickyblocks/init.lua b/mesecons_stickyblocks/init.lua index 659a227..e124143 100644 --- a/mesecons_stickyblocks/init.lua +++ b/mesecons_stickyblocks/init.lua @@ -3,7 +3,7 @@ -- All sides sticky block minetest.register_node("mesecons_stickyblocks:sticky_block_all", { - description = "All-sides sticky block", + description = "All-Sides Sticky Block", tiles = {"default_grass.png^default_footprint.png"}, groups = {dig_immediate=2}, mvps_sticky = function (pos, node) diff --git a/pipeworks/filter-injector.lua b/pipeworks/filter-injector.lua index 6f3271f..72f7bad 100644 --- a/pipeworks/filter-injector.lua +++ b/pipeworks/filter-injector.lua @@ -167,6 +167,7 @@ local function punch_filter(data, filtpos, filtnode, msg) local fakePlayer = { get_player_name = delay(owner), is_fake_player = ":pipeworks", + get_wielded_item = delay(ItemStack(nil)) } -- TODO: use a mechanism as the wielder one local dir = minetest.facedir_to_right_dir(filtnode.param2) local frompos = vector.subtract(filtpos, dir) diff --git a/player_textures/init.lua b/player_textures/init.lua index 5aa2ec4..5f2fb48 100644 --- a/player_textures/init.lua +++ b/player_textures/init.lua @@ -7,16 +7,17 @@ local function pivot(table) end local textures = pivot(minetest.get_dir_list(minetest.get_modpath("player_textures")..DIR_DELIM.."textures")) +local mesh = minetest.get_modpath("3d_armor") and "3d_armor_character.b3d" or "character.b3d" local function applyskin(player) local name = player:get_player_name() if textures[string.format("player_%s.png",name)] then if minetest.get_modpath("default") then - default.player_set_textures(player,string.format("[combine:64x32:0,0=player_%s.png",name)) + default.player_set_textures(player,string.format("player_%s.png",name)) end - player:set_properties({textures={string.format("[combine:64x32:0,0=player_%s.png",name)}}) + player:set_properties({textures={string.format("player_%s.png",name)}}) end - player:set_properties({visual="mesh",visual_size={x=1,y=1},mesh="character.b3d"}) + player:set_properties({visual="mesh",visual_size={x=1,y=1},mesh=mesh}) end minetest.register_on_joinplayer(function(player) diff --git a/signs_lib/init.lua b/signs_lib/init.lua index b89cff7..536066f 100644 --- a/signs_lib/init.lua +++ b/signs_lib/init.lua @@ -571,7 +571,9 @@ function signs_lib.determine_sign_type(itemstack, placer, pointed_thing, locked) local node=minetest.get_node(pointed_thing.under) - if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + if minetest.registered_nodes[node.name] and + minetest.registered_nodes[node.name].on_rightclick and + not placer:get_player_control().sneak then return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack, pointed_thing) else local above = pointed_thing.above diff --git a/technic/README.md b/technic/README.md index b6aa05f..e5adf31 100644 --- a/technic/README.md +++ b/technic/README.md @@ -25,3 +25,11 @@ RealBadAngel: (WTFPL) * Everything else. CC BY-SA 3.0: + +Sound licenses: + +veikk0 (Veikko Mäkelä) (CC BY-SA 4.0): + * technic_hv_nuclear_reactor_siren_danger_loop.ogg + * Derived from "Nuclear alarm.wav" by Freesound.org user rene___ from . Originally licensed under CC0 1.0 + +CC BY-SA 4.0: \ No newline at end of file diff --git a/technic/locale/it.txt b/technic/locale/it.txt index 59ba7f6..a092a53 100644 --- a/technic/locale/it.txt +++ b/technic/locale/it.txt @@ -26,8 +26,8 @@ Graphite = Lastra in graffite Carbon Cloth = Fibra di carbonio Raw Latex = Latex grezzo Rubber Fiber = Fibra di gomma -%.1f%%-Fissile Uranium Ingot = -%.1f%%-Fissile Uranium Block = +%.1f%%-Fissile Uranium Ingot = %.1f%%-Lingotto di uranio fissile +%.1f%%-Fissile Uranium Block = %.1f%%-Blocco di uranio fissile ## Machine misc Machine cannot be removed because it is not empty = La macchina non può essere rimossa perchè non è vuota @@ -36,7 +36,7 @@ Inventory move disallowed due to protection = Impossibile muovere l'inventario a @1 Active (@2 EU) = @1 Attivo (@2 EU) %s Active = %s Attivo %s Disabled = %s Disabilitato -%s Enabled = +%s Enabled = %s Abilitato %s Idle = %s Inattivo %s Improperly Placed = %s Piazzato impropiamente %s Unpowered = %s Non alimentato @@ -46,18 +46,18 @@ Inventory move disallowed due to protection = Impossibile muovere l'inventario a %s Finished = %s Finito Enable/Disable = Abilita/Disabilita Range = Raggio -Upgrade Slots = +Upgrade Slots = Alloggi di aggiornamento In: = Ingresso: Out: = Uscita: -Slot %d = +Slot %d = Alloggio %d Itemwise = Singolo elemento Stackwise = pila completa -Owner: = -Unlocked = -Locked = -Radius: = -Enabled = -Disabled = +Owner: = Proprietario: +Unlocked = Non chiuso a chiave +Locked = Chiuso a chiave +Radius: = Raggio: +Enabled = Abilitato +Disabled = Disabilitato ## Machine names # $1: Tier @@ -84,10 +84,10 @@ Self-Contained Injector = Ignettore Constructor Mk%d = Costruttore Mk%d Frame = Cornice Frame Motor = Cornice del motore -Template = -Template (replacing) = Template (rimpiazzato) -Template Motor = -Template Tool = +Template = Sagoma +Template (replacing) = Sagoma (di rimpiazzo) +Template Motor = Motore per sagome +Template Tool = Strumento per sagome Battery Box = Box batterie Supply Converter = Trasformatore Switching Station = Stazione di controllo @@ -96,7 +96,7 @@ Fuel-Fired Furnace = Fornace a carbone Wind Mill Frame = Pala eolica Forcefield = Campo di forza Nuclear Reactor Rod Compartment = Compartimento combustibile nucleare -Administrative World Anchor = +Administrative World Anchor = Ancora-mondo amministrativa ## Machine-specific # $1: Pruduced EU @@ -111,12 +111,12 @@ Production at %d%% = Produzione a %d%% Choose Milling Program: = Scegliere un programma di Fresatura Slim Elements half / normal height: = Metà elementi sottili / altezza normale: Current track %s = Traccia corrente %s -Stopped = -Keeping %d/%d map blocks loaded = -Digging not started = -Digging finished = -Digging %d m above machine = -Digging %d m below machine = +Stopped = Fermato +Keeping %d/%d map blocks loaded = Mantenimento di %d/%d blocchi mappa caricati +Digging not started = Scavo non iniziato +Digging finished = Scavo finito +Digging %d m above machine = Scavo di %d m sopra la macchina +Digging %d m below machine = Scavo di %d m sotto la macchina ## CNC Cylinder = Cilindro @@ -174,10 +174,10 @@ Talinite = Talinite Tin = Stagno Wrought Iron = Ferro Battuto Zinc = Zinco -%.1f%%-Fissile Uranium = +%.1f%%-Fissile Uranium = %.1f%%-Uranio fissile ## Tools -RE Battery = +RE Battery = Batteria RE Water Can = Serbatoio d'acqua Lava Can = Serbatoio di lava Chainsaw = Motosega diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua index 8255676..8d87b65 100644 --- a/technic/machines/HV/quarry.lua +++ b/technic/machines/HV/quarry.lua @@ -12,6 +12,7 @@ minetest.register_craft({ local quarry_dig_above_nodes = 3 -- How far above the quarry we will dig nodes local quarry_max_depth = 100 local quarry_demand = 10000 +local quarry_eject_dir = vector.new(0, 1, 0) local function set_quarry_formspec(meta) local radius = meta:get_int("size") @@ -83,7 +84,7 @@ local function quarry_handle_purge(pos) if stack then local item = stack:to_table() if item then - technic.tube_inject_item(pos, pos, vector.new(0, 1, 0), item) + technic.tube_inject_item(pos, pos, quarry_eject_dir, item) stack:clear() inv:set_stack("cache", i, stack) break @@ -217,6 +218,16 @@ minetest.register_node("technic:quarry", { connect_sides = {"bottom", "front", "left", "right"}, tube = { connect_sides = {top = 1}, + -- lower priority than other tubes, so that quarries will prefer any + -- other tube to another quarry, which could lead to server freezes + -- in certain quarry placements (2x2 for example would never eject) + priority = 10, + can_go = function(pos, node, velocity, stack) + -- always eject the same, even if items came in another way + -- this further mitigates loops and generally avoids random sideway movement + -- that can be expected in certain quarry placements + return { quarry_eject_dir } + end }, on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/technic/machines/init.lua b/technic/machines/init.lua index ad79eab..f2e31c9 100644 --- a/technic/machines/init.lua +++ b/technic/machines/init.lua @@ -8,6 +8,7 @@ dofile(path.."/MV/init.lua") dofile(path.."/HV/init.lua") dofile(path.."/switching_station.lua") +dofile(path.."/power_monitor.lua") dofile(path.."/supply_converter.lua") dofile(path.."/other/init.lua") diff --git a/technic/machines/other/constructor.lua b/technic/machines/other/constructor.lua index 3396ac7..9c64051 100644 --- a/technic/machines/other/constructor.lua +++ b/technic/machines/other/constructor.lua @@ -21,7 +21,7 @@ local function deploy_node(inv, slot_name, pos, node, machine_node) end if remove_to then for i = 1, remove_to do - inv:remove_item(drops[i]) + inv:remove_item(slot_name, drops[i]) end else minetest.remove_node(pos) diff --git a/technic/machines/power_monitor.lua b/technic/machines/power_monitor.lua new file mode 100644 index 0000000..4306693 --- /dev/null +++ b/technic/machines/power_monitor.lua @@ -0,0 +1,67 @@ +-- POWER MONITOR +-- The power monitor can be used to monitor how much power is available on a network, +-- similarly to the old "slave" switching stations. + +local S = technic.getter + +minetest.register_craft({ + output = "technic:power_monitor", + recipe = { + {"", "", ""}, + {"", "technic:machine_casing", "default:copper_ingot"}, + {"technic:lv_cable", "technic:lv_cable", "technic:lv_cable"} + } +}) + +minetest.register_node("technic:power_monitor",{ + description = S("Power Monitor"), + tiles = { + "technic_power_monitor_sides.png", + "technic_power_monitor_bottom_back.png", + "technic_power_monitor_sides.png", + "technic_power_monitor_sides.png", + "technic_power_monitor_bottom_back.png", + "technic_power_monitor_front.png" + }, + paramtype2 = "facedir", + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1, technic_machine=1}, + connect_sides = {"bottom", "back"}, + sounds = default.node_sound_wood_defaults(), + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", S("Power Monitor")) + end, +}) + +minetest.register_abm({ + nodenames = {"technic:power_monitor"}, + label = "Power Monitor", + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.get_meta(pos) + local network_hash = technic.cables[minetest.hash_node_position(pos)] + local network = network_hash and minetest.get_position_from_hash(network_hash) + local sw_pos = network and {x=network.x,y=network.y+1,z=network.z} + local timeout = 0 + for tier in pairs(technic.machines) do + timeout = math.max(meta:get_int(tier.."_EU_timeout"),timeout) + end + if timeout > 0 and sw_pos and minetest.get_node(sw_pos).name == "technic:switching_station" then + local sw_meta = minetest.get_meta(sw_pos) + local supply = sw_meta:get_int("supply") + local demand = sw_meta:get_int("demand") + meta:set_string("infotext", + S("Power Monitor. Supply: @1 Demand: @2", + technic.pretty_num(supply), technic.pretty_num(demand))) + else + meta:set_string("infotext",S("Power Monitor Has No Network")) + end + end, +}) + +for tier in pairs(technic.machines) do + -- RE in order to use the "timeout" functions, although it consumes 0 power + technic.register_machine(tier, "technic:power_monitor", "RE") +end + diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index 28984c0..165db98 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -11,8 +11,110 @@ function technic.get_cable_tier(name) return cable_tier[name] end -local function clear_networks() - technic.networks = {} +local function check_connections(pos) + -- Build a table of all machines + local machines = {} + for tier,list in pairs(technic.machines) do + for k,v in pairs(list) do + machines[k] = v + end + end + local connections = {} + local positions = { + {x=pos.x+1, y=pos.y, z=pos.z}, + {x=pos.x-1, y=pos.y, z=pos.z}, + {x=pos.x, y=pos.y+1, z=pos.z}, + {x=pos.x, y=pos.y-1, z=pos.z}, + {x=pos.x, y=pos.y, z=pos.z+1}, + {x=pos.x, y=pos.y, z=pos.z-1}} + for _,connected_pos in pairs(positions) do + local name = minetest.get_node(connected_pos).name + if machines[name] or technic.get_cable_tier(name) then + table.insert(connections,connected_pos) + end + end + return connections +end + +local function clear_networks(pos) + local node = minetest.get_node(pos) + local meta = minetest.get_meta(pos) + local placed = node.name ~= "air" + local positions = check_connections(pos) + if #positions < 1 then return end + local dead_end = #positions == 1 + for _,connected_pos in pairs(positions) do + local net = technic.cables[minetest.hash_node_position(connected_pos)] + if net and technic.networks[net] then + if dead_end and placed then + -- Dead end placed, add it to the network + -- Get the network + local network_id = technic.cables[minetest.hash_node_position(positions[1])] + if not network_id then + -- We're evidently not on a network, nothing to add ourselves to + return + end + local sw_pos = minetest.get_position_from_hash(network_id) + sw_pos.y = sw_pos.y + 1 + local network = technic.networks[network_id] + local tier = network.tier + + -- Actually add it to the (cached) network + -- This is similar to check_node_subp + technic.cables[minetest.hash_node_position(pos)] = network_id + pos.visited = 1 + if technic.is_tier_cable(name, tier) then + table.insert(network.all_nodes,pos) + elseif technic.machines[tier][node.name] then + meta:set_string(tier.."_network",minetest.pos_to_string(sw_pos)) + if technic.machines[tier][node.name] == technic.producer then + table.insert(network.PR_nodes,pos) + elseif technic.machines[tier][node.name] == technic.receiver then + table.insert(network.RE_nodes,pos) + elseif technic.machines[tier][node.name] == technic.producer_receiver then + table.insert(network.PR_nodes,pos) + table.insert(network.RE_nodes,pos) + elseif technic.machines[tier][node.name] == "SPECIAL" and + (pos.x ~= sw_pos.x or pos.y ~= sw_pos.y or pos.z ~= sw_pos.z) and + from_below then + table.insert(network.SP_nodes,pos) + elseif technic.machines[tier][node.name] == technic.battery then + table.insert(network.BA_nodes,pos) + end + end + elseif dead_end and not placed then + -- Dead end removed, remove it from the network + -- Get the network + local network_id = technic.cables[minetest.hash_node_position(positions[1])] + if not network_id then + -- We're evidently not on a network, nothing to add ourselves to + return + end + local network = technic.networks[network_id] + + -- Search for and remove machine + technic.cables[minetest.hash_node_position(pos)] = nil + for tblname,table in pairs(network) do + if tblname ~= "tier" then + for machinenum,machine in pairs(table) do + if machine.x == pos.x + and machine.y == pos.y + and machine.z == pos.z then + table[machinenum] = nil + end + end + end + end + else + -- Not a dead end, so the whole network needs to be recalculated + for _,v in pairs(technic.networks[net].all_nodes) do + local pos1 = minetest.hash_node_position(v) + technic.cables[pos1] = nil + end + technic.networks[net] = nil + end + end + end end function technic.register_cable(tier, size) @@ -55,7 +157,7 @@ end local function clear_nets_if_machine(pos, node) for tier, machine_list in pairs(technic.machines) do if machine_list[node.name] ~= nil then - return clear_networks() + return clear_networks(pos) end end end diff --git a/technic/machines/supply_converter.lua b/technic/machines/supply_converter.lua index 32597de..15c761d 100644 --- a/technic/machines/supply_converter.lua +++ b/technic/machines/supply_converter.lua @@ -9,12 +9,62 @@ local S = technic.getter +local function set_supply_converter_formspec(meta) + local formspec = "size[5,2.25]".. + "field[0.3,0.5;2,1;power;"..S("Input Power")..";"..meta:get_int("power").."]" + -- The names for these toggle buttons are explicit about which + -- state they'll switch to, so that multiple presses (arising + -- from the ambiguity between lag and a missed press) only make + -- the single change that the user expects. + if meta:get_int("mesecon_mode") == 0 then + formspec = formspec.."button[0,1;5,1;mesecon_mode_1;"..S("Ignoring Mesecon Signal").."]" + else + formspec = formspec.."button[0,1;5,1;mesecon_mode_0;"..S("Controlled by Mesecon Signal").."]" + end + if meta:get_int("enabled") == 0 then + formspec = formspec.."button[0,1.75;5,1;enable;"..S("%s Disabled"):format(S("Supply Converter")).."]" + else + formspec = formspec.."button[0,1.75;5,1;disable;"..S("%s Enabled"):format(S("Supply Converter")).."]" + end + meta:set_string("formspec", formspec) +end + +local supply_converter_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + local power = nil + if fields.power then + power = tonumber(fields.power) or 0 + power = 100 * math.floor(power / 100) + power = math.max(power, 0) + power = math.min(power, 10000) + if power == meta:get_int("power") then power = nil end + end + if power then meta:set_int("power", power) end + if fields.enable then meta:set_int("enabled", 1) end + if fields.disable then meta:set_int("enabled", 0) end + if fields.mesecon_mode_0 then meta:set_int("mesecon_mode", 0) end + if fields.mesecon_mode_1 then meta:set_int("mesecon_mode", 1) end + set_supply_converter_formspec(meta) +end + +local mesecons = { + effector = { + action_on = function(pos, node) + minetest.get_meta(pos):set_int("mesecon_effect", 1) + end, + action_off = function(pos, node) + minetest.get_meta(pos):set_int("mesecon_effect", 0) + end + } +} + local run = function(pos, node) - local demand = 10000 local remain = 0.9 -- Machine information local machine_name = S("Supply Converter") local meta = minetest.get_meta(pos) + local enabled = meta:get_int("enabled") ~= 0 and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0) + local demand = enabled and meta:get_int("power") or 10000 local pos_up = {x=pos.x, y=pos.y+1, z=pos.z} local pos_down = {x=pos.x, y=pos.y-1, z=pos.z} @@ -53,12 +103,19 @@ minetest.register_node("technic:supply_converter", { technic_machine=1, technic_all_tiers=1}, connect_sides = {"top", "bottom"}, sounds = default.node_sound_wood_defaults(), + on_receive_fields = supply_converter_receive_fields, on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", S("Supply Converter")) - meta:set_float("active", false) + meta:set_int("power", 10000) + meta:set_int("enabled", 1) + meta:set_int("mesecon_mode", 0) + meta:set_int("mesecon_effect", 0) + set_supply_converter_formspec(meta) end, + mesecons = mesecons, technic_run = run, + technic_on_disable = run, }) minetest.register_craft({ diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index f7ec0b6..f925817 100644 --- a/technic/machines/switching_station.lua +++ b/technic/machines/switching_station.lua @@ -32,6 +32,7 @@ -- This way the supplies are separated per network. technic.networks = {} +technic.cables = {} local S = technic.getter @@ -57,6 +58,11 @@ minetest.register_node("technic:switching_station",{ meta:set_string("infotext", S("Switching Station")) meta:set_string("active", 1) end, + after_dig_node = function(pos) + minetest.forceload_free_block(pos) + pos.y = pos.y - 1 + minetest.forceload_free_block(pos) + end, }) -------------------------------------------------- @@ -64,7 +70,8 @@ minetest.register_node("technic:switching_station",{ -------------------------------------------------- -- Add a wire node to the LV/MV/HV network -local add_new_cable_node = function(nodes, pos) +local add_new_cable_node = function(nodes, pos, network_id) + technic.cables[minetest.hash_node_position(pos)] = network_id -- Ignore if the node has already been added for i = 1, #nodes do if pos.x == nodes[i].x and @@ -78,31 +85,31 @@ local add_new_cable_node = function(nodes, pos) end -- Generic function to add found connected nodes to the right classification array -local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, pos, machines, tier, sw_pos, from_below) +local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, pos, machines, tier, sw_pos, from_below, network_id) technic.get_or_load_node(pos) local meta = minetest.get_meta(pos) local name = minetest.get_node(pos).name if technic.is_tier_cable(name, tier) then - add_new_cable_node(all_nodes, pos) + add_new_cable_node(all_nodes, pos,network_id) elseif machines[name] then --dprint(name.." is a "..machines[name]) + meta:set_string(tier.."_network",minetest.pos_to_string(sw_pos)) if machines[name] == technic.producer then - add_new_cable_node(PR_nodes, pos) + add_new_cable_node(PR_nodes, pos, network_id) elseif machines[name] == technic.receiver then - add_new_cable_node(RE_nodes, pos) + add_new_cable_node(RE_nodes, pos, network_id) elseif machines[name] == technic.producer_receiver then - add_new_cable_node(PR_nodes, pos) - add_new_cable_node(RE_nodes, pos) + add_new_cable_node(PR_nodes, pos, network_id) + add_new_cable_node(RE_nodes, pos, network_id) elseif machines[name] == "SPECIAL" and (pos.x ~= sw_pos.x or pos.y ~= sw_pos.y or pos.z ~= sw_pos.z) and from_below then -- Another switching station -> disable it - add_new_cable_node(SP_nodes, pos) + add_new_cable_node(SP_nodes, pos, network_id) meta:set_int("active", 0) - meta:set_string("active_pos", minetest.serialize(sw_pos)) elseif machines[name] == technic.battery then - add_new_cable_node(BA_nodes, pos) + add_new_cable_node(BA_nodes, pos, network_id) end meta:set_int(tier.."_EU_timeout", 2) -- Touch node @@ -110,7 +117,7 @@ local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nod end -- Traverse a network given a list of machines and a cable type name -local traverse_network = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, i, machines, tier, sw_pos) +local traverse_network = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, i, machines, tier, sw_pos, network_id) local pos = all_nodes[i] local positions = { {x=pos.x+1, y=pos.y, z=pos.z}, @@ -121,7 +128,7 @@ local traverse_network = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_no {x=pos.x, y=pos.y, z=pos.z-1}} --print("ON") for i, cur_pos in pairs(positions) do - check_node_subp(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, cur_pos, machines, tier, sw_pos, i == 3) + check_node_subp(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, cur_pos, machines, tier, sw_pos, i == 3, network_id) end end @@ -153,11 +160,11 @@ local get_network = function(sw_pos, pos1, tier) local all_nodes = {pos1} repeat traverse_network(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, - i, technic.machines[tier], tier, sw_pos) + i, technic.machines[tier], tier, sw_pos, minetest.hash_node_position(pos1)) i = i + 1 until all_nodes[i] == nil technic.networks[minetest.hash_node_position(pos1)] = {tier = tier, PR_nodes = PR_nodes, - RE_nodes = RE_nodes, BA_nodes = BA_nodes, SP_nodes = SP_nodes} + RE_nodes = RE_nodes, BA_nodes = BA_nodes, SP_nodes = SP_nodes, all_nodes = all_nodes} return PR_nodes, BA_nodes, RE_nodes end @@ -183,27 +190,30 @@ minetest.register_abm({ local BA_nodes local RE_nodes local machine_name = S("Switching Station") + + -- Which kind of network are we on: + pos1 = {x=pos.x, y=pos.y-1, z=pos.z} + --Disable if necessary if meta:get_int("active") ~= 1 then - meta:set_int("active", 1) - local active_pos = minetest.deserialize(meta:get_string("active_pos")) - if active_pos then - local meta1 = minetest.get_meta(active_pos) - meta:set_string("infotext", S("%s (Slave)"):format(meta1:get_string("infotext"))) - end + minetest.forceload_free_block(pos) + minetest.forceload_free_block(pos1) + meta:set_string("infotext",S("%s Already Present"):format(machine_name)) return end - - -- Which kind of network are we on: - pos1 = {x=pos.x, y=pos.y-1, z=pos.z} local name = minetest.get_node(pos1).name local tier = technic.get_cable_tier(name) if tier then + -- Forceload switching station + minetest.forceload_block(pos) + minetest.forceload_block(pos1) PR_nodes, BA_nodes, RE_nodes = get_network(pos, pos1, tier) else --dprint("Not connected to a network") meta:set_string("infotext", S("%s Has No Network"):format(machine_name)) + minetest.forceload_free_block(pos) + minetest.forceload_free_block(pos1) return end @@ -291,6 +301,10 @@ minetest.register_abm({ S("@1. Supply: @2 Demand: @3", machine_name, technic.pretty_num(PR_eu_supply), technic.pretty_num(RE_eu_demand))) + -- Data that will be used by the power monitor + meta:set_int("supply",PR_eu_supply) + meta:set_int("demand",RE_eu_demand) + -- If the PR supply is enough for the RE demand supply them all if PR_eu_supply >= RE_eu_demand then --dprint("PR_eu_supply"..PR_eu_supply.." >= RE_eu_demand"..RE_eu_demand) @@ -352,6 +366,7 @@ minetest.register_abm({ meta1 = minetest.get_meta(pos1) meta1:set_int(eu_input_str, 0) end + end, }) @@ -374,6 +389,7 @@ minetest.register_abm({ interval = 1, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.get_meta(pos) for tier, machines in pairs(technic.machines) do if machines[node.name] and switching_station_timeout_count(pos, tier) then local nodedef = minetest.registered_nodes[node.name] @@ -392,6 +408,23 @@ minetest.register_abm({ end, }) +--Re-enable disabled switching station if necessary, similar to the timeout above +minetest.register_abm({ + nodenames = {"technic:switching_station"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.get_meta(pos) + local pos1 = {x=pos.x,y=pos.y-1,z=pos.z} + local tier = technic.get_cable_tier(minetest.get_node(pos1).name) + if not tier then return end + if switching_station_timeout_count(pos, tier) then + local meta = minetest.get_meta(pos) + meta:set_int("active",1) + end + end, +}) + for tier, machines in pairs(technic.machines) do -- SPECIAL will not be traversed technic.register_machine(tier, "technic:switching_station", "SPECIAL") diff --git a/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg b/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg index 3d290b0..1f21a16 100644 Binary files a/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg and b/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg differ diff --git a/technic/textures/technic_power_monitor_bottom_back.png b/technic/textures/technic_power_monitor_bottom_back.png new file mode 100644 index 0000000..c857039 Binary files /dev/null and b/technic/textures/technic_power_monitor_bottom_back.png differ diff --git a/technic/textures/technic_power_monitor_front.png b/technic/textures/technic_power_monitor_front.png new file mode 100644 index 0000000..b0db568 Binary files /dev/null and b/technic/textures/technic_power_monitor_front.png differ diff --git a/technic/textures/technic_power_monitor_sides.png b/technic/textures/technic_power_monitor_sides.png new file mode 100644 index 0000000..a6df4f3 Binary files /dev/null and b/technic/textures/technic_power_monitor_sides.png differ diff --git a/technic/tools/mining_drill.lua b/technic/tools/mining_drill.lua index 8a25abe..bc426e7 100644 --- a/technic/tools/mining_drill.lua +++ b/technic/tools/mining_drill.lua @@ -71,20 +71,21 @@ local function drill_dig_it1 (player) end local function drill_dig_it2 (pos,player) + pos.y=pos.y+1 drill_dig_it0 (pos,player) pos.z=pos.z+1 drill_dig_it0 (pos,player) pos.z=pos.z-2 drill_dig_it0 (pos,player) pos.z=pos.z+1 - pos.y=pos.y+1 + pos.y=pos.y-1 drill_dig_it0 (pos,player) pos.z=pos.z+1 drill_dig_it0 (pos,player) pos.z=pos.z-2 drill_dig_it0 (pos,player) pos.z=pos.z+1 - pos.y=pos.y-2 + pos.y=pos.y-1 drill_dig_it0 (pos,player) pos.z=pos.z+1 drill_dig_it0 (pos,player) @@ -93,20 +94,21 @@ local function drill_dig_it2 (pos,player) end local function drill_dig_it3 (pos,player) + pos.y=pos.y+1 drill_dig_it0 (pos,player) pos.x=pos.x+1 drill_dig_it0 (pos,player) pos.x=pos.x-2 drill_dig_it0 (pos,player) pos.x=pos.x+1 - pos.y=pos.y+1 + pos.y=pos.y-1 drill_dig_it0 (pos,player) pos.x=pos.x+1 drill_dig_it0 (pos,player) pos.x=pos.x-2 drill_dig_it0 (pos,player) pos.x=pos.x+1 - pos.y=pos.y-2 + pos.y=pos.y-1 drill_dig_it0 (pos,player) pos.x=pos.x+1 drill_dig_it0 (pos,player) @@ -252,10 +254,9 @@ local function mining_drill_mk2_setmode(user,itemstack) mode=mode+1 if mode>=5 then mode=1 end minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(2, mode)..": "..mining_drill_mode_text[mode][1]) - item["name"]="technic:mining_drill_mk2_"..mode + itemstack:set_name("technic:mining_drill_mk2_"..mode); meta["mode"]=mode - item["metadata"]=minetest.serialize(meta) - itemstack:replace(item) + itemstack:set_metadata(minetest.serialize(meta)) return itemstack end @@ -276,10 +277,9 @@ local function mining_drill_mk3_setmode(user,itemstack) mode=mode+1 if mode>=6 then mode=1 end minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(3, mode)..": "..mining_drill_mode_text[mode][1]) - item["name"]="technic:mining_drill_mk3_"..mode + itemstack:set_name("technic:mining_drill_mk3_"..mode); meta["mode"]=mode - item["metadata"]=minetest.serialize(meta) - itemstack:replace(item) + itemstack:set_metadata(minetest.serialize(meta)) return itemstack end @@ -296,7 +296,7 @@ local function mining_drill_mk2_handler(itemstack, user, pointed_thing) end local charge_to_take = cost_to_use(2, meta.mode) if meta.charge >= charge_to_take then - local pos = minetest.get_pointed_thing_position(pointed_thing, above) + local pos = minetest.get_pointed_thing_position(pointed_thing, false) drill_dig_it(pos, user, meta.mode) if not technic.creative_mode then meta.charge = meta.charge - charge_to_take @@ -319,7 +319,7 @@ local function mining_drill_mk3_handler(itemstack, user, pointed_thing) end local charge_to_take = cost_to_use(3, meta.mode) if meta.charge >= charge_to_take then - local pos = minetest.get_pointed_thing_position(pointed_thing, above) + local pos = minetest.get_pointed_thing_position(pointed_thing, false) drill_dig_it(pos, user, meta.mode) if not technic.creative_mode then meta.charge = meta.charge - charge_to_take @@ -348,7 +348,7 @@ minetest.register_tool("technic:mining_drill", { end local charge_to_take = cost_to_use(1, 1) if meta.charge >= charge_to_take then - local pos = minetest.get_pointed_thing_position(pointed_thing, above) + local pos = minetest.get_pointed_thing_position(pointed_thing, false) drill_dig_it(pos, user, 1) if not technic.creative_mode then meta.charge = meta.charge - charge_to_take diff --git a/technic_chests/common.lua b/technic_chests/common.lua index 47054f5..32b34eb 100644 --- a/technic_chests/common.lua +++ b/technic_chests/common.lua @@ -26,12 +26,7 @@ technic.chests.can_dig = function(pos, player) end local function inv_change(pos, count, player) - local meta = minetest.get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) + if not default.can_interact_with_node(player, pos) then return 0 end return count @@ -54,18 +49,14 @@ function technic.chests.on_inv_move(pos, from_list, from_index, to_list, to_inde end function technic.chests.on_inv_put(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " puts stuff in to chest at " - ..minetest.pos_to_string(pos)) + minetest.log("action", player:get_player_name() .. + " moves " .. stack:get_name() .. + " to chest at " .. minetest.pos_to_string(pos)) end function technic.chests.on_inv_take(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from chest at " - ..minetest.pos_to_string(pos)) -end - -function has_locked_chest_privilege(meta, player) - return player:get_player_name() == meta:get_string("owner") + minetest.log("action", player:get_player_name() .. + " takes " .. stack:get_name() .. + " from chest at " .. minetest.pos_to_string(pos)) end diff --git a/technic_chests/register.lua b/technic_chests/register.lua index 25e4cde..6a5b8db 100644 --- a/technic_chests/register.lua +++ b/technic_chests/register.lua @@ -263,12 +263,45 @@ function technic.chests:definition(name, data) on_receive_fields = get_receive_fields(name, data), on_metadata_inventory_move = self.on_inv_move, on_metadata_inventory_put = self.on_inv_put, - on_metadata_inventory_take = self.on_inv_take, + on_metadata_inventory_take = self.on_inv_take, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "main", drops) + drops[#drops+1] = "technic:"..name:lower()..(data.locked and "_locked" or "").."_chest" + minetest.remove_node(pos) + return drops + end, } if data.locked then def.allow_metadata_inventory_move = self.inv_move def.allow_metadata_inventory_put = self.inv_put def.allow_metadata_inventory_take = self.inv_take + def.on_blast = function() end + def.can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") and default.can_interact_with_node(player, pos) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local name = player:get_player_name() + + -- verify placer is owner of lockable chest + if owner ~= name then + minetest.record_protection_violation(pos, name) + minetest.chat_send_player(name, "You do not own this chest.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked chest", owner + end end return def end diff --git a/technic_worldgen/oregen.lua b/technic_worldgen/oregen.lua index 795f0ec..c6782e6 100644 --- a/technic_worldgen/oregen.lua +++ b/technic_worldgen/oregen.lua @@ -54,13 +54,13 @@ minetest.register_ore({ ore_type = "scatter", ore = "technic:mineral_zinc", wherein = "default:stone", - clust_scarcity = 8*8*8, - clust_num_ores = 4, - clust_size = 3, + clust_scarcity = 9*9*9, + clust_num_ores = 5, + clust_size = 7, y_min = -32, y_max = 2, - noise_params = zinc_params, - noise_threshhold = zinc_threshhold, + noise_params = lead_params, + noise_threshhold = lead_threshhold, }) minetest.register_ore({ diff --git a/unifieddyes/init.lua b/unifieddyes/init.lua index 1221a72..a713c45 100644 --- a/unifieddyes/init.lua +++ b/unifieddyes/init.lua @@ -505,6 +505,8 @@ function unifieddyes.on_use(itemstack, player, pointed_thing) local nodedef = minetest.registered_nodes[node.name] local playername = player:get_player_name() + if not nodedef then return end -- target was an unknown node, just bail out + -- if the node has an on_punch defined, bail out and call that instead, unless "sneak" is pressed. if not player:get_player_control().sneak then local onpunch = nodedef.on_punch(pos, node, player, pointed_thing) diff --git a/worldedit_commands/wand.lua b/worldedit_commands/wand.lua index 16f9265..0780801 100644 --- a/worldedit_commands/wand.lua +++ b/worldedit_commands/wand.lua @@ -3,16 +3,6 @@ minetest.register_tool(":worldedit:wand", { inventory_image = "worldedit_wand.png", stack_max = 1, -- there is no need to have more than one liquids_pointable = true, -- ground with only water on can be selected as well - -- the tool_capabilities are completely irrelevant here - no need to dig - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level = 0, - groupcaps={ - fleshy={times={[2]=0.80, [3]=0.40}, uses=1/0.05, maxlevel=1}, - snappy={times={[2]=0.80, [3]=0.40}, uses=1/0.05, maxlevel=1}, - choppy={times={[3]=0.90}, uses=1/0.05, maxlevel=0} - } - }, on_use = function(itemstack, placer, pointed_thing) if placer ~= nil and pointed_thing ~= nil and pointed_thing.type == "node" then diff --git a/worldedit_gui/depends.txt b/worldedit_gui/depends.txt index d603ac9..2558dce 100644 --- a/worldedit_gui/depends.txt +++ b/worldedit_gui/depends.txt @@ -2,4 +2,5 @@ worldedit worldedit_commands unified_inventory? inventory_plus? -creative? \ No newline at end of file +sfinv? +creative? diff --git a/worldedit_gui/functionality.lua b/worldedit_gui/functionality.lua index 7010b14..5cbf8fa 100644 --- a/worldedit_gui/functionality.lua +++ b/worldedit_gui/functionality.lua @@ -40,7 +40,7 @@ local angle_values = {90, 180, 270} setmetatable(angle_indices, {__index = function () return 1 end}) setmetatable(angle_values, {__index = function () return 90 end}) ---given multiple sets of privileges, produces a single set of privs that would have the same effect as requiring all of them at the same time +-- given multiple sets of privileges, produces a single set of privs that would have the same effect as requiring all of them at the same time local combine_privs = function(...) local result = {} for i, privs in ipairs({...}) do @@ -54,6 +54,12 @@ local combine_privs = function(...) return result end +-- display node (or unknown_node image otherwise) at specified pos in formspec +local formspec_node = function(pos, nodename) + return nodename and string.format("item_image[%s;1,1;%s]", pos, nodename) + or string.format("image[%s;1,1;worldedit_gui_unknown.png]", pos) +end + worldedit.register_gui_function("worldedit_gui_about", { name = "About", privs = minetest.chatcommands["/about"].privs, on_select = function(name) @@ -155,8 +161,7 @@ worldedit.register_gui_function("worldedit_gui_set", { return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_set") .. string.format("field[0.5,1.5;4,0.8;worldedit_gui_set_node;Name;%s]", minetest.formspec_escape(node)) .. "button[4,1.18;1.5,0.8;worldedit_gui_set_search;Search]" .. - (nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename) - or "image[5.5,1.1;1,1;unknown_node.png]") .. + formspec_node("5.5,1.1", nodename) .. "button_exit[0,2.5;3,0.8;worldedit_gui_set_submit;Set Nodes]" end, }) @@ -166,7 +171,10 @@ worldedit.register_gui_handler("worldedit_gui_set", function(name, fields) gui_nodename1[name] = tostring(fields.worldedit_gui_set_node) worldedit.show_page(name, "worldedit_gui_set") if fields.worldedit_gui_set_submit then - minetest.chatcommands["/set"].func(name, gui_nodename1[name]) + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/set"].func(name, n) + end end return true end @@ -181,12 +189,10 @@ worldedit.register_gui_function("worldedit_gui_replace", { return "size[6.5,4]" .. worldedit.get_formspec_header("worldedit_gui_replace") .. string.format("field[0.5,1.5;4,0.8;worldedit_gui_replace_search;Name;%s]", minetest.formspec_escape(search)) .. "button[4,1.18;1.5,0.8;worldedit_gui_replace_search_search;Search]" .. - (search_nodename and string.format("item_image[5.5,1.1;1,1;%s]", search_nodename) - or "image[5.5,1.1;1,1;unknown_node.png]") .. + formspec_node("5.5,1.1", search_nodename) .. string.format("field[0.5,2.5;4,0.8;worldedit_gui_replace_replace;Name;%s]", minetest.formspec_escape(replace)) .. "button[4,2.18;1.5,0.8;worldedit_gui_replace_replace_search;Search]" .. - (replace_nodename and string.format("item_image[5.5,2.1;1,1;%s]", replace_nodename) - or "image[5.5,2.1;1,1;unknown_node.png]") .. + formspec_node("5.5,2.1", replace_nodename) .. "button_exit[0,3.5;3,0.8;worldedit_gui_replace_submit;Replace Nodes]" .. "button_exit[3.5,3.5;3,0.8;worldedit_gui_replace_submit_inverse;Replace Inverse]" end, @@ -198,10 +204,19 @@ worldedit.register_gui_handler("worldedit_gui_replace", function(name, fields) gui_nodename1[name] = tostring(fields.worldedit_gui_replace_search) gui_nodename2[name] = tostring(fields.worldedit_gui_replace_replace) worldedit.show_page(name, "worldedit_gui_replace") + + local submit = nil if fields.worldedit_gui_replace_submit then - minetest.chatcommands["/replace"].func(name, string.format("%s %s", gui_nodename1[name], gui_nodename2[name])) + submit = "replace" elseif fields.worldedit_gui_replace_submit_inverse then - minetest.chatcommands["/replaceinverse"].func(name, string.format("%s %s", gui_nodename1[name], gui_nodename2[name])) + submit = "replaceinverse" + end + if submit then + local n1 = worldedit.normalize_nodename(gui_nodename1[name]) + local n2 = worldedit.normalize_nodename(gui_nodename2[name]) + if n1 and n2 then + minetest.chatcommands["/"..submit].func(name, string.format("%s %s", n1, n2)) + end end return true end @@ -216,8 +231,7 @@ worldedit.register_gui_function("worldedit_gui_sphere_dome", { return "size[6.5,5]" .. worldedit.get_formspec_header("worldedit_gui_sphere_dome") .. string.format("field[0.5,1.5;4,0.8;worldedit_gui_sphere_dome_node;Name;%s]", minetest.formspec_escape(node)) .. "button[4,1.18;1.5,0.8;worldedit_gui_sphere_dome_search;Search]" .. - (nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename) - or "image[5.5,1.1;1,1;unknown_node.png]") .. + formspec_node("5.5,1.1", nodename) .. string.format("field[0.5,2.5;4,0.8;worldedit_gui_sphere_dome_radius;Radius;%s]", minetest.formspec_escape(radius)) .. "button_exit[0,3.5;3,0.8;worldedit_gui_sphere_dome_submit_hollow;Hollow Sphere]" .. "button_exit[3.5,3.5;3,0.8;worldedit_gui_sphere_dome_submit_solid;Solid Sphere]" .. @@ -233,14 +247,22 @@ worldedit.register_gui_handler("worldedit_gui_sphere_dome", function(name, field gui_nodename1[name] = tostring(fields.worldedit_gui_sphere_dome_node) gui_distance2[name] = tostring(fields.worldedit_gui_sphere_dome_radius) worldedit.show_page(name, "worldedit_gui_sphere_dome") + + local submit = nil if fields.worldedit_gui_sphere_dome_submit_hollow then - minetest.chatcommands["/hollowsphere"].func(name, string.format("%s %s", gui_distance2[name], gui_nodename1[name])) + submit = "hollowsphere" elseif fields.worldedit_gui_sphere_dome_submit_solid then - minetest.chatcommands["/sphere"].func(name, string.format("%s %s", gui_distance2[name], gui_nodename1[name])) + submit = "sphere" elseif fields.worldedit_gui_sphere_dome_submit_hollow_dome then - minetest.chatcommands["/hollowdome"].func(name, string.format("%s %s", gui_distance2[name], gui_nodename1[name])) + submit = "hollowdome" elseif fields.worldedit_gui_sphere_dome_submit_solid_dome then - minetest.chatcommands["/dome"].func(name, string.format("%s %s", gui_distance2[name], gui_nodename1[name])) + submit = "dome" + end + if submit then + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/"..submit].func(name, string.format("%s %s", gui_distance2[name], n)) + end end return true end @@ -255,8 +277,7 @@ worldedit.register_gui_function("worldedit_gui_cylinder", { return "size[6.5,5]" .. worldedit.get_formspec_header("worldedit_gui_cylinder") .. string.format("field[0.5,1.5;4,0.8;worldedit_gui_cylinder_node;Name;%s]", minetest.formspec_escape(node)) .. "button[4,1.18;1.5,0.8;worldedit_gui_cylinder_search;Search]" .. - (nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename) - or "image[5.5,1.1;1,1;unknown_node.png]") .. + formspec_node("5.5,1.1", nodename) .. string.format("field[0.5,2.5;4,0.8;worldedit_gui_cylinder_length;Length;%s]", minetest.formspec_escape(length)) .. string.format("dropdown[4,2.18;2.5;worldedit_gui_cylinder_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) .. string.format("field[0.5,3.5;4,0.8;worldedit_gui_cylinder_radius;Radius;%s]", minetest.formspec_escape(radius)) .. @@ -273,10 +294,18 @@ worldedit.register_gui_handler("worldedit_gui_cylinder", function(name, fields) gui_distance1[name] = tostring(fields.worldedit_gui_cylinder_length) gui_distance2[name] = tostring(fields.worldedit_gui_cylinder_radius) worldedit.show_page(name, "worldedit_gui_cylinder") + + local submit = nil if fields.worldedit_gui_cylinder_submit_hollow then - minetest.chatcommands["/hollowcylinder"].func(name, string.format("%s %s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_distance2[name], gui_nodename1[name])) + submit = "hollowcylinder" elseif fields.worldedit_gui_cylinder_submit_solid then - minetest.chatcommands["/cylinder"].func(name, string.format("%s %s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_distance2[name], gui_nodename1[name])) + submit = "cylinder" + end + if submit then + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/"..submit].func(name, string.format("%s %s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_distance2[name], n)) + end end return true end @@ -296,8 +325,7 @@ worldedit.register_gui_function("worldedit_gui_pyramid", { return "size[6.5,4]" .. worldedit.get_formspec_header("worldedit_gui_pyramid") .. string.format("field[0.5,1.5;4,0.8;worldedit_gui_pyramid_node;Name;%s]", minetest.formspec_escape(node)) .. "button[4,1.18;1.5,0.8;worldedit_gui_pyramid_search;Search]" .. - (nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename) - or "image[5.5,1.1;1,1;unknown_node.png]") .. + formspec_node("5.5,1.1", nodename) .. string.format("field[0.5,2.5;4,0.8;worldedit_gui_pyramid_length;Length;%s]", minetest.formspec_escape(length)) .. string.format("dropdown[4,2.18;2.5;worldedit_gui_pyramid_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) .. "button_exit[0,3.5;3,0.8;worldedit_gui_pyramid_submit_hollow;Hollow Pyramid]" .. @@ -311,10 +339,18 @@ worldedit.register_gui_handler("worldedit_gui_pyramid", function(name, fields) gui_axis1[name] = axis_indices[fields.worldedit_gui_pyramid_axis] gui_distance1[name] = tostring(fields.worldedit_gui_pyramid_length) worldedit.show_page(name, "worldedit_gui_pyramid") + + local submit = nil if fields.worldedit_gui_pyramid_submit_solid then - minetest.chatcommands["/pyramid"].func(name, string.format("%s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_nodename1[name])) + submit = "pyramid" elseif fields.worldedit_gui_pyramid_submit_hollow then - minetest.chatcommands["/hollowpyramid"].func(name, string.format("%s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_nodename1[name])) + submit = "hollowpyramid" + end + if submit then + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/"..submit].func(name, string.format("%s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], n)) + end end return true end @@ -334,8 +370,7 @@ worldedit.register_gui_function("worldedit_gui_spiral", { return "size[6.5,6]" .. worldedit.get_formspec_header("worldedit_gui_spiral") .. string.format("field[0.5,1.5;4,0.8;worldedit_gui_spiral_node;Name;%s]", minetest.formspec_escape(node)) .. "button[4,1.18;1.5,0.8;worldedit_gui_spiral_search;Search]" .. - (nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename) - or "image[5.5,1.1;1,1;unknown_node.png]") .. + formspec_node("5.5,1.1", nodename) .. string.format("field[0.5,2.5;4,0.8;worldedit_gui_spiral_length;Side Length;%s]", minetest.formspec_escape(length)) .. string.format("field[0.5,3.5;4,0.8;worldedit_gui_spiral_height;Height;%s]", minetest.formspec_escape(height)) .. string.format("field[0.5,4.5;4,0.8;worldedit_gui_spiral_space;Wall Spacing;%s]", minetest.formspec_escape(space)) .. @@ -351,7 +386,10 @@ worldedit.register_gui_handler("worldedit_gui_spiral", function(name, fields) gui_distance3[name] = tostring(fields.worldedit_gui_spiral_space) worldedit.show_page(name, "worldedit_gui_spiral") if fields.worldedit_gui_spiral_submit then - minetest.chatcommands["/spiral"].func(name, string.format("%s %s %s %s", gui_distance1[name], gui_distance2[name], gui_distance3[name], gui_nodename1[name])) + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/spiral"].func(name, string.format("%s %s %s %s", gui_distance1[name], gui_distance2[name], gui_distance3[name], n)) + end end return true end @@ -456,7 +494,6 @@ worldedit.register_gui_function("worldedit_gui_transpose", { worldedit.register_gui_handler("worldedit_gui_transpose", function(name, fields) if fields.worldedit_gui_transpose_submit then gui_axis1[name] = axis_indices[fields.worldedit_gui_transpose_axis1] - gui_axis2[name] = axis_indices[fields.worldedit_gui_transpose_axis2] worldedit.show_page(name, "worldedit_gui_transpose") minetest.chatcommands["/transpose"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], axis_values[gui_axis2[name]])) return true @@ -578,8 +615,7 @@ worldedit.register_gui_function("worldedit_gui_suppress", { return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_suppress") .. string.format("field[0.5,1.5;4,0.8;worldedit_gui_suppress_node;Name;%s]", minetest.formspec_escape(node)) .. "button[4,1.18;1.5,0.8;worldedit_gui_suppress_search;Search]" .. - (nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename) - or "image[5.5,1.1;1,1;unknown_node.png]") .. + formspec_node("5.5,1.1", nodename) .. "button_exit[0,2.5;3,0.8;worldedit_gui_suppress_submit;Suppress Nodes]" end, }) @@ -589,7 +625,10 @@ worldedit.register_gui_handler("worldedit_gui_suppress", function(name, fields) gui_nodename1[name] = tostring(fields.worldedit_gui_suppress_node) worldedit.show_page(name, "worldedit_gui_suppress") if fields.worldedit_gui_suppress_submit then - minetest.chatcommands["/suppress"].func(name, gui_nodename1[name]) + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/suppress"].func(name, n) + end end return true end @@ -604,8 +643,7 @@ worldedit.register_gui_function("worldedit_gui_highlight", { return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_highlight") .. string.format("field[0.5,1.5;4,0.8;worldedit_gui_highlight_node;Name;%s]", minetest.formspec_escape(node)) .. "button[4,1.18;1.5,0.8;worldedit_gui_highlight_search;Search]" .. - (nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename) - or "image[5.5,1.1;1,1;unknown_node.png]") .. + formspec_node("5.5,1.1", nodename) .. "button_exit[0,2.5;3,0.8;worldedit_gui_highlight_submit;Highlight Nodes]" end, }) @@ -615,7 +653,10 @@ worldedit.register_gui_handler("worldedit_gui_highlight", function(name, fields) gui_nodename1[name] = tostring(fields.worldedit_gui_highlight_node) worldedit.show_page(name, "worldedit_gui_highlight") if fields.worldedit_gui_highlight_submit then - minetest.chatcommands["/highlight"].func(name, gui_nodename1[name]) + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/highlight"].func(name, n) + end end return true end diff --git a/worldedit_gui/init.lua b/worldedit_gui/init.lua index 57fd9a8..0a770c6 100644 --- a/worldedit_gui/init.lua +++ b/worldedit_gui/init.lua @@ -131,7 +131,37 @@ elseif rawget(_G, "inventory_plus") then --inventory++ installed inventory_plus.set_inventory_formspec(player, get_formspec(name, page)) end end +elseif rawget(_G, "sfinv") then --sfinv installed (part of minetest_game since 0.4.15) + assert(sfinv.enabled) + local orig_get = sfinv.pages["sfinv:crafting"].get + sfinv.override_page("sfinv:crafting", { + get = function(self, player, context) + local can_worldedit = minetest.check_player_privs(player, {worldedit=true}) + local fs = orig_get(self, player, context) + return fs .. (can_worldedit and "image_button[0,0;1,1;inventory_plus_worldedit_gui.png;worldedit_gui;]" or "") + end + }) + + --show the form when the button is pressed and hide it when done + minetest.register_on_player_receive_fields(function(player, formname, fields) + if fields.worldedit_gui then --main page + worldedit.show_page(player:get_player_name(), "worldedit_gui") + return true + elseif fields.worldedit_gui_exit then --return to original page + sfinv.set_page(player, "sfinv:crafting") + return true + end + return false + end) + + worldedit.show_page = function(name, page) + local player = minetest.get_player_by_name(name) + if player then + player:set_inventory_formspec(get_formspec(name, page)) + end + end else --fallback button + -- FIXME: this is a huge clusterfuck and the back button is broken local player_formspecs = {} local update_main_formspec = function(name) diff --git a/worldedit_gui/textures/worldedit_gui_unknown.png b/worldedit_gui/textures/worldedit_gui_unknown.png new file mode 100644 index 0000000..f57436c Binary files /dev/null and b/worldedit_gui/textures/worldedit_gui_unknown.png differ -- cgit v1.2.3