From 3c47f229fcbdb7cad28bacbc579516bf3ecf6c03 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Sun, 19 Aug 2018 20:28:44 -0400 Subject: drop usesdirt, update gloopblocks, led_marquee and technic --- gloopblocks/depends.txt | 1 + gloopblocks/init.lua | 171 +++++- .../textures/gloopblocks_dirt_brick_overlay.png | Bin 0 -> 430 bytes .../textures/gloopblocks_dirt_cobble_mask.png | Bin 0 -> 224 bytes .../textures/gloopblocks_dirt_stone_mask.png | Bin 0 -> 268 bytes gloopblocks/textures/gloopblocks_ladder_mask.png | Bin 0 -> 110 bytes .../textures/gloopblocks_ladder_overlay.png | Bin 0 -> 141 bytes led_marquee/README.md | 31 +- led_marquee/depends.txt | 4 +- led_marquee/init.lua | 135 +++-- led_marquee/screenshot_20180816_234431.png | Bin 0 -> 664346 bytes led_marquee/screenshot_20180816_234431_1.png | Bin 0 -> 664346 bytes led_marquee/textures/led_marquee_char_138.png | Bin 272 -> 451 bytes technic/config.lua | 1 + technic/crafts.lua | 2 +- technic/machines/creative.lua | 40 ++ technic/machines/init.lua | 5 + technic/machines/power_monitor.lua | 6 + technic/machines/register/alloy_recipes.lua | 2 +- technic/machines/register/battery_box.lua | 2 +- technic/machines/register/grinder_recipes.lua | 6 +- technic/machines/switching_station.lua | 7 + technic/radiation.lua | 4 +- technic/tools/mining_drill.lua | 2 +- technic/tools/mining_lasers.lua | 84 +-- technic_worldgen/oregen.lua | 250 +++++---- usesdirt/README.md | 0 usesdirt/depends.txt | 1 - usesdirt/init.lua | 605 --------------------- usesdirt/textures/usesdirt_dirt_axe.png | Bin 724 -> 0 bytes usesdirt/textures/usesdirt_dirt_brick.png | Bin 4274 -> 0 bytes usesdirt/textures/usesdirt_dirt_chest.png | Bin 500 -> 0 bytes usesdirt/textures/usesdirt_dirt_cobble_stone.png | Bin 7397 -> 0 bytes .../textures/usesdirt_dirt_cobble_stone_fence.png | Bin 6533 -> 0 bytes .../textures/usesdirt_dirt_cobble_stone_ladder.png | Bin 8930 -> 0 bytes usesdirt/textures/usesdirt_dirt_cup.png | Bin 952 -> 0 bytes usesdirt/textures/usesdirt_dirt_fence.png | Bin 2176 -> 0 bytes usesdirt/textures/usesdirt_dirt_furnace_bottom.png | Bin 3062 -> 0 bytes usesdirt/textures/usesdirt_dirt_furnace_front.png | Bin 2853 -> 0 bytes .../usesdirt_dirt_furnace_front_active.png | Bin 4794 -> 0 bytes usesdirt/textures/usesdirt_dirt_furnace_side.png | Bin 3062 -> 0 bytes usesdirt/textures/usesdirt_dirt_furnace_top.png | Bin 3062 -> 0 bytes usesdirt/textures/usesdirt_dirt_ladder.png | Bin 2969 -> 0 bytes usesdirt/textures/usesdirt_dirt_locked_chest.png | Bin 948 -> 0 bytes usesdirt/textures/usesdirt_dirt_pick.png | Bin 1041 -> 0 bytes usesdirt/textures/usesdirt_dirt_shovel.png | Bin 773 -> 0 bytes usesdirt/textures/usesdirt_dirt_stone.png | Bin 1619 -> 0 bytes usesdirt/textures/usesdirt_dirt_stone_fence.png | Bin 1630 -> 0 bytes usesdirt/textures/usesdirt_dirt_stone_ladder.png | Bin 1909 -> 0 bytes usesdirt/textures/usesdirt_dirt_sword.png | Bin 896 -> 0 bytes usesdirt/textures/usesdirt_dirt_torch.png | Bin 1103 -> 0 bytes 51 files changed, 550 insertions(+), 809 deletions(-) create mode 100644 gloopblocks/textures/gloopblocks_dirt_brick_overlay.png create mode 100644 gloopblocks/textures/gloopblocks_dirt_cobble_mask.png create mode 100644 gloopblocks/textures/gloopblocks_dirt_stone_mask.png create mode 100644 gloopblocks/textures/gloopblocks_ladder_mask.png create mode 100644 gloopblocks/textures/gloopblocks_ladder_overlay.png create mode 100644 led_marquee/screenshot_20180816_234431.png create mode 100644 led_marquee/screenshot_20180816_234431_1.png create mode 100644 technic/machines/creative.lua delete mode 100644 usesdirt/README.md delete mode 100644 usesdirt/depends.txt delete mode 100644 usesdirt/init.lua delete mode 100644 usesdirt/textures/usesdirt_dirt_axe.png delete mode 100644 usesdirt/textures/usesdirt_dirt_brick.png delete mode 100644 usesdirt/textures/usesdirt_dirt_chest.png delete mode 100644 usesdirt/textures/usesdirt_dirt_cobble_stone.png delete mode 100644 usesdirt/textures/usesdirt_dirt_cobble_stone_fence.png delete mode 100644 usesdirt/textures/usesdirt_dirt_cobble_stone_ladder.png delete mode 100644 usesdirt/textures/usesdirt_dirt_cup.png delete mode 100644 usesdirt/textures/usesdirt_dirt_fence.png delete mode 100644 usesdirt/textures/usesdirt_dirt_furnace_bottom.png delete mode 100644 usesdirt/textures/usesdirt_dirt_furnace_front.png delete mode 100644 usesdirt/textures/usesdirt_dirt_furnace_front_active.png delete mode 100644 usesdirt/textures/usesdirt_dirt_furnace_side.png delete mode 100644 usesdirt/textures/usesdirt_dirt_furnace_top.png delete mode 100644 usesdirt/textures/usesdirt_dirt_ladder.png delete mode 100644 usesdirt/textures/usesdirt_dirt_locked_chest.png delete mode 100644 usesdirt/textures/usesdirt_dirt_pick.png delete mode 100644 usesdirt/textures/usesdirt_dirt_shovel.png delete mode 100644 usesdirt/textures/usesdirt_dirt_stone.png delete mode 100644 usesdirt/textures/usesdirt_dirt_stone_fence.png delete mode 100644 usesdirt/textures/usesdirt_dirt_stone_ladder.png delete mode 100644 usesdirt/textures/usesdirt_dirt_sword.png delete mode 100644 usesdirt/textures/usesdirt_dirt_torch.png diff --git a/gloopblocks/depends.txt b/gloopblocks/depends.txt index cdae19c..6b7584f 100644 --- a/gloopblocks/depends.txt +++ b/gloopblocks/depends.txt @@ -10,3 +10,4 @@ xdecor? caverealms? technic? nyancat? +usesdirt? diff --git a/gloopblocks/init.lua b/gloopblocks/init.lua index 44b51b8..387b6e1 100644 --- a/gloopblocks/init.lua +++ b/gloopblocks/init.lua @@ -62,7 +62,6 @@ minetest.register_node("gloopblocks:evil_block", { sounds = default.node_sound_stone_defaults(), }) - minetest.register_node("gloopblocks:basalt", { description = S("Basalt"), tiles = {"gloopblocks_basalt.png"}, @@ -159,6 +158,176 @@ minetest.register_node("gloopblocks:scaffolding", { minetest.register_alias("moreblocks:oerkkiblock", "gloopblocks:oerkki_block") minetest.register_alias("gloopblocks:obsidian", "default:obsidian") +-- Nodes imported from Usesdirt ================================================================================ + +if not minetest.get_modpath("usesdirt") then + + local dirt_brick_tex = "default_dirt.png^gloopblocks_dirt_brick_overlay.png" + local dirt_cobble_tex = "default_cobble.png^(default_dirt.png^[mask:gloopblocks_dirt_cobble_mask.png)" + local dirt_stone_tex = "default_stone.png^(default_dirt.png^[mask:gloopblocks_dirt_stone_mask.png)" + + local dirt_ladder_tex = "(default_dirt.png^[mask:gloopblocks_ladder_mask.png)^gloopblocks_ladder_overlay.png" + local dirt_cobble_ladder_tex = "(("..dirt_cobble_tex..")^[mask:gloopblocks_ladder_mask.png)^gloopblocks_ladder_overlay.png" + local dirt_stone_ladder_tex = "(("..dirt_stone_tex..")^[mask:gloopblocks_ladder_mask.png)^gloopblocks_ladder_overlay.png" + + minetest.register_node(":usesdirt:dirt_brick", { + tiles = { dirt_brick_tex }, + description = "Dirt Brick", + groups = {snappy=2,choppy=1,oddly_breakable_by_hand=2}, + }) + minetest.register_craft({ + output = '"usesdirt:dirt_brick" 6', + recipe = { + {'default:dirt', 'default:dirt', 'default:dirt'}, + {'default:dirt', 'default:dirt', 'default:dirt'}, + {'default:dirt', 'default:dirt', 'default:dirt'}, + } + }) + + minetest.register_node(":usesdirt:dirt_ladder", { + description = "Ladder", + drawtype = "signlike", + tiles = { dirt_ladder_tex }, + inventory_image = dirt_ladder_tex, + wield_image = dirt_ladder_tex, + paramtype = "light", + paramtype2 = "wallmounted", + is_ground_content = true, + walkable = false, + climbable = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3}, + legacy_wallmounted = true, + }) + minetest.register_craft({ + output = 'usesdirt:dirt_ladder 3', + recipe = { + {'usesdirt:dirt_brick', '', 'usesdirt:dirt_brick'}, + {'usesdirt:dirt_brick', 'usesdirt:dirt_brick','usesdirt:dirt_brick'}, + {'usesdirt:dirt_brick','','usesdirt:dirt_brick'}, + } + }) + + default.register_fence(":usesdirt:dirt_fence", { + description = "Dirt Fence", + texture = "default_dirt.png", + inventory_image = "default_fence_overlay.png^default_dirt.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_dirt.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:dirt", + groups = {snappy=2,choppy=1,oddly_breakable_by_hand=3}, + sounds = default.node_sound_dirt_defaults() + }) + +---- + + minetest.register_node(":usesdirt:dirt_cobble_stone", { + tiles = { dirt_cobble_tex }, + description = "Dirt Cobble Stone", + is_ground_content = true, + groups = {cracky=3, stone=2}, + }) + minetest.register_craft({ + output = '"usesdirt:dirt_cobble_stone" 3', + recipe = { + {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, + {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, + {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, + } + }) + + minetest.register_node(":usesdirt:dirt_cobble_stone_ladder", { + description = "Ladder", + drawtype = "signlike", + tiles = { dirt_cobble_ladder_tex }, + inventory_image = dirt_cobble_ladder_tex, + wield_image = dirt_cobble_ladder_tex, + paramtype = "light", + paramtype2 = "wallmounted", + is_ground_content = true, + walkable = false, + climbable = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {cracky=3, stone=2}, + legacy_wallmounted = true, + }) + minetest.register_craft({ + output = 'usesdirt:dirt_cobble_stone_ladder 3', + recipe = { + {'usesdirt:dirt_cobble_stone', '', 'usesdirt:dirt_cobble_stone'}, + {'usesdirt:dirt_cobble_stone', 'usesdirt:dirt_cobble_stone','usesdirt:dirt_cobble_stone'}, + {'usesdirt:dirt_cobble_stone','','usesdirt:dirt_cobble_stone'}, + } + }) + + default.register_fence(":usesdirt:dirt_cobble_stone_fence", { + description = "Dirt Cobble Stone Fence", + texture = dirt_cobble_tex, + inventory_image = "default_fence_overlay.png^("..dirt_cobble_tex..")^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^("..dirt_cobble_tex..")^default_fence_overlay.png^[makealpha:255,126,126", + material = "usesdirt:dirt_cobble_stone", + groups = {cracky=3, stone=2}, + sounds = default.node_sound_stone_defaults() + }) + +---- + + minetest.register_node(":usesdirt:dirt_stone", { + tiles = { dirt_stone_tex }, + description = "Dirt Stone", + is_ground_content = true, + groups = {cracky=3, stone=2}, + }) + + minetest.register_node(":usesdirt:dirt_stone_ladder", { + description = "Ladder", + drawtype = "signlike", + tiles = { dirt_stone_ladder_tex }, + inventory_image = dirt_stone_ladder_tex, + wield_image = dirt_stone_ladder_tex, + paramtype = "light", + paramtype2 = "wallmounted", + is_ground_content = true, + walkable = false, + climbable = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {cracky=3, stone=2}, + legacy_wallmounted = true, + }) + minetest.register_craft({ + output = 'usesdirt:dirt_stone_ladder 3', + recipe = { + {'usesdirt:dirt_stone', '', 'usesdirt:dirt_stone'}, + {'usesdirt:dirt_stone', 'usesdirt:dirt_stone','usesdirt:dirt_stone'}, + {'usesdirt:dirt_stone','','usesdirt:dirt_stone'}, + } + }) + + default.register_fence(":usesdirt:dirt_stone_fence", { + description = "Dirt Cobble Stone Fence", + texture = dirt_cobble_tex, + inventory_image = "default_fence_overlay.png^("..dirt_stone_tex..")^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^("..dirt_stone_tex..")^default_fence_overlay.png^[makealpha:255,126,126", + material = "usesdirt:dirt_stone", + groups = {cracky=3, stone=2}, + sounds = default.node_sound_stone_defaults() + }) +end + -- Stairs/slabs defs, conversion of normal -> mossy items if minetest.setting_getbool("gloopblocks_mossy_conversion") ~= false then diff --git a/gloopblocks/textures/gloopblocks_dirt_brick_overlay.png b/gloopblocks/textures/gloopblocks_dirt_brick_overlay.png new file mode 100644 index 0000000..2eb70c6 Binary files /dev/null and b/gloopblocks/textures/gloopblocks_dirt_brick_overlay.png differ diff --git a/gloopblocks/textures/gloopblocks_dirt_cobble_mask.png b/gloopblocks/textures/gloopblocks_dirt_cobble_mask.png new file mode 100644 index 0000000..f1b500e Binary files /dev/null and b/gloopblocks/textures/gloopblocks_dirt_cobble_mask.png differ diff --git a/gloopblocks/textures/gloopblocks_dirt_stone_mask.png b/gloopblocks/textures/gloopblocks_dirt_stone_mask.png new file mode 100644 index 0000000..9b81c10 Binary files /dev/null and b/gloopblocks/textures/gloopblocks_dirt_stone_mask.png differ diff --git a/gloopblocks/textures/gloopblocks_ladder_mask.png b/gloopblocks/textures/gloopblocks_ladder_mask.png new file mode 100644 index 0000000..94fbd16 Binary files /dev/null and b/gloopblocks/textures/gloopblocks_ladder_mask.png differ diff --git a/gloopblocks/textures/gloopblocks_ladder_overlay.png b/gloopblocks/textures/gloopblocks_ladder_overlay.png new file mode 100644 index 0000000..976713d Binary files /dev/null and b/gloopblocks/textures/gloopblocks_ladder_overlay.png differ diff --git a/led_marquee/README.md b/led_marquee/README.md index 3cbf23c..00508dc 100644 --- a/led_marquee/README.md +++ b/led_marquee/README.md @@ -4,9 +4,11 @@ Simply place one or more panels, and set a channel on just the left-most or uppe Then send a character, a string, or one of several control words or codes to that channel from a Mesecons Lua Controller and the mod will try to display it. -A single character will be displayed on the connected panel. A numeric message (i.e. not a string) will display the first digit on the connected panel. +A single character will be displayed on the connected panel. -Strings will be displayed using all panels in a lineup, so long as they all face the same way, starting from the panel the Lua Controller is connected to, going left to right. The other panels in the line do not need to be connected to anything - think of them as being connected together internally. Only the panel at the far left need be connected to the Lua Controller. +A numeric message (i.e. not a string) will be converted into a string. + +Strings of all types (other than the keywords below) will be displayed using all panels in a lineup, so long as they all face the same way, starting from the panel the Lua Controller is connected to, going left to right. The other panels in the line do not need to be connected to anything - think of them as being connected together internally. Only the panel at the far left need be connected to the Lua Controller. The string will spread down the line until either a panel is found that faces the wrong way, or has a channel that's not empty/nil and is set to something other than what the first is set to, or if a node is encountered that is not an alpha-numeric panel at all. @@ -40,13 +42,22 @@ This mod uses the full ISO-8859-1 character set (see https://en.wikipedia.org/wi If a string is prefixed with character code 255, it is treated as UTF-8 and passed through a simple translation function. Only characters with codes greater than 159 are altered; normal ASCII text, color codes, control codes, and the above symbols are passed through unchanged. Note that in this mode, a character code over 159 is treated as the first byte of a two-byte symbol. The panels also respond to these control messages: -the keywords "off", "colon" and "period" translate to a blank space, ":", and ".", respectively (they're leftover from the nixie tubes fork, but might be useful anyway) -* "del" is mapped to character #127, a square with an X in it. -* "allon" is mapped to character #144, the full/all-on block graphic. -* "cursor" or character code 31 will display a short, thick, flashing line at the bottom of the panel. -* "off_multi" turns all panels in a lineup or wall off - essentially a "clear screen" command. -* "allon_multi" turns on all LEDs of all panels in a lineup/wall (by filling them with char #144). +* "clear" turns all panels in a lineup or wall off - essentially a "clear screen" command. +* "allon" fills all panels in a lineup/wall with char(144), i.e. the reverse of "clear". +* "start_scroll" starts the automatic scrolling function, repeatedly moving the last displayed message to the left one character space each time the scroll timer runs out (and automatically restarting it, natch). The scroll action will spread across the line, and down a multi-line wall (just set a new, different channel on the first row you want to exclude), and will continue until "stop_scroll" or any displayable message is received. + + As it advances through the message, the scroll code will search through the message for a printable character, on each scroll step, basically stripping-out color code, and using just the last one before the new start position. This is done in order to keep a constant visible speed (the text will still be colored properly though). +* "stop_scroll" does just what it says - it stops the auto-scroll timer. +* "scroll_speed" followed by a decimal number (in the string, not a byte value) sets the time between scroll steps. Minimum 0.5s, maximum 5s. +* "scroll_step" will immediately advance the last-displayed message by one character. Omit the above automatic scrolling keywords, and use ONLY this keyword instead if you want to let your LuaController control the scrolling speed. Optionally, you can follow this with a number and the scroll code will skip forward that many bytes into the message, starting from the current position, before starting the above-mentioned color-vs-character search. Essentially, this value will roughly translate to the number of printable characters to skip. +* "get" will read the one character (as a numerical character value) currently displayed by the master panel (by reading its node name) +* "getstr" will read the last-stored message for the entire lineup/wall (from the master panel's meta). Note that even if the message has been or is being scrolled, you'll get the original stored message. +* "getindex" will read the scroll index position in that message, which will always point at a printable character, per the above color-versus-character search. + +During a scroll event, the printed string is padded with spaces (one in auto mode, or as many as the skip value when manually stepping). + +If you need vertical scrolling, you will have to handle that yourself (since the size of a screen/wall is not hard-coded). A byte value of 0 to 27 in a string will change colors (i.e. string.char(0 to 27) ). @@ -64,8 +75,10 @@ A byte value of 28 in a string will act as a line feed (I would have used 10, bu A byte value of 29 in a string signals a cursor position command. The next two byte values select a column and row, respectively. The next character after the row byte will be printed there, and the rest of the string then continues printing from that spot onward with normal line wrapping, colors and so forth. Note that any string that does NOT contain cursor positioning commands will automatically start printing at the upper-left. -You can use "get" and "getstr" to read the one character from the connected panel. These messages will not read the other panels in the lineup. +Any number of color, line feed, and cursor position commands may be present in a string, making it possible to "frame-buffer" a screen full of text into a string before printing it. All panels emit a small amount of light when displaying something. The panels only mount on a wall. + +The "master"/connected panel stores the last-displayed message and some other details in its metadata, so you may occasionally need to dig and re-place the panel if things go wonky (this won't happen during normal use, but it may happen if you're making lots of changes to the panels' layout, channel names, etc). diff --git a/led_marquee/depends.txt b/led_marquee/depends.txt index 8c54f92..98f1e3e 100644 --- a/led_marquee/depends.txt +++ b/led_marquee/depends.txt @@ -1,5 +1,5 @@ default digilines mesecons_luacontroller -mesecons_microcontroller -mesecons_lamp +mesecons_microcontroller? +mesecons_lamp? diff --git a/led_marquee/init.lua b/led_marquee/init.lua index f60dfbd..5bfc1e0 100644 --- a/led_marquee/init.lua +++ b/led_marquee/init.lua @@ -1,6 +1,8 @@ -- simple LED marquee mod -- by Vanessa Dannenberg +led_marquee = {} + local S if minetest.get_modpath("intllib") then S = intllib.make_gettext_pair() @@ -53,6 +55,51 @@ local make_iso = function(s) return s2 end +-- scrolling + +led_marquee.set_timer = function(pos, timeout) + local timer = minetest.get_node_timer(pos) + timer:stop() + if timeout > 0 then + local meta = minetest.get_meta(pos) + timer:start(timeout) + end +end + +led_marquee.scroll_text = function(pos, elapsed, skip) + local meta = minetest.get_meta(pos) + local msg = meta:get_string("last_msg") + local channel = meta:get_string("channel") + local index = meta:get_int("index") + if not index or index < 1 or not string.byte(msg, index) then index = 1 end + local len = string.len(msg) + skip = skip or 1 + + index = index + skip + + while index < len and string.byte(msg, index) < 28 do + index = index + 1 + if index > len then index = 1 break end + end + + if string.byte(msg, index - 1) < 28 then + led_marquee.display_msg(pos, channel, string.sub(msg, index - 1)..string.rep(" ", skip + 1)) + else + local i = index - 1 + local color = "" + while i > 0 and string.byte(msg, i) > 27 do + i = i - 1 + if i == 0 then break end + end + if i > 0 then color = string.sub(msg, i, i) end + led_marquee.display_msg(pos, channel, color..string.sub(msg, index)..string.rep(" ", skip + 1)) + end + + meta:set_int("index", index) + if not elapsed or elapsed < 0.5 then return false end + return true +end + -- the nodes: local fdir_to_right = { @@ -71,14 +118,10 @@ local cbox = { wall_side = { -8/16, -8/16, -8/16, -7/16, 8/16, 8/16 } } -local display_string = function(pos, channel, string) - string = string.sub(string, 1, 1024) - if string == "off_multi" then - string = string.rep(" ", 1024) - elseif string == "allon_multi" then - string = string.rep(string.char(144), 1024) - elseif string.sub(string,1,1) == string.char(255) then -- treat it as incoming UTF-8 - string = make_iso(string.sub(string, 2, 1024)) +led_marquee.display_msg = function(pos, channel, msg) + msg = string.sub(msg, 1, 4096) + if string.sub(msg,1,1) == string.char(255) then -- treat it as incoming UTF-8 + msg = make_iso(string.sub(msg, 2, 4096)) end local master_fdir = minetest.get_node(pos).param2 % 8 @@ -90,7 +133,7 @@ local display_string = function(pos, channel, string) master_meta:set_int("last_color", 0) end local i = 1 - local len = string.len(string) + local len = string.len(msg) local wrapped = nil while i <= len do local node = minetest.get_node(pos2) @@ -98,7 +141,7 @@ local display_string = function(pos, channel, string) local meta = minetest.get_meta(pos2) local setchan = nil if meta then setchan = meta:get_string("channel") end - local asc = string.byte(string, i, i) + local asc = string.byte(msg, i, i) if not string.match(node.name, "led_marquee:char_") then if not wrapped then pos2.x = pos.x @@ -118,8 +161,8 @@ local display_string = function(pos, channel, string) i = i + 1 wrapped = nil elseif asc == 29 then - local c = string.byte(string, i+1, i+1) or 0 - local r = string.byte(string, i+2, i+2) or 0 + local c = string.byte(msg, i+1, i+1) or 0 + local r = string.byte(msg, i+2, i+2) or 0 pos2.x = pos.x + (fdir_to_right[fdir+1][1])*c pos2.y = pos.y - r pos2.z = pos.z + (fdir_to_right[fdir+1][2])*c @@ -153,43 +196,65 @@ local on_digiline_receive_string = function(pos, node, channel, msg) if setchan ~= channel then return end if msg and msg ~= "" and type(msg) == "string" then if string.len(msg) > 1 then - if msg == "off" then - minetest.swap_node(pos, { name = "led_marquee:char_32", param2 = fdir + (last_color*8)}) - elseif msg == "colon" then - minetest.swap_node(pos, { name = "led_marquee:char_58", param2 = fdir + (last_color*8)}) - elseif msg == "period" then - minetest.swap_node(pos, { name = "led_marquee:char_46", param2 = fdir + (last_color*8)}) - elseif msg == "del" then - minetest.swap_node(pos, { name = "led_marquee:char_127", param2 = fdir + (last_color*8)}) + if msg == "clear" then + led_marquee.set_timer(pos, 0) + msg = string.rep(" ", 2048) + meta:set_string("last_msg", msg) + led_marquee.display_msg(pos, channel, msg) + meta:set_int("index", 1) elseif msg == "allon" then - minetest.swap_node(pos, { name = "led_marquee:char_144", param2 = fdir + (last_color*8)}) - elseif msg == "cursor" then - minetest.swap_node(pos, { name = "led_marquee:char_31", param2 = fdir + (last_color*8)}) + led_marquee.set_timer(pos, 0) + msg = string.rep(string.char(144), 2048) + meta:set_string("last_msg", msg) + led_marquee.display_msg(pos, channel, msg) + meta:set_int("index", 1) + elseif msg == "start_scroll" then + local timeout = meta:get_int("timeout") + if not timeout or timeout < 0.5 or timeout > 5 then timeout = 0 end + led_marquee.set_timer(pos, timeout) + elseif msg == "stop_scroll" then + led_marquee.set_timer(pos, 0) + return + elseif string.sub(msg, 1, 12) == "scroll_speed" then + local timeout = tonumber(string.sub(msg, 13)) + if not timeout or timeout < 0.5 or timeout > 5 then timeout = 0 end + meta:set_int("timeout", timeout) + led_marquee.set_timer(pos, timeout) + elseif string.sub(msg, 1, 11) == "scroll_step" then + local skip = tonumber(string.sub(msg, 12)) + led_marquee.scroll_text(pos, nil, skip) + elseif msg == "get" then -- get the master panel's displayed char as ASCII numerical value + digilines.receptor_send(pos, digiline.rules.default, channel, tonumber(string.match(minetest.get_node(pos).name,"led_marquee:char_(.+)"))) -- wonderfully horrible string manipulaiton + elseif msg == "getstr" then -- get the last stored message + digilines.receptor_send(pos, digiline.rules.default, channel, meta:get_string("last_msg")) + elseif msg == "getindex" then -- get the scroll index + digilines.receptor_send(pos, digiline.rules.default, channel, meta:get_int("index")) else - display_string(pos, channel, msg) + led_marquee.set_timer(pos, 0) + meta:set_string("last_msg", msg) + led_marquee.display_msg(pos, channel, msg) + meta:set_int("index", 1) end else local asc = string.byte(msg) if asc > 30 and asc < 256 then minetest.swap_node(pos, { name = "led_marquee:char_"..asc, param2 = fdir + (last_color*8)}) + meta:set_string("last_msg", tostring(msg)) + meta:set_int("index", 1) elseif asc < 28 then last_color = asc meta:set_int("last_color", asc) - elseif msg == "get" then -- get value as ASCII numerical value - digiline:receptor_send(pos, digiline.rules.default, channel, tonumber(string.match(minetest.get_node(pos).name,"led_marquee:char_(.+)"))) -- wonderfully horrible string manipulaiton - elseif msg == "getstr" then -- get actual char - digiline:receptor_send(pos, digiline.rules.default, channel, string.char(tonumber(string.match(minetest.get_node(pos).name,"led_marquee:char_(.+)")))) end end elseif msg and type(msg) == "number" then - if msg == 0 then - minetest.swap_node(pos, { name = "led_marquee:char_32", param2 = fdir + (last_color*8)}) - elseif msg > 30 then - minetest.swap_node(pos, { name = "led_marquee:char_"..tostring(msg), param2 = fdir + (last_color*8)}) - end + meta:set_string("last_msg", tostring(msg)) + led_marquee.display_msg(pos, channel, tostring(msg)) + meta:set_int("index", 1) end end +-- the nodes! + for i = 31, 255 do local groups = { cracky = 2, not_in_creative_inventory = 1} local light = LIGHT_MAX-2 @@ -244,13 +309,13 @@ for i = 31, 255 do action = on_digiline_receive_string, }, }, - drop = "led_marquee:char_32" + drop = "led_marquee:char_32", + on_timer = led_marquee.scroll_text }) end -- crafts - minetest.register_craft({ output = "led_marquee:char_32 6", recipe = { diff --git a/led_marquee/screenshot_20180816_234431.png b/led_marquee/screenshot_20180816_234431.png new file mode 100644 index 0000000..c154de3 Binary files /dev/null and b/led_marquee/screenshot_20180816_234431.png differ diff --git a/led_marquee/screenshot_20180816_234431_1.png b/led_marquee/screenshot_20180816_234431_1.png new file mode 100644 index 0000000..c154de3 Binary files /dev/null and b/led_marquee/screenshot_20180816_234431_1.png differ diff --git a/led_marquee/textures/led_marquee_char_138.png b/led_marquee/textures/led_marquee_char_138.png index ce35cc2..091a34c 100644 Binary files a/led_marquee/textures/led_marquee_char_138.png and b/led_marquee/textures/led_marquee_char_138.png differ diff --git a/technic/config.lua b/technic/config.lua index bb748ec..ab834f9 100644 --- a/technic/config.lua +++ b/technic/config.lua @@ -13,6 +13,7 @@ local defaults = { enable_entity_radiation_damage = "true", enable_longterm_radiation_damage = "true", enable_nuclear_reactor_digiline_selfdestruct = "false", + enable_creative_mode = "false", } for k, v in pairs(defaults) do diff --git a/technic/crafts.lua b/technic/crafts.lua index 14bafd3..5d3ae04 100644 --- a/technic/crafts.lua +++ b/technic/crafts.lua @@ -164,7 +164,7 @@ minetest.register_craft({ recipe = { {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, - {'moreores:tin_ingot', 'moreores:tin_ingot', 'moreores:tin_ingot'}, + {'default:tin_ingot', 'default:tin_ingot', 'default:tin_ingot'}, } }) diff --git a/technic/machines/creative.lua b/technic/machines/creative.lua new file mode 100644 index 0000000..7c09a80 --- /dev/null +++ b/technic/machines/creative.lua @@ -0,0 +1,40 @@ +local S = technic.getter + +minetest.register_abm({ + nodenames = {"group:technic_lv","group:technic_mv","group:technic_hv"}, + label = "Run Machines", + interval = 1, + chance = 1, + action = function(pos,node) + 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) + local meta = minetest.get_meta(pos) + if not tier then + meta:set_int("active",0) + return + end + meta:set_int("active",1) + meta:set_int("LV_EU_input",meta:get_int("LV_EU_demand")) + meta:set_int("MV_EU_input",meta:get_int("MV_EU_demand")) + meta:set_int("HV_EU_input",meta:get_int("HV_EU_demand")) + local nodedef = minetest.registered_nodes[node.name] + if nodedef and nodedef.technic_run then + nodedef.technic_run(pos,node) + end + end, +}) + +minetest.register_lbm({ + nodenames = {"technic:switching_station","technic:power_monitor"}, + name = "technic:update_infotext", + label = "Update switching station / power monitor infotext", + action = function(pos,node) + local meta = minetest.get_meta(pos) + if node.name == "technic:switching_station" then + meta:set_string("infotext",S("Switching Station")) + elseif node.name == "technic:power_monitor" then + meta:set_string("infotext",S("Power Monitor")) + end + end, +}) diff --git a/technic/machines/init.lua b/technic/machines/init.lua index f2e31c9..b8d36c1 100644 --- a/technic/machines/init.lua +++ b/technic/machines/init.lua @@ -13,3 +13,8 @@ dofile(path.."/supply_converter.lua") dofile(path.."/other/init.lua") +if technic.config:get_bool("enable_creative_mode") then + --The switching station does not handle running machines + --in this mode, so alternative means are used to do so. + dofile(path.."/creative.lua") +end diff --git a/technic/machines/power_monitor.lua b/technic/machines/power_monitor.lua index 7e8b850..25836d6 100644 --- a/technic/machines/power_monitor.lua +++ b/technic/machines/power_monitor.lua @@ -35,6 +35,12 @@ minetest.register_node("technic:power_monitor",{ end, }) +if technic.config:get_bool("enable_creative_mode") then + --Power distribution is not used in this mode, + --so the power monitor is inert and never needs to run. + return +end + minetest.register_abm({ nodenames = {"technic:power_monitor"}, label = "Machines: run power monitor", diff --git a/technic/machines/register/alloy_recipes.lua b/technic/machines/register/alloy_recipes.lua index bd09bd6..3aeacd5 100644 --- a/technic/machines/register/alloy_recipes.lua +++ b/technic/machines/register/alloy_recipes.lua @@ -13,7 +13,7 @@ end local recipes = { {"technic:copper_dust 3", "technic:tin_dust", "technic:bronze_dust 4"}, - {"default:copper_ingot 3", "moreores:tin_ingot", "default:bronze_ingot 4"}, + {"default:copper_ingot 3", "default:tin_ingot", "default:bronze_ingot 4"}, {"technic:wrought_iron_dust", "technic:coal_dust", "technic:carbon_steel_dust", 3}, {"technic:wrought_iron_ingot", "technic:coal_dust", "technic:carbon_steel_ingot", 3}, {"technic:carbon_steel_dust", "technic:coal_dust", "technic:cast_iron_dust", 3}, diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua index 7f25dfd..d10b705 100644 --- a/technic/machines/register/battery_box.lua +++ b/technic/machines/register/battery_box.lua @@ -18,7 +18,7 @@ minetest.register_craft({ output = "technic:battery", recipe = { {"group:wood", "default:copper_ingot", "group:wood"}, - {"group:wood", "moreores:tin_ingot", "group:wood"}, + {"group:wood", "default:tin_ingot", "group:wood"}, {"group:wood", "default:copper_ingot", "group:wood"}, } }) diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index fa55e7a..1f4047c 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -15,6 +15,7 @@ local recipes = { {"default:desert_stone", "default:desert_sand"}, {"default:gold_lump", "technic:gold_dust 2"}, {"default:iron_lump", "technic:wrought_iron_dust 2"}, + {"default:tin_lump", "technic:tin_dust 2"}, {"technic:chromium_lump", "technic:chromium_dust 2"}, {"technic:uranium_lump", "technic:uranium_dust 2"}, {"technic:zinc_lump", "technic:zinc_dust 2"}, @@ -43,7 +44,6 @@ end if minetest.get_modpath("moreores") then table.insert(recipes, {"moreores:mithril_lump", "technic:mithril_dust 2"}) table.insert(recipes, {"moreores:silver_lump", "technic:silver_dust 2"}) - table.insert(recipes, {"moreores:tin_lump", "technic:tin_dust 2"}) end if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then @@ -94,9 +94,9 @@ register_dust("Gold", "default:gold_ingot") register_dust("Mithril", "moreores:mithril_ingot") register_dust("Silver", "moreores:silver_ingot") register_dust("Stainless Steel", "technic:stainless_steel_ingot") -register_dust("Stone", "default:stone") +register_dust("Stone", "default:stone") register_dust("Sulfur", nil) -register_dust("Tin", "moreores:tin_ingot") +register_dust("Tin", "default:tin_ingot") register_dust("Wrought Iron", "technic:wrought_iron_ingot") register_dust("Zinc", "technic:zinc_ingot") if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index d645847..2d96b9b 100644 --- a/technic/machines/switching_station.lua +++ b/technic/machines/switching_station.lua @@ -88,6 +88,13 @@ minetest.register_node("technic:switching_station",{ }, }) +if technic.config:get_bool("enable_creative_mode") then + --Power distribution is not used in this mode, + --so the switching station is inert and none of the + --network processing is needed. + return +end + -------------------------------------------------- -- Functions to traverse the electrical network -------------------------------------------------- diff --git a/technic/radiation.lua b/technic/radiation.lua index 722b0ac..a4c49c6 100644 --- a/technic/radiation.lua +++ b/technic/radiation.lua @@ -54,6 +54,7 @@ local rad_resistance_node = { ["default:lava_source"] = 17, ["default:mese"] = 21, ["default:mossycobble"] = 15, + ["default:tinblock"] = 37, ["pbj_pup:pbj_pup"] = 10000, ["pbj_pup:pbj_pup_candies"] = 10000, ["gloopblocks:rainbow_block_diagonal"] = 5000, @@ -76,6 +77,7 @@ local rad_resistance_node = { ["default:stone_with_gold"] = 34, ["default:stone_with_iron"] = 20, ["default:stone_with_mese"] = 17, + ["default:stone_with_tin"] = 19, ["default:stonebrick"] = 17, ["default:water_flowing"] = 2.8, ["default:water_source"] = 5.6, @@ -141,10 +143,8 @@ local rad_resistance_node = { ["moreblocks:wood_tile_up"] = 1.7, ["moreores:mineral_mithril"] = 18, ["moreores:mineral_silver"] = 21, - ["moreores:mineral_tin"] = 19, ["moreores:mithril_block"] = 26, ["moreores:silver_block"] = 53, - ["moreores:tin_block"] = 37, ["snow:snow_brick"] = 2.8, ["technic:brass_block"] = 43, ["technic:carbon_steel_block"] = 40, diff --git a/technic/tools/mining_drill.lua b/technic/tools/mining_drill.lua index bc426e7..1cf7491 100644 --- a/technic/tools/mining_drill.lua +++ b/technic/tools/mining_drill.lua @@ -6,7 +6,7 @@ local S = technic.getter minetest.register_craft({ output = 'technic:mining_drill', recipe = { - {'moreores:tin_ingot', 'technic:diamond_drill_head', 'moreores:tin_ingot'}, + {'default:tin_ingot', 'technic:diamond_drill_head', 'default:tin_ingot'}, {'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot'}, {'', 'technic:red_energy_crystal', 'default:copper_ingot'}, } diff --git a/technic/tools/mining_lasers.lua b/technic/tools/mining_lasers.lua index ef1eecb..6015e5a 100644 --- a/technic/tools/mining_lasers.lua +++ b/technic/tools/mining_lasers.lua @@ -4,43 +4,43 @@ local mining_lasers_list = { {"2", 14, 200000, 2000}, {"3", 21, 650000, 3000}, } +local allow_entire_discharging = true local S = technic.getter minetest.register_craft({ - output = 'technic:laser_mk1', + output = "technic:laser_mk1", recipe = { - {'default:diamond', 'technic:brass_ingot', 'default:obsidian_glass'}, - {'', 'technic:brass_ingot', 'technic:red_energy_crystal'}, - {'', '', 'default:copper_ingot'}, + {"default:diamond", "technic:brass_ingot", "default:obsidian_glass"}, + {"", "technic:brass_ingot", "technic:red_energy_crystal"}, + {"", "", "default:copper_ingot"}, } }) minetest.register_craft({ - output = 'technic:laser_mk2', + output = "technic:laser_mk2", recipe = { - {'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk1'}, - {'', 'technic:carbon_steel_ingot', 'technic:green_energy_crystal'}, - {'', '', 'default:copper_ingot'}, + {"default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk1"}, + {"", "technic:carbon_steel_ingot", "technic:green_energy_crystal"}, + {"", "", "default:copper_ingot"}, } }) minetest.register_craft({ - output = 'technic:laser_mk3', + output = "technic:laser_mk3", recipe = { - {'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk2'}, - {'', 'technic:carbon_steel_ingot', 'technic:blue_energy_crystal'}, - {'', '', 'default:copper_ingot'}, + {"default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk2"}, + {"", "technic:carbon_steel_ingot", "technic:blue_energy_crystal"}, + {"", "", "default:copper_ingot"}, } }) local function laser_node(pos, node, player) local def = minetest.registered_nodes[node.name] - if def and def.liquidtype ~= "none" then + if def.liquidtype ~= "none" and def.buildable_to then minetest.remove_node(pos) minetest.add_particle({ pos = pos, - velocity = {x=0, y=2, z=0}, - acceleration = {x=0, y=-1, z=0}, - expirationtime = 1.5, + velocity = {x = 0, y = 1.5 + math.random(), z = 0}, + acceleration = {x = 0, y = -1, z = 0}, size = 6 + math.random() * 2, texture = "smoke_puff.png^[transform" .. math.random(0, 7), }) @@ -49,11 +49,15 @@ local function laser_node(pos, node, player) minetest.node_dig(pos, node, player) end -local no_destroy = { - ["air"] = true, - ["default:lava_source"] = true, - ["default:lava_flowing"] = true, -} +local keep_node = {air = true} +local function can_keep_node(name) + if keep_node[name] ~= nil then + return keep_node[name] + end + keep_node[name] = minetest.get_item_group(name, "hot") ~= 0 + return keep_node[name] +end + local function laser_shoot(player, range, particle_texture, sound) local player_pos = player:getpos() local player_name = player:get_player_name() @@ -61,12 +65,12 @@ local function laser_shoot(player, range, particle_texture, sound) local start_pos = vector.new(player_pos) -- Adjust to head height - start_pos.y = start_pos.y + 1.6 + start_pos.y = start_pos.y + (player:get_properties().eye_height or 1.625) minetest.add_particle({ - pos = startpos, + pos = start_pos, velocity = dir, acceleration = vector.multiply(dir, 50), - expirationtime = range / 11, + expirationtime = (math.sqrt(1 + 100 * (range + 0.4)) - 1) / 50, size = 1, texture = particle_texture .. "^[transform" .. math.random(0, 7), }) @@ -76,42 +80,48 @@ local function laser_shoot(player, range, particle_texture, sound) minetest.record_protection_violation(pos, player_name) break end - local node = minetest.get_node_or_nil(pos) - if not node then + local node = minetest.get_node(pos) + if node.name == "ignore" + or not minetest.registered_nodes[node.name] then break end - if not no_destroy[node.name] then + if not can_keep_node(node.name) then laser_node(pos, node, player) end end end - for _, m in pairs(mining_lasers_list) do technic.register_power_tool("technic:laser_mk"..m[1], m[3]) minetest.register_tool("technic:laser_mk"..m[1], { description = S("Mining Laser Mk%d"):format(m[1]), inventory_image = "technic_mining_laser_mk"..m[1]..".png", + range = 0, stack_max = 1, wear_represents = "technic_RE_charge", on_refill = technic.refill_RE_charge, on_use = function(itemstack, user) local meta = minetest.deserialize(itemstack:get_metadata()) - if not meta or not meta.charge then + if not meta or not meta.charge or meta.charge == 0 then return end - -- If there's enough charge left, fire the laser - if meta.charge >= m[4] then - laser_shoot(user, m[2], "technic_laser_beam_mk"..m[1]..".png", "technic_laser_mk"..m[1]) - if not technic.creative_mode then - meta.charge = meta.charge - m[4] - technic.set_RE_wear(itemstack, meta.charge, m[3]) - itemstack:set_metadata(minetest.serialize(meta)) + local range = m[2] + if meta.charge < m[4] then + if not allow_entire_discharging then + return end + -- If charge is too low, give the laser a shorter range + range = range * meta.charge / m[4] + end + laser_shoot(user, range, "technic_laser_beam_mk" .. m[1] .. ".png", + "technic_laser_mk" .. m[1]) + if not technic.creative_mode then + meta.charge = math.max(meta.charge - m[4], 0) + technic.set_RE_wear(itemstack, meta.charge, m[3]) + itemstack:set_metadata(minetest.serialize(meta)) end return itemstack end, }) end - diff --git a/technic_worldgen/oregen.lua b/technic_worldgen/oregen.lua index 16a3b8d..4fd41fd 100644 --- a/technic_worldgen/oregen.lua +++ b/technic_worldgen/oregen.lua @@ -1,132 +1,157 @@ -local uranium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 420, octaves = 3, persist = 0.7} +local uranium_params = { + offset = 0, + scale = 1, + spread = {x = 100, y = 100, z = 100}, + seed = 420, + octaves = 3, + persist = 0.7 +} local uranium_threshold = 0.55 -local chromium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 421, octaves = 3, persist = 0.7} +local chromium_params = { + offset = 0, + scale = 1, + spread = {x = 100, y = 100, z = 100}, + seed = 421, + octaves = 3, + persist = 0.7 +} local chromium_threshold = 0.55 -local zinc_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 422, octaves = 3, persist = 0.7} +local zinc_params = { + offset = 0, + scale = 1, + spread = {x = 100, y = 100, z = 100}, + seed = 422, + octaves = 3, + persist = 0.7 +} local zinc_threshold = 0.5 -local lead_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 423, octaves = 3, persist = 0.7} +local lead_params = { + offset = 0, + scale = 1, + spread = {x = 100, y = 100, z = 100}, + seed = 423, + octaves = 3, + persist = 0.7 +} local lead_threshold = 0.3 minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_uranium", - wherein = "default:stone", - clust_scarcity = 8*8*8, - clust_num_ores = 4, - clust_size = 3, - y_min = -300, - y_max = -80, - noise_params = uranium_params, + ore_type = "scatter", + ore = "technic:mineral_uranium", + wherein = "default:stone", + clust_scarcity = 8*8*8, + clust_num_ores = 4, + clust_size = 3, + y_min = -300, + y_max = -80, + noise_params = uranium_params, noise_threshold = uranium_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_chromium", - wherein = "default:stone", - clust_scarcity = 8*8*8, - clust_num_ores = 2, - clust_size = 3, - y_min = -200, - y_max = -100, - noise_params = chromium_params, + ore_type = "scatter", + ore = "technic:mineral_chromium", + wherein = "default:stone", + clust_scarcity = 8*8*8, + clust_num_ores = 2, + clust_size = 3, + y_min = -200, + y_max = -100, + noise_params = chromium_params, noise_threshold = chromium_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_chromium", - wherein = "default:stone", - clust_scarcity = 6*6*6, - clust_num_ores = 2, - clust_size = 3, - y_min = -31000, - y_max = -200, - flags = "absheight", - noise_params = chromium_params, + ore_type = "scatter", + ore = "technic:mineral_chromium", + wherein = "default:stone", + clust_scarcity = 6*6*6, + clust_num_ores = 2, + clust_size = 3, + y_min = -31000, + y_max = -200, + flags = "absheight", + noise_params = chromium_params, noise_threshold = chromium_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_zinc", - wherein = "default:stone", - clust_scarcity = 8*8*8, - clust_num_ores = 5, - clust_size = 7, - y_min = -32, - y_max = 2, - noise_params = zinc_params, + ore_type = "scatter", + ore = "technic:mineral_zinc", + wherein = "default:stone", + clust_scarcity = 8*8*8, + clust_num_ores = 5, + clust_size = 7, + y_min = -32, + y_max = 2, + noise_params = zinc_params, noise_threshold = zinc_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_zinc", - wherein = "default:stone", - clust_scarcity = 6*6*6, - clust_num_ores = 4, - clust_size = 3, - y_min = -31000, - y_max = -32, - flags = "absheight", - noise_params = zinc_params, + ore_type = "scatter", + ore = "technic:mineral_zinc", + wherein = "default:stone", + clust_scarcity = 6*6*6, + clust_num_ores = 4, + clust_size = 3, + y_min = -31000, + y_max = -32, + flags = "absheight", + noise_params = zinc_params, noise_threshold = zinc_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_lead", - wherein = "default:stone", - clust_scarcity = 9*9*9, - clust_num_ores = 5, - clust_size = 3, - y_min = -16, - y_max = 16, - noise_params = lead_params, + ore_type = "scatter", + ore = "technic:mineral_lead", + wherein = "default:stone", + clust_scarcity = 9*9*9, + clust_num_ores = 5, + clust_size = 3, + y_min = -16, + y_max = 16, + noise_params = lead_params, noise_threshold = lead_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_lead", - wherein = "default:stone", - clust_scarcity = 8*8*8, - clust_num_ores = 5, - clust_size = 3, - y_min = -128, - y_max = -16, - noise_params = lead_params, + ore_type = "scatter", + ore = "technic:mineral_lead", + wherein = "default:stone", + clust_scarcity = 8*8*8, + clust_num_ores = 5, + clust_size = 3, + y_min = -128, + y_max = -16, + noise_params = lead_params, noise_threshold = lead_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_lead", - wherein = "default:stone", - clust_scarcity = 6*6*6, - clust_num_ores = 5, - clust_size = 3, - y_min = -31000, - y_max = -128, - flags = "absheight", - noise_params = lead_params, + ore_type = "scatter", + ore = "technic:mineral_lead", + wherein = "default:stone", + clust_scarcity = 6*6*6, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -128, + flags = "absheight", + noise_params = lead_params, noise_threshold = lead_threshold, }) -- Sulfur local sulfur_buf = {} -local sulfur_noise= nil +local sulfur_noise -minetest.register_on_generated(function(minp, maxp, seed) +minetest.register_on_generated(function(minp, maxp) local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") - local a = VoxelArea:new{ - MinEdge = {x = emin.x, y = emin.y, z = emin.z}, - MaxEdge = {x = emax.x, y = emax.y, z = emax.z}, - } + local a = VoxelArea:new({MinEdge=emin, MaxEdge=emax}) local data = vm:get_data(sulfur_buf) local pr = PseudoRandom(17 * minp.x + 42 * minp.y + 101 * minp.z) sulfur_noise = sulfur_noise or minetest.get_perlin(9876, 3, 0.5, 100) @@ -166,32 +191,37 @@ end) if technic.config:get_bool("enable_marble_generation") then -minetest.register_ore({ - ore_type = "sheet", - ore = "technic:marble", - wherein = "default:stone", - clust_scarcity = 1, - clust_num_ores = 1, - clust_size = 3, - y_min = -31000, - y_max = -50, - noise_threshold = 0.4, - noise_params = {offset=0, scale=15, spread={x=150, y=150, z=150}, seed=23, octaves=3, persist=0.70} -}) + minetest.register_ore({ + ore_type = "sheet", + ore = "technic:marble", + wherein = "default:stone", + clust_scarcity = 1, + clust_num_ores = 1, + clust_size = 3, + y_min = -31000, + y_max = -50, + noise_threshold = 0.4, + noise_params = { + offset = 0, scale = 15, spread = {x = 150, y = 150, z = 150}, + seed = 23, octaves = 3, persist = 0.70 + } + }) end if technic.config:get_bool("enable_granite_generation") then -minetest.register_ore({ - ore_type = "sheet", - ore = "technic:granite", - wherein = "default:stone", - clust_scarcity = 1, - clust_num_ores = 1, - clust_size = 4, - y_min = -31000, - y_max = -150, - noise_threshold = 0.4, - noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70} -}) + minetest.register_ore({ + ore_type = "sheet", + ore = "technic:granite", + wherein = "default:stone", + clust_scarcity = 1, + clust_num_ores = 1, + clust_size = 4, + y_min = -31000, + y_max = -150, + noise_threshold = 0.4, + noise_params = { + offset = 0, scale = 15, spread = {x = 130, y = 130, z = 130}, + seed = 24, octaves = 3, persist = 0.70 + } + }) end - diff --git a/usesdirt/README.md b/usesdirt/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/usesdirt/depends.txt b/usesdirt/depends.txt deleted file mode 100644 index 331d858..0000000 --- a/usesdirt/depends.txt +++ /dev/null @@ -1 +0,0 @@ -default \ No newline at end of file diff --git a/usesdirt/init.lua b/usesdirt/init.lua deleted file mode 100644 index 367a183..0000000 --- a/usesdirt/init.lua +++ /dev/null @@ -1,605 +0,0 @@ -minetest.register_node("usesdirt:dirt_brick", { - tiles = {"usesdirt_dirt_brick.png"}, - description = "Dirt Brick", - groups = {snappy=2,choppy=1,oddly_breakable_by_hand=2}, -}) -minetest.register_craft({ - output = '"usesdirt:dirt_brick" 6', - recipe = { - {'default:dirt', 'default:dirt', 'default:dirt'}, - {'default:dirt', 'default:dirt', 'default:dirt'}, - {'default:dirt', 'default:dirt', 'default:dirt'}, - } -}) ---Ladder -minetest.register_node("usesdirt:dirt_ladder", { - description = "Ladder", - drawtype = "signlike", - tiles ={"usesdirt_dirt_ladder.png"}, - inventory_image = "usesdirt_dirt_ladder.png", - wield_image = "usesdirt_dirt_ladder.png", - paramtype = "light", - paramtype2 = "wallmounted", - is_ground_content = true, - walkable = false, - climbable = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - }, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3}, - legacy_wallmounted = true, -}) -minetest.register_craft({ - output = 'usesdirt:dirt_ladder 3', - recipe = { - {'usesdirt:dirt_brick', '', 'usesdirt:dirt_brick'}, - {'usesdirt:dirt_brick', 'usesdirt:dirt_brick','usesdirt:dirt_brick'}, - {'usesdirt:dirt_brick','','usesdirt:dirt_brick'}, - } -}) ---Fence -minetest.register_node("usesdirt:dirt_fence", { - description = "Dirt Fence", - drawtype = "fencelike", - tiles ={"usesdirt_dirt_brick.png"}, - inventory_image = "usesdirt_dirt_fence.png", - wield_image = "usesdirt_dirt_fence.png", - paramtype = "light", - is_ground_content = true, - selection_box = { - type = "fixed", - fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, - }, - groups = {snappy=2,choppy=1,oddly_breakable_by_hand=3}, -}) -minetest.register_craft({ - output = 'usesdirt:dirt_fence 2', - recipe = { - {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, - {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, - } -}) ---------------------------------------------------------------------------------------------------- -minetest.register_node("usesdirt:dirt_cobble_stone", { - tiles = {"usesdirt_dirt_cobble_stone.png"}, - description = "Dirt Cobble Stone", - is_ground_content = true, - groups = {cracky=3, stone=2}, -}) -minetest.register_craft({ - output = '"usesdirt:dirt_cobble_stone" 3', - recipe = { - {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, - {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, - {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, - } -}) ---Ladder -minetest.register_node("usesdirt:dirt_cobble_stone_ladder", { - description = "Ladder", - drawtype = "signlike", - tiles ={"usesdirt_dirt_cobble_stone_ladder.png"}, - inventory_image = "usesdirt_dirt_cobble_stone_ladder.png", - wield_image = "usesdirt_dirt_cobble_stone_ladder.png", - paramtype = "light", - paramtype2 = "wallmounted", - is_ground_content = true, - walkable = false, - climbable = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - }, - groups = {cracky=3, stone=2}, - legacy_wallmounted = true, -}) -minetest.register_craft({ - output = 'usesdirt:dirt_cobble_stone_ladder 3', - recipe = { - {'usesdirt:dirt_cobble_stone', '', 'usesdirt:dirt_cobble_stone'}, - {'usesdirt:dirt_cobble_stone', 'usesdirt:dirt_cobble_stone','usesdirt:dirt_cobble_stone'}, - {'usesdirt:dirt_cobble_stone','','usesdirt:dirt_cobble_stone'}, - } -}) ---Fence -minetest.register_node("usesdirt:dirt_cobble_stone_fence", { - description = "Dirt Cobble Stone Fence", - drawtype = "fencelike", - tiles ={"usesdirt_dirt_cobble_stone.png"}, - inventory_image = "usesdirt_dirt_cobble_stone_fence.png", - wield_image = "usesdirt_dirt_cobble_stone_fence.png", - paramtype = "light", - is_ground_content = true, - selection_box = { - type = "fixed", - fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, - }, - groups = {cracky=3, stone=2}, -}) -minetest.register_craft({ - output = 'usesdirt:dirt_cobble_stone_fence 2', - recipe = { - {'usesdirt:dirt_cobble_stone', 'usesdirt:dirt_cobble_stone', 'usesdirt:dirt_cobble_stone'}, - {'usesdirt:dirt_cobble_stone', 'usesdirt:dirt_cobble_stone', 'usesdirt:dirt_cobble_stone'}, - } -}) ----------------------------------------------------------------------------------------------------- -minetest.register_node("usesdirt:dirt_stone", { - tiles = {"usesdirt_dirt_stone.png"}, - description = "Dirt Stone", - is_ground_content = true, - groups = {cracky=3, stone=2}, -}) ---Ladder -minetest.register_node("usesdirt:dirt_stone_ladder", { - description = "Ladder", - drawtype = "signlike", - tiles ={"usesdirt_dirt_stone_ladder.png"}, - inventory_image = "usesdirt_dirt_stone_ladder.png", - wield_image = "usesdirt_dirt_stone_ladder.png", - paramtype = "light", - paramtype2 = "wallmounted", - is_ground_content = true, - walkable = false, - climbable = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - }, - groups = {cracky=3, stone=2}, - legacy_wallmounted = true, -}) -minetest.register_craft({ - output = 'usesdirt:dirt_stone_ladder 3', - recipe = { - {'usesdirt:dirt_stone', '', 'usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone', 'usesdirt:dirt_stone','usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone','','usesdirt:dirt_stone'}, - } -}) ---Fence -minetest.register_node("usesdirt:dirt_stone_fence", { - description = "Dirt Stone Fence", - drawtype = "fencelike", - tiles ={"usesdirt_dirt_stone.png"}, - inventory_image = "usesdirt_dirt_stone_fence.png", - wield_image = "usesdirt_dirt_stone_fence.png", - paramtype = "light", - is_ground_content = true, - selection_box = { - type = "fixed", - fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, - }, - groups = {cracky=3, stone=2}, -}) -minetest.register_craft({ - output = 'usesdirt:dirt_stone_fence 2', - recipe = { - {'usesdirt:dirt_stone', 'usesdirt:dirt_stone', 'usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone', 'usesdirt:dirt_stone', 'usesdirt:dirt_stone'}, - } -}) -minetest.register_craft({ - type = "cooking", - output = "usesdirt:dirt_stone", - recipe = "usesdirt:dirt_cobble_stone", -}) ---Furnace - -local furnace_inactive_formspec = - "size[8,9]".. - "image[2,2;1,1;default_furnace_fire_bg.png]".. - "list[current_name;fuel;2,3;1,1;]".. - "list[current_name;src;2,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. - "background[-0.5,-0.65;9,10.35;bg_furnace.jpg]" - -minetest.register_node("usesdirt:dirt_furnace", { - description = "Furnace", - tiles = {"usesdirt_dirt_furnace_top.png", "usesdirt_dirt_furnace_bottom.png", "usesdirt_dirt_furnace_side.png", - "usesdirt_dirt_furnace_side.png", "usesdirt_dirt_furnace_side.png", "usesdirt_dirt_furnace_front.png"}, - paramtype2 = "facedir", - groups = {cracky=2}, - legacy_facedir_simple = true, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", furnace_inactive_formspec) - meta:set_string("infotext", "Furnace") - local inv = meta:get_inventory() - inv:set_size("fuel", 1) - inv:set_size("src", 1) - inv:set_size("dst", 4) - end, - can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("fuel") then - return false - elseif not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -minetest.register_node("usesdirt:dirt_furnace_active", { - description = "Furnace", - tiles = {"usesdirt_dirt_furnace_top.png", "usesdirt_dirt_furnace_bottom.png", "usesdirt_dirt_furnace_side.png", - "usesdirt_dirt_furnace_side.png", "usesdirt_dirt_furnace_side.png", "usesdirt_dirt_furnace_front_active.png"}, - paramtype2 = "facedir", - light_source = 8, - drop = "usesdirt:dirt_furnace", - groups = {cracky=2, not_in_creative_inventory=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", furnace_inactive_formspec) - meta:set_string("infotext", "Furnace"); - local inv = meta:get_inventory() - inv:set_size("fuel", 1) - inv:set_size("src", 1) - inv:set_size("dst", 4) - end, - can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("fuel") then - return false - elseif not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -function hacky_swap_node(pos,name) - local node = minetest.get_node(pos) - local meta = minetest.get_meta(pos) - local meta0 = meta:to_table() - if node.name == name then - return - end - node.name = name - local meta0 = meta:to_table() - minetest.set_node(pos,node) - meta = minetest.get_meta(pos) - meta:from_table(meta0) -end - -minetest.register_abm({ - nodenames = {"usesdirt:dirt_furnace","usesdirt:dirt_furnace_active"}, - interval = 1.0, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - local meta = minetest.get_meta(pos) - for i, name in ipairs({ - "fuel_totaltime", - "fuel_time", - "src_totaltime", - "src_time" - }) do - if meta:get_string(name) == "" then - meta:set_float(name, 0.0) - end - end - - local inv = meta:get_inventory() - - local srclist = inv:get_list("src") - local cooked = nil - - if srclist then - cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - end - - local was_active = false - - if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then - was_active = true - meta:set_float("fuel_time", meta:get_float("fuel_time") + 1) - meta:set_float("src_time", meta:get_float("src_time") + 1) - if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then - -- check if there's room for output in "dst" list - if inv:room_for_item("dst",cooked.item) then - -- Put result in "dst" list - inv:add_item("dst", cooked.item) - -- take stuff from "src" list - srcstack = inv:get_stack("src", 1) - srcstack:take_item() - inv:set_stack("src", 1, srcstack) - else - print("Could not insert '"..cooked.item:to_string().."'") - end - meta:set_string("src_time", 0) - end - end - - if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then - local percent = math.floor(meta:get_float("fuel_time") / - meta:get_float("fuel_totaltime") * 100) - meta:set_string("infotext","Furnace active: "..percent.."%") - hacky_swap_node(pos,"usesdirt:dirt_furnace_active") - meta:set_string("formspec", - "size[8,9]".. - "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:".. - (100-percent)..":default_furnace_fire_fg.png]".. - "list[current_name;fuel;2,3;1,1;]".. - "list[current_name;src;2,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]") - return - end - - local fuel = nil - local cooked = nil - local fuellist = inv:get_list("fuel") - local srclist = inv:get_list("src") - - if srclist then - cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - end - if fuellist then - fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) - end - - if fuel.time <= 0 then - meta:set_string("infotext","Furnace out of fuel") - hacky_swap_node(pos,"usesdirt:dirt_furnace") - meta:set_string("formspec", furnace_inactive_formspec) - return - end - - if cooked.item:is_empty() then - if was_active then - meta:set_string("infotext","Furnace is empty") - hacky_swap_node(pos,"usesdirt:dirt_furnace") - meta:set_string("formspec", furnace_inactive_formspec) - end - return - end - - meta:set_string("fuel_totaltime", fuel.time) - meta:set_string("fuel_time", 0) - - local stack = inv:get_stack("fuel", 1) - stack:take_item() - inv:set_stack("fuel", 1, stack) - end, -}) -minetest.register_craft({ - output = 'usesdirt:dirt_furnace', - recipe = { - {'usesdirt:dirt_stone', 'usesdirt:dirt_stone', 'usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone', 'default:dirt','usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone','usesdirt:dirt_stone','usesdirt:dirt_stone'}, - } -}) ---Tools ---axe -minetest.register_tool("usesdirt:dirt_axe", { - description = "Dirt Axe", - inventory_image = "usesdirt_dirt_axe.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - choppy={times={[1]=3.00, [2]=1.00, [3]=0.60}, uses=20, maxlevel=1}, - fleshy={times={[2]=1.30, [3]=0.70}, uses=20, maxlevel=1} - } - }, -}) -minetest.register_craft({ - output = 'usesdirt:dirt_axe', - recipe = { - {'usesdirt:dirt_stone', 'usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone', 'default:stick'}, - {'', 'default:stick'}, - } -}) ---Sword -minetest.register_tool("usesdirt:dirt_sword", { - description = "Dirt Sword", - inventory_image = "usesdirt_dirt_sword.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=0, - groupcaps={ - fleshy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1}, - snappy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1}, - choppy={times={[3]=0.90}, uses=20, maxlevel=0} - } - } -}) -minetest.register_craft({ - output = 'usesdirt:dirt_sword', - recipe = { - {'usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone'}, - {'default:stick'}, - } -}) - ---Shovel -minetest.register_tool("usesdirt:dirt_shovel", { - description = "Dirt Shovel", - inventory_image = "usesdirt_dirt_shovel.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - crumbly={times={[1]=1.50, [2]=0.50, [3]=0.30}, uses=20, maxlevel=1} - } - }, -}) -minetest.register_craft({ - output = 'usesdirt:dirt_shovel', - recipe = { - {'usesdirt:dirt_stone'}, - {'default:stick'}, - {'default:stick'}, - } -}) ---Pickaxe -minetest.register_tool("usesdirt:dirt_pick", { - description = "Dirt Pickaxe", - inventory_image = "usesdirt_dirt_pick.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - cracky={times={[1]=3.00, [2]=1.20, [3]=0.80}, uses=20, maxlevel=1} - } - }, -}) -minetest.register_craft({ - output = 'usesdirt:dirt_pick', - recipe = { - {'usesdirt:dirt_stone', 'usesdirt:dirt_stone', 'usesdirt:dirt_stone'}, - {'', 'default:stick', ''}, - {'', 'default:stick', ''}, - } -}) ---Chest -minetest.register_node("usesdirt:dirt_chest", { - description = "Dirt Chest", - tiles = {"usesdirt_dirt_chest.png"}, - paramtype2 = "facedir", - groups = {cracky=3, stone=2}, - legacy_facedir_simple = true, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", - "size[8,9]".. - "list[current_name;main;0,0;8,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Chest") - local inv = meta:get_inventory() - inv:set_size("main", 8*4) - end, - can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - return inv:is_empty("main") - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from chest at "..minetest.pos_to_string(pos)) - end, -}) - -local function has_locked_chest_privilege(meta, player) - if player:get_player_name() ~= meta:get_string("owner") then - return false - end - return true -end - -minetest.register_node("usesdirt:dirt_locked_chest", { - description = "Dirt Locked Chest", - tiles = {"usesdirt_dirt_locked_chest.png"}, - paramtype2 = "facedir", - groups = {cracky=3, stone=2}, - legacy_facedir_simple = true, - after_place_node = function(pos, placer) - local meta = minetest.get_meta(pos) - meta:set_string("owner", placer:get_player_name() or "") - meta:set_string("infotext", "Locked Chest (owned by ".. - meta:get_string("owner")..")") - end, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", - "size[8,9]".. - "list[current_name;main;0,0;8,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Locked Chest") - meta:set_string("owner", "") - local inv = meta:get_inventory() - inv:set_size("main", 8*4) - end, - can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - return inv:is_empty("main") - end, - allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, 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)) - return 0 - end - return count - end, - allow_metadata_inventory_put = function(pos, listname, index, stack, 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)) - return 0 - end - return stack:get_count() - end, - allow_metadata_inventory_take = function(pos, listname, index, stack, 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)) - return 0 - end - return stack:get_count() - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from locked chest at "..minetest.pos_to_string(pos)) - end, -}) - -minetest.register_craft({ - output = 'usesdirt:dirt_locked_chest', - recipe = { - {'usesdirt:dirt_stone', 'usesdirt:dirt_stone', 'usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone', 'default:steel_ingot', 'usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone', 'usesdirt:dirt_stone', 'usesdirt:dirt_stone'}, - } -}) -minetest.register_craft({ - output = 'usesdirt:dirt_chest', - recipe = { - {'usesdirt:dirt_stone', 'usesdirt:dirt_stone', 'usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone', '', 'usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone', 'usesdirt:dirt_stone', 'usesdirt:dirt_stone'}, - } -}) diff --git a/usesdirt/textures/usesdirt_dirt_axe.png b/usesdirt/textures/usesdirt_dirt_axe.png deleted file mode 100644 index d09c33e..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_axe.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_brick.png b/usesdirt/textures/usesdirt_dirt_brick.png deleted file mode 100644 index d2fd6c8..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_brick.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_chest.png b/usesdirt/textures/usesdirt_dirt_chest.png deleted file mode 100644 index 93436a0..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_chest.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_cobble_stone.png b/usesdirt/textures/usesdirt_dirt_cobble_stone.png deleted file mode 100644 index 34d8f67..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_cobble_stone.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_cobble_stone_fence.png b/usesdirt/textures/usesdirt_dirt_cobble_stone_fence.png deleted file mode 100644 index 4aaebc4..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_cobble_stone_fence.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_cobble_stone_ladder.png b/usesdirt/textures/usesdirt_dirt_cobble_stone_ladder.png deleted file mode 100644 index 3160f1c..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_cobble_stone_ladder.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_cup.png b/usesdirt/textures/usesdirt_dirt_cup.png deleted file mode 100644 index ef367e5..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_cup.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_fence.png b/usesdirt/textures/usesdirt_dirt_fence.png deleted file mode 100644 index 65d5e0e..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_fence.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_furnace_bottom.png b/usesdirt/textures/usesdirt_dirt_furnace_bottom.png deleted file mode 100644 index dd1d47c..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_furnace_bottom.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_furnace_front.png b/usesdirt/textures/usesdirt_dirt_furnace_front.png deleted file mode 100644 index 17e66c4..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_furnace_front.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_furnace_front_active.png b/usesdirt/textures/usesdirt_dirt_furnace_front_active.png deleted file mode 100644 index ef00526..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_furnace_front_active.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_furnace_side.png b/usesdirt/textures/usesdirt_dirt_furnace_side.png deleted file mode 100644 index dd1d47c..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_furnace_side.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_furnace_top.png b/usesdirt/textures/usesdirt_dirt_furnace_top.png deleted file mode 100644 index dd1d47c..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_furnace_top.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_ladder.png b/usesdirt/textures/usesdirt_dirt_ladder.png deleted file mode 100644 index 32a9899..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_ladder.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_locked_chest.png b/usesdirt/textures/usesdirt_dirt_locked_chest.png deleted file mode 100644 index 28f7554..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_locked_chest.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_pick.png b/usesdirt/textures/usesdirt_dirt_pick.png deleted file mode 100644 index 2eff560..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_pick.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_shovel.png b/usesdirt/textures/usesdirt_dirt_shovel.png deleted file mode 100644 index 6955a88..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_shovel.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_stone.png b/usesdirt/textures/usesdirt_dirt_stone.png deleted file mode 100644 index a646721..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_stone.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_stone_fence.png b/usesdirt/textures/usesdirt_dirt_stone_fence.png deleted file mode 100644 index cf89ae0..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_stone_fence.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_stone_ladder.png b/usesdirt/textures/usesdirt_dirt_stone_ladder.png deleted file mode 100644 index ab5bbd0..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_stone_ladder.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_sword.png b/usesdirt/textures/usesdirt_dirt_sword.png deleted file mode 100644 index cd4fee0..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_sword.png and /dev/null differ diff --git a/usesdirt/textures/usesdirt_dirt_torch.png b/usesdirt/textures/usesdirt_dirt_torch.png deleted file mode 100644 index fdb1245..0000000 Binary files a/usesdirt/textures/usesdirt_dirt_torch.png and /dev/null differ -- cgit v1.2.3