From ec25fd83415d0ecb49f41295af3dc30f14850b2f Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Mon, 17 Dec 2018 02:20:30 -0500 Subject: update biome_lib, digilines, hotbar, mesecons, pipeworks, ropes, technic, unified inventory, unified dyes, vines, and worldedit --- biome_lib/API.txt | 21 ++- biome_lib/init.lua | 20 ++ digilines/lcd.lua | 32 +++- hotbar/init.lua | 33 ++-- hotbar/textures/gui_hb_bg.png | Bin 474 -> 0 bytes hotbar/textures/gui_hb_bg_1.png | Bin 0 -> 246 bytes hotbar/textures/gui_hb_bg_16.png | Bin 764 -> 763 bytes hotbar/textures/gui_hb_bg_23.png | Bin 971 -> 952 bytes hotbar/textures/gui_hb_bg_24.png | Bin 0 -> 984 bytes hotbar/textures/gui_hb_bg_32.png | Bin 0 -> 1203 bytes hotbar/textures/gui_hb_bg_8.png | Bin 0 -> 479 bytes mesecons_fpga/doc/fpga/description.html | 2 +- mesecons_luacontroller/init.lua | 13 +- .../doc/powerplant/description.html | 2 +- .../doc/pressureplate_stone/description.html | 2 +- .../doc/pressureplate_wood/description.html | 2 +- mesecons_random/doc/ghoststone/description.html | 2 +- mesecons_random/doc/removestone/description.html | 2 +- .../doc/solarpanel/description.html | 2 +- mesecons_switch/doc/switch/description.html | 2 +- pipeworks/depends.txt | 4 +- pipeworks/filter-injector.lua | 2 + pipeworks/init.lua | 7 +- ropes/README.md | 2 + ropes/bridge.lua | 88 +++++++++ ropes/doc.lua | 8 + ropes/extendingladder.lua | 204 +++++++++++++++++++++ ropes/init.lua | 31 +++- ropes/ladder.lua | 191 ------------------- ropes/locale/es.po | 80 ++++++-- ropes/locale/template.pot | 73 ++++++-- ropes/locale/update.bat | 6 + ropes/ropeladder.lua | 191 +++++++++++++++++++ ropes/settingtypes.txt | 15 +- technic/machines/HV/forcefield.lua | 11 +- technic/machines/HV/quarry.lua | 5 + technic/machines/MV/freezer.lua | 12 ++ technic/machines/MV/hydro_turbine.lua | 2 +- technic/machines/MV/init.lua | 2 + technic/machines/register/freezer.lua | 9 + technic/machines/register/freezer_recipes.lua | 21 +++ technic/machines/register/grinder_recipes.lua | 2 + technic/machines/register/init.lua | 2 + technic/textures/technic_mv_freezer_bottom.png | Bin 0 -> 284 bytes technic/textures/technic_mv_freezer_front.png | Bin 0 -> 413 bytes .../textures/technic_mv_freezer_front_active.png | Bin 0 -> 447 bytes technic/textures/technic_mv_freezer_side.png | Bin 0 -> 381 bytes technic/textures/technic_mv_freezer_top.png | Bin 0 -> 325 bytes .../technicx32/technic_mv_freezer_bottom.png | Bin 0 -> 672 bytes .../technicx32/technic_mv_freezer_front.png | Bin 0 -> 947 bytes .../technicx32/technic_mv_freezer_front_active.png | Bin 0 -> 1094 bytes .../technicx32/technic_mv_freezer_side.png | Bin 0 -> 1079 bytes .../textures/technicx32/technic_mv_freezer_top.png | Bin 0 -> 826 bytes unified_inventory/internal.lua | 21 ++- unifieddyes/init.lua | 47 +++-- vines/init.lua | 15 +- worldedit/init.lua | 2 +- worldedit_commands/init.lua | 2 +- 58 files changed, 879 insertions(+), 311 deletions(-) delete mode 100644 hotbar/textures/gui_hb_bg.png create mode 100644 hotbar/textures/gui_hb_bg_1.png create mode 100644 hotbar/textures/gui_hb_bg_24.png create mode 100644 hotbar/textures/gui_hb_bg_32.png create mode 100644 hotbar/textures/gui_hb_bg_8.png create mode 100644 ropes/bridge.lua create mode 100644 ropes/extendingladder.lua delete mode 100644 ropes/ladder.lua create mode 100644 ropes/locale/update.bat create mode 100644 ropes/ropeladder.lua create mode 100644 technic/machines/MV/freezer.lua create mode 100644 technic/machines/register/freezer.lua create mode 100644 technic/machines/register/freezer_recipes.lua create mode 100644 technic/textures/technic_mv_freezer_bottom.png create mode 100644 technic/textures/technic_mv_freezer_front.png create mode 100644 technic/textures/technic_mv_freezer_front_active.png create mode 100644 technic/textures/technic_mv_freezer_side.png create mode 100644 technic/textures/technic_mv_freezer_top.png create mode 100644 technic/textures/technicx32/technic_mv_freezer_bottom.png create mode 100644 technic/textures/technicx32/technic_mv_freezer_front.png create mode 100644 technic/textures/technicx32/technic_mv_freezer_front_active.png create mode 100644 technic/textures/technicx32/technic_mv_freezer_side.png create mode 100644 technic/textures/technicx32/technic_mv_freezer_top.png diff --git a/biome_lib/API.txt b/biome_lib/API.txt index 6aab582..0dd15c3 100644 --- a/biome_lib/API.txt +++ b/biome_lib/API.txt @@ -72,6 +72,7 @@ biome = { ---- most likely want to use at least some of these to limit how and ---- where your objects are spawned. + label = string, -- set this to identify the ABM for Minetest's profiler avoid_nodes = {table}, -- same meaning as savoid, above avoid_radius = num, -- same as sradius seed_diff = num, -- The Perlin seed difference value passed to the @@ -238,7 +239,7 @@ biome = { ---- Everything else is optional, but you'll definitely want to use ---- some of these other fields to limit where and under what ---- conditions the objects are spawned. - + below_nodes = {table}, -- List of nodes that must be below the target -- node. Useful in snow biomes to keep objects from -- spawning in snow that's on the wrong surface for @@ -342,14 +343,18 @@ into something else over time. This function has no return value, and accepts a biome definition table as the only parameter. These are defined like so: options = { - grow_plant = "string", -- Name of the node to be grown into something - -- else. This value is passed to the ABM as the - -- "nodenames" parameter, so it is the plants - -- themselves that are the ABM trigger, rather than + label = string, -- set this to identify the ABM for Minetest's + -- profiler. If not set, biome_lib will set it to + -- "biome_lib grow_plants(): " appended with the node + -- in grow_plant (or the first item if it's a table) + grow_plant = "string" or {table}, -- Name(s) of the node(s) to be grown + -- into something else. This value is passed to the + -- ABM as the "nodenames" parameter, so the plants + -- themselves are the ABM trigger, rather than -- the ground they spawned on. A plant will only grow - -- if the node above it is air. Can also be a table, - -- but note that all nodes referenced therein will be - -- grown into the same object. + -- if the node above it is air. If you use a table, + -- note that all nodes referenced therein will be + -- grown into the same final object. grow_delay = num, -- Passed as the ABM "interval" parameter, as with -- spawning. grow_chance = num, -- Passed as the ABM "chance" parameter. diff --git a/biome_lib/init.lua b/biome_lib/init.lua index 818011f..f79c1d7 100644 --- a/biome_lib/init.lua +++ b/biome_lib/init.lua @@ -501,11 +501,20 @@ function biome_lib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa) biome_lib:set_defaults(biome) biome.spawn_plants_count = #(biome.spawn_plants) + local n + if type(biome.spawn_plants) == "table" then + n = "random: "..biome.spawn_plants[1]..", ..." + else + n = biome.spawn_plants + end + biome.label = biome.label or "biome_lib spawn_on_surfaces(): "..n + minetest.register_abm({ nodenames = biome.spawn_surfaces, interval = biome.interval, chance = biome.spawn_chance, neighbors = biome.neighbors, + label = biome.label, action = function(pos, node, active_object_count, active_object_count_wider) local p_top = { x = pos.x, y = pos.y + 1, z = pos.z } local n_top = minetest.get_node(p_top) @@ -583,6 +592,16 @@ function biome_lib:grow_plants(opts) options.grow_nodes = options.grow_nodes or { "default:dirt_with_grass" } options.seed_diff = options.seed_diff or 0 + local n + + if type(options.grow_plant) == "table" then + n = "multi: "..options.grow_plant[1]..", ..." + else + n = options.grow_plant + end + + options.label = options.label or "biome_lib grow_plants(): "..n + if options.grow_delay*time_scale >= 1 then options.interval = options.grow_delay*time_scale else @@ -593,6 +612,7 @@ function biome_lib:grow_plants(opts) nodenames = { options.grow_plant }, interval = options.interval, chance = options.grow_chance, + label = options.label, action = function(pos, node, active_object_count, active_object_count_wider) local p_top = {x=pos.x, y=pos.y+1, z=pos.z} local p_bot = {x=pos.x, y=pos.y-1, z=pos.z} diff --git a/digilines/lcd.lua b/digilines/lcd.lua index 19aa4a4..a59b0b2 100644 --- a/digilines/lcd.lua +++ b/digilines/lcd.lua @@ -155,24 +155,34 @@ local get_entity = function(pos) return lcd_entity end -local spawn_entity = function(pos) - if not get_entity(pos) then - local lcd_info = lcds[minetest.get_node(pos).param2] - if not lcd_info then - return - end - local text = minetest.add_entity(vector.add(pos, lcd_info.delta), "digilines_lcd:text") - text:set_yaw(lcd_info.yaw or 0) +local rotate_text = function(pos, param) + local entity = get_entity(pos) + if not entity then + return + end + local lcd_info = lcds[param or minetest.get_node(pos).param2] + if not lcd_info then + return end + entity.object:set_pos(vector.add(pos, lcd_info.delta)) + entity.object:set_yaw(lcd_info.yaw or 0) end local prepare_writing = function(pos) local entity = get_entity(pos) if entity then set_texture(entity) + rotate_text(pos) end end +local spawn_entity = function(pos) + if not get_entity(pos) then + local text = minetest.add_entity(pos, "digilines_lcd:text") + rotate_text(pos) + end +end + local on_digiline_receive = function(pos, _, channel, msg) local meta = minetest.get_meta(pos) local setchan = meta:get_string("channel") @@ -220,6 +230,12 @@ minetest.register_node("digilines:lcd", { spawn_entity(pos) end end, + on_rotate = function(pos, node, user, mode, new_param2) + if mode ~= screwdriver.ROTATE_FACE then + return false + end + rotate_text(pos, new_param2) + end, on_receive_fields = function(pos, _, fields, sender) local name = sender:get_player_name() if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then diff --git a/hotbar/init.lua b/hotbar/init.lua index 71b48f4..81b0518 100644 --- a/hotbar/init.lua +++ b/hotbar/init.lua @@ -1,4 +1,15 @@ -local hotbar_size_default = minetest.setting_get("hotbar_size") or 16 +local mtver = minetest.get_version() +local maxslots = (string.sub(mtver.string, 1, 4) ~= "0.4.") and 32 or 23 + +local function validate_size(s) + local size = s and tonumber(s) or 16 + if (size == 8 or size == 16 or size == 23 or size == 24 or size == 32) + and size <= maxslots then + return size + end +end + +local hotbar_size_default = validate_size(minetest.setting_get("hotbar_size")) local player_hotbar_settings = {} @@ -27,18 +38,12 @@ end load_hotbar_settings() -local function resize_hotbar(size) - if size == 8 then return "gui_hb_bg.png" end - if size == 23 then return "gui_hb_bg_23.png" end - return "gui_hb_bg_16.png" -end - minetest.register_on_joinplayer(function(player) - local hotbar_size = get_hotbar_setting(player:get_player_name()) + local hotbar_size = validate_size(get_hotbar_setting(player:get_player_name())) player:hud_set_hotbar_itemcount(hotbar_size) minetest.after(0.5,function(hotbar_size) player:hud_set_hotbar_selected_image("gui_hotbar_selected.png") - player:hud_set_hotbar_image(resize_hotbar(hotbar_size)) + player:hud_set_hotbar_image("gui_hb_bg_"..hotbar_size..".png") end,hotbar_size) end) @@ -46,12 +51,12 @@ minetest.register_chatcommand("hotbar", { params = "[size]", description = "Sets the size of your hotbar", func = function(name, slots) - if slots ~= "8" and slots ~= "23" then slots = "16" end - player_hotbar_settings[name] = slots + hotbar_size = validate_size(tonumber(slots)) + player_hotbar_settings[name] = hotbar_size local player = minetest.get_player_by_name(name) - player:hud_set_hotbar_itemcount(tonumber(slots)) - minetest.chat_send_player(name, "[_] Hotbar size set to " .. tonumber(slots) .. ".") - player:hud_set_hotbar_image(resize_hotbar(tonumber(slots))) + player:hud_set_hotbar_itemcount(hotbar_size) + minetest.chat_send_player(name, "[_] Hotbar size set to " ..hotbar_size.. ".") + player:hud_set_hotbar_image("gui_hb_bg_"..hotbar_size..".png") save_hotbar_settings() end, }) diff --git a/hotbar/textures/gui_hb_bg.png b/hotbar/textures/gui_hb_bg.png deleted file mode 100644 index 9389700..0000000 Binary files a/hotbar/textures/gui_hb_bg.png and /dev/null differ diff --git a/hotbar/textures/gui_hb_bg_1.png b/hotbar/textures/gui_hb_bg_1.png new file mode 100644 index 0000000..d2d02c0 Binary files /dev/null and b/hotbar/textures/gui_hb_bg_1.png differ diff --git a/hotbar/textures/gui_hb_bg_16.png b/hotbar/textures/gui_hb_bg_16.png index 2624cd0..b8a52a9 100644 Binary files a/hotbar/textures/gui_hb_bg_16.png and b/hotbar/textures/gui_hb_bg_16.png differ diff --git a/hotbar/textures/gui_hb_bg_23.png b/hotbar/textures/gui_hb_bg_23.png index 53f0294..51ba70f 100644 Binary files a/hotbar/textures/gui_hb_bg_23.png and b/hotbar/textures/gui_hb_bg_23.png differ diff --git a/hotbar/textures/gui_hb_bg_24.png b/hotbar/textures/gui_hb_bg_24.png new file mode 100644 index 0000000..fb101a2 Binary files /dev/null and b/hotbar/textures/gui_hb_bg_24.png differ diff --git a/hotbar/textures/gui_hb_bg_32.png b/hotbar/textures/gui_hb_bg_32.png new file mode 100644 index 0000000..57dd588 Binary files /dev/null and b/hotbar/textures/gui_hb_bg_32.png differ diff --git a/hotbar/textures/gui_hb_bg_8.png b/hotbar/textures/gui_hb_bg_8.png new file mode 100644 index 0000000..45e1ef2 Binary files /dev/null and b/hotbar/textures/gui_hb_bg_8.png differ diff --git a/mesecons_fpga/doc/fpga/description.html b/mesecons_fpga/doc/fpga/description.html index be6bd65..95177b2 100644 --- a/mesecons_fpga/doc/fpga/description.html +++ b/mesecons_fpga/doc/fpga/description.html @@ -1,5 +1,5 @@ FPGAs can be used to chain multiple logic gates together in a compact manner. They come with 4 I/O ports and 10 internal registers, -which can then be connected with eachother to form logic circuits.
+which can then be connected with each other to form logic circuits.
Supported gate types: AND, OR, NOT, XOR, NAND, XNOR, Buffer (=)
I/O ports: A B C D; Registers: numbered 0 to 9 diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua index e91d460..19b6479 100644 --- a/mesecons_luacontroller/init.lua +++ b/mesecons_luacontroller/init.lua @@ -619,12 +619,13 @@ local function reset_formspec(meta, code, errmsg) meta:mark_as_private("code") code = minetest.formspec_escape(code or "") errmsg = minetest.formspec_escape(tostring(errmsg or "")) - meta:set_string("formspec", "size[12,10]".. - "background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]".. - "textarea[0.2,0.2;12.2,9.5;code;;"..code.."]".. - "image_button[4.75,8.75;2.5,1;jeija_luac_runbutton.png;program;]".. - "image_button_exit[11.72,-0.25;0.425,0.4;jeija_close_window.png;exit;]".. - "label[0.1,9;"..errmsg.."]") + meta:set_string("formspec", "size[12,10]" + .."background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]" + .."label[0.1,8.3;"..errmsg.."]" + .."textarea[0.2,0.2;12.2,9.5;code;;"..code.."]" + .."image_button[4.75,8.75;2.5,1;jeija_luac_runbutton.png;program;]" + .."image_button_exit[11.72,-0.25;0.425,0.4;jeija_close_window.png;exit;]" + ) end local function reset_meta(pos, code, errmsg) diff --git a/mesecons_powerplant/doc/powerplant/description.html b/mesecons_powerplant/doc/powerplant/description.html index 12abbbb..4ed8f33 100644 --- a/mesecons_powerplant/doc/powerplant/description.html +++ b/mesecons_powerplant/doc/powerplant/description.html @@ -1 +1 @@ -A power plant is a receptor that is always turned on: It provides energy. +A power plant is a receptor that is always turned on: it provides energy. diff --git a/mesecons_pressureplates/doc/pressureplate_stone/description.html b/mesecons_pressureplates/doc/pressureplate_stone/description.html index 3edc95b..35e3fc0 100644 --- a/mesecons_pressureplates/doc/pressureplate_stone/description.html +++ b/mesecons_pressureplates/doc/pressureplate_stone/description.html @@ -1 +1 @@ -This receptor turns on if there's an object above it. And object can be a player, an item, a mob... +This receptor turns on if there's an object above it. An object can be a player, an item, a mob... diff --git a/mesecons_pressureplates/doc/pressureplate_wood/description.html b/mesecons_pressureplates/doc/pressureplate_wood/description.html index 3edc95b..35e3fc0 100644 --- a/mesecons_pressureplates/doc/pressureplate_wood/description.html +++ b/mesecons_pressureplates/doc/pressureplate_wood/description.html @@ -1 +1 @@ -This receptor turns on if there's an object above it. And object can be a player, an item, a mob... +This receptor turns on if there's an object above it. An object can be a player, an item, a mob... diff --git a/mesecons_random/doc/ghoststone/description.html b/mesecons_random/doc/ghoststone/description.html index 138a2b3..395430e 100644 --- a/mesecons_random/doc/ghoststone/description.html +++ b/mesecons_random/doc/ghoststone/description.html @@ -1 +1 @@ -Ghoststones disappear when powered, just like Removestones. But in contrast to Removestones, they Reappear again when not powered anymore and they are also conductive. +Ghoststones disappear when powered, just like Removestones. But in contrast to Removestones, they reappear again when not powered anymore and they are also conductive. diff --git a/mesecons_random/doc/removestone/description.html b/mesecons_random/doc/removestone/description.html index d540fe9..6947441 100644 --- a/mesecons_random/doc/removestone/description.html +++ b/mesecons_random/doc/removestone/description.html @@ -1 +1 @@ -Removestones are propably the simplest effectors possible. They simply disappear when powered. +Removestones are probably the simplest effectors possible. They simply disappear when powered. diff --git a/mesecons_solarpanel/doc/solarpanel/description.html b/mesecons_solarpanel/doc/solarpanel/description.html index f8e7450..add6213 100644 --- a/mesecons_solarpanel/doc/solarpanel/description.html +++ b/mesecons_solarpanel/doc/solarpanel/description.html @@ -1 +1 @@ -Solar Panel are light receptors: they turn on if there is enough light. +Solar panels are light receptors: they turn on if there is enough light. diff --git a/mesecons_switch/doc/switch/description.html b/mesecons_switch/doc/switch/description.html index 3ef4ace..0c8f607 100644 --- a/mesecons_switch/doc/switch/description.html +++ b/mesecons_switch/doc/switch/description.html @@ -1 +1 @@ -The switch is a receptor. It changes its state as when punched. +The switch is a receptor. It changes its state when punched. diff --git a/pipeworks/depends.txt b/pipeworks/depends.txt index 97c9e30..b5dcdb1 100644 --- a/pipeworks/depends.txt +++ b/pipeworks/depends.txt @@ -1,5 +1,5 @@ default basic_materials -mesecons -mesecons_mvps +mesecons? +mesecons_mvps? digilines? diff --git a/pipeworks/filter-injector.lua b/pipeworks/filter-injector.lua index 29fc1d3..675ea07 100644 --- a/pipeworks/filter-injector.lua +++ b/pipeworks/filter-injector.lua @@ -193,6 +193,8 @@ local function punch_filter(data, filtpos, filtnode, msg) ["technic:mv_grinder"] = "dst", ["technic:mv_grinder_active"] = "dst", ["technic:tool_workshop"] = "src", + ["technic:mv_freezer"] = "dst", + ["technic:mv_freezer_active"] = "dst" } -- make sure there's something appropriate to inject the item into diff --git a/pipeworks/init.lua b/pipeworks/init.lua index 714480e..445a8d4 100644 --- a/pipeworks/init.lua +++ b/pipeworks/init.lua @@ -133,15 +133,16 @@ dofile(pipeworks.modpath..logicdir.."flowable_node_registry_install.lua") if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end - if pipeworks.enable_redefines then dofile(pipeworks.modpath.."/compat-chests.lua") dofile(pipeworks.modpath.."/compat-furnaces.lua") end if pipeworks.enable_autocrafter then dofile(pipeworks.modpath.."/autocrafter.lua") end -if pipeworks.enable_lua_tube then dofile(pipeworks.modpath.."/lua_tube.lua") end +if pipeworks.enable_lua_tube and + (minetest.get_modpath("mesecons") or minetest.get_modpath("digilines")) then + dofile(pipeworks.modpath.."/lua_tube.lua") +end minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty") print("Pipeworks loaded!") - diff --git a/ropes/README.md b/ropes/README.md index 699369c..8465745 100644 --- a/ropes/README.md +++ b/ropes/README.md @@ -6,6 +6,8 @@ The rope stops lowering if it reaches an obstruction. Ropes can be cut using an Also included is a rope ladder that behaves similarly, though it only comes in one standard maximum length - 50m by default, again changeable in settings. +This mod will also enhance default wood ladders and steel ladders to make them "extendable", capable of building upward independent of support to a setting-defined limit (defaulting to 5 nodes for wood and 15 nodes for steel ladders). This can be disabled if undesired. + This mod retains optional backward compatibility with the crafting items from the vines mod (anything with group "vines" can be used to make rope boxes and rope ladders). Ropes can also be made from cotton, available via an optional dependency on the farming mod. In-game documentation is provided via an optional dependency on the doc mod. \ No newline at end of file diff --git a/ropes/bridge.lua b/ropes/bridge.lua new file mode 100644 index 0000000..31db7e6 --- /dev/null +++ b/ropes/bridge.lua @@ -0,0 +1,88 @@ +local modpath = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(modpath.."/intllib.lua") + +if ropes.bridges_enabled then + +local bridge_on_place = function(itemstack, placer, pointed_thing) + -- Shall place item and return the leftover itemstack. + -- The placer may be any ObjectRef or nil. + -- default: minetest.item_place + if placer == nil then + return minetest.item_place(itemstack, placer, pointed_thing) + end + + local above = pointed_thing.above + local under = pointed_thing.under + + if above.x == under.x and above.z == under.z and above.y > under.y then + -- we're aimed downward at a buildable node from above. + -- determine the direction the placer lies relative to this node. + local new_under = vector.new(under) + local placer_pos = placer:get_pos() + local diff_x = placer_pos.x - under.x + local diff_z = placer_pos.z - under.z + if math.abs(diff_x) > math.abs(diff_z) then + -- placer is displaced along the X axis relative to the target + if diff_x > 0 then + new_under.x = under.x - 1 + else + new_under.x = under.x + 1 + end + else + -- placer is displaced along the Z axis relative to the target + if diff_z > 0 then + new_under.z = under.z - 1 + else + new_under.z = under.z + 1 + end + end + if minetest.registered_nodes[minetest.get_node(new_under).name].buildable_to then + local new_pointed_thing = {type="node", under=new_under, above={x=new_under.x, y=new_under.y+1, z=new_under.z}} + return minetest.item_place(itemstack, placer, new_pointed_thing) + end + end + + return minetest.item_place(itemstack, placer, pointed_thing) +end + +minetest.register_node("ropes:wood_bridge", { + description = S("Wooden Bridge"), + _doc_items_longdesc = ropes.doc.wooden_bridge_longdesc, + _doc_items_usagehelp = ropes.doc.wooden_bridge_usagehelp, + tiles = { + "default_wood.png", "default_wood.png", + "default_wood.png^[transformR270", "default_wood.png^[transformR90", + "default_wood.png^[transformR270", "default_wood.png^[transformR90", + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = {choppy = 2, flammable = 2, oddly_breakable_by_hand = 1, flow_through = 1, fence = 1, wall = 1}, + sounds = default.node_sound_wood_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- Platform + {-0.375, -0.5, -0.5, 0.375, -0.375, -0.4375}, -- x beam4 + {-0.375, -0.5, 0.4375, 0.375, -0.375, 0.5}, -- x beam3 + {0.375, -0.5, -0.4375, 0.5, -0.375, 0.4375}, -- z beam2 + {-0.5, -0.5, -0.4375, -0.375, -0.375, 0.4375}, -- z beam1 + {0.375, -0.5, -0.5, 0.5, 0.375, -0.4375}, -- upright4 + {0.375, -0.5, 0.4375, 0.5, 0.375, 0.5}, -- upright3 + {-0.5, -0.5, -0.5, -0.375, 0.375, -0.4375}, -- upright2 + {-0.5, -0.5, 0.4375, -0.375, 0.375, 0.5}, -- upright1 + } + }, + on_place = bridge_on_place, +}) + +minetest.register_craft({ + output = "ropes:wood_bridge 5", + recipe = { + {"group:stick", "stairs:slab_wood", "group:stick"}, + {"group:stick", "", "group:stick"}, + {"group:stick", "group:stick", "group:stick"}, + } +}) + +end diff --git a/ropes/doc.lua b/ropes/doc.lua index 7f2ce54..020fb04 100644 --- a/ropes/doc.lua +++ b/ropes/doc.lua @@ -39,6 +39,14 @@ ropes.doc.ropebox_usage = rope_length_doc .. "\n\n" .. S("When a rope box is placed the rope will immediately begin lowering from it at one meter per second. The rope will only descend when its end is in the vicinity of an active player, suspending its journey when no players are nearby, so a long descent may require a player to climb down the rope as it goes. If you are near the bottom end of a rope that's extending you'll be automatically carried down with it. The rope will stop when it encounters and obstruction, but will resume lowering if the obstruction is removed.") .. "\n\n" .. S("A rope can be severed midway using an axe or other similar tool. The section of rope below the cut will collapse and disappear, potentially causing players who were hanging on to it to fall. The remaining rope will not resume descent on its own, but the rope box at the top of the rope \"remembers\" how long the rope was and if it is deconstructed and replaced it will still have the same maximum length of rope as before - no rope is permanently lost when a rope is severed like this.") +if ropes.extending_ladder_enabled then + ropes.doc.ladder_longdesc = S("A ladder for climbing. It can reach greater heights when placed against a supporting block.") + ropes.doc.ladder_usagehelp = S("Right-clicking on a ladder with a stack of identical ladder items will automatically add new ladder segments to the top, provided it hasn't extended too far up beyond the last block behind it providing support.") +end + +ropes.doc.wooden_bridge_longdesc = S("A wooden platform with support struts useful for bridging gaps.") +ropes.doc.wooden_bridge_usagehelp = S("This behaves like most structural blocks except in one circumstance: when placed on top of a block with buildable space on the side facing away from you, this block will not be built on top but instead will extend out from that far side of the target block. This allows a platform to be easily built that juts out away from the location you're standing on.") + doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder") doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder_bottom") doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder_falling") diff --git a/ropes/extendingladder.lua b/ropes/extendingladder.lua new file mode 100644 index 0000000..c804ac2 --- /dev/null +++ b/ropes/extendingladder.lua @@ -0,0 +1,204 @@ +local modpath = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(modpath.."/intllib.lua") + +if ropes.extending_ladder_enabled then + +minetest.unregister_item("default:ladder_wood") +minetest.unregister_item("default:ladder_steel") +minetest.clear_craft({output = "default:ladder_wood"}) +minetest.clear_craft({output = "default:ladder_steel"}) + +local wallmounted_to_facedir = +{[0] = 15, -- ceiling +[1] = 13, -- floor +[2] = 1, -- +X +[3] = 3, -- -X +[4] = 0, -- +Z +[5] = 2, -- -Z +} + +minetest.register_lbm({ + label = "Switch from wallmounted default ladders to rope mod extending ladders", + name = "ropes:wallmounted_ladder_to_facedir_ladder", + nodenames = {"default:ladder_wood", "default:ladder_steel"}, + run_at_every_load = false, + action = function(pos, node) + local new_node = {param2 = wallmounted_to_facedir[node.param2]} + if (node.name == "default:ladder_wood") then + new_node.name = "ropes:ladder_wood" + else + new_node.name = "ropes:ladder_steel" + end + minetest.set_node(pos, new_node) + end, +}) + +minetest.register_craft({ + output = "ropes:ladder_wood 5", + recipe = { + {"group:stick", "", "group:stick"}, + {"group:stick", "group:stick", "group:stick"}, + {"group:stick", "", "group:stick"}, + } +}) + +minetest.register_craft({ + output = 'ropes:ladder_steel 15', + recipe = { + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', '', 'default:steel_ingot'}, + } +}) + + +local ladder_extender = function(pos, node, clicker, itemstack, pointed_thing, ladder_node, standing_limit) + local clicked_stack = ItemStack(itemstack) + + -- true if we're pointing up at the ladder from below and there's a buildable space below it + -- this check allows us to extend ladders downward + local pointing_directly_below = + pointed_thing.above.x == pos.x and + pointed_thing.above.z == pos.z and + pointed_thing.above.y == pos.y - 1 and + minetest.registered_nodes[minetest.get_node(pointed_thing.above).name].buildable_to + + if clicked_stack:get_name() == ladder_node and not pointing_directly_below then + local param2 = minetest.get_node(pos).param2 + local dir = minetest.facedir_to_dir(param2) + local scan_limit = pos.y + 6 -- Only add ladder segments up to five nodes above the one clicked on + pos.y = pos.y + 1 + while pos.y < scan_limit and minetest.get_node(pos).name == ladder_node do + param2 = minetest.get_node(pos).param2 + pos.y = pos.y + 1 + end + if pos.y < scan_limit and minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then + + -- scan downward behind the ladder to find support + local behind_pos = vector.add(pos, minetest.facedir_to_dir(param2)) + local target_height = pos.y - standing_limit - 1 + while behind_pos.y > target_height and minetest.registered_nodes[minetest.get_node(behind_pos).name].buildable_to do + behind_pos.y = behind_pos.y - 1 + end + + -- If there's enough support, build a new ladder segment + if behind_pos.y > target_height then + if minetest.is_protected(pos, clicker:get_player_name()) then + minetest.record_protection_violation(clicker:get_player_name()) + else + minetest.set_node(pos, {name=ladder_node, param2=param2}) + if not minetest.settings:get_bool("creative_mode") then + clicked_stack:take_item(1) + end + end + end + end + elseif clicked_stack:get_definition().type == "node" then + return minetest.item_place_node(itemstack, clicker, pointed_thing) + end + return clicked_stack +end + +minetest.register_node("ropes:ladder_wood", { + description = S("Wooden Ladder"), + _doc_items_longdesc = ropes.doc.ladder_longdesc, + _doc_items_usagehelp = ropes.doc.ladder_usagehelp, + tiles = {"default_wood.png","default_wood.png","default_wood.png^[transformR270","default_wood.png^[transformR270","default_ladder_wood.png"}, + inventory_image = "default_ladder_wood.png", + wield_image = "default_ladder_wood.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {-0.375, -0.5, 0.375, -0.25, 0.5, 0.5}, -- Upright1 + {0.25, -0.5, 0.375, 0.375, 0.5, 0.5}, -- Upright2 + {-0.4375, 0.3125, 0.4375, 0.4375, 0.4375, 0.5}, -- Rung_4 + {-0.4375, -0.1875, 0.4375, 0.4375, -0.0625, 0.5}, -- Rung_2 + {-0.4375, -0.4375, 0.4375, 0.4375, -0.3125, 0.5}, -- Rung_1 + {-0.4375, 0.0625, 0.4375, 0.4375, 0.1875, 0.5}, -- Rung_3 + } + }, + groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2, flow_through = 1}, + sounds = default.node_sound_wood_defaults(), + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return ladder_extender(pos, node, clicker, itemstack, pointed_thing, "ropes:ladder_wood", ropes.extending_wood_ladder_limit) + end, +}) + +minetest.register_node("ropes:ladder_steel", { + description = S("Steel Ladder"), + _doc_items_longdesc = ropes.doc.ladder_longdesc, + _doc_items_usagehelp = ropes.doc.ladder_usagehelp, + tiles = {"default_steel_block.png","default_steel_block.png","default_steel_block.png","default_steel_block.png","default_ladder_steel.png"}, + inventory_image = "default_ladder_steel.png", + wield_image = "default_ladder_steel.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.4375, -0.5, 0.3125, -0.25, 0.5, 0.5}, -- Upright1 + {0.25, -0.5, 0.3125, 0.4375, 0.5, 0.5}, -- Upright2 + {-0.25, 0.3125, 0.375, 0.25, 0.4375, 0.5}, -- Rung_4 + {-0.25, -0.1875, 0.375, 0.25, -0.0625, 0.5}, -- Rung_2 + {-0.25, -0.4375, 0.375, 0.25, -0.3125, 0.5}, -- Rung_1 + {-0.25, 0.0625, 0.375, 0.25, 0.1875, 0.5}, -- Rung_3 + } + }, + groups = {cracky = 2, flow_through = 1}, + sounds = default.node_sound_metal_defaults(), + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return ladder_extender(pos, node, clicker, itemstack, pointed_thing, "ropes:ladder_steel", ropes.extending_steel_ladder_limit) + end, +}) + +else + +-- Table of possible wallmounted values +local facedir_to_wallmounted = { + 4, -- +Z + 2, -- +X + 5, -- -Z + 3, -- -X + 1, -- -Y + 0, -- +Y +} +-- Mapping from facedir value to index in facedir_to_dir. +local facedir_to_wallmounted_map = { + [0]=1, 2, 3, 4, + 5, 2, 6, 4, + 6, 2, 5, 4, + 1, 5, 3, 6, + 1, 6, 3, 5, + 1, 4, 3, 2, +} + +minetest.register_lbm({ + label = "Switch from ropes ladders to wallmounted default ladders", + name = "ropes:facedir_ladder_to_wallmounted_ladder", + nodenames = {"ropes:ladder_wood", "ropes:ladder_steel"}, + run_at_every_load = false, + action = function(pos, node) + local new_node = {param2 = facedir_to_wallmounted[facedir_to_wallmounted_map[node.param2 % 32]]} + if (node.name == "ropes:ladder_wood") then + new_node.name = "default:ladder_wood" + else + new_node.name = "default:ladder_steel" + end + minetest.set_node(pos, new_node) + end, +}) + +end diff --git a/ropes/init.lua b/ropes/init.lua index cf57df3..1ef9915 100644 --- a/ropes/init.lua +++ b/ropes/init.lua @@ -7,18 +7,33 @@ local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") ropes.ropeLength = tonumber(minetest.settings:get("ropes_rope_length")) or 50 -ropes.ropeLadderLength = tonumber(minetest.settings:get("ropes_rope_ladder_length")) or 50 ropes.woodRopeBoxMaxMultiple = tonumber(minetest.settings:get("ropes_wood_rope_box_max_multiple")) or 2 ropes.copperRopeBoxMaxMultiple = tonumber(minetest.settings:get("ropes_copper_rope_box_max_multiple")) or 5 ropes.steelRopeBoxMaxMultiple = tonumber(minetest.settings:get("ropes_steel_rope_box_max_multiple")) or 9 ropes.create_all_definitions = minetest.settings:get_bool("ropes_create_all_definitions") -dofile( minetest.get_modpath( ropes.name ) .. "/doc.lua" ) -dofile( minetest.get_modpath( ropes.name ) .. "/functions.lua" ) -dofile( minetest.get_modpath( ropes.name ) .. "/crafts.lua" ) -dofile( minetest.get_modpath( ropes.name ) .. "/ropeboxes.lua" ) -dofile( minetest.get_modpath( ropes.name ) .. "/ladder.lua" ) -dofile( minetest.get_modpath( ropes.name ) .. "/loot.lua" ) +ropes.ropeLadderLength = tonumber(minetest.settings:get("ropes_rope_ladder_length")) or 50 + +ropes.extending_ladder_enabled = minetest.settings:get_bool("ropes_extending_ladder_enabled") +if ropes.extending_ladder_enabled == nil then + ropes.extending_ladder_enabled = true +end +ropes.extending_wood_ladder_limit = tonumber(minetest.settings:get("ropes_extending_wood_ladder_limit")) or 5 +ropes.extending_steel_ladder_limit = tonumber(minetest.settings:get("ropes_extending_steel_ladder_limit")) or 15 + +ropes.bridges_enabled = minetest.settings:get_bool("ropes_bridges_enabled") +if ropes.bridges_enabled == nil then + ropes.bridges_enabled = true +end + +dofile( MP .. "/doc.lua" ) +dofile( MP .. "/functions.lua" ) +dofile( MP .. "/crafts.lua" ) +dofile( MP .. "/ropeboxes.lua" ) +dofile( MP .. "/ropeladder.lua" ) +dofile( MP .. "/extendingladder.lua" ) +dofile( MP .. "/bridge.lua" ) +dofile( MP .. "/loot.lua" ) for i=1,5 do @@ -40,4 +55,4 @@ minetest.register_alias("castle:ropes", "ropes:rope") minetest.register_alias("castle:ropebox", "ropes:steel1rope_block") minetest.register_alias("castle:box_rope", "ropes:rope") -print(S("[Ropes] Loaded!")) +print("[Ropes] Loaded!") diff --git a/ropes/ladder.lua b/ropes/ladder.lua deleted file mode 100644 index 7097c72..0000000 --- a/ropes/ladder.lua +++ /dev/null @@ -1,191 +0,0 @@ -if ropes.ropeLadderLength == 0 and not ropes.create_all_definitions then - return -end - --- internationalization boilerplate -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - -if ropes.ropeLadderLength > 0 then - minetest.register_craft({ - output = "ropes:ropeladder_top", - recipe = { - {'','group:stick',''}, - {'group:vines','group:stick','group:vines'}, - {'','group:stick',''}, - } - }) -end - -minetest.register_craft({ - type = "fuel", - recipe = "ropes:ropeladder_top", - burntime = ropes.ladder_burn_time, -}) - -local rope_ladder_top_def = { - description = S("Rope Ladder"), - _doc_items_longdesc = ropes.doc.ropeladder_longdesc, - _doc_items_usagehelp = ropes.doc.ropeladder_usage, - drawtype = "signlike", - tiles = {"default_ladder_wood.png^ropes_ropeladder_top.png"}, - is_ground_content = false, - inventory_image = "default_ladder_wood.png^ropes_ropeladder_top.png", - wield_image = "default_ladder_wood.png^ropes_ropeladder_top.png", - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - climbable = true, - sunlight_propagates = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - - }, - groups = { choppy=2, oddly_breakable_by_hand=1,flammable=2}, - sounds = default.node_sound_wood_defaults(), - - on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type == "node" then - local target_node = minetest.get_node(pointed_thing.under) - local target_def = minetest.registered_nodes[target_node.name] - if target_def.walkable == false then - return itemstack - end - end - return minetest.item_place(itemstack, placer, pointed_thing) - end, - - after_place_node = function(pos, placer) - local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} - local node_below = minetest.get_node(pos_below) - local this_node = minetest.get_node(pos) - local placer_name = placer:get_player_name() - -- param2 holds the facing direction of this node. If it's 0 or 1 the node is "flat" and we don't want the ladder to extend. - if node_below.name == "air" and this_node.param2 > 1 - and (not minetest.is_protected(pos_below, placer_name) - or minetest.check_player_privs(placer_name, "protection_bypass")) then - minetest.add_node(pos_below, {name="ropes:ropeladder_bottom", param2=this_node.param2}) - local meta = minetest.get_meta(pos_below) - meta:set_int("length_remaining", ropes.ropeLadderLength) - meta:set_string("placer", placer_name) - end - end, - after_destruct = function(pos) - local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} - ropes.destroy_rope(pos_below, {"ropes:ropeladder", "ropes:ropeladder_bottom", "ropes:ropeladder_falling"}) - end, -} - -if ropes.ropeLadderLength == 0 then - rope_ladder_top_def.groups.not_in_creative_inventory = 1 -end - -minetest.register_node("ropes:ropeladder_top", rope_ladder_top_def) - -minetest.register_node("ropes:ropeladder", { - description = S("Rope Ladder"), - _doc_items_create_entry = false, - drop = "", - drawtype = "signlike", - tiles = {"default_ladder_wood.png^ropes_ropeladder.png"}, - is_ground_content = false, - inventory_image = "default_ladder_wood.png^ropes_ropeladder.png", - wield_image = "default_ladder_wood.png^ropes_ropeladder.png", - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - climbable = true, - sunlight_propagates = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - }, - groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, - sounds = default.node_sound_wood_defaults(), - - after_destruct = function(pos) - ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom") - end, -}) - -local ladder_extender = ropes.make_rope_on_timer("ropes:ropeladder") - -minetest.register_node("ropes:ropeladder_bottom", { - description = S("Rope Ladder"), - _doc_items_create_entry = false, - drop = "", - drawtype = "signlike", - tiles = {"default_ladder_wood.png^ropes_ropeladder_bottom.png"}, - is_ground_content = false, - inventory_image = "default_ladder_wood.png^ropes_ropeladder_bottom.png", - wield_image = "default_ladder_wood.png^ropes_ropeladder_bottom.png", - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - climbable = true, - sunlight_propagates = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - - }, - groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, - sounds = default.node_sound_wood_defaults(), - on_construct = function( pos ) - local timer = minetest.get_node_timer( pos ) - timer:start( 1 ) - end, - on_timer = ladder_extender, - - after_destruct = function(pos) - ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom") - end, -}) - -minetest.register_node("ropes:ropeladder_falling", { - description = S("Rope Ladder"), - _doc_items_create_entry = false, - drop = "", - drawtype = "signlike", - tiles = {"default_ladder_wood.png^ropes_ropeladder.png"}, - is_ground_content = false, - inventory_image = "default_ladder_wood.png^ropes_ropeladder.png", - wield_image = "default_ladder_wood.png^ropes_ropeladder.png", - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - climbable = true, - sunlight_propagates = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - - }, - groups = {flammable=2, not_in_creative_inventory=1}, - sounds = default.node_sound_wood_defaults(), - on_construct = function( pos ) - local timer = minetest.get_node_timer( pos ) - timer:start( 1 ) - end, - on_timer = function( pos, elapsed ) - local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} - local node_below = minetest.get_node(pos_below) - - if (node_below.name ~= "ignore") then - ropes.destroy_rope(pos_below, {'ropes:ropeladder', 'ropes:ropeladder_bottom', 'ropes:ropeladder_falling'}) - minetest.swap_node(pos, {name="air"}) - else - local timer = minetest.get_node_timer( pos ) - timer:start( 1 ) - end - end -}) diff --git a/ropes/locale/es.po b/ropes/locale/es.po index b7c1b56..79e0bda 100644 --- a/ropes/locale/es.po +++ b/ropes/locale/es.po @@ -7,18 +7,22 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-27 10:41+0200\n" +"POT-Creation-Date: 2018-11-27 22:45-0700\n" "PO-Revision-Date: 2018-10-27 11:26+0200\n" +"Last-Translator: \n" "Language-Team: \n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 1.8.11\n" -"Last-Translator: \n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"Language: es\n" -#: crafts.lua:17 +#: bridge.lua:47 +msgid "Wooden Bridge" +msgstr "" + +#: crafts.lua:54 msgid "Rope Segment" msgstr "Segmento de cuerda" @@ -83,23 +87,33 @@ msgstr "" "recuperar dos segmentos de cable colocando solo la caja de cable de @1m en " "la rejilla de fabricación." -#: doc.lua:20 doc.lua:22 ropeboxes.lua:302 +#: doc.lua:20 +#: doc.lua:22 +#: ropeboxes.lua:321 msgid "Wood" msgstr "madera" -#: doc.lua:20 doc.lua:26 doc.lua:32 +#: doc.lua:20 +#: doc.lua:26 +#: doc.lua:32 msgid "rope boxes can hold @1m of rope." msgstr "Las cajas de cuerdas pueden mantener @1m de cuerda." -#: doc.lua:22 doc.lua:28 doc.lua:34 +#: doc.lua:22 +#: doc.lua:28 +#: doc.lua:34 msgid "rope boxes can hold rope lengths from @1m to @2m." msgstr "Las cajas de cuerda pueden contener longitudes de cuerda de @1m a @2m." -#: doc.lua:26 doc.lua:28 ropeboxes.lua:319 +#: doc.lua:26 +#: doc.lua:28 +#: ropeboxes.lua:338 msgid "Copper" msgstr "cobre" -#: doc.lua:32 doc.lua:34 ropeboxes.lua:336 +#: doc.lua:32 +#: doc.lua:34 +#: ropeboxes.lua:355 msgid "Steel" msgstr "acero" @@ -149,18 +163,52 @@ msgstr "" "longitud máxima de cuerda que antes - ninguna cuerda se pierde " "permanentemente cuando una cuerda es cortada de esta manera." -#: init.lua:72 -msgid "[Ropes] Loaded!" -msgstr "¡[Ropes] Cargado!" +#: doc.lua:43 +msgid "" +"A ladder for climbing. It can reach greater heights when placed against a " +"supporting block." +msgstr "" -#: ladder.lua:27 ladder.lua:78 ladder.lua:108 ladder.lua:142 -msgid "Rope Ladder" -msgstr "Escalera de cuerda" +#: doc.lua:44 +msgid "" +"Right-clicking on a ladder with a stack of identical ladder items will " +"automatically add new ladder segments to the top, provided it hasn't " +"extended too far up beyond the last block behind it providing support." +msgstr "" + +#: doc.lua:47 +msgid "A wooden platform with support struts useful for bridging gaps." +msgstr "" + +#: doc.lua:48 +msgid "" +"This behaves like most structural blocks except in one circumstance: when " +"placed on top of a block with buildable space on the side facing away from " +"you, this block will not be built on top but instead will extend out from " +"that far side of the target block. This allows a platform to be easily built " +"that juts out away from the location you're standing on." +msgstr "" + +#: extendingladder.lua:103 +msgid "Wooden Ladder" +msgstr "" + +#: extendingladder.lua:136 +msgid "Steel Ladder" +msgstr "" #: ropeboxes.lua:121 msgid "@1 Ropebox @2m" msgstr "Caja de cuerda de @1 de @2m" -#: ropeboxes.lua:218 ropeboxes.lua:249 +#: ropeboxes.lua:229 +#: ropeboxes.lua:264 msgid "Rope" msgstr "Cuerda" + +#: ropeladder.lua:27 +#: ropeladder.lua:89 +#: ropeladder.lua:119 +#: ropeladder.lua:153 +msgid "Rope Ladder" +msgstr "Escalera de cuerda" diff --git a/ropes/locale/template.pot b/ropes/locale/template.pot index 3d739ab..ac17db9 100644 --- a/ropes/locale/template.pot +++ b/ropes/locale/template.pot @@ -8,15 +8,20 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-02-09 21:21-0700\n" +"POT-Creation-Date: 2018-11-27 22:45-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: crafts.lua:17 +#: bridge.lua:47 +msgid "Wooden Bridge" +msgstr "" + +#: crafts.lua:54 msgid "Rope Segment" msgstr "" @@ -58,23 +63,33 @@ msgid "" "box in the crafting grid by itself." msgstr "" -#: doc.lua:20 doc.lua:22 ropeboxes.lua:302 +#: doc.lua:20 +#: doc.lua:22 +#: ropeboxes.lua:321 msgid "Wood" msgstr "" -#: doc.lua:20 doc.lua:26 doc.lua:32 +#: doc.lua:20 +#: doc.lua:26 +#: doc.lua:32 msgid "rope boxes can hold @1m of rope." msgstr "" -#: doc.lua:22 doc.lua:28 doc.lua:34 +#: doc.lua:22 +#: doc.lua:28 +#: doc.lua:34 msgid "rope boxes can hold rope lengths from @1m to @2m." msgstr "" -#: doc.lua:26 doc.lua:28 ropeboxes.lua:319 +#: doc.lua:26 +#: doc.lua:28 +#: ropeboxes.lua:338 msgid "Copper" msgstr "" -#: doc.lua:32 doc.lua:34 ropeboxes.lua:336 +#: doc.lua:32 +#: doc.lua:34 +#: ropeboxes.lua:355 msgid "Steel" msgstr "" @@ -106,18 +121,52 @@ msgid "" "permanently lost when a rope is severed like this." msgstr "" -#: init.lua:72 -msgid "[Ropes] Loaded!" +#: doc.lua:43 +msgid "" +"A ladder for climbing. It can reach greater heights when placed against a " +"supporting block." msgstr "" -#: ladder.lua:27 ladder.lua:78 ladder.lua:108 ladder.lua:142 -msgid "Rope Ladder" +#: doc.lua:44 +msgid "" +"Right-clicking on a ladder with a stack of identical ladder items will " +"automatically add new ladder segments to the top, provided it hasn't " +"extended too far up beyond the last block behind it providing support." +msgstr "" + +#: doc.lua:47 +msgid "A wooden platform with support struts useful for bridging gaps." +msgstr "" + +#: doc.lua:48 +msgid "" +"This behaves like most structural blocks except in one circumstance: when " +"placed on top of a block with buildable space on the side facing away from " +"you, this block will not be built on top but instead will extend out from " +"that far side of the target block. This allows a platform to be easily built " +"that juts out away from the location you're standing on." +msgstr "" + +#: extendingladder.lua:103 +msgid "Wooden Ladder" +msgstr "" + +#: extendingladder.lua:136 +msgid "Steel Ladder" msgstr "" #: ropeboxes.lua:121 msgid "@1 Ropebox @2m" msgstr "" -#: ropeboxes.lua:218 ropeboxes.lua:249 +#: ropeboxes.lua:229 +#: ropeboxes.lua:264 msgid "Rope" msgstr "" + +#: ropeladder.lua:27 +#: ropeladder.lua:89 +#: ropeladder.lua:119 +#: ropeladder.lua:153 +msgid "Rope Ladder" +msgstr "" diff --git a/ropes/locale/update.bat b/ropes/locale/update.bat new file mode 100644 index 0000000..e87d44c --- /dev/null +++ b/ropes/locale/update.bat @@ -0,0 +1,6 @@ +@echo off +setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION +cd .. +set LIST= +for /r %%X in (*.lua) do set LIST=!LIST! %%X +..\intllib\tools\xgettext.bat %LIST% \ No newline at end of file diff --git a/ropes/ropeladder.lua b/ropes/ropeladder.lua new file mode 100644 index 0000000..7097c72 --- /dev/null +++ b/ropes/ropeladder.lua @@ -0,0 +1,191 @@ +if ropes.ropeLadderLength == 0 and not ropes.create_all_definitions then + return +end + +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + +if ropes.ropeLadderLength > 0 then + minetest.register_craft({ + output = "ropes:ropeladder_top", + recipe = { + {'','group:stick',''}, + {'group:vines','group:stick','group:vines'}, + {'','group:stick',''}, + } + }) +end + +minetest.register_craft({ + type = "fuel", + recipe = "ropes:ropeladder_top", + burntime = ropes.ladder_burn_time, +}) + +local rope_ladder_top_def = { + description = S("Rope Ladder"), + _doc_items_longdesc = ropes.doc.ropeladder_longdesc, + _doc_items_usagehelp = ropes.doc.ropeladder_usage, + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder_top.png"}, + is_ground_content = false, + inventory_image = "default_ladder_wood.png^ropes_ropeladder_top.png", + wield_image = "default_ladder_wood.png^ropes_ropeladder_top.png", + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + + }, + groups = { choppy=2, oddly_breakable_by_hand=1,flammable=2}, + sounds = default.node_sound_wood_defaults(), + + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local target_node = minetest.get_node(pointed_thing.under) + local target_def = minetest.registered_nodes[target_node.name] + if target_def.walkable == false then + return itemstack + end + end + return minetest.item_place(itemstack, placer, pointed_thing) + end, + + after_place_node = function(pos, placer) + local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} + local node_below = minetest.get_node(pos_below) + local this_node = minetest.get_node(pos) + local placer_name = placer:get_player_name() + -- param2 holds the facing direction of this node. If it's 0 or 1 the node is "flat" and we don't want the ladder to extend. + if node_below.name == "air" and this_node.param2 > 1 + and (not minetest.is_protected(pos_below, placer_name) + or minetest.check_player_privs(placer_name, "protection_bypass")) then + minetest.add_node(pos_below, {name="ropes:ropeladder_bottom", param2=this_node.param2}) + local meta = minetest.get_meta(pos_below) + meta:set_int("length_remaining", ropes.ropeLadderLength) + meta:set_string("placer", placer_name) + end + end, + after_destruct = function(pos) + local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} + ropes.destroy_rope(pos_below, {"ropes:ropeladder", "ropes:ropeladder_bottom", "ropes:ropeladder_falling"}) + end, +} + +if ropes.ropeLadderLength == 0 then + rope_ladder_top_def.groups.not_in_creative_inventory = 1 +end + +minetest.register_node("ropes:ropeladder_top", rope_ladder_top_def) + +minetest.register_node("ropes:ropeladder", { + description = S("Rope Ladder"), + _doc_items_create_entry = false, + drop = "", + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder.png"}, + is_ground_content = false, + inventory_image = "default_ladder_wood.png^ropes_ropeladder.png", + wield_image = "default_ladder_wood.png^ropes_ropeladder.png", + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + + after_destruct = function(pos) + ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom") + end, +}) + +local ladder_extender = ropes.make_rope_on_timer("ropes:ropeladder") + +minetest.register_node("ropes:ropeladder_bottom", { + description = S("Rope Ladder"), + _doc_items_create_entry = false, + drop = "", + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder_bottom.png"}, + is_ground_content = false, + inventory_image = "default_ladder_wood.png^ropes_ropeladder_bottom.png", + wield_image = "default_ladder_wood.png^ropes_ropeladder_bottom.png", + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + + }, + groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + on_construct = function( pos ) + local timer = minetest.get_node_timer( pos ) + timer:start( 1 ) + end, + on_timer = ladder_extender, + + after_destruct = function(pos) + ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom") + end, +}) + +minetest.register_node("ropes:ropeladder_falling", { + description = S("Rope Ladder"), + _doc_items_create_entry = false, + drop = "", + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder.png"}, + is_ground_content = false, + inventory_image = "default_ladder_wood.png^ropes_ropeladder.png", + wield_image = "default_ladder_wood.png^ropes_ropeladder.png", + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + + }, + groups = {flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + on_construct = function( pos ) + local timer = minetest.get_node_timer( pos ) + timer:start( 1 ) + end, + on_timer = function( pos, elapsed ) + local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} + local node_below = minetest.get_node(pos_below) + + if (node_below.name ~= "ignore") then + ropes.destroy_rope(pos_below, {'ropes:ropeladder', 'ropes:ropeladder_bottom', 'ropes:ropeladder_falling'}) + minetest.swap_node(pos, {name="air"}) + else + local timer = minetest.get_node_timer( pos ) + timer:start( 1 ) + end + end +}) diff --git a/ropes/settingtypes.txt b/ropes/settingtypes.txt index 242cd76..3c5d747 100644 --- a/ropes/settingtypes.txt +++ b/ropes/settingtypes.txt @@ -34,4 +34,17 @@ ropes_steel_rope_box_max_multiple (Maximum steel rope box multiple) int 9 0 9 #intended for the situation where you have an established world and you want #to reduce the number of rope boxes available to players without turning #existing rope boxes into "unknown node"s. -ropes_create_all_definitions (Create all rope box definitions) bool false \ No newline at end of file +ropes_create_all_definitions (Create all rope box definitions) bool false + +#Extending ladders replaces the default wallmounted wood and steel ladders +#with ladders capable of standing on their own, to a defined limit. +#A ladder can extend to its unsupported limit before needing another node +#behind it to provide a new point of support. Right-clicking on an existing +#ladder with a stack of ladders will add new ladder segments to its top. +ropes_extending_ladder_enabled (Enable extendable ladders) bool true +ropes_extending_wood_ladder_limit (Unsupported limit of wooden ladders) int 5 +ropes_extending_steel_ladder_limit (Unsupported limit of steel ladders) int 15 + +#These nodes make it easier to build bridges by extending out away +#from the player as they're placed +ropes_bridges_enabled (Enable bridges) bool true \ No newline at end of file diff --git a/technic/machines/HV/forcefield.lua b/technic/machines/HV/forcefield.lua index 230c8b0..7395284 100644 --- a/technic/machines/HV/forcefield.lua +++ b/technic/machines/HV/forcefield.lua @@ -42,7 +42,7 @@ end) -- | | -- \___/\___/ -local function update_forcefield(pos, meta, active, first) +local function update_forcefield(pos, meta, active) local shape = meta:get_int("shape") local range = meta:get_int("range") local vm = VoxelManip() @@ -86,11 +86,6 @@ local function update_forcefield(pos, meta, active, first) vm:set_data(data) vm:update_liquids() vm:write_to_map() - -- update_map is very slow, but if we don't call it we'll - -- get phantom blocks on the client. - if not active or first then - vm:update_map() - end end local function set_forcefield_formspec(meta) @@ -273,13 +268,11 @@ local function run(pos, node) technic.swap_node(pos, "technic:forcefield_emitter_off") end elseif eu_input >= power_requirement then - local first = false if node.name == "technic:forcefield_emitter_off" then - first = true technic.swap_node(pos, "technic:forcefield_emitter_on") meta:set_string("infotext", S("%s Active"):format(machine_name)) end - update_forcefield(pos, meta, true, first) + update_forcefield(pos, meta, true) end end diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua index 0a45559..b6f9c14 100644 --- a/technic/machines/HV/quarry.lua +++ b/technic/machines/HV/quarry.lua @@ -112,6 +112,11 @@ local function quarry_run(pos, node) if meta:get_int("enabled") and meta:get_int("HV_EU_input") >= quarry_demand and meta:get_int("purge_on") == 0 then local pdir = minetest.facedir_to_dir(node.param2) + if pdir.y ~= 0 then + -- faces up or down, not valid, otherwise depth-check would run endless and hang up the server + return + end + local qdir = pdir.x == 1 and vector.new(0,0,-1) or (pdir.z == -1 and vector.new(-1,0,0) or (pdir.x == -1 and vector.new(0,0,1) or diff --git a/technic/machines/MV/freezer.lua b/technic/machines/MV/freezer.lua new file mode 100644 index 0000000..ab48838 --- /dev/null +++ b/technic/machines/MV/freezer.lua @@ -0,0 +1,12 @@ +-- MV freezer + +minetest.register_craft({ + output = 'technic:mv_freezer', + recipe = { + {'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot'}, + {'pipeworks:pipe_1_empty', 'technic:mv_transformer', 'pipeworks:pipe_1_empty'}, + {'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'}, + } +}) + +technic.register_freezer({tier = "MV", demand = {800, 600, 400}, speed = 0.5, upgrade = 1, tube = 1}) diff --git a/technic/machines/MV/hydro_turbine.lua b/technic/machines/MV/hydro_turbine.lua index 36aac91..e5df5e6 100644 --- a/technic/machines/MV/hydro_turbine.lua +++ b/technic/machines/MV/hydro_turbine.lua @@ -18,7 +18,7 @@ minetest.register_craft({ local function get_water_flow(pos) local node = minetest.get_node(pos) - if minetest.get_item_group(node.name, "water") == 3 then + if minetest.get_item_group(node.name, "water") == 3 and string.find(node.name, "flowing") then return node.param2 -- returns approx. water flow, if any end return 0 diff --git a/technic/machines/MV/init.lua b/technic/machines/MV/init.lua index 7092fda..07c44b6 100644 --- a/technic/machines/MV/init.lua +++ b/technic/machines/MV/init.lua @@ -25,6 +25,8 @@ dofile(path.."/centrifuge.lua") dofile(path.."/tool_workshop.lua") +dofile(path.."/freezer.lua") + -- The power radiator supplies appliances with inductive coupled power: -- Lighting and associated textures is taken directly from VanessaE's homedecor and made electric. -- This is currently useless, slow, and mostly copied diff --git a/technic/machines/register/freezer.lua b/technic/machines/register/freezer.lua new file mode 100644 index 0000000..b4da6d9 --- /dev/null +++ b/technic/machines/register/freezer.lua @@ -0,0 +1,9 @@ + +local S = technic.getter + +function technic.register_freezer(data) + data.typename = "freezing" + data.machine_name = "freezer" + data.machine_desc = S("%s Freezer") + technic.register_base_machine(data) +end diff --git a/technic/machines/register/freezer_recipes.lua b/technic/machines/register/freezer_recipes.lua new file mode 100644 index 0000000..641b28a --- /dev/null +++ b/technic/machines/register/freezer_recipes.lua @@ -0,0 +1,21 @@ + +local S = technic.getter + +technic.register_recipe_type("freezing", { description = S("Freezing") }) + +function technic.register_freezer_recipe(data) + data.time = data.time or 5 + technic.register_recipe("freezing", data) +end + +local recipes = { + {"bucket:bucket_water", { "default:ice", "bucket:bucket_empty" } }, + {"bucket:bucket_river_water", { "default:ice", "bucket:bucket_empty" } }, + {"default:dirt", "default:dirt_with_snow" }, + {"bucket:bucket_lava", { "default:obsidian", "bucket:bucket_empty" } } +} + +for _, data in pairs(recipes) do + technic.register_freezer_recipe({input = {data[1]}, output = data[2]}) +end + diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index da90aad..ab70724 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -30,6 +30,8 @@ local recipes = { {"default:sandstone", "default:sand 2"}, -- reverse recipe can be found in the compressor {"default:desert_sandstone", "default:desert_sand 2"}, -- reverse recipe can be found in the compressor {"default:silver_sandstone", "default:silver_sand 2"}, -- reverse recipe can be found in the compressor + + {"default:ice", "default:snowblock"}, } -- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe) diff --git a/technic/machines/register/init.lua b/technic/machines/register/init.lua index 1667d75..29ec2ea 100644 --- a/technic/machines/register/init.lua +++ b/technic/machines/register/init.lua @@ -20,6 +20,7 @@ dofile(path.."/grinder_recipes.lua") dofile(path.."/extractor_recipes.lua") dofile(path.."/compressor_recipes.lua") dofile(path.."/centrifuge_recipes.lua") +dofile(path.."/freezer_recipes.lua") -- Multi-Machine Recipes dofile(path.."/grindings.lua") @@ -31,3 +32,4 @@ dofile(path.."/grinder.lua") dofile(path.."/extractor.lua") dofile(path.."/compressor.lua") dofile(path.."/centrifuge.lua") +dofile(path.."/freezer.lua") diff --git a/technic/textures/technic_mv_freezer_bottom.png b/technic/textures/technic_mv_freezer_bottom.png new file mode 100644 index 0000000..f0c7ce2 Binary files /dev/null and b/technic/textures/technic_mv_freezer_bottom.png differ diff --git a/technic/textures/technic_mv_freezer_front.png b/technic/textures/technic_mv_freezer_front.png new file mode 100644 index 0000000..bd6f387 Binary files /dev/null and b/technic/textures/technic_mv_freezer_front.png differ diff --git a/technic/textures/technic_mv_freezer_front_active.png b/technic/textures/technic_mv_freezer_front_active.png new file mode 100644 index 0000000..d90010a Binary files /dev/null and b/technic/textures/technic_mv_freezer_front_active.png differ diff --git a/technic/textures/technic_mv_freezer_side.png b/technic/textures/technic_mv_freezer_side.png new file mode 100644 index 0000000..c5e211b Binary files /dev/null and b/technic/textures/technic_mv_freezer_side.png differ diff --git a/technic/textures/technic_mv_freezer_top.png b/technic/textures/technic_mv_freezer_top.png new file mode 100644 index 0000000..10102bd Binary files /dev/null and b/technic/textures/technic_mv_freezer_top.png differ diff --git a/technic/textures/technicx32/technic_mv_freezer_bottom.png b/technic/textures/technicx32/technic_mv_freezer_bottom.png new file mode 100644 index 0000000..4e3351f Binary files /dev/null and b/technic/textures/technicx32/technic_mv_freezer_bottom.png differ diff --git a/technic/textures/technicx32/technic_mv_freezer_front.png b/technic/textures/technicx32/technic_mv_freezer_front.png new file mode 100644 index 0000000..4327514 Binary files /dev/null and b/technic/textures/technicx32/technic_mv_freezer_front.png differ diff --git a/technic/textures/technicx32/technic_mv_freezer_front_active.png b/technic/textures/technicx32/technic_mv_freezer_front_active.png new file mode 100644 index 0000000..4aba6f8 Binary files /dev/null and b/technic/textures/technicx32/technic_mv_freezer_front_active.png differ diff --git a/technic/textures/technicx32/technic_mv_freezer_side.png b/technic/textures/technicx32/technic_mv_freezer_side.png new file mode 100644 index 0000000..c439476 Binary files /dev/null and b/technic/textures/technicx32/technic_mv_freezer_side.png differ diff --git a/technic/textures/technicx32/technic_mv_freezer_top.png b/technic/textures/technicx32/technic_mv_freezer_top.png new file mode 100644 index 0000000..2b54212 Binary files /dev/null and b/technic/textures/technicx32/technic_mv_freezer_top.png differ diff --git a/unified_inventory/internal.lua b/unified_inventory/internal.lua index 06967d2..3fad275 100644 --- a/unified_inventory/internal.lua +++ b/unified_inventory/internal.lua @@ -223,7 +223,8 @@ function unified_inventory.get_formspec(player, page) for y = 0, ui_peruser.pagerows - 1 do for x = 0, ui_peruser.pagecols - 1 do local name = unified_inventory.filtered_items_list[player_name][list_index] - if minetest.registered_items[name] then + local item = minetest.registered_items[name] + if item then -- Clicked on current item: Flip crafting direction if name == unified_inventory.current_item[player_name] then local cdir = unified_inventory.current_craft_direction[player_name] @@ -236,12 +237,18 @@ function unified_inventory.get_formspec(player, page) -- Default: use active search direction by default dir = unified_inventory.active_search_direction[player_name] end - formspec[n] = "item_image_button[" - ..(8.2 + x * 0.7).."," - ..(ui_peruser.formspec_y + ui_peruser.page_y + y * 0.7)..";.81,.81;" - ..name..";item_button_"..dir.."_" - ..unified_inventory.mangle_for_formspec(name)..";]" - n = n+1 + + local button_name = "item_button_" .. dir .. "_" + .. unified_inventory.mangle_for_formspec(name) + formspec[n] = ("item_image_button[%f,%f;.81,.81;%s;%s;]"):format( + 8.2 + x * 0.7, ui_peruser.formspec_y + ui_peruser.page_y + y * 0.7, + name, button_name + ) + formspec[n + 1] = ("tooltip[%s;%s \\[%s\\]]"):format( + button_name, minetest.formspec_escape(item.description), + item.mod_origin or "??" + ) + n = n + 2 list_index = list_index + 1 end end diff --git a/unifieddyes/init.lua b/unifieddyes/init.lua index 9edd87f..673eef1 100644 --- a/unifieddyes/init.lua +++ b/unifieddyes/init.lua @@ -128,7 +128,7 @@ unifieddyes.GREYS = { unifieddyes.GREYS_EXTENDED = table.copy(unifieddyes.GREYS) for i = 1, 14 do - if i ~= 0 and i ~= 3 and i ~= 7 and i ~= 11 and i ~= 15 then + if i ~= 0 and i ~= 4 and i ~= 8 and i ~= 11 and i ~= 15 then table.insert(unifieddyes.GREYS_EXTENDED, "grey_"..i) end end @@ -449,7 +449,7 @@ function unifieddyes.getpaletteidx(color, palette_type) ["grey_14"] = 1, ["grey_13"] = 2, ["grey_12"] = 3, - ["light_grey"] = 3, + ["light_grey"] = 4, ["grey_11"] = 4, ["grey_10"] = 5, ["grey_9"] = 6, @@ -630,6 +630,19 @@ function unifieddyes.getpaletteidx(color, palette_type) end end +function unifieddyes.get_color_from_dye_name(name) + if name == "dye:black" then + return "000000" + elseif name == "dye:white" then + return "ffffff" + end + local item = minetest.registered_items[name] + if not item then return end + local inv_image = item.inventory_image + if not inv_image then return end + return string.match(inv_image,"colorize:#(......):200") +end + -- punch-to-recolor using the airbrush function unifieddyes.on_airbrush(itemstack, player, pointed_thing) @@ -640,8 +653,28 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing) painting_with = unifieddyes.player_current_dye[player_name] end + if not painting_with then + minetest.chat_send_player(player_name, "*** You need to set a color first.") + minetest.chat_send_player(player_name, "*** Right-click any random node to open the color selector,") + minetest.chat_send_player(player_name, "*** or shift+right-click a colorized node to use its color.") + minetest.chat_send_player(player_name, "*** Be sure to click \"Accept\", or the color you select will be ignored.") + return + end + local pos = minetest.get_pointed_thing_position(pointed_thing) - if not pos then return end + if not pos then + local look_angle = player:get_look_vertical() + if look_angle > -1.55 then + minetest.chat_send_player(player_name, "*** No node selected") + else + local hexcolor = unifieddyes.get_color_from_dye_name(painting_with) + local r = tonumber(string.sub(hexcolor,1,2),16) + local g = tonumber(string.sub(hexcolor,3,4),16) + local b = tonumber(string.sub(hexcolor,5,6),16) + player:set_sky({r=r,g=g,b=b,a=255},"plain") + end + return + end local node = minetest.get_node(pos) local def = minetest.registered_items[node.name] @@ -652,14 +685,6 @@ function unifieddyes.on_airbrush(itemstack, player, pointed_thing) return end - if not painting_with then - minetest.chat_send_player(player_name, "*** You need to set a color first.") - minetest.chat_send_player(player_name, "*** Right-click any random node to open the color selector,") - minetest.chat_send_player(player_name, "*** or shift+right-click a colorized node to use its color.") - minetest.chat_send_player(player_name, "*** Be sure to click \"Accept\", or the color you select will be ignored.") - return - end - if not (def.groups and def.groups.ud_param2_colorable and def.groups.ud_param2_colorable > 0) then minetest.chat_send_player(player_name, "*** That node can't be colored.") return diff --git a/vines/init.lua b/vines/init.lua index cce7cca..cb4c1e1 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -3,6 +3,8 @@ vines = { recipes = {} } +local enable_roots = minetest.settings:get_bool("vines_enable_roots") + -- support for i18n local S = plantlife_i18n.gettext @@ -305,6 +307,14 @@ minetest.register_tool("vines:shears", { }) -- VINES +local spawn_root_surfaces = {} + +if enable_roots ~= false then + spawn_root_surfaces = { + "default:dirt_with_grass", + "default:dirt" + } +end vines.register_vine('root', {description = S("Roots"), average_length = 9}, { @@ -313,10 +323,7 @@ vines.register_vine('root', avoid_radius = 5, spawn_delay = 500, spawn_chance = 10, - spawn_surfaces = { - "default:dirt_with_grass", - "default:dirt" - }, + spawn_surfaces = spawn_root_surfaces, spawn_on_bottom = true, plantlife_limit = -0.6, humidity_min = 0.4, diff --git a/worldedit/init.lua b/worldedit/init.lua index 8358e3b..a38e3e6 100644 --- a/worldedit/init.lua +++ b/worldedit/init.lua @@ -42,7 +42,7 @@ load_module(path .. "/compatibility.lua") load_module(path .. "/cuboid.lua") -if minetest.setting_getbool("log_mods") then +if minetest.settings:get_bool("log_mods") then print("[WorldEdit] Loaded!") end diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index 763e895..61aafc1 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -108,7 +108,7 @@ end minetest.register_chatcommand("/about", { params = "", - description = "Get information about the mod", + description = "Get information about the WorldEdit mod", func = function(name, param) worldedit.player_notify(name, "WorldEdit " .. worldedit.version_string .. " is available on this server. Type /help to get a list of commands, or get more information at https://github.com/Uberi/Minetest-WorldEdit/") end, -- cgit v1.2.3