diff options
author | Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> | 2019-03-10 19:44:56 -0400 |
---|---|---|
committer | Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> | 2019-03-10 19:44:56 -0400 |
commit | 18fc18b5aece7aae1caafd38a2c742af7974348c (patch) | |
tree | 460b6c6ab31c621cd437d04aa7443e5bb343d718 | |
parent | b21c3d368077aa3a1c42ff1582cda6263c018585 (diff) | |
download | dreambuilder_modpack-18fc18b5aece7aae1caafd38a2c742af7974348c.tar dreambuilder_modpack-18fc18b5aece7aae1caafd38a2c742af7974348c.tar.gz dreambuilder_modpack-18fc18b5aece7aae1caafd38a2c742af7974348c.tar.bz2 dreambuilder_modpack-18fc18b5aece7aae1caafd38a2c742af7974348c.tar.xz dreambuilder_modpack-18fc18b5aece7aae1caafd38a2c742af7974348c.zip |
update cottages, digilines, locks, maptools, moreblocks, technic,
and travelnet
55 files changed, 1825 insertions, 471 deletions
diff --git a/cottages/nodes_water.lua b/cottages/nodes_water.lua index 1cfe77d..c2bb118 100644 --- a/cottages/nodes_water.lua +++ b/cottages/nodes_water.lua @@ -16,6 +16,7 @@ -- how many seconds does it take to fill a bucket? cottages.water_fill_time = 10 +local S = cottages.S -- code taken from the itemframes mod in homedecor -- (the relevant functions are sadly private there and thus cannot be reused) diff --git a/digilines/.luacheckrc b/digilines/.luacheckrc index 6d89a3f..b356748 100644 --- a/digilines/.luacheckrc +++ b/digilines/.luacheckrc @@ -1,5 +1,7 @@ read_globals = { + "vector", + "screwdriver", "minetest", "default", "pipeworks", diff --git a/digilines/init.lua b/digilines/init.lua index 21c1c8e..93c94e9 100644 --- a/digilines/init.lua +++ b/digilines/init.lua @@ -64,19 +64,19 @@ minetest.register_craft({ } }) --- former submods -if minetest.is_yes(minetest.setting_get("digilines_enable_inventory") or true) then +-- For minetest 0.4 support returned nil are also tested: ~= false +if minetest.settings:get_bool("digilines_enable_inventory", true) ~= false then dofile(modpath .. "/inventory.lua") end -if minetest.is_yes(minetest.setting_get("digilines_enable_lcd") or true) then +if minetest.settings:get_bool("digilines_enable_lcd", true) ~= false then dofile(modpath .. "/lcd.lua") end -if minetest.is_yes(minetest.setting_get("digilines_enable_lightsensor") or true) then +if minetest.settings:get_bool("digilines_enable_lightsensor", true) ~= false then dofile(modpath .. "/lightsensor.lua") end -if minetest.is_yes(minetest.setting_get("digilines_enable_rtc") or true) then +if minetest.settings:get_bool("digilines_enable_rtc", true) ~= false then dofile(modpath .. "/rtc.lua") end diff --git a/digilines/internal.lua b/digilines/internal.lua index 2528f35..05c93fa 100644 --- a/digilines/internal.lua +++ b/digilines/internal.lua @@ -1,6 +1,7 @@ function digilines.getspec(node) - if not minetest.registered_nodes[node.name] then return false end - return minetest.registered_nodes[node.name].digiline + local def = minetest.registered_nodes[node.name] + if not def then return false end + return def.digilines or def.digiline end function digilines.importrules(spec, node) @@ -86,6 +87,12 @@ local function queue_dequeue(queue) end function digilines.transmit(pos, channel, msg, checked) + local checkedID = minetest.hash_node_position(pos) + if checked[checkedID] then + return + end + checked[checkedID] = true + digilines.vm_begin() local queue = queue_new() queue_enqueue(queue, pos) diff --git a/digilines/inventory.lua b/digilines/inventory.lua index 693f882..86b1536 100644 --- a/digilines/inventory.lua +++ b/digilines/inventory.lua @@ -1,33 +1,56 @@ local pipeworks_enabled = minetest.get_modpath("pipeworks") ~= nil -local function sendMessage(pos, msg, channel) - if channel == nil then - channel = minetest.get_meta(pos):get_string("channel") - end - digilines.receptor_send(pos,digilines.rules.default,channel,msg) +-- Sends a message onto the Digilines network. +-- pos: the position of the Digilines chest node. +-- action: the action string indicating what happened. +-- stack: the ItemStack that the action acted on (optional). +-- from_slot: the slot number that is taken from (optional). +-- to_slot: the slot number that is put into (optional). +-- side: which side of the chest the action occurred (optional). +local function send_message(pos, action, stack, from_slot, to_slot, side) + local channel = minetest.get_meta(pos):get_string("channel") + local msg = { + action = action, + stack = stack and stack:to_table(), + from_slot = from_slot, + to_slot = to_slot, + -- Duplicate the vector in case the caller expects it not to change. + side = side and vector.new(side) + } + digilines.receptor_send(pos, digilines.rules.default, channel, msg) end -local function maybeString(stack) - if type(stack)=='string' then return stack - elseif type(stack)=='table' then return dump(stack) - else return stack:to_string() +-- Checks if the inventory has become empty and, if so, sends an empty message. +local function check_empty(pos) + if minetest.get_meta(pos):get_inventory():is_empty("main") then + send_message(pos, "empty") end end -local function can_insert(pos, stack) - local can = minetest.get_meta(pos):get_inventory():room_for_item("main", stack) - if can then - sendMessage(pos,"put "..maybeString(stack)) - else - -- overflow and lost means that items are gonna be out as entities :/ - sendMessage(pos,"lost "..maybeString(stack)) +-- Checks if the inventory has become full for a particular type of item and, +-- if so, sends a full message. +local function check_full(pos, stack) + local one_item_stack = ItemStack(stack) + one_item_stack:set_count(1) + if not minetest.get_meta(pos):get_inventory():room_for_item("main", one_item_stack) then + send_message(pos, "full", one_item_stack) end - return can end local tubeconn = pipeworks_enabled and "^pipeworks_tube_connection_wooden.png" or "" local tubescan = pipeworks_enabled and function(pos) pipeworks.scan_for_tube_objects(pos) end or nil +-- A place to remember things from allow_metadata_inventory_put to +-- on_metadata_inventory_put. This is a hack due to issue +-- minetest/minetest#6534 that should be removed once that’s fixed. +local last_inventory_put_index +local last_inventory_put_stack + +-- A place to remember things from allow_metadata_inventory_take to +-- tube.remove_items. This is a hack due to issue minetest-mods/pipeworks#205 +-- that should be removed once that’s fixed. +local last_inventory_take_index + minetest.register_alias("digilines_inventory:chest", "digilines:chest") minetest.register_node("digilines:chest", { description = "Digiline Chest", @@ -86,63 +109,203 @@ minetest.register_node("digilines:chest", { return not pipeworks.connects.facingFront(i,param2) end, input_inventory = "main", - can_insert = function(pos, _, stack) - return can_insert(pos, stack) + can_insert = function(pos, _, stack, direction) + local ret = minetest.get_meta(pos):get_inventory():room_for_item("main", stack) + if not ret then + -- The stack cannot be accepted. It will never be passed to + -- insert_object, but it should be reported as a toverflow. + -- Here, direction = direction item is moving, which is into + -- side. + local side = vector.multiply(direction, -1) + send_message(pos, "toverflow", stack, nil, nil, side) + end + return ret end, - insert_object = function(pos, _, stack) + insert_object = function(pos, _, original_stack, direction) + -- Here, direction = direction item is moving, which is into side. + local side = vector.multiply(direction, -1) local inv = minetest.get_meta(pos):get_inventory() - local leftover = inv:add_item("main", stack) - local count = leftover:get_count() - if count == 0 then - local derpstack = stack:get_name()..' 1' - if not inv:room_for_item("main", derpstack) then - -- when you can't put a single more of whatever you just put, - -- you'll get a put for it, then a full - sendMessage(pos,"full "..maybeString(stack)..' '..tostring(count)) + local inv_contents = inv:get_list("main") + local any_put = false + local stack = original_stack + local stack_name = stack:get_name() + local stack_count = stack:get_count() + -- Walk the inventory, adding items to existing stacks of the same + -- type. + for i = 1, #inv_contents do + local existing_stack = inv_contents[i] + if not existing_stack:is_empty() and existing_stack:get_name() == stack_name then + local leftover = existing_stack:add_item(stack) + local leftover_count = leftover:get_count() + if leftover_count ~= stack_count then + -- We put some items into the slot. Update the slot in + -- the inventory, tell Digilines listeners about it, + -- and keep looking for the a place to put the + -- leftovers if any. + any_put = true + inv:set_stack("main", i, existing_stack) + local stack_that_was_put + if leftover_count == 0 then + stack_that_was_put = stack + else + stack_that_was_put = ItemStack(stack) + stack_that_was_put:set_count(stack_count - leftover_count) + end + send_message(pos, "tput", stack_that_was_put, nil, i, side) + stack = leftover + stack_count = leftover_count + if stack_count == 0 then + break + end + end + end + end + if stack_count ~= 0 then + -- Walk the inventory, adding items to empty slots. + for i = 1, #inv_contents do + local existing_stack = inv_contents[i] + if existing_stack:is_empty() then + local leftover = existing_stack:add_item(stack) + local leftover_count = leftover:get_count() + if leftover_count ~= stack_count then + -- We put some items into the slot. Update the slot in + -- the inventory, tell Digilines listeners about it, + -- and keep looking for the a place to put the + -- leftovers if any. + any_put = true + inv:set_stack("main", i, existing_stack) + local stack_that_was_put + if leftover_count == 0 then + stack_that_was_put = stack + else + stack_that_was_put = ItemStack(stack) + stack_that_was_put:set_count(stack_count - leftover_count) + end + send_message(pos, "tput", stack_that_was_put, nil, i, side) + stack = leftover + stack_count = leftover_count + if stack_count == 0 then + break + end + end + end end - else - -- this happens when the chest has received two stacks in a row and - -- filled up exactly with the first one. - -- You get a put for the first stack, a put for the second - -- and then a overflow with the first in stack and the second in leftover - -- and NO full? - sendMessage(pos,"overflow "..maybeString(stack)..' '..tostring(count)) end - return leftover + if any_put then + check_full(pos, original_stack) + end + if stack_count ~= 0 then + -- Some items could not be added and bounced back. Report them. + send_message(pos, "toverflow", stack, nil, nil, side) + end + return stack + end, + remove_items = function(pos, _, stack, dir, count) + -- Here, stack is the ItemStack in our own inventory that is being + -- pulled from, NOT the stack that is actually pulled out. + -- Combining it with count gives the stack that is pulled out. + -- Also, note that Pipeworks doesn’t pass the index to this + -- function, so we use the one recorded in + -- allow_metadata_inventory_take; because we don’t implement + -- tube.can_remove, Pipeworks will call + -- allow_metadata_inventory_take instead and will pass it the + -- index. + local taken = stack:take_item(count) + minetest.get_meta(pos):get_inventory():set_stack("main", last_inventory_take_index, stack) + send_message(pos, "ttake", taken, last_inventory_take_index, nil, dir) + check_empty(pos) + return taken end, }, - allow_metadata_inventory_put = function(pos, _, _, stack) - if not can_insert(pos, stack) then - sendMessage(pos,"uoverflow "..maybeString(stack)) - end + allow_metadata_inventory_put = function(pos, _, index, stack) + -- Remember what was in the target slot before the put; see + -- on_metadata_inventory_put for why we care. + last_inventory_put_index = index + last_inventory_put_stack = minetest.get_meta(pos):get_inventory():get_stack("main", index) return stack:get_count() end, - on_metadata_inventory_move = function(pos, _, _, _, _, _, player) - minetest.log("action", player:get_player_name().." moves stuff in chest at "..minetest.pos_to_string(pos)) + allow_metadata_inventory_take = function(_, _, index, stack) + -- Remember the index value; see tube.remove_items for why we care. + last_inventory_take_index = index + return stack:get_count() end, - on_metadata_inventory_put = function(pos, _, _, stack, player) - local channel = minetest.get_meta(pos):get_string("channel") - local send = function(msg) - sendMessage(pos,msg,channel) + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + -- See what would happen if we were to move the items back from in the + -- opposite direction. In the event of a normal move, this must + -- succeed, because a normal move subtracts some items from the from + -- stack and adds them to the to stack; the two stacks naturally must + -- be compatible and so the reverse operation must succeed. However, if + -- the user *swaps* the two stacks instead, then due to issue + -- minetest/minetest#6534, this function is only called once; however, + -- when it is called, the stack that used to be in the to stack has + -- already been moved to the from stack, so we can detect the situation + -- by the fact that the reverse move will fail due to the from stack + -- being incompatible with its former contents. + local inv = minetest.get_meta(pos):get_inventory() + local from_stack = inv:get_stack("main", from_index) + local to_stack = inv:get_stack("main", to_index) + local reverse_move_stack = ItemStack(to_stack) + reverse_move_stack:set_count(count) + local swapped = from_stack:add_item(reverse_move_stack):get_count() == count + if swapped then + local channel = minetest.get_meta(pos):get_string("channel") + to_stack:set_count(count) + local msg = { + action = "uswap", + -- The slot and stack do not match because this function is + -- called after the action has taken place, but the Digilines + -- message is from the perspective of a viewer who hasn’t + -- observed the movement yet. + x_stack = to_stack:to_table(), + x_slot = from_index, + y_stack = from_stack:to_table(), + y_slot = to_index, + } + digilines.receptor_send(pos, digilines.rules.default, channel, msg) + else + to_stack:set_count(count) + send_message(pos, "umove", to_stack, from_index, to_index) end - -- direction is only for furnaces - -- as the item has already been put, can_insert should return false if the chest is now full. - local derpstack = stack:get_name()..' 1' - if can_insert(pos,derpstack) then - send("uput "..maybeString(stack)) + minetest.log("action", player:get_player_name().." moves stuff in chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, _, index, stack, player) + -- Get what was in the target slot before the put; it has disappeared + -- by now (been replaced by the result of the put action) but we saved + -- it in allow_metadata_inventory_put. This should always work + -- (allow_metadata_inventory_put should AFAICT always be called + -- immediately before on_metadata_inventory_put), but in case of + -- something weird happening, just fall back to using an empty + -- ItemStack rather than crashing. + local old_stack + if last_inventory_put_index == index then + old_stack = last_inventory_put_stack + last_inventory_put_index = nil + last_inventory_put_stack = nil else - send("ufull "..maybeString(stack)) + old_stack = ItemStack(nil) end + -- If the player tries to place a stack into an inventory, there’s + -- already a stack there, and the existing stack is either of a + -- different item type or full, then obviously the stacks can’t be + -- merged; instead the stacks are swapped. This information is not + -- reported to mods (Minetest core neither tells us that a particular + -- action was a swap, nor tells us a take followed by a put). In core, + -- the condition for swapping is that you try to add the new stack to + -- the existing stack and the leftovers are as big as the original + -- stack to put. Replicate that logic here using the old stack saved in + -- allow_metadata_inventory_put. If a swap happened, report it to the + -- Digilines network as a utake followed by a uput. + local leftovers = old_stack:add_item(stack) + if leftovers:get_count() == stack:get_count() then + send_message(pos, "utake", old_stack, index) + end + send_message(pos, "uput", stack, nil, index) + check_full(pos, stack) minetest.log("action", player:get_player_name().." puts stuff into chest at "..minetest.pos_to_string(pos)) end, - on_metadata_inventory_take = function(pos, listname, _, stack, player) - local meta = minetest.get_meta(pos) - local channel = meta:get_string("channel") - local inv = meta:get_inventory() - if inv:is_empty(listname) then - sendMessage(pos, "empty", channel) - end - sendMessage(pos,"utake "..maybeString(stack)) + on_metadata_inventory_take = function(pos, _, index, stack, player) + send_message(pos, "utake", stack, index) + check_empty(pos) minetest.log("action", player:get_player_name().." takes stuff from chest at "..minetest.pos_to_string(pos)) end }) diff --git a/digilines/lcd.lua b/digilines/lcd.lua index a59b0b2..37ce3e0 100644 --- a/digilines/lcd.lua +++ b/digilines/lcd.lua @@ -178,7 +178,7 @@ end local spawn_entity = function(pos) if not get_entity(pos) then - local text = minetest.add_entity(pos, "digilines_lcd:text") + minetest.add_entity(pos, "digilines_lcd:text") rotate_text(pos) end end diff --git a/locks/init.lua b/locks/init.lua index e8a1355..0f463c3 100644 --- a/locks/init.lua +++ b/locks/init.lua @@ -46,7 +46,7 @@ minetest.register_privilege("diglocks", { description = "allows to open/use and locks.config_button = [[ - image_button[%d,%d;1,1;locks_lock16.png;locks_config;Config + image_button[%s,%s;1,1;locks_lock16.png;locks_config;Config Locks] tooltip[locks_config;Configure the players or set the password to grant access to other players.] ]] @@ -56,7 +56,7 @@ function locks.get_config_button(x,y) end locks.authorize_button = [[ - image_button[%d,%d;1,1;locks_key16.png;locks_authorize;Autho- + image_button[%s,%s;1,1;locks_key16.png;locks_authorize;Autho- rize] tooltip[locks_authorize;Opens a password prompt to grant you access to this object.] ]] @@ -181,6 +181,7 @@ function locks:lock_init( pos, default_formspec ) meta:set_string("allowed_users",""); -- objects can be unlocked by passwords as well (if it is set) meta:set_string("password",""); + meta:mark_as_private("password") -- the last player who entered the right password (to save space this is not a list) meta:set_string("pw_user",""); -- this formspec is presented on right-click for every user @@ -228,6 +229,7 @@ function locks:set_lockdata( pos, data ) meta:set_string("owner", (data.owner or "")); meta:set_string("allowed_users",(data.allowed_users or "")); meta:set_string("password", (data.password or "")); + meta:mark_as_private("password") meta:set_string("pw_user", (data.pw_user or "")); meta:set_string("formspec", (data.formspec or "")); end @@ -598,6 +600,7 @@ function locks:lock_handle_input( pos, formname, fields, player ) meta:set_string( "password", help[2]); + meta:mark_as_private("password") -- reset the list of users who typed the right password meta:set_string("pw_users",""); diff --git a/maptools/.travis.yml b/maptools/.travis.yml new file mode 100644 index 0000000..1c4c0d8 --- /dev/null +++ b/maptools/.travis.yml @@ -0,0 +1,15 @@ +language: generic + +addons: + apt: + packages: + - luarocks + +install: + - pyenv global 3.6.3 + - pip3 install --user pre-commit + - luarocks install --local luacheck + +script: + - $HOME/.local/bin/pre-commit run --all-files + - $HOME/.luarocks/bin/luacheck . diff --git a/maptools/CHANGELOG.md b/maptools/CHANGELOG.md index 0830e62..6e022a4 100644 --- a/maptools/CHANGELOG.md +++ b/maptools/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed + +- Increased the range of the Admin Pickaxe from 12 to 20 nodes. +- Updated intllib support to avoid using deprecated functions. + ## 1.0.0 - 2017-02-19 - Initial versioned release. diff --git a/maptools/README.md b/maptools/README.md index 7a14122..9474ce5 100644 --- a/maptools/README.md +++ b/maptools/README.md @@ -12,15 +12,15 @@ world block sandbox game. To install Map Tools, clone this Git repository into your Minetest's `mods/` directory: -``` +```bash git clone https://github.com/minetest-mods/maptools.git ``` You can also [download a ZIP archive](https://github.com/minetest-mods/maptools/archive/master.zip) -of Map Tools. If you do so, you will need to extract the archive, then rename +of Map Tools. If you do so, you will need to extract the archive then rename the resulting folder from `maptools-master` to `maptools` – this is -**absolutely** necessary to do, else, it won't work! +**absolutely** required, as the mod won't work otherwise. ### Enable the mod @@ -43,16 +43,17 @@ This is the easiest way to enable Map Tools when playing in singleplayer This is the recommended way to enable the mod on a server without using a GUI. -1. Make sure Minetest is not currently running (else, it will overwrite +1. Make sure Minetest is not currently running (otherwise, it will overwrite the changes when exiting). 2. Open the world's `world.mt` file using a text editor. 3. Add the following line at the end of the file: -``` +```text load_mod_maptools = true ``` -If the line is already present in the file, then replace `false` with `true` on that line. +If the line is already present in the file, then replace `false` with `true` +on that line. 4. Save the file, then start a game on the world you enabled Map Tools on. 5. Map Tools should now be running on your world. diff --git a/maptools/craftitems.lua b/maptools/craftitems.lua index aa2330b..00f09f2 100644 --- a/maptools/craftitems.lua +++ b/maptools/craftitems.lua @@ -5,7 +5,7 @@ Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = maptools.intllib +local S = maptools.S maptools.creative = maptools.config["hide_from_creative_inventory"] diff --git a/maptools/default_nodes.lua b/maptools/default_nodes.lua index 89409f0..15ce925 100644 --- a/maptools/default_nodes.lua +++ b/maptools/default_nodes.lua @@ -5,7 +5,7 @@ Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = maptools.intllib +local S = maptools.S maptools.creative = maptools.config["hide_from_creative_inventory"] diff --git a/maptools/init.lua b/maptools/init.lua index a329f62..a7ae4a5 100644 --- a/maptools/init.lua +++ b/maptools/init.lua @@ -10,20 +10,11 @@ Licensed under the zlib license. See LICENSE.md for more information. maptools = {} -local S -if minetest.get_modpath("intllib") then - S = intllib.Getter() -else - S = function(s) return s end -end -maptools.intllib = S - local modpath = minetest.get_modpath("maptools") -maptools.drop_msg = function(itemstack, player) - local name = player:get_player_name() - minetest.chat_send_player(name, S("[maptools] tools/nodes do not drop!")) -end +local S, NS = dofile(modpath .. "/intllib.lua") +maptools.S = S +maptools.NS = NS dofile(modpath .. "/config.lua") dofile(modpath .. "/aliases.lua") @@ -32,6 +23,11 @@ dofile(modpath .. "/default_nodes.lua") dofile(modpath .. "/nodes.lua") dofile(modpath .. "/tools.lua") +maptools.drop_msg = function(itemstack, player) + local name = player:get_player_name() + minetest.chat_send_player(name, S("[maptools] tools/nodes do not drop!")) +end + if minetest.setting_getbool("log_mods") then minetest.log("action", S("[maptools] loaded.")) end diff --git a/maptools/intllib.lua b/maptools/intllib.lua new file mode 100644 index 0000000..c7af2c2 --- /dev/null +++ b/maptools/intllib.lua @@ -0,0 +1,44 @@ +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense <http://unlicense.org>. + +-- Get the latest version of this file at: +-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua + +local function format(str, ...) + local args = { ... } + local function repl(escape, open, num, close) + if escape == "" then + local replacement = tostring(args[tonumber(num)]) + if open == "" then + replacement = replacement..close + end + return replacement + else + return "@"..open..num..close + end + end + return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) +end + +local gettext, ngettext +if minetest.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + gettext, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + gettext = intllib.Getter() + end +end + +-- Fill in missing functions. + +gettext = gettext or function(msgid, ...) + return format(msgid, ...) +end + +ngettext = ngettext or function(msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext diff --git a/maptools/nodes.lua b/maptools/nodes.lua index 3a2ebf5..200107f 100644 --- a/maptools/nodes.lua +++ b/maptools/nodes.lua @@ -5,11 +5,11 @@ Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = maptools.intllib +local S = maptools.S maptools.creative = maptools.config["hide_from_creative_inventory"] --- Redefine cloud so that the admin pickaxe can mine it: +-- Redefine cloud so that the admin pickaxe can mine it minetest.register_node(":default:cloud", { description = S("Cloud"), tiles = {"default_cloud.png"}, @@ -20,7 +20,6 @@ minetest.register_node(":default:cloud", { }) -- Nodes --- ===== minetest.register_node("maptools:black", { description = S("Black"), @@ -239,29 +238,29 @@ minetest.register_node("maptools:playerclip_top", { }) for pusher_num=1,10,1 do -minetest.register_node("maptools:pusher_" .. pusher_num, { - description = S("Pusher (%s)"):format(pusher_num), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^default_apple.png", - drawtype = "nodebox", - tiles = {"invisible.png"}, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, - }, - drop = "", - groups = { - unbreakable = 1, - not_in_creative_inventory = maptools.creative, - fall_damage_add_percent = -100, - bouncy = pusher_num * 100, - }, - on_drop = maptools.drop_msg -}) + minetest.register_node("maptools:pusher_" .. pusher_num, { + description = S("Pusher (%s)"):format(pusher_num), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^default_apple.png", + drawtype = "nodebox", + tiles = {"invisible.png"}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, + }, + drop = "", + groups = { + unbreakable = 1, + not_in_creative_inventory = maptools.creative, + fall_damage_add_percent = -100, + bouncy = pusher_num * 100, + }, + on_drop = maptools.drop_msg + }) end minetest.register_node("maptools:lightbulb", { diff --git a/maptools/tools.lua b/maptools/tools.lua index 9e784ae..550ab6b 100644 --- a/maptools/tools.lua +++ b/maptools/tools.lua @@ -5,52 +5,41 @@ Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = maptools.intllib +local S = maptools.S maptools.creative = maptools.config["hide_from_creative_inventory"] +local pick_admin_toolcaps = { + full_punch_interval = 0.1, + max_drop_level = 3, + groupcaps = { + unbreakable = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + fleshy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + choppy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + bendy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + cracky = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + crumbly = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + snappy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + }, + damage_groups = {fleshy = 1000}, +} + minetest.register_tool("maptools:pick_admin", { description = S("Admin Pickaxe"), - range = 12, + range = 20, inventory_image = "maptools_adminpick.png", groups = {not_in_creative_inventory = maptools.creative}, - tool_capabilities = { - full_punch_interval = 0.1, - max_drop_level = 3, - groupcaps= { - unbreakable = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - fleshy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - choppy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - bendy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - snappy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - }, - damage_groups = {fleshy = 1000}, - }, - on_drop = maptools.drop_msg + tool_capabilities = pick_admin_toolcaps, + on_drop = maptools.drop_msg, }) minetest.register_tool("maptools:pick_admin_with_drops", { description = S("Admin Pickaxe with Drops"), - range = 12, + range = 20, inventory_image = "maptools_adminpick_with_drops.png", groups = {not_in_creative_inventory = maptools.creative}, - tool_capabilities = { - full_punch_interval = 0.35, - max_drop_level = 3, - groupcaps = { - unbreakable = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - fleshy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - choppy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - bendy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - snappy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - }, - damage_groups = {fleshy = 1000}, - }, - on_drop = maptools.drop_msg + tool_capabilities = pick_admin_toolcaps, + on_drop = maptools.drop_msg, }) minetest.register_on_punchnode(function(pos, node, puncher) @@ -66,9 +55,9 @@ minetest.register_on_punchnode(function(pos, node, puncher) " using an Admin Pickaxe." ) -- The node is removed directly, which means it even works - -- on non-empty containers and group-less nodes. + -- on non-empty containers and group-less nodes minetest.remove_node(pos) - -- Run node update actions like falling nodes. + -- Run node update actions like falling nodes minetest.check_for_falling(pos) end end) diff --git a/moreblocks/.travis.yml b/moreblocks/.travis.yml new file mode 100644 index 0000000..1c4c0d8 --- /dev/null +++ b/moreblocks/.travis.yml @@ -0,0 +1,15 @@ +language: generic + +addons: + apt: + packages: + - luarocks + +install: + - pyenv global 3.6.3 + - pip3 install --user pre-commit + - luarocks install --local luacheck + +script: + - $HOME/.local/bin/pre-commit run --all-files + - $HOME/.luarocks/bin/luacheck . diff --git a/moreblocks/CHANGELOG.md b/moreblocks/CHANGELOG.md index 0d949aa..aa9942c 100644 --- a/moreblocks/CHANGELOG.md +++ b/moreblocks/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed + +- Updated intllib support to avoid using deprecated functions. + ### Fixed - Node rotation now works correctly when placing Stairs+ nodes. @@ -32,12 +36,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed -- New craft for: +- New crafting recipes for: - Stone Tile - Circle Stone Bricks - Stairs+: - - Move definitions to `stairsplus.defs` table in a separate file - - Move recipe definitions to `stairsplus.register_recipes` function in a separate file + - Moved definitions to `stairsplus.defs` table into a separate file. + - Moved recipe definitions to `stairsplus.register_recipes` function + into a separate file. ## [1.1.0] - 2017-10-04 @@ -57,7 +62,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Straw - Tin Block - Wool (all colors) -- Other mods can now get a list of all the defined Stairs+ shapes +- Other mods can now get a list of all the defined Stairs+ shapes. ## 1.0.0 - 2017-02-19 diff --git a/moreblocks/README.md b/moreblocks/README.md index 739164b..4e58814 100644 --- a/moreblocks/README.md +++ b/moreblocks/README.md @@ -12,15 +12,15 @@ world block sandbox game. To install More Blocks, clone this Git repository into your Minetest's `mods/` directory: -``` +```bash git clone https://github.com/minetest-mods/moreblocks.git ``` You can also [download a ZIP archive](https://github.com/minetest-mods/moreblocks/archive/master.zip) -of More Blocks. If you do so, you will need to extract the archive, then rename +of More Blocks. If you do so, you will need to extract the archive then rename the resulting folder from `moreblocks-master` to `moreblocks` – this is -**absolutely** necessary to do, else, it won't work! +**absolutely** required, as the mod won't work otherwise. ### Enable the mod @@ -43,16 +43,17 @@ This is the easiest way to enable More Blocks when playing in singleplayer This is the recommended way to enable the mod on a server without using a GUI. -1. Make sure Minetest is not currently running (else, it will overwrite +1. Make sure Minetest is not currently running (otherwise, it will overwrite the changes when exiting). 2. Open the world's `world.mt` file using a text editor. 3. Add the following line at the end of the file: -``` +```text load_mod_moreblocks = true ``` -If the line is already present in the file, then replace `false` with `true` on that line. +If the line is already present in the file, then replace `false` with `true` +on that line. 4. Save the file, then start a game on the world you enabled More Blocks on. 5. More Blocks should now be running on your world. diff --git a/moreblocks/circular_saw.lua b/moreblocks/circular_saw.lua index 4d1a3d9..1dce479 100644 --- a/moreblocks/circular_saw.lua +++ b/moreblocks/circular_saw.lua @@ -5,7 +5,7 @@ Copyright © 2011-2019 Hugo Locurcio, Sokomine and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib +local S = moreblocks.S circular_saw = {} diff --git a/moreblocks/init.lua b/moreblocks/init.lua index ad5ad25..7627f7d 100644 --- a/moreblocks/init.lua +++ b/moreblocks/init.lua @@ -10,20 +10,12 @@ Licensed under the zlib license. See LICENSE.md for more information. moreblocks = {} -local S -if minetest.global_exists("intllib") then - if intllib.make_gettext_pair then - S = intllib.make_gettext_pair() - else - S = intllib.Getter() - end -else - S = function(s) return s end -end -moreblocks.intllib = S - local modpath = minetest.get_modpath("moreblocks") +local S, NS = dofile(modpath .. "/intllib.lua") +moreblocks.S = S +moreblocks.NS = NS + dofile(modpath .. "/config.lua") dofile(modpath .. "/circular_saw.lua") dofile(modpath .. "/stairsplus/init.lua") diff --git a/moreblocks/intllib.lua b/moreblocks/intllib.lua new file mode 100644 index 0000000..c7af2c2 --- /dev/null +++ b/moreblocks/intllib.lua @@ -0,0 +1,44 @@ +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense <http://unlicense.org>. + +-- Get the latest version of this file at: +-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua + +local function format(str, ...) + local args = { ... } + local function repl(escape, open, num, close) + if escape == "" then + local replacement = tostring(args[tonumber(num)]) + if open == "" then + replacement = replacement..close + end + return replacement + else + return "@"..open..num..close + end + end + return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) +end + +local gettext, ngettext +if minetest.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + gettext, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + gettext = intllib.Getter() + end +end + +-- Fill in missing functions. + +gettext = gettext or function(msgid, ...) + return format(msgid, ...) +end + +ngettext = ngettext or function(msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext diff --git a/moreblocks/nodes.lua b/moreblocks/nodes.lua index 5bcab6c..047f59e 100644 --- a/moreblocks/nodes.lua +++ b/moreblocks/nodes.lua @@ -5,7 +5,7 @@ Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib +local S = moreblocks.S local sound_dirt = default.node_sound_dirt_defaults() local sound_wood = default.node_sound_wood_defaults() diff --git a/moreblocks/ownership.lua b/moreblocks/ownership.lua index 34bcffa..20f0fe1 100644 --- a/moreblocks/ownership.lua +++ b/moreblocks/ownership.lua @@ -5,7 +5,7 @@ Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.gettext +local S = moreblocks.S function moreblocks.node_is_owned(pos, placer) local ownername = false diff --git a/moreblocks/stairsplus/common.lua b/moreblocks/stairsplus/common.lua index 6ec5101..7b86fad 100644 --- a/moreblocks/stairsplus/common.lua +++ b/moreblocks/stairsplus/common.lua @@ -5,7 +5,7 @@ Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib +local S = moreblocks.S stairsplus.register_single = function(category, alternate, info, modname, subname, recipeitem, fields) diff --git a/moreblocks/stairsplus/custom.lua b/moreblocks/stairsplus/custom.lua index ad67009..4004c6c 100644 --- a/moreblocks/stairsplus/custom.lua +++ b/moreblocks/stairsplus/custom.lua @@ -61,7 +61,8 @@ local subset = { } --]] -function register_custom_subset(subset, modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_custom_subset(subset, modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_custom_subset(subset, modname, subname, recipeitem, { groups = groups, tiles = images, diff --git a/moreblocks/stairsplus/init.lua b/moreblocks/stairsplus/init.lua index 0d99a14..a3f3399 100644 --- a/moreblocks/stairsplus/init.lua +++ b/moreblocks/stairsplus/init.lua @@ -58,7 +58,8 @@ function stairsplus:register_alias_force_all(modname_old, subname_old, modname_n self:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new) end -function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_all(modname, subname, recipeitem, { groups = groups, tiles = images, diff --git a/moreblocks/stairsplus/microblocks.lua b/moreblocks/stairsplus/microblocks.lua index a08ec7c..e477664 100644 --- a/moreblocks/stairsplus/microblocks.lua +++ b/moreblocks/stairsplus/microblocks.lua @@ -7,7 +7,8 @@ Licensed under the zlib license. See LICENSE.md for more information. -- Node will be called <modname>:micro_<subname> -function register_micro(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_micro(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_micro(modname, subname, recipeitem, { groups = groups, tiles = images, diff --git a/moreblocks/stairsplus/panels.lua b/moreblocks/stairsplus/panels.lua index c017af6..095c4c2 100644 --- a/moreblocks/stairsplus/panels.lua +++ b/moreblocks/stairsplus/panels.lua @@ -7,7 +7,8 @@ Licensed under the zlib license. See LICENSE.md for more information. -- Node will be called <modname>:panel_<subname> -function register_panel(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_panel(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_panel(modname, subname, recipeitem, { groups = groups, tiles = images, diff --git a/moreblocks/stairsplus/slabs.lua b/moreblocks/stairsplus/slabs.lua index c41b2e3..ee9ce89 100644 --- a/moreblocks/stairsplus/slabs.lua +++ b/moreblocks/stairsplus/slabs.lua @@ -5,11 +5,10 @@ Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - -- Node will be called <modname>:slab_<subname> -function register_slab(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_slab(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_slab(modname, subname, recipeitem, { groups = groups, tiles = images, @@ -36,7 +35,6 @@ end function stairsplus:register_slab(modname, subname, recipeitem, fields) local defs = table.copy(stairsplus.defs["slab"]) - local desc_base = S("%s Slab"):format(fields.description) for alternate, shape in pairs(defs) do stairsplus.register_single("slab", alternate, shape, modname, subname, recipeitem, fields) end diff --git a/moreblocks/stairsplus/slopes.lua b/moreblocks/stairsplus/slopes.lua index 0652a51..6e516d5 100644 --- a/moreblocks/stairsplus/slopes.lua +++ b/moreblocks/stairsplus/slopes.lua @@ -7,7 +7,8 @@ Licensed under the zlib license. See LICENSE.md for more information. -- Node will be called <modname>:slope_<subname> -function register_slope(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_slope(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_slope(modname, subname, recipeitem, { groups = groups, tiles = images, diff --git a/moreblocks/stairsplus/stairs.lua b/moreblocks/stairsplus/stairs.lua index c72b268..8c77498 100644 --- a/moreblocks/stairsplus/stairs.lua +++ b/moreblocks/stairsplus/stairs.lua @@ -7,7 +7,8 @@ Licensed under the zlib license. See LICENSE.md for more information. -- Node will be called <modname>:stair_<subname> -function register_stair(modname, subname, recipeitem, groups, images, description, drop, light) +-- luacheck: no unused +local function register_stair(modname, subname, recipeitem, groups, images, description, drop, light) stairsplus:register_stair(modname, subname, recipeitem, { groups = groups, tiles = images, diff --git a/moreores/.travis.yml b/moreores/.travis.yml new file mode 100644 index 0000000..1c4c0d8 --- /dev/null +++ b/moreores/.travis.yml @@ -0,0 +1,15 @@ +language: generic + +addons: + apt: + packages: + - luarocks + +install: + - pyenv global 3.6.3 + - pip3 install --user pre-commit + - luarocks install --local luacheck + +script: + - $HOME/.local/bin/pre-commit run --all-files + - $HOME/.luarocks/bin/luacheck . diff --git a/moreores/CHANGELOG.md b/moreores/CHANGELOG.md index 6ec2e51..cd7bd33 100644 --- a/moreores/CHANGELOG.md +++ b/moreores/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Ores are now slower to mine and cannot be mined using wooden tools anymore. +- Updated intllib support to avoid using deprecated functions. ### Deprecated diff --git a/moreores/README.md b/moreores/README.md index 5b4877e..601001b 100644 --- a/moreores/README.md +++ b/moreores/README.md @@ -12,15 +12,15 @@ world block sandbox game. To install More Ores, clone this Git repository into your Minetest's `mods/` directory: -``` +```bash git clone https://github.com/minetest-mods/moreores.git ``` You can also [download a ZIP archive](https://github.com/minetest-mods/moreores/archive/master.zip) -of More Ores. If you do so, you will need to extract the archive, then rename +of More Ores. If you do so, you will need to extract the archive then rename the resulting folder from `moreores-master` to `moreores` – this is -**absolutely** necessary to do, else, it won't work! +**absolutely** required, as the mod won't work otherwise. ### Enable the mod @@ -43,16 +43,17 @@ This is the easiest way to enable More Ores when playing in singleplayer This is the recommended way to enable the mod on a server without using a GUI. -1. Make sure Minetest is not currently running (else, it will overwrite +1. Make sure Minetest is not currently running (otherwise, it will overwrite the changes when exiting). 2. Open the world's `world.mt` file using a text editor. 3. Add the following line at the end of the file: -``` +```text load_mod_moreores = true ``` -If the line is already present in the file, then replace `false` with `true` on that line. +If the line is already present in the file, then replace `false` with `true` +on that line. 4. Save the file, then start a game on the world you enabled More Ores on. 5. More Ores should now be running on your world. diff --git a/moreores/init.lua b/moreores/init.lua index 08bc0a6..e389778 100644 --- a/moreores/init.lua +++ b/moreores/init.lua @@ -10,15 +10,12 @@ Licensed under the zlib license. See LICENSE.md for more information. moreores = {} -local S -if minetest.get_modpath("intllib") then - S = intllib.Getter() -else - S = function(s) return s end -end - local modpath = minetest.get_modpath("moreores") +local S, NS = dofile(modpath .. "/intllib.lua") +moreores.S = S +moreores.NS = NS + dofile(modpath .. "/_config.txt") -- `mg` mapgen support diff --git a/moreores/intllib.lua b/moreores/intllib.lua new file mode 100644 index 0000000..c7af2c2 --- /dev/null +++ b/moreores/intllib.lua @@ -0,0 +1,44 @@ +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense <http://unlicense.org>. + +-- Get the latest version of this file at: +-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua + +local function format(str, ...) + local args = { ... } + local function repl(escape, open, num, close) + if escape == "" then + local replacement = tostring(args[tonumber(num)]) + if open == "" then + replacement = replacement..close + end + return replacement + else + return "@"..open..num..close + end + end + return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) +end + +local gettext, ngettext +if minetest.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + gettext, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + gettext = intllib.Getter() + end +end + +-- Fill in missing functions. + +gettext = gettext or function(msgid, ...) + return format(msgid, ...) +end + +ngettext = ngettext or function(msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua index b6f9c14..1671c4e 100644 --- a/technic/machines/HV/quarry.lua +++ b/technic/machines/HV/quarry.lua @@ -129,7 +129,7 @@ local function quarry_run(pos, node) vector.multiply(qdir, -radius)) local owner = meta:get_string("owner") local nd = meta:get_int("dug") - while nd ~= diameter*diameter * (quarry_dig_above_nodes+1+quarry_max_depth) do + while nd < diameter*diameter * (quarry_dig_above_nodes+1+quarry_max_depth) do local ry = math.floor(nd / (diameter*diameter)) local ndl = nd % (diameter*diameter) if ry % 2 == 1 then diff --git a/technic/tools/chainsaw.lua b/technic/tools/chainsaw.lua index 8245fd6..4b9ccfd 100644 --- a/technic/tools/chainsaw.lua +++ b/technic/tools/chainsaw.lua @@ -51,6 +51,7 @@ if minetest.get_modpath("moretrees") then timber_nodenames["moretrees:spruce_trunk"] = true timber_nodenames["moretrees:willow_trunk"] = true timber_nodenames["moretrees:jungletree_trunk"] = true + timber_nodenames["moretrees:poplar_trunk"] = true if chainsaw_leaves then timber_nodenames["moretrees:acacia_leaves"] = true @@ -75,6 +76,7 @@ if minetest.get_modpath("moretrees") then timber_nodenames["moretrees:pine_cone"] = true timber_nodenames["moretrees:fir_cone"] = true timber_nodenames["moretrees:apple_blossoms"] = true + timber_nodenames["moretrees:poplar_leaves"] = true end end diff --git a/travelnet/config.lua b/travelnet/config.lua index 519e66d..83115de 100644 --- a/travelnet/config.lua +++ b/travelnet/config.lua @@ -48,6 +48,7 @@ travelnet.travelnet_inventory_image = "travelnet_inv.png" travelnet.elevator_inventory_image = "travelnet_elevator_inv.png" if( minetest.registered_nodes["mcl_core:wood"]) then + local w_texture = "default_wood.png^[transformR90"; -- "mcl_doors_door_spruce_lower.png"; travelnet.travelnet_recipe = { {"mcl_stairs:slab_wood", "mcl_stairs:slab_wood", "mcl_stairs:slab_wood",}, {"mesecons_torch:mesecon_torch_on", "mcl_chests:chest", "mesecons_torch:mesecon_torch_on"}, @@ -65,11 +66,11 @@ if( minetest.registered_nodes["mcl_core:wood"]) then -- {"mcl_core:iron_ingot", "mcl_core:glass", "mcl_core:iron_ingot", } } travelnet.tiles_travelnet = { - "default_wood.png^[transformR90", -- backward view - "default_wood.png^[transformR90", -- front view - "default_wood.png^[transformR90", -- sides :) - "default_wood.png^[transformR90", -- view from top - "default_wood.png^[transformR90", -- view from bottom + w_texture, -- backward view + w_texture, -- front view + w_texture, -- sides :) + w_texture, -- view from top + w_texture, -- view from bottom } travelnet.tiles_elevator = { "mcl_core_planks_big_oak.png^[transformR90", -- front @@ -118,3 +119,5 @@ travelnet.allow_travel = function( player_name, owner_name, network_name, statio return true; end + +travelnet.travelnet_sound_enabled = true diff --git a/travelnet/etc/travelnet_bell.mmpz b/travelnet/etc/travelnet_bell.mmpz Binary files differnew file mode 100644 index 0000000..161be57 --- /dev/null +++ b/travelnet/etc/travelnet_bell.mmpz diff --git a/travelnet/etc/travelnet_bell.xml b/travelnet/etc/travelnet_bell.xml new file mode 100644 index 0000000..e62bc89 --- /dev/null +++ b/travelnet/etc/travelnet_bell.xml @@ -0,0 +1,7 @@ +<tags> + <tag name="Software" value="LMMS (libsndfile-1.0.26pre5)"/> + <tag name="YEAR" value="2017-05-25"/> + <tag name="TITLE" value="travelnet bell"/> + <tag name="COMMENTS" value="CC-BY-SA 3.0 https://github.com/expertmm/travelnet"/> + <tag name="ARTIST" value="expertmm"/> +</tags> diff --git a/travelnet/etc/travelnet_travel.mmpz b/travelnet/etc/travelnet_travel.mmpz Binary files differnew file mode 100644 index 0000000..a67a7df --- /dev/null +++ b/travelnet/etc/travelnet_travel.mmpz diff --git a/travelnet/etc/travelnet_travel.xml b/travelnet/etc/travelnet_travel.xml new file mode 100644 index 0000000..d9ebb6e --- /dev/null +++ b/travelnet/etc/travelnet_travel.xml @@ -0,0 +1,7 @@ +<tags> + <tag name="Software" value="LMMS (libsndfile-1.0.26pre5)"/> + <tag name="YEAR" value="2017-05-25"/> + <tag name="TITLE" value="travelnet travel"/> + <tag name="COMMENTS" value="CC-BY-SA 3.0 https://github.com/expertmm/travelnet"/> + <tag name="ARTIST" value="expertmm"/> +</tags> diff --git a/travelnet/init.lua b/travelnet/init.lua index 7827a70..b1ceb6b 100644 --- a/travelnet/init.lua +++ b/travelnet/init.lua @@ -1,5 +1,5 @@ - + --[[ Teleporter networks that allow players to choose a destination out of a list Copyright (C) 2013 Sokomine @@ -17,11 +17,17 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. - Version: 2.2 (with optional abm for self-healing) - + Version: 2.3 (click button to dig) + Please configure this mod in config.lua Changelog: + 10.03.19 - Added the extra config buttons for locked_travelnet mod. + 09.03.19 - Several PRs merged (sound added, locale changed etc.) + Version bumped to 2.3 + 26.02.19 - Removing a travelnet can now be done by clicking on a button (no need to + wield a diamond pick anymore) + 26.02.19 - Added compatibility with MineClone2 22.09.18 - Move up/move down no longer close the formspec. 22.09.18 - If in creative mode, wield a diamond pick to dig the station. This avoids conflicts with too fast punches. @@ -78,57 +84,65 @@ - target list is now centered if there are less than 9 targets --]] +-- Required to save the travelnet data properly in all cases +if not minetest.safe_file_write then + error("[Mod travelnet] Your Minetest version is no longer supported. (version < 0.4.17)") +end travelnet = {}; travelnet.targets = {}; +travelnet.path = minetest.get_modpath(minetest.get_current_modname()) --- Boilerplate to support localized strings if intllib mod is installed. -if minetest.get_modpath( "intllib" ) and intllib then - travelnet.S = intllib.Getter() -else - travelnet.S = function(s) return s end -end -local S = travelnet.S; +-- Intllib +local S = dofile(travelnet.path .. "/intllib.lua") +travelnet.S = S + minetest.register_privilege("travelnet_attach", { description = S("allows to attach travelnet boxes to travelnets of other players"), give_to_singleplayer = false}); minetest.register_privilege("travelnet_remove", { description = S("allows to dig travelnet boxes which belog to nets of other players"), give_to_singleplayer = false}); -- read the configuration -dofile(minetest.get_modpath("travelnet").."/config.lua"); -- the normal, default travelnet - +dofile(travelnet.path.."/config.lua"); -- the normal, default travelnet +travelnet.mod_data_path = minetest.get_worldpath().."/mod_travelnet.data" -- TODO: save and restore ought to be library functions and not implemented in each individual mod! -- called whenever a station is added or removed travelnet.save_data = function() - + local data = minetest.serialize( travelnet.targets ); - local path = minetest.get_worldpath().."/mod_travelnet.data"; - local file = io.open( path, "w" ); - if( file ) then - file:write( data ); - file:close(); - else - print(S("[Mod travelnet] Error: Savefile '%s' could not be written."):format(tostring(path))); + local success = minetest.safe_file_write( travelnet.mod_data_path, data ); + if( not success ) then + print(S("[Mod travelnet] Error: Savefile '%s' could not be written.") + :format(travelnet.mod_data_path)); end end travelnet.restore_data = function() - - local path = minetest.get_worldpath().."/mod_travelnet.data"; - local file = io.open( path, "r" ); - if( file ) then - local data = file:read("*all"); - travelnet.targets = minetest.deserialize( data ); - file:close(); - else - print(S("[Mod travelnet] Error: Savefile '%s' not found."):format(tostring(path))); + local file = io.open( travelnet.mod_data_path, "r" ); + if( not file ) then + print(S("[Mod travelnet] Error: Savefile '%s' not found.") + :format(travelnet.mod_data_path)); + return; end + + local data = file:read("*all"); + travelnet.targets = minetest.deserialize( data ); + + if( not travelnet.targets ) then + local backup_file = travelnet.mod_data_path..".bak" + print(S("[Mod travelnet] Error: Savefile '%s' is damaged. Saved the backup as '%s'.") + :format(travelnet.mod_data_path, backup_file)); + + minetest.safe_file_write( backup_file, data ); + travelnet.targets = {}; + end + file:close(); end @@ -191,6 +205,9 @@ end travelnet.form_input_handler = function( player, formname, fields) if(formname == "travelnet:show" and fields and fields.pos2str) then local pos = minetest.string_to_pos( fields.pos2str ); + if( locks and (fields.locks_config or fields.locks_authorize)) then + return locks:lock_handle_input( pos, formname, fields, player ) + end -- back button leads back to the main menu if( fields.back and fields.back ~= "" ) then return travelnet.show_current_formspec( pos, @@ -231,7 +248,7 @@ travelnet.reset_formspec = function( meta ) "field[0.3,2.8;9,0.9;station_network;"..S("Assign to Network:")..";".. minetest.formspec_escape(station_network or "").."]".. - "label[0.3,3.1;"..S("You can have more than one network. If unsure, use \"%s\""):format(tostring(station_network)).."\".]".. + "label[0.3,3.1;"..S("You can have more than one network. If unsure, use \"%s\""):format(tostring(station_network))..".]".. "field[0.3,4.4;9,0.9;owner;"..S("Owned by:")..";]".. "label[0.3,4.7;"..S("Unless you know what you are doing, leave this empty.").."]".. "button_exit[1.3,5.3;1.7,0.7;station_help_setup;"..S("Help").."]".. @@ -248,7 +265,7 @@ travelnet.update_formspec = function( pos, puncher_name, fields ) if( this_node ~= nil and this_node.name == 'travelnet:elevator' ) then is_elevator = true; - end + end if( not( meta )) then return; @@ -258,7 +275,7 @@ travelnet.update_formspec = function( pos, puncher_name, fields ) local station_name = meta:get_string( "station_name" ); local station_network = meta:get_string( "station_network" ); - if( not( owner_name ) + if( not( owner_name ) or not( station_name ) or station_network == '' or not( station_network )) then @@ -288,7 +305,7 @@ travelnet.update_formspec = function( pos, puncher_name, fields ) if( not( travelnet.targets[ owner_name ] )) then travelnet.targets[ owner_name ] = {}; end - + -- first station on this network? if( not( travelnet.targets[ owner_name ][ station_network ] )) then travelnet.targets[ owner_name ][ station_network ] = {}; @@ -312,8 +329,10 @@ travelnet.update_formspec = function( pos, puncher_name, fields ) -- add name of station + network + owner + update-button local zusatzstr = ""; local trheight = "10"; - if( this_node and this_node.name=="locked_travelnet:travelnet" ) then - zusatzstr = "field[0.3,11;6,0.7;locks_sent_lock_command;"..S("Locked travelnet. Type /help for help:")..";]"; + if( this_node and this_node.name=="locked_travelnet:travelnet" and locks) then + zusatzstr = "field[0.3,11;6,0.7;locks_sent_lock_command;"..S("Locked travelnet. Type /help for help:")..";]".. + locks.get_authorize_button(10,"10.5").. + locks.get_config_button(11,"10.5") trheight = "11.5"; end local formspec = "size[12,"..trheight.."]".. @@ -331,15 +350,15 @@ travelnet.update_formspec = function( pos, puncher_name, fields ) -- collect all station names in a table local stations = {}; - + for k,v in pairs( travelnet.targets[ owner_name ][ station_network ] ) do table.insert( stations, k ); end -- minetest.chat_send_player(puncher_name, "stations: "..minetest.serialize( stations )); - + local ground_level = 1; if( is_elevator ) then - table.sort( stations, function(a,b) return travelnet.targets[ owner_name ][ station_network ][ a ].pos.y > + table.sort( stations, function(a,b) return travelnet.targets[ owner_name ][ station_network ][ a ].pos.y > travelnet.targets[ owner_name ][ station_network ][ b ].pos.y end); -- find ground level local vgl_timestamp = 999999999999; @@ -348,7 +367,7 @@ travelnet.update_formspec = function( pos, puncher_name, fields ) travelnet.targets[ owner_name ][ station_network ][ k ].timestamp = os.time(); end if( travelnet.targets[ owner_name ][ station_network ][ k ].timestamp < vgl_timestamp ) then - vgl_timestamp = travelnet.targets[ owner_name ][ station_network ][ k ].timestamp; + vgl_timestamp = travelnet.targets[ owner_name ][ station_network ][ k ].timestamp; ground_level = index; end end @@ -359,10 +378,10 @@ travelnet.update_formspec = function( pos, puncher_name, fields ) travelnet.targets[ owner_name ][ station_network ][ k ].nr = tostring( ground_level - index ); end end - - else + + else -- sort the table according to the timestamp (=time the station was configured) - table.sort( stations, function(a,b) return travelnet.targets[ owner_name ][ station_network ][ a ].timestamp < + table.sort( stations, function(a,b) return travelnet.targets[ owner_name ][ station_network ][ a ].timestamp < travelnet.targets[ owner_name ][ station_network ][ b ].timestamp end); end @@ -400,9 +419,9 @@ travelnet.update_formspec = function( pos, puncher_name, fields ) else -- swap the actual data by which the stations are sorted local old_timestamp = travelnet.targets[ owner_name ][ station_network ][ stations[swap_with_pos]].timestamp; - travelnet.targets[ owner_name ][ station_network ][ stations[swap_with_pos]].timestamp = + travelnet.targets[ owner_name ][ station_network ][ stations[swap_with_pos]].timestamp = travelnet.targets[ owner_name ][ station_network ][ stations[current_pos ]].timestamp; - travelnet.targets[ owner_name ][ station_network ][ stations[current_pos ]].timestamp = + travelnet.targets[ owner_name ][ station_network ][ stations[current_pos ]].timestamp = old_timestamp; -- for elevators, only the "G"(round) marking is moved; no point in swapping stations @@ -423,7 +442,7 @@ travelnet.update_formspec = function( pos, puncher_name, fields ) x = 4; end - for index,k in ipairs( stations ) do + for index,k in ipairs( stations ) do -- check if there is an elevator door in front that needs to be opened local open_door_cmd = false; @@ -431,7 +450,7 @@ travelnet.update_formspec = function( pos, puncher_name, fields ) open_door_cmd = true; end - if( k ~= station_name or open_door_cmd) then + if( k ~= station_name or open_door_cmd) then i = i+1; -- new column @@ -489,7 +508,7 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m if( this_node.name == 'travelnet:elevator' ) then -- owner_name = '*'; -- the owner name is not relevant here is_elevator = true; - network_name = tostring( pos.x )..','..tostring( pos.z ); + network_name = tostring( pos.x )..','..tostring( pos.z ); if( not( station_name ) or station_name == '' ) then station_name = S('at %s m'):format(tostring( pos.y )); end @@ -531,7 +550,7 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m if( not( travelnet.targets[ owner_name ] )) then travelnet.targets[ owner_name ] = {}; end - + -- first station on this network? if( not( travelnet.targets[ owner_name ][ network_name ] )) then travelnet.targets[ owner_name ][ network_name ] = {}; @@ -558,7 +577,7 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m "Please choose a diffrent/new network name."):format(travelnet.MAX_STATIONS_PER_NETWORK)); return; end - + -- add this station travelnet.targets[ owner_name ][ network_name ][ station_name ] = {pos=pos, timestamp=os.time() }; @@ -574,7 +593,7 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m meta:set_string( "owner", owner_name ); meta:set_int( "timestamp", travelnet.targets[ owner_name ][ network_name ][ station_name ].timestamp); - meta:set_string("formspec", + meta:set_string("formspec", "size[12,10]".. "field[0.3,0.6;6,0.7;station_name;"..S("Station:")..";".. minetest.formspec_escape(meta:get_string("station_name")).."]".. "field[0.3,3.6;6,0.7;station_network;"..S("Network:")..";"..minetest.formspec_escape(meta:get_string("station_network")).."]" ); @@ -592,7 +611,11 @@ end -- allow doors to open travelnet.open_close_door = function( pos, player, mode ) - local this_node = minetest.get_node( pos ); + local this_node = minetest.get_node_or_nil( pos ); + -- give up if the area is *still* not loaded + if( this_node == nil ) then + return + end local pos2 = {x=pos.x,y=pos.y,z=pos.z}; if( this_node.param2 == 0 ) then pos2 = {x=pos.x,y=pos.y,z=(pos.z-1)}; @@ -609,20 +632,22 @@ travelnet.open_close_door = function( pos, player, mode ) -- do not close the elevator door if it is already closed if( mode==1 and ( string.sub( door_node.name, -7 ) == '_closed' -- handle doors that change their facedir - or ( door_node.param2 == this_node.param2 + or ( door_node.param2 == ((this_node.param2 + 2)%4) and door_node.name ~= 'travelnet:elevator_door_glass_open' + and door_node.name ~= 'travelnet:elevator_door_tin_open' and door_node.name ~= 'travelnet:elevator_door_steel_open'))) then return; end -- do not open the doors if they are already open (works only on elevator-doors; not on doors in general) if( mode==2 and ( string.sub( door_node.name, -5 ) == '_open' -- handle doors that change their facedir - or ( door_node.param2 ~= this_node.param2 + or ( door_node.param2 ~= ((this_node.param2 + 2)%4) and door_node.name ~= 'travelnet:elevator_door_glass_closed' + and door_node.name ~= 'travelnet:elevator_door_tin_closed' and door_node.name ~= 'travelnet:elevator_door_steel_closed'))) then return; end - + if( mode==2 ) then minetest.after( 1, minetest.registered_nodes[ door_node.name ].on_rightclick, pos2, door_node, player ); else @@ -645,6 +670,11 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) return; end + -- show special locks buttons if needed + if( locks and (fields.locks_config or fields.locks_authorize)) then + return locks:lock_handle_input( pos, formname, fields, player ) + end + -- show help text if( fields and fields.station_help_setup and fields.station_help_setup ~= "") then -- simulate right-click @@ -667,6 +697,8 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) description = "travelnet box" elseif( node and node.name and node.name == "travelnet:elevator") then description = "elevator" + elseif( node and node.name and node.name == "locked_travelnet:travelnet") then + description = "locked travelnet" else minetest.chat_send_player(name, "Error: Unkown node."); return @@ -704,7 +736,7 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) -- if the box has not been configured yet if( meta:get_string("station_network")=="" ) then - travelnet.add_target( fields.station_name, fields.station_network, pos, name, meta, fields.owner_name ); + travelnet.add_target( fields.station_name, fields.station_network, pos, name, meta, fields.owner ); return; end @@ -730,8 +762,8 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) local station_name = meta:get_string( "station_name" ); local station_network = meta:get_string( "station_network" ); - if( not( owner_name ) - or not( station_name ) + if( not( owner_name ) + or not( station_name ) or not( station_network ) or not( travelnet.targets[ owner_name ] ) or not( travelnet.targets[ owner_name ][ station_network ] )) then @@ -766,7 +798,7 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) end local this_node = minetest.get_node( pos ); - if( this_node ~= nil and this_node.name == 'travelnet:elevator' ) then + if( this_node ~= nil and this_node.name == 'travelnet:elevator' ) then for k,v in pairs( travelnet.targets[ owner_name ][ station_network ] ) do if( travelnet.targets[ owner_name ][ station_network ][ k ].nr --..' ('..tostring( travelnet.targets[ owner_name ][ station_network ][ k ].pos.y )..'m)' == fields.target) then @@ -794,9 +826,13 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) if( travelnet.travelnet_sound_enabled ) then - minetest.sound_play("128590_7037-lq.mp3", {pos = pos, gain = 1.0, max_hear_distance = 10,}) + if ( this_node.name == 'travelnet:elevator' ) then + minetest.sound_play("travelnet_bell", {pos = pos, gain = 0.75, max_hear_distance = 10,}); + else + minetest.sound_play("travelnet_travel", {pos = pos, gain = 0.75, max_hear_distance = 10,}); + end end - if( travelnet.travelnet_effect_enabled ) then + if( travelnet.travelnet_effect_enabled ) then minetest.add_entity( {x=pos.x,y=pos.y+0.5,z=pos.z}, "travelnet:effect"); -- it self-destructs after 20 turns end @@ -807,16 +843,13 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) local target_pos = travelnet.targets[ owner_name ][ station_network ][ fields.target ].pos; player:moveto( target_pos, false); - if( travelnet.travelnet_sound_enabled ) then - minetest.sound_play("travelnet_travel.wav", {pos = target_pos, gain = 1.0, max_hear_distance = 10,}) - end if( travelnet.travelnet_effect_enabled ) then minetest.add_entity( {x=target_pos.x,y=target_pos.y+0.5,z=target_pos.z}, "travelnet:effect"); -- it self-destructs after 20 turns end -- check if the box has at the other end has been removed. - local node2 = minetest.get_node( target_pos ); + local node2 = minetest.get_node_or_nil( target_pos ); if( node2 ~= nil and node2.name ~= 'ignore' and node2.name ~= 'travelnet:travelnet' and node2.name ~= 'travelnet:elevator' and node2.name ~= "locked_travelnet:travelnet" and node2.name ~= "travelnet:travelnet_private") then -- provide information necessary to identify the removed box @@ -828,9 +861,32 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) -- send the player back as there's no receiving travelnet player:moveto( pos, false ); - -- do this only on servers where the function exists - elseif( player.set_look_horizontal ) then + else + travelnet.rotate_player( target_pos, player, 0 ) + end +end +travelnet.rotate_player = function( target_pos, player, tries ) + -- try later when the box is loaded + local node2 = minetest.get_node_or_nil( target_pos ); + if( node2 == nil ) then + if( tries < 30 ) then + minetest.after( 0, travelnet.rotate_player, target_pos, player, tries+1 ) + end + return + end + + -- play sound at the target position as well + if( travelnet.travelnet_sound_enabled ) then + if ( node2.name == 'travelnet:elevator' ) then + minetest.sound_play("travelnet_bell", {pos = target_pos, gain = 0.75, max_hear_distance = 10,}); + else + minetest.sound_play("travelnet_travel", {pos = target_pos, gain = 0.75, max_hear_distance = 10,}); + end + end + + -- do this only on servers where the function exists + if( player.set_look_horizontal ) then -- rotate the player so that he/she can walk straight out of the box local yaw = 0; local param2 = node2.param2; @@ -843,7 +899,7 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) elseif( param2==3 ) then yaw = 270; end - + player:set_look_horizontal( math.rad( yaw )); player:set_look_vertical( math.rad( 0 )); end @@ -865,19 +921,19 @@ travelnet.remove_box = function( pos, oldnode, oldmetadata, digger ) local station_network = oldmetadata.fields[ "station_network" ]; -- station is not known? then just remove it - if( not( owner_name ) - or not( station_name ) - or not( station_network ) + if( not( owner_name ) + or not( station_name ) + or not( station_network ) or not( travelnet.targets[ owner_name ] ) or not( travelnet.targets[ owner_name ][ station_network ] )) then - + minetest.chat_send_player( digger:get_player_name(), S("Error")..": ".. S("Could not find the station that is to be removed.")); return; end travelnet.targets[ owner_name ][ station_network ][ station_name ] = nil; - + -- inform the owner minetest.chat_send_player( owner_name, S("Station '%s'"):format(station_name ).." ".. S("has been REMOVED from the network '%s'."):format(station_network)); @@ -971,17 +1027,17 @@ end if( travelnet.travelnet_enabled ) then - dofile(minetest.get_modpath("travelnet").."/travelnet.lua"); -- the travelnet node definition + dofile(travelnet.path.."/travelnet.lua"); -- the travelnet node definition end if( travelnet.elevator_enabled ) then - dofile(minetest.get_modpath("travelnet").."/elevator.lua"); -- allows up/down transfers only + dofile(travelnet.path.."/elevator.lua"); -- allows up/down transfers only end if( travelnet.doors_enabled ) then - dofile(minetest.get_modpath("travelnet").."/doors.lua"); -- doors that open and close automaticly when the travelnet or elevator is used + dofile(travelnet.path.."/doors.lua"); -- doors that open and close automaticly when the travelnet or elevator is used end if( travelnet.abm_enabled ) then - dofile(minetest.get_modpath("travelnet").."/restore_network_via_abm.lua"); -- restore travelnet data when players pass by broken networks + dofile(travelnet.path.."/restore_network_via_abm.lua"); -- restore travelnet data when players pass by broken networks end -- upon server start, read the savefile diff --git a/travelnet/intllib.lua b/travelnet/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/travelnet/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense <http://unlicense.org>. + +-- Get the latest version of this file at: +-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua + +local function format(str, ...) + local args = { ... } + local function repl(escape, open, num, close) + if escape == "" then + local replacement = tostring(args[tonumber(num)]) + if open == "" then + replacement = replacement..close + end + return replacement + else + return "@"..open..num..close + end + end + return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) +end + +local gettext, ngettext +if minetest.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + gettext, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + gettext = intllib.Getter() + end +end + +-- Fill in missing functions. + +gettext = gettext or function(msgid, ...) + return format(msgid, ...) +end + +ngettext = ngettext or function(msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext diff --git a/travelnet/locale/de.po b/travelnet/locale/de.po new file mode 100644 index 0000000..f39db71 --- /dev/null +++ b/travelnet/locale/de.po @@ -0,0 +1,326 @@ +# German translation for the travelnet mod. +# Copyright (C) 2018 Sokomine +# This file is distributed under the same license as the travelnet package. +# Sokomine, 2017 +# CodeXP <codexp@gmx.net>, 2018. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-24 01:31+0100\n" +"PO-Revision-Date: \n" +"Last-Translator: CodeXP <codexp@gmx.net>\n" +"Language-Team: \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: init.lua +msgid "allows to attach travelnet boxes to travelnets of other players" +msgstr "erlaubt es, Stationen zu den Reisenetzwerken anderer Spieler hinzuzufügen" + +#: init.lua +msgid "allows to dig travelnet boxes which belog to nets of other players" +msgstr "erlaubt es, die Reisenetz-Stationen anderer Spieler zu entfernen" + +#: init.lua +msgid "[Mod travelnet] Error: Savefile '%s' could not be written." +msgstr "[Mod travelnet] Fehler: Sicherungsdatei '%s' konnte nicht geschrieben werden." + +#: init.lua +msgid "[Mod travelnet] Error: Savefile '%s' not found." +msgstr "[Mod travelnet] Fehler: Sicherungsdatei '%s' nicht gefunden." + +#: init.lua +msgid "Back" +msgstr "Zurück" + +#: init.lua +msgid "Exit" +msgstr "Ende" + +#: init.lua +msgid "Travelnet-box (unconfigured)" +msgstr "Reisenetz-Box (nicht konfiguriert)" + +#: init.lua +msgid "Configure this travelnet station" +msgstr "Konfiguration dieser Reisenetz-Box" + +#: init.lua +msgid "Name of this station" +msgstr "Name dieser Reisenetz-Box" + +#: init.lua +msgid "How do you call this place here? Example: \"my first house\", \"mine\", \"shop\"..." +msgstr "Wie willst du diesen Ort nennen? Beispiel: \"mein erstes Haus\", \"Mine\", \"Laden\"..." + +#: init.lua +msgid "Assign to Network:" +msgstr "Station dem folgendem Netzwerk zuweisen:" + +#: init.lua +msgid "You can have more than one network. If unsure, use \"%s\"" +msgstr "Du kannst mehrere Netzwerke anlegen. Falls du nicht weißt, was du tun sollst, wähle \"%s\"" + +#: init.lua +msgid "Owned by:" +msgstr "Besitzer:" + +#: init.lua +msgid "Unless you know what you are doing, leave this empty." +msgstr "Wenn du nicht weißt, wozu dieses Feld dient, laß es leer." + +#: init.lua +msgid "Help" +msgstr "Hilfe" + +#: init.lua +msgid "Save" +msgstr "Speichern" + +#: init.lua +msgid "Update failed! Resetting this box on the travelnet." +msgstr "Aktualisierung gescheitert. Konfiguration der Reisenetz-Box wird zurückgesetzt." + +#: init.lua +msgid "Station '%s'" +msgstr "Station '%s'" + +#: init.lua +msgid "has been reattached to the network '%s'." +msgstr "wurde dem Netzwerk '%s' wieder hinzugefügt." + +#: init.lua +msgid "Locked travelnet. Type /help for help:" +msgstr "Abgeschlossene Reisenetz-Box. Tippe /help für Hilfe:" + +#: init.lua +msgid "Punch box to update target list." +msgstr "Reisenetz-Box mit Linksklick aktualisieren." + +#: init.lua +msgid "Travelnet-Box" +msgstr "Reisenetz-Box" + +#: init.lua +msgid "Name of this station:" +msgstr "Name dieser Station:" + +#: init.lua +msgid "Assigned to Network:" +msgstr "Zugehöriges Netzwerk:" + +#: init.lua +msgid "Click on target to travel there:" +msgstr "Klicke auf das Ziel um dorthin zu reisen:" + +#: init.lua +msgid "G" +msgstr "E" + +#: init.lua +msgid "This station is already the first one on the list." +msgstr "Diese Reisenetz-Box ist bereits die erste auf der Liste." + +#: init.lua +msgid "This station is already the last one on the list." +msgstr "Diese Reisenetz-Box ist bereits die letzte auf der Liste." + +#: init.lua +msgid "Position in list:" +msgstr "Listenposition:" + +#: init.lua +msgid "move up" +msgstr "hoch" + +#: init.lua +msgid "move down" +msgstr "runter" + +#: init.lua +msgid "on travelnet '%s'" +msgstr "im Reisenetzwerk '%s'" + +#: init.lua +msgid "owned by %s" +msgstr "Eigentum von %s" + +#: init.lua +msgid "ready for usage. Right-click to travel, punch to update." +msgstr "bereit für die Nutzung. Rechtsklick um zu Reisen, Linksklick für Update." + +#: init.lua +msgid "at %s m" +msgstr "in %s m Höhe" + +#: init.lua +msgid "Error" +msgstr "Fehler" + +#: init.lua +msgid "Please provide a name for this station." +msgstr "Bitte gib einen Namen für diese Reisenetz-Box an." + +#: init.lua +msgid "Please provide the name of the network this station ought to be connected to." +msgstr "Bitte gib einen Namen für das Netzwerk an zu dem diese Reisenetz-Box gehören soll." + +#: init.lua +msgid "There is no player with interact privilege named '%s'. Aborting." +msgstr "Es gibt keinen Spieler mit interact-Recht names '%s'. Abbruch." + +#: init.lua +msgid "You do not have the travelnet_attach priv which is required to attach your box to the network of someone else. Aborting." +msgstr "Dir fehlt das travelnet_attach-Recht, welches für das Hinzufügen von Reisenetz-Boxen zu Netzwerken nötig ist, die anderen Spielern gehören. Abbruch." + +#: init.lua +msgid "A station named '%s' already exists on this network. Please choose a diffrent name!" +msgstr "Eine Reisenetz-Box namens '%s' existiert bereits in diesem Netzwerk. Abbruch." + +#: init.lua +msgid "Network '%s'" +msgstr "Netzwerk '%s'" + +#: init.lua +msgid "already contains the maximum number (" +msgstr "%s) of allowed stations per network. Please choose a diffrent/new network name. = enthält bereits die maixmale Anzahl (=%s) erlaubert Stationen pro Netzwerk. Bitte wähle ein anderes bzw. neues Netzwerk." + +#: init.lua +msgid "has been added to the network '%s'" +msgstr "wurde an das Netzwerk '%s' angeschlossen." + +#: init.lua +msgid ", which now consists of %s station(s)." +msgstr ", das nun aus %s Station(en) besteht." + +#: init.lua +msgid "Station:" +msgstr "Station:" + +#: init.lua +msgid "Network:" +msgstr "Netzwerk:" + +#: init.lua +msgid "No help available yet." +msgstr "Noch keine Hilfe eingebaut." + +#: init.lua +msgid "Please click on the target you want to travel to." +msgstr "Bitte klicke auf das Ziel zu dem du reisen willst." + +#: init.lua +msgid "There is something wrong with the configuration of this station." +msgstr "Die Konfiguration dieser Reisenetz-Box ist fehlerhaft." + +#: init.lua +msgid "This travelnet is lacking data and/or improperly configured." +msgstr "Diese Reisenetz-Box ist fehlerhaft oder unvollständig konfiguriert." + +#: init.lua +msgid "does not exist (anymore?) on this network." +msgstr "gibt es nicht (mehr?) in diesem Netzwerk." + +#: init.lua +msgid "Initiating transfer to station '%s'." +msgstr "leite Reise zur Station '%s' ein." + +#: init.lua +msgid "Could not find information about the station that is to be removed." +msgstr "Konnte keine Informationen über die zu entfernende Station finden." + +#: init.lua +msgid "Could not find the station that is to be removed." +msgstr "Konnte die zu entfernende Station nicht finden." + +#: init.lua +msgid "has been REMOVED from the network '%s'." +msgstr "wurde vom Netzwerk '%s' ENTFERNT." + +#: init.lua +msgid "This %s has not been configured yet. Please set it up first to claim it. Afterwards you can remove it because you are then the owner." +msgstr "Diese Reisenetz-Box wurde noch nicht konfiguriert. Bitte konfiguriere sie um sie in Besitz zu nehmen. Anschließend kannst du sie auch wieder entfernen da du dann der Besitzer bist." + +#: init.lua +msgid "This %s belongs to %s. You can't remove it." +msgstr "Diese Reisenetz-Box gehört %s. Du kannst sie nicht entfernen." + +#: travelnet.lua +msgid "Not enough vertical space to place the travelnet box!" +msgstr "Nicht genug Platz (vertikal) um die Reisenetz-Box zu setzen!" + +#: elevator.lua +msgid "Congratulations! This is your first elevator. You can build an elevator network by placing further elevators somewhere above or below this one. Just make sure that the x and z coordinate are the same." +msgstr "" + +#: elevator.lua +msgid "This elevator will automaticly connect to the other elevators you have placed at diffrent heights. Just enter a station name and click on \"store\" to set it up. Or just punch it to set the height as station name." +msgstr "Dieser Aufzug wird sich automatisch mit anderen Aufzügen verbinden die du auf unterschiedlichen Höhen positioniert hast. Gib einfach einen Namen für diese Station hier ein und klicke auf \"Speichern\" um die Station einzurichten. Oder mache einen Linksklick um die Höhe als Stationsname zu setzen." + +#: elevator.lua +msgid "Your nearest elevator network is located" +msgstr "Dein nächstgelegenes Aufzugs-Netzwerk befindet sich" + +#: elevator.lua +msgid "m behind this elevator and" +msgstr "m hinter diesem Aufzug und" + +#: elevator.lua +msgid "m in front of this elevator and" +msgstr "m vor diesem Aufzug und" + +#: elevator.lua +msgid "m to the left" +msgstr "m links" + +#: elevator.lua +msgid "m to the right" +msgstr "m rechts" + +#: elevator.lua +msgid ", located at x" +msgstr ", an Position x" + +#: elevator.lua +msgid "This elevator here will start a new shaft/network." +msgstr "Dieser Aufzug hier wird einen neuen Schaft bzw. ein neues Netzwerk erstellen." + +#: elevator.lua +msgid "This is your first elevator. It differs from travelnet networks by only allowing movement in vertical direction (up or down). All further elevators which you will place at the same x,z coordinates at differnt heights will be able to connect to this elevator." +msgstr "Dies ist dein erster Aufzug. Der Aufzug unterscheidet sich von Reisenetz-Boxen insofern als daß er nur Reisen in vertikaler Richtung (hoch und runter) erlaubt. Alle folgenden Aufzüge, die du an die selben x,z Koordinaten auf verschiedenen Höhenpositionen setzen wirst, werden sich automatisch mit diesem Aufzug verbinden." + +#: elevator.lua +msgid "Elevator" +msgstr "Aufzug" + +#: elevator.lua +msgid "Elevator (unconfigured)" +msgstr "Aufzug (nicht konfiguriert)" + +#: doors.lua +msgid "elevator door (open)" +msgstr "Aufzugstür (offen)" + +#: doors.lua +msgid "elevator door (closed)" +msgstr "Aufzugstür (geschlossen)" + +#: init.lua +#, lua-format +msgid "Remove station" +msgstr "Station entfernen" + +#: init.lua +#, lua-format +msgid "You do not have enough room in your inventory." +msgstr "Du hast nicht genug Platz in deinem Inventar." + +#: init.lua +#, lua-format +msgid "[Mod travelnet] Error: Savefile '%s' is damaged. Saved the backup as '%s'." +msgstr "[Mod travelnet] Fehler: Sicherungsdatei '%s' ist beschädigt. Backup wurde unter '%s' gespeichert." diff --git a/travelnet/locale/de.txt b/travelnet/locale/de.txt deleted file mode 100644 index e5f7642..0000000 --- a/travelnet/locale/de.txt +++ /dev/null @@ -1,94 +0,0 @@ -# Template - -### config.lua ### - -### init.lua ### - -allows to attach travelnet boxes to travelnets of other players = erlaubt es, Stationen zu den Reisenetzwerken anderer Spieler hinzuzufügen -allows to dig travelnet boxes which belog to nets of other players = erlaubt es, die Reisenetz-Stationen anderer Spieler zu entfernen - -[Mod travelnet] Error: Savefile '%s' could not be written. = [Mod travelnet] Fehler: Sicherungsdatei '%s' konnte nicht geschrieben werden. -[Mod travelnet] Error: Savefile '%s' not found. = [Mod travelnet] Fehler: Sicherungsdatei '%s' nicht gefunden. - -Back = Zurück -Exit = Ende - -Travelnet-box (unconfigured) = Reisenetz-Box (nicht konfiguriert) - -Configure this travelnet station = Konfiguration dieser Reisenetz-Box -Name of this station = Name dieser Reisenetz-Box -How do you call this place here? Example: \"my first house\", \"mine\", \"shop\"... = Wie willst du diesen Ort nennen? Beispiel: \"mein erstes Haus\", \"Mine\", \"Laden\"... -Assign to Network: = Station dem folgendem Netzwerk zuweisen: -You can have more than one network. If unsure, use \"%s\" = Du kannst mehrere Netzwerke anlegen. Falls du nicht weißt, was du tun sollst, wähle \"%s\" -Owned by: = Besitzer: -Unless you know what you are doing, leave this empty. = Wenn du nicht weißt, wozu dieses Feld dient, laß es leer. -Help = Hilfe -Save = Speichern -Remove station = Station entfernen -You do not have enough room in your inventory. = Du hast nicht genug Platz in deinem Inventar. -Update failed! Resetting this box on the travelnet. = Aktualisierung gescheitert. Konfiguration der Reisenetz-Box wird zurückgesetzt. -Station '%s' = Station '%s' -has been reattached to the network '%s'. = wurde dem Netzwerk '%s' wieder hinzugefügt. -Locked travelnet. Type /help for help: = Abgeschlossene Reisenetz-Box. Tippe /help für Hilfe: -Punch box to update target list. = Reisenetz-Box mit Linksklick aktualisieren. -Travelnet-Box = Reisenetz-Box -Name of this station: = Name dieser Station: -Assigned to Network: = Zugehöriges Netzwerk: -Click on target to travel there: = Klicke auf das Ziel um dorthin zu reisen: -G = E -This station is already the first one on the list. = Diese Reisenetz-Box ist bereits die erste auf der Liste. -This station is already the last one on the list. = Diese Reisenetz-Box ist bereits die letzte auf der Liste. -Position in list: = Listenposition: -move up = hoch -move down = runter -on travelnet '%s' = im Reisenetzwerk '%s' -owned by %s = Eigentum von %s -ready for usage. Right-click to travel, punch to update. = bereit für die Nutzung. Rechtsklick um zu Reisen, Linksklick für Update. -at %s m = in %s m Höhe -Error = Fehler -Please provide a name for this station. = Bitte gib einen Namen für diese Reisenetz-Box an. -Please provide the name of the network this station ought to be connected to. = Bitte gib einen Namen für das Netzwerk an zu dem diese Reisenetz-Box gehören soll. -There is no player with interact privilege named '%s'. Aborting. = Es gibt keinen Spieler mit interact-Recht names '%s'. Abbruch. -You do not have the travelnet_attach priv which is required to attach your box to the network of someone else. Aborting. = Dir fehlt das travelnet_attach-Recht, welches für das Hinzufügen von Reisenetz-Boxen zu Netzwerken nötig ist, die anderen Spielern gehören. Abbruch. -A station named '%s' already exists on this network. Please choose a diffrent name! = Eine Reisenetz-Box namens '%s' existiert bereits in diesem Netzwerk. Abbruch. -Network '%s' = Netzwerk '%s' -already contains the maximum number (=%s) of allowed stations per network. Please choose a diffrent/new network name. = enthält bereits die maixmale Anzahl (=%s) erlaubert Stationen pro Netzwerk. Bitte wähle ein anderes bzw. neues Netzwerk. -has been added to the network '%s' = wurde an das Netzwerk '%s' angeschlossen. -, which now consists of %s station(s). = , das nun aus %s Station(en) besteht. -Station: = Station: -Network: = Netzwerk: -No help available yet. = Noch keine Hilfe eingebaut. -Please click on the target you want to travel to. = Bitte klicke auf das Ziel zu dem du reisen willst. -There is something wrong with the configuration of this station. = Die Konfiguration dieser Reisenetz-Box ist fehlerhaft. -This travelnet is lacking data and/or improperly configured. = Diese Reisenetz-Box ist fehlerhaft oder unvollständig konfiguriert. -does not exist (anymore?) on this network. = gibt es nicht (mehr?) in diesem Netzwerk. -Initiating transfer to station '%s'. = leite Reise zur Station '%s' ein. -Could not find information about the station that is to be removed. = Konnte keine Informationen über die zu entfernende Station finden. -Could not find the station that is to be removed. = Konnte die zu entfernende Station nicht finden. -has been REMOVED from the network '%s'. = wurde vom Netzwerk '%s' ENTFERNT. -This %s has not been configured yet. Please set it up first to claim it. Afterwards you can remove it because you are then the owner. = Diese Reisenetz-Box wurde noch nicht konfiguriert. Bitte konfiguriere sie um sie in Besitz zu nehmen. Anschließend kannst du sie auch wieder entfernen da du dann der Besitzer bist. -This %s belongs to %s. You can't remove it. = Diese Reisenetz-Box gehört %s. Du kannst sie nicht entfernen. - - -### travelnet.lua ### -Not enough vertical space to place the travelnet box! = Nicht genug Platz (vertikal) um die Reisenetz-Box zu setzen! - - -### elevator.lua ### -Congratulations! This is your first elevator. You can build an elevator network by placing further elevators somewhere above or below this one. Just make sure that the x and z coordinate are the same. = -This elevator will automaticly connect to the other elevators you have placed at diffrent heights. Just enter a station name and click on \"store\" to set it up. Or just punch it to set the height as station name. = Dieser Aufzug wird sich automatisch mit anderen Aufzügen verbinden die du auf unterschiedlichen Höhen positioniert hast. Gib einfach einen Namen für diese Station hier ein und klicke auf \"Speichern\" um die Station einzurichten. Oder mache einen Linksklick um die Höhe als Stationsname zu setzen. -Your nearest elevator network is located = Dein nächstgelegenes Aufzugs-Netzwerk befindet sich -m behind this elevator and = m hinter diesem Aufzug und -m in front of this elevator and = m vor diesem Aufzug und -m to the left = m links -m to the right = m rechts -, located at x = , an Position x -This elevator here will start a new shaft/network. = Dieser Aufzug hier wird einen neuen Schaft bzw. ein neues Netzwerk erstellen. -This is your first elevator. It differs from travelnet networks by only allowing movement in vertical direction (up or down). All further elevators which you will place at the same x,z coordinates at differnt heights will be able to connect to this elevator. = Dies ist dein erster Aufzug. Der Aufzug unterscheidet sich von Reisenetz-Boxen insofern als daß er nur Reisen in vertikaler Richtung (hoch und runter) erlaubt. Alle folgenden Aufzüge, die du an die selben x,z Koordinaten auf verschiedenen Höhenpositionen setzen wirst, werden sich automatisch mit diesem Aufzug verbinden. -Elevator = Aufzug -Elevator (unconfigured) = Aufzug (nicht konfiguriert) - - -### doors.lua ### -elevator door (open) = Aufzugstür (offen) -elevator door (closed) = Aufzugstür (geschlossen) diff --git a/travelnet/locale/ru.po b/travelnet/locale/ru.po new file mode 100644 index 0000000..004fe29 --- /dev/null +++ b/travelnet/locale/ru.po @@ -0,0 +1,377 @@ +# Russian translation for the travelnet mod. +# Copyright (C) 2018 Sokomine +# This file is distributed under the same license as the travelnet package. +# CodeXP <codexp@gmx.net>, 2018. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: travelnet\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-05 14:30+0200\n" +"PO-Revision-Date: \n" +"Last-Translator: CodeXP <codexp@gmx.net>\n" +"Language-Team: \n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: doors.lua +msgid "elevator door (open)" +msgstr "дверь лифта (открыта)" + +#: doors.lua +msgid "elevator door (closed)" +msgstr "дверь лифта (закрыта)" + +#: elevator.lua +msgid "" +"Congratulations! This is your first elevator.You can build an elevator " +"network by placing further elevators somewhere above or below this one. " +"Just make sure that the x and z coordinate are the same." +msgstr "" +"Поздравляем! Это ваш первый лифт. Вы можете построить сеть лифтов, " +"разместив дополнительные лифты выше или ниже этого лифта. " +"Только убедитесь, что координаты x и z совпадают." + +#: elevator.lua +msgid "" +"This elevator will automaticly connect to the other elevators you have " +"placed at diffrent heights. Just enter a station name and click on \"store\" " +"to set it up. Or just punch it to set the height as station name." +msgstr "" +"Этот лифт будет автоматически подключен к другим лифтам, которые размещены " +"на разных высотах. После установки можете ввести название лифта и нажать \"сохранить\". " +"Или просто ударьте его, чтобы установить высоту в качестве названия лифта." + +#: elevator.lua +msgid "Your nearest elevator network is located" +msgstr "Ваша ближайшая сеть лифтов находится" + +#: elevator.lua +msgid "m behind this elevator and" +msgstr "м за этим лифтом" + +#: elevator.lua +msgid "m in front of this elevator and" +msgstr "м перед этим лифтом" + +#: elevator.lua +msgid " ERROR" +msgstr " ОЩИБКА" + +#: elevator.lua +msgid "m to the left" +msgstr "м с лева" + +#: elevator.lua +msgid "m to the right" +msgstr "м с права" + +#: elevator.lua +msgid ", located at x" +msgstr ", находится на x" + +#: elevator.lua +msgid "This elevator here will start a new shaft/network." +msgstr "Этот лифт составит новую сеть." + +#: elevator.lua +msgid "" +"This is your first elevator. It differs from travelnet networks by only " +"allowing movement in vertical direction (up or down). All further elevators " +"which you will place at the same x,z coordinates at differnt heights will be " +"able to connect to this elevator." +msgstr "" +"Это ваш первый лифт. Он отличается от сети телепортов только тем что " +"движение ограниченно в вертикальном направлении (вверх или вниз). " +"Все дополнительные лифты, которые вы будете размещать в тех же координатах " +"(x, z) на разных высотах, будут подключены к этому лифту." + +#: elevator.lua +msgid "Elevator" +msgstr "Лифт" + +#: elevator.lua +msgid "Elevator (unconfigured)" +msgstr "Лифт (без настройки)" + +#: elevator.lua init.lua +msgid "Name of this station:" +msgstr "Имя этой станции:" + +#: elevator.lua +msgid "Store" +msgstr "Сохранить" + +#: elevator.lua travelnet.lua +msgid "Not enough vertical space to place the travelnet box!" +msgstr "Недостаточно вертикального места, чтобы разместить телепорт!" + +#: init.lua +msgid "allows to attach travelnet boxes to travelnets of other players" +msgstr "позволяет присоеденять телепорты к сетям других игроков" + +#: init.lua +msgid "allows to dig travelnet boxes which belog to nets of other players" +msgstr "позволяет убирать телепорты других игроков" + +#: init.lua +#, lua-format +msgid "[Mod travelnet] Error: Savefile '%s' could not be written." +msgstr "[MOD travelnet] Ошибка: Файл «%s» не может быть записан." + +#: init.lua +#, lua-format +msgid "[Mod travelnet] Error: Savefile '%s' not found." +msgstr "[MOD travelnet] Ошибка: Файл «%s» не найден." + +#: init.lua +msgid "Back" +msgstr "Назад" + +#: init.lua +msgid "Exit" +msgstr "Выход" + +#: init.lua +msgid "Travelnet-box (unconfigured)" +msgstr "Телепорт (без настройки)" + +#: init.lua +msgid "Configure this travelnet station" +msgstr "НАСТРОЙКИ СТАНЦИИ" + +#: init.lua +msgid "Name of this station" +msgstr "Имя этой станции" + +#: init.lua +msgid "" +"How do you call this place here? Example: \"my first house\", \"mine\", \"shop\"..." +msgstr "" +"Как вы назавёте это место? Пример: \"мой первый дом\", \"шахта\", \"магазин\"..." + +#: init.lua +msgid "Assign to Network:" +msgstr "Добавить в сеть:" + +#: init.lua +#, lua-format +msgid "You can have more than one network. If unsure, use \"%s\"" +msgstr "Вы можете иметь несколько сетей. Если вы не уверены, используйте \"%s\"" + +#: init.lua +msgid "Owned by:" +msgstr "Пренадлежит:" + +#: init.lua +msgid "Unless you know what you are doing, leave this empty." +msgstr "Если вы не знаете для чего это, оставьте это пустым." + +#: init.lua +msgid "Help" +msgstr "Справка" + +#: init.lua +msgid "Save" +msgstr "Сохранить" + +#: init.lua +msgid "Update failed! Resetting this box on the travelnet." +msgstr "Обновление не выполнено! Нстройки телепорта сброшенны." + +#: init.lua +#, lua-format +msgid "Station '%s'" +msgstr "Станция «%s»" + +#: init.lua +#, lua-format +msgid " has been reattached to the network '%s'." +msgstr " присоеденён к сети «%s»." + +#: init.lua +msgid "Locked travelnet. Type /help for help:" +msgstr "Закрытый телепорт. Напишите /help для справки:" + +#: init.lua travelnet.lua +msgid "Travelnet-Box" +msgstr "Телепорт" + +#: init.lua +msgid "Punch box to update target list." +msgstr "Ударьте станцию для обновления целей." + +#: init.lua +msgid "Assigned to Network:" +msgstr "Присоеденён к сети:" + +#: init.lua +msgid "Click on target to travel there:" +msgstr "Выберите цель, чтобы переместится:" + +# (G)round floor +#: init.lua +msgid "G" +msgstr "1" + +#: init.lua +msgid "This station is already the first one on the list." +msgstr "Эта станция уже первая в списке." + +#: init.lua +msgid "This station is already the last one on the list." +msgstr "Эта станция уже последнея в списке." + +#: init.lua +msgid "Position in list:" +msgstr "Позиция:" + +#: init.lua +msgid "move up" +msgstr "▲ вверх" + +#: init.lua +msgid "move down" +msgstr "▼ вниз" + +#: init.lua +#, lua-format +msgid "on travelnet '%s'" +msgstr "на сети «%s»" + +#: init.lua +#, lua-format +msgid "(owned by %s)" +msgstr "(пренадлежит %s)" + +#: init.lua +msgid "ready for usage. Right-click to travel, punch to update." +msgstr "готова к использованию. Правая кнопка для перемещения, ударить чтобы обновить." + +#: init.lua +#, lua-format +msgid "at %s m" +msgstr "на %s м" + +#: init.lua +msgid "Error" +msgstr "Ошибка" + +#: init.lua +msgid "Please provide a name for this station." +msgstr "Укажите название этой станции." + +#: init.lua +msgid "" +"Please provide the name of the network this station ought to be connected to." +msgstr "" +"Укажите название сети, к которой добавить эту станцию." + +#: init.lua +#, lua-format +msgid "There is no player with interact privilege named '%s'. Aborting." +msgstr "Нет игрока с привилегией «interact» по имени «%s». Отмена." + +#: init.lua +msgid "" +"You do not have the travelnet_attach priv which is required to attach your " +"box to the network of someone else. Aborting." +msgstr "" +"У вас нет привилегии «travelnet_attach», которая необходима для добавки " +"вашего телепорта в сеть другого игрока. Отмена." + +#: init.lua +#, lua-format +msgid "" +"A station named '%s' already exists on this network. Please choose a " +"diffrent name!" +msgstr "" +"Станция «%s» уже существует в этой сети. " +"Попробуйте другое имя!" + +#: init.lua +#, lua-format +msgid "Network '%s'," +msgstr "Сеть «%s»," + +#: init.lua +#, lua-format +msgid "" +"already contains the maximum number (=%s) of allowed stations per network. " +"Please choose a diffrent/new network name." +msgstr "" +"уже содержит максимальное количество (=%s) разрешенных станций на сеть. " +"Выберите друю сеть (иное имя сети)." + +#: init.lua +#, lua-format +msgid "has been added to the network '%s'" +msgstr "была добавлена в сеть «%s»" + +#: init.lua +#, lua-format +msgid ", which now consists of %s station(s)." +msgstr ", которая теперь состоит из %s станций." + +#: init.lua +msgid "Station:" +msgstr "Станция:" + +#: init.lua +msgid "Network:" +msgstr "Сеть:" + +#: init.lua +msgid "No help available yet." +msgstr "Пока нет справки." + +#: init.lua +msgid "Please click on the target you want to travel to." +msgstr "Пожалуйста, выберите цель, куда вы хотели бы попасть." + +#: init.lua +msgid "There is something wrong with the configuration of this station." +msgstr "С конфигурацией этой станции что-то не так." + +#: init.lua +msgid "This travelnet is lacking data and/or improperly configured." +msgstr "В этом телепорте отсутствуют данные или он неправильно настроен." + +#: init.lua +msgid "does not exist (anymore?) on this network." +msgstr "в этой сети (больше?) не существует." + +#: init.lua +#, lua-format +msgid "Initiating transfer to station '%s'." +msgstr "Инициирование перехода на станцию «%s»." + +#: init.lua +msgid "Could not find information about the station that is to be removed." +msgstr "Не удалось найти информацию о станции, для удаления." + +#: init.lua +msgid "Could not find the station that is to be removed." +msgstr "Не удалось найти станцию, для удаления." + +#: init.lua +#, lua-format +msgid "has been REMOVED from the network '%s'." +msgstr "УДАЛЕНА из сети «%s»." + +#: init.lua +#, lua-format +msgid "" +"This %s has not been configured yet. Please set it up first to claim it. " +"Afterwards you can remove it because you are then the owner." +msgstr "" +"Этот %s еще не настроен. Пожалуйста, сначала настройте его, чтобы перенять имущество. " +"После этого вы можете удалить его, так как вы являетесь владельцем." + +#: init.lua +#, lua-format +msgid "This %s belongs to %s. You can't remove it." +msgstr "Этот %s принадлежит %s." diff --git a/travelnet/locale/template.pot b/travelnet/locale/template.pot new file mode 100644 index 0000000..86e0e5c --- /dev/null +++ b/travelnet/locale/template.pot @@ -0,0 +1,372 @@ +# LANGUAGE translation for the travelnet mod. +# Copyright (C) 2018 Sokomine +# This file is distributed under the same license as the travelnet package. +# CodeXP <codexp@gmx.net>, 2018. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: travelnet\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-05 14:34+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: doors.lua +msgid "elevator door (open)" +msgstr "" + +#: doors.lua +msgid "elevator door (closed)" +msgstr "" + +#: elevator.lua +msgid "" +"Congratulations! This is your first elevator.You can build an elevator " +"network by placing further elevators somewhere above or below this one. Just " +"make sure that the x and z coordinate are the same." +msgstr "" + +#: elevator.lua +msgid "" +"This elevator will automaticly connect to the other elevators you have " +"placed at diffrent heights. Just enter a station name and click on \"store\" " +"to set it up. Or just punch it to set the height as station name." +msgstr "" + +#: elevator.lua +msgid "Your nearest elevator network is located" +msgstr "" + +#: elevator.lua +msgid "m behind this elevator and" +msgstr "" + +#: elevator.lua +msgid "m in front of this elevator and" +msgstr "" + +#: elevator.lua +msgid " ERROR" +msgstr "" + +#: elevator.lua +msgid "m to the left" +msgstr "" + +#: elevator.lua +msgid "m to the right" +msgstr "" + +#: elevator.lua +msgid ", located at x" +msgstr "" + +#: elevator.lua +msgid "This elevator here will start a new shaft/network." +msgstr "" + +#: elevator.lua +msgid "" +"This is your first elevator. It differs from travelnet networks by only " +"allowing movement in vertical direction (up or down). All further elevators " +"which you will place at the same x,z coordinates at differnt heights will be " +"able to connect to this elevator." +msgstr "" + +#: elevator.lua +msgid "Elevator" +msgstr "" + +#: elevator.lua +msgid "Elevator (unconfigured)" +msgstr "" + +#: elevator.lua init.lua +msgid "Name of this station:" +msgstr "" + +#: elevator.lua +msgid "Store" +msgstr "" + +#: elevator.lua travelnet.lua +msgid "Not enough vertical space to place the travelnet box!" +msgstr "" + +#: init.lua +msgid "allows to attach travelnet boxes to travelnets of other players" +msgstr "" + +#: init.lua +msgid "allows to dig travelnet boxes which belog to nets of other players" +msgstr "" + +#: init.lua +#, lua-format +msgid "[Mod travelnet] Error: Savefile '%s' could not be written." +msgstr "" + +#: init.lua +#, lua-format +msgid "[Mod travelnet] Error: Savefile '%s' not found." +msgstr "" + +#: init.lua +msgid "Back" +msgstr "" + +#: init.lua +msgid "Exit" +msgstr "" + +#: init.lua +msgid "Travelnet-box (unconfigured)" +msgstr "" + +#: init.lua +msgid "Configure this travelnet station" +msgstr "" + +#: init.lua +msgid "Name of this station" +msgstr "" + +#: init.lua +msgid "" +"How do you call this place here? Example: \"my first house\", \"mine\", " +"\"shop\"..." +msgstr "" + +#: init.lua +msgid "Assign to Network:" +msgstr "" + +#: init.lua +#, lua-format +msgid "You can have more than one network. If unsure, use \"%s\"" +msgstr "" + +#: init.lua +msgid "Owned by:" +msgstr "" + +#: init.lua +msgid "Unless you know what you are doing, leave this empty." +msgstr "" + +#: init.lua +msgid "Help" +msgstr "" + +#: init.lua +msgid "Save" +msgstr "" + +#: init.lua +msgid "Update failed! Resetting this box on the travelnet." +msgstr "" + +#: init.lua +#, lua-format +msgid "Station '%s'" +msgstr "" + +#: init.lua +#, lua-format +msgid " has been reattached to the network '%s'." +msgstr "" + +#: init.lua +msgid "Locked travelnet. Type /help for help:" +msgstr "" + +#: init.lua travelnet.lua +msgid "Travelnet-Box" +msgstr "" + +#: init.lua +msgid "Punch box to update target list." +msgstr "" + +#: init.lua +msgid "Assigned to Network:" +msgstr "" + +#: init.lua +msgid "Click on target to travel there:" +msgstr "" + +#: init.lua +msgid "G" +msgstr "" + +#: init.lua +msgid "This station is already the first one on the list." +msgstr "" + +#: init.lua +msgid "This station is already the last one on the list." +msgstr "" + +#: init.lua +msgid "Position in list:" +msgstr "" + +#: init.lua +msgid "move up" +msgstr "" + +#: init.lua +msgid "move down" +msgstr "" + +#: init.lua +#, lua-format +msgid "on travelnet '%s'" +msgstr "" + +#: init.lua +#, lua-format +msgid "(owned by %s)" +msgstr "" + +#: init.lua +msgid "ready for usage. Right-click to travel, punch to update." +msgstr "" + +#: init.lua +#, lua-format +msgid "at %s m" +msgstr "" + +#: init.lua +msgid "Error" +msgstr "" + +#: init.lua +msgid "Please provide a name for this station." +msgstr "" + +#: init.lua +msgid "" +"Please provide the name of the network this station ought to be connected to." +msgstr "" + +#: init.lua +#, lua-format +msgid "There is no player with interact privilege named '%s'. Aborting." +msgstr "" + +#: init.lua +msgid "" +"You do not have the travelnet_attach priv which is required to attach your " +"box to the network of someone else. Aborting." +msgstr "" + +#: init.lua +#, lua-format +msgid "" +"A station named '%s' already exists on this network. Please choose a " +"diffrent name!" +msgstr "" + +#: init.lua +#, lua-format +msgid "Network '%s'," +msgstr "" + +#: init.lua +#, lua-format +msgid "" +"already contains the maximum number (=%s) of allowed stations per network. " +"Please choose a diffrent/new network name." +msgstr "" + +#: init.lua +#, lua-format +msgid "has been added to the network '%s'" +msgstr "" + +#: init.lua +#, lua-format +msgid ", which now consists of %s station(s)." +msgstr "" + +#: init.lua +msgid "Station:" +msgstr "" + +#: init.lua +msgid "Network:" +msgstr "" + +#: init.lua +msgid "No help available yet." +msgstr "" + +#: init.lua +msgid "Please click on the target you want to travel to." +msgstr "" + +#: init.lua +msgid "There is something wrong with the configuration of this station." +msgstr "" + +#: init.lua +msgid "This travelnet is lacking data and/or improperly configured." +msgstr "" + +#: init.lua +msgid "does not exist (anymore?) on this network." +msgstr "" + +#: init.lua +#, lua-format +msgid "Initiating transfer to station '%s'." +msgstr "" + +#: init.lua +msgid "Could not find information about the station that is to be removed." +msgstr "" + +#: init.lua +msgid "Could not find the station that is to be removed." +msgstr "" + +#: init.lua +#, lua-format +msgid "has been REMOVED from the network '%s'." +msgstr "" + +#: init.lua +#, lua-format +msgid "" +"This %s has not been configured yet. Please set it up first to claim it. " +"Afterwards you can remove it because you are then the owner." +msgstr "" + +#: init.lua +#, lua-format +msgid "This %s belongs to %s. You can't remove it." +msgstr "" + +#: init.lua +#, lua-format +msgid "Remove station" +msgstr "" + +#: init.lua +#, lua-format +msgid "You do not have enough room in your inventory." +msgstr "" + +#: init.lua +#, lua-format +msgid "[Mod travelnet] Error: Savefile '%s' is damaged. Saved the backup as '%s'." +msgstr "" diff --git a/travelnet/locale/template.txt b/travelnet/locale/template.txt deleted file mode 100644 index f247861..0000000 --- a/travelnet/locale/template.txt +++ /dev/null @@ -1,94 +0,0 @@ -# Template - -### config.lua ### - -### init.lua ### - -allows to attach travelnet boxes to travelnets of other players = -allows to dig travelnet boxes which belog to nets of other players = - -[Mod travelnet] Error: Savefile '%s' could not be written. = -[Mod travelnet] Error: Savefile '%s' not found. = - -Back = -Exit = - -Travelnet-box (unconfigured) = - -Configure this travelnet station = -Name of this station = -How do you call this place here? Example: \"my first house\", \"mine\", \"shop\"... = -Assign to Network: = -You can have more than one network. If unsure, use \"%s\" = -Owned by: = -Unless you know what you are doing, leave this empty. = -Help = -Save = -Remove station = -You do not have enough room in your inventory. = -Update failed! Resetting this box on the travelnet. = -Station '%s' = -has been reattached to the network '%s'. = -Locked travelnet. Type /help for help: = -Punch box to update target list. = -Travelnet-Box = -Name of this station: = -Assigned to Network: = -Click on target to travel there: = -G = -This station is already the first one on the list. = -This station is already the last one on the list. = -Position in list: = -move up = -move down = -on travelnet '%s' = -owned by %s = -ready for usage. Right-click to travel, punch to update. = -at %s m = -Error = -Please provide a name for this station. = -Please provide the name of the network this station ought to be connected to. = -There is no player with interact privilege named '%s'. Aborting. = -You do not have the travelnet_attach priv which is required to attach your box to the network of someone else. Aborting. = -A station named '%s' already exists on this network. Please choose a diffrent name! = -Network '%s' = -already contains the maximum number (=%s) of allowed stations per network. Please choose a diffrent/new network name. = -has been added to the network '%s' = -, which now consists of %s station(s). = -Station: = -Network: = -No help available yet. = -Please click on the target you want to travel to. = -There is something wrong with the configuration of this station. = -This travelnet is lacking data and/or improperly configured. = -does not exist (anymore?) on this network. = -Initiating transfer to station '%s'. = -Could not find information about the station that is to be removed. = -Could not find the station that is to be removed. = -has been REMOVED from the network '%s'. = -This %s has not been configured yet. Please set it up first to claim it. Afterwards you can remove it because you are then the owner. = -This %s belongs to %s. You can't remove it. = - - -### travelnet.lua ### -Not enough vertical space to place the travelnet box! = - - -### elevator.lua ### -Congratulations! This is your first elevator. You can build an elevator network by placing further elevators somewhere above or below this one. Just make sure that the x and z coordinate are the same. = -This elevator will automaticly connect to the other elevators you have placed at diffrent heights. Just enter a station name and click on \"store\" to set it up. Or just punch it to set the height as station name. = -Your nearest elevator network is located = -m behind this elevator and = -m in front of this elevator and = -m to the left = -m to the right = -, located at x = -This elevator here will start a new shaft/network. = -This is your first elevator. It differs from travelnet networks by only allowing movement in vertical direction (up or down). All further elevators which you will place at the same x,z coordinates at differnt heights will be able to connect to this elevator. = -Elevator = -Elevator (unconfigured) = - - -### doors.lua ### -elevator door (open) = -elevator door (closed) = diff --git a/travelnet/mod.conf b/travelnet/mod.conf new file mode 100644 index 0000000..49fcb68 --- /dev/null +++ b/travelnet/mod.conf @@ -0,0 +1 @@ +name = travelnet diff --git a/travelnet/sounds/travelnet_bell.ogg b/travelnet/sounds/travelnet_bell.ogg Binary files differnew file mode 100644 index 0000000..994f649 --- /dev/null +++ b/travelnet/sounds/travelnet_bell.ogg diff --git a/travelnet/sounds/travelnet_travel.ogg b/travelnet/sounds/travelnet_travel.ogg Binary files differnew file mode 100644 index 0000000..b39be8f --- /dev/null +++ b/travelnet/sounds/travelnet_travel.ogg diff --git a/travelnet/travelnet.lua b/travelnet/travelnet.lua index 56cbf35..9fba7fe 100644 --- a/travelnet/travelnet.lua +++ b/travelnet/travelnet.lua @@ -74,7 +74,9 @@ minetest.register_node("travelnet:travelnet", { on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.above; - if( minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" ) then + local def = minetest.registered_nodes[ + minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name] + if not def or not def.buildable_to then minetest.chat_send_player( placer:get_player_name(), S('Not enough vertical space to place the travelnet box!')) return; |