This commit is contained in:
root 2020-11-20 19:20:28 +01:00
parent 93558985af
commit 7c9e9550a4
112 changed files with 2711 additions and 973 deletions

View file

@ -1,28 +0,0 @@
The TechPack Modpack for Minetest is
Copyright (C) 2017-2018 Joachim Stolberg
License of source code
----------------------
This program is free software; you can redistribute and/or
modify it under the terms of the GNU Lesser General Public License version 2.1 or later
published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
License of media (textures, sounds and documentation)
-----------------------------------------------------
All textures, sounds and documentation files are licensed under the
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
# TechPack V2.03
# TechPack V2.04
TechPack, a Mining, Crafting, & Farming Modpack for Minetest.
@ -115,7 +115,7 @@ The value 200 (default) results in a lifetime for standard machines of about 200
### License
Copyright (C) 2017-2020 Joachim Stolberg
Code: Licensed under the GNU LGPL version 2.1 or later. See LICENSE.txt
Code: Licensed under the GNU AGPL version 3 or later. See LICENSE.txt
Textures: CC BY-SA 3.0
@ -151,6 +151,7 @@ tubelib_addons1 optional: unified_inventory
- 2019-01-27 V2.01 * SaferLua Controller Terminal added
- 2019-01-28 V2.02 * Logic Not added, output reduction on Harvester, Fermenter, and Gravel Sieve
- 2019-04-23 V2.03 * Piston/WorldEdit/replacer detection added, farming and grinder recipes added
- 2020-11-20 V2.04 * Switch to AGPL v3, adapt to minetest 5.3, add translation support, fix minor bugs
## New in v2 (from players point of view)

View file

@ -5,6 +5,8 @@
]]--
-- Load support for I18n
local S = gravelsieve.S
gravelsieve.disallow = function(pos, node, user, mode, new_param2)
return false
@ -40,7 +42,7 @@ gravelsieve.handler = function(itemstack, user, pointed_thing)
end
minetest.register_tool("gravelsieve:hammer", {
description = "Hammer converts Cobblestone into Gravel",
description = S("Hammer converts Cobblestone into Gravel"),
inventory_image = "gravelsieve_hammer.png",
on_use = function(itemstack, user, pointed_thing)
return gravelsieve.handler(itemstack, user, pointed_thing)

View file

@ -7,11 +7,11 @@
Derived from the work of celeron55, Perttu Ahola (furnace)
Pipeworks support added by FiftySix
Copyright (C) 2017-2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
Copyright (C) 2011-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2011-2016 Various Minetest developers and contributors
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
History:
@ -42,6 +42,10 @@
gravelsieve = {
}
-- Load support for I18n
gravelsieve.S = minetest.get_translator("gravelsieve")
local S = gravelsieve.S
dofile(minetest.get_modpath("gravelsieve") .. "/hammer.lua")
local settings_get
@ -320,7 +324,7 @@ for idx = 0,4 do
local tube_info
if automatic == 0 then
node_name = "gravelsieve:sieve"
description = "Gravel Sieve"
description = S("Gravel Sieve")
tiles_data = {
-- up, down, right, left, back, front
"gravelsieve_gravel.png",
@ -332,7 +336,7 @@ for idx = 0,4 do
}
else
node_name = "gravelsieve:auto_sieve"
description = "Automatic Gravel Sieve"
description = S("Automatic Gravel Sieve")
tiles_data = {
-- up, down, right, left, back, front
"gravelsieve_gravel.png",
@ -366,6 +370,7 @@ for idx = 0,4 do
}
end
local not_in_creative_inventory
if idx == 3 then
tiles_data[1] = "gravelsieve_top.png"
not_in_creative_inventory = 0
@ -522,7 +527,7 @@ if minetest.global_exists("tubelib") then
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Gravel Sieve")
meta:set_string("infotext", S("Gravel Sieve"))
end,
on_dig = function(pos, node, puncher, pointed_thing)
@ -581,14 +586,14 @@ if minetest.global_exists("tubelib") then
end
minetest.register_node("gravelsieve:sieved_gravel", {
description = "Sieved Gravel",
description = S("Sieved Gravel"),
tiles = {"default_gravel.png"},
groups = {crumbly=2, falling_node=1, not_in_creative_inventory=1},
sounds = default.node_sound_gravel_defaults(),
})
minetest.register_node("gravelsieve:compressed_gravel", {
description = "Compressed Gravel",
description = S("Compressed Gravel"),
tiles = {"gravelsieve_compressed_gravel.png"},
groups = {cracky=2, crumbly = 2, cracky = 2},
sounds = default.node_sound_gravel_defaults(),
@ -654,7 +659,7 @@ end
if minetest.get_modpath("moreblocks") then
stairsplus:register_all("gravelsieve", "compressed_gravel", "gravelsieve:compressed_gravel", {
description="Compressed Gravel",
description=S("Compressed Gravel"),
groups={cracky=2, crumbly=2, choppy=2, not_in_creative_inventory=1},
tiles = {"gravelsieve_compressed_gravel.png"},
sounds = default.node_sound_stone_defaults(),

View file

@ -0,0 +1,14 @@
# textdomain: gravelsieve
### hammer.lua ###
Hammer converts Cobblestone into Gravel=Hammer, Zertrümmert Pflasterstein in Kies
### init.lua ###
Automatic Gravel Sieve=Automatisches Kiessieb
Compressed Gravel=Komprimiertes Kies
Gravel Sieve=Kiessieb
Sieved Gravel=Gesiebtes Kies

View file

@ -0,0 +1,14 @@
# textdomain: gravelsieve
### hammer.lua ###
Hammer converts Cobblestone into Gravel=
### init.lua ###
Automatic Gravel Sieve=
Compressed Gravel=
Gravel Sieve=
Sieved Gravel=

450
mods/techpack/i18n.py Normal file
View file

@ -0,0 +1,450 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Script to generate the template file and update the translation files.
# Copy the script into the mod or modpack root folder and run it there.
#
# Copyright (C) 2019 Joachim Stolberg, 2020 FaceDeer, 2020 Louis Royer
# LGPLv2.1+
#
# See https://github.com/minetest-tools/update_translations for
# potential future updates to this script.
from __future__ import print_function
import os, fnmatch, re, shutil, errno
from sys import argv as _argv
from sys import stderr as _stderr
# Running params
params = {"recursive": False,
"help": False,
"mods": False,
"verbose": False,
"folders": [],
"no-old-file": False
}
# Available CLI options
options = {"recursive": ['--recursive', '-r'],
"help": ['--help', '-h'],
"mods": ['--installed-mods'],
"verbose": ['--verbose', '-v'],
"no-old-file": ['--no-old-file']
}
# Strings longer than this will have extra space added between
# them in the translation files to make it easier to distinguish their
# beginnings and endings at a glance
doublespace_threshold = 60
def set_params_folders(tab: list):
'''Initialize params["folders"] from CLI arguments.'''
# Discarding argument 0 (tool name)
for param in tab[1:]:
stop_param = False
for option in options:
if param in options[option]:
stop_param = True
break
if not stop_param:
params["folders"].append(os.path.abspath(param))
def set_params(tab: list):
'''Initialize params from CLI arguments.'''
for option in options:
for option_name in options[option]:
if option_name in tab:
params[option] = True
break
def print_help(name):
'''Prints some help message.'''
print(f'''SYNOPSIS
{name} [OPTIONS] [PATHS...]
DESCRIPTION
{', '.join(options["help"])}
prints this help message
{', '.join(options["recursive"])}
run on all subfolders of paths given
{', '.join(options["mods"])}
run on locally installed modules
{', '.join(options["no-old-file"])}
do not create *.old files
{', '.join(options["verbose"])}
add output information
''')
def main():
'''Main function'''
set_params(_argv)
set_params_folders(_argv)
if params["help"]:
print_help(_argv[0])
elif params["recursive"] and params["mods"]:
print("Option --installed-mods is incompatible with --recursive")
else:
# Add recursivity message
print("Running ", end='')
if params["recursive"]:
print("recursively ", end='')
# Running
if params["mods"]:
print(f"on all locally installed modules in {os.path.abspath('~/.minetest/mods/')}")
run_all_subfolders("~/.minetest/mods")
elif len(params["folders"]) >= 2:
print("on folder list:", params["folders"])
for f in params["folders"]:
if params["recursive"]:
run_all_subfolders(f)
else:
update_folder(f)
elif len(params["folders"]) == 1:
print("on folder", params["folders"][0])
if params["recursive"]:
run_all_subfolders(params["folders"][0])
else:
update_folder(params["folders"][0])
else:
print("on folder", os.path.abspath("./"))
if params["recursive"]:
run_all_subfolders(os.path.abspath("./"))
else:
update_folder(os.path.abspath("./"))
#group 2 will be the string, groups 1 and 3 will be the delimiters (" or ')
#See https://stackoverflow.com/questions/46967465/regex-match-text-in-either-single-or-double-quote
pattern_lua_s = re.compile(r'[\.=^\t,{\(\s]N?S\(\s*(["\'])((?:\\\1|(?:(?!\1)).)*)(\1)[\s,\)]', re.DOTALL)
pattern_lua_fs = re.compile(r'[\.=^\t,{\(\s]N?FS\(\s*(["\'])((?:\\\1|(?:(?!\1)).)*)(\1)[\s,\)]', re.DOTALL)
pattern_lua_bracketed_s = re.compile(r'[\.=^\t,{\(\s]N?S\(\s*\[\[(.*?)\]\][\s,\)]', re.DOTALL)
pattern_lua_bracketed_fs = re.compile(r'[\.=^\t,{\(\s]N?FS\(\s*\[\[(.*?)\]\][\s,\)]', re.DOTALL)
# Handles "concatenation" .. " of strings"
pattern_concat = re.compile(r'["\'][\s]*\.\.[\s]*["\']', re.DOTALL)
pattern_tr = re.compile(r'(.*?[^@])=(.*)')
pattern_name = re.compile(r'^name[ ]*=[ ]*([^ \n]*)')
pattern_tr_filename = re.compile(r'\.tr$')
pattern_po_language_code = re.compile(r'(.*)\.po$')
#attempt to read the mod's name from the mod.conf file. Returns None on failure
def get_modname(folder):
try:
with open(os.path.join(folder, "mod.conf"), "r", encoding='utf-8') as mod_conf:
for line in mod_conf:
match = pattern_name.match(line)
if match:
return match.group(1)
except FileNotFoundError:
pass
return None
#If there are already .tr files in /locale, returns a list of their names
def get_existing_tr_files(folder):
out = []
for root, dirs, files in os.walk(os.path.join(folder, 'locale/')):
for name in files:
if pattern_tr_filename.search(name):
out.append(name)
return out
# A series of search and replaces that massage a .po file's contents into
# a .tr file's equivalent
def process_po_file(text):
# The first three items are for unused matches
text = re.sub(r'#~ msgid "', "", text)
text = re.sub(r'"\n#~ msgstr ""\n"', "=", text)
text = re.sub(r'"\n#~ msgstr "', "=", text)
# comment lines
text = re.sub(r'#.*\n', "", text)
# converting msg pairs into "=" pairs
text = re.sub(r'msgid "', "", text)
text = re.sub(r'"\nmsgstr ""\n"', "=", text)
text = re.sub(r'"\nmsgstr "', "=", text)
# various line breaks and escape codes
text = re.sub(r'"\n"', "", text)
text = re.sub(r'"\n', "\n", text)
text = re.sub(r'\\"', '"', text)
text = re.sub(r'\\n', '@n', text)
# remove header text
text = re.sub(r'=Project-Id-Version:.*\n', "", text)
# remove double-spaced lines
text = re.sub(r'\n\n', '\n', text)
return text
# Go through existing .po files and, if a .tr file for that language
# *doesn't* exist, convert it and create it.
# The .tr file that results will subsequently be reprocessed so
# any "no longer used" strings will be preserved.
# Note that "fuzzy" tags will be lost in this process.
def process_po_files(folder, modname):
for root, dirs, files in os.walk(os.path.join(folder, 'locale/')):
for name in files:
code_match = pattern_po_language_code.match(name)
if code_match == None:
continue
language_code = code_match.group(1)
tr_name = modname + "." + language_code + ".tr"
tr_file = os.path.join(root, tr_name)
if os.path.exists(tr_file):
if params["verbose"]:
print(f"{tr_name} already exists, ignoring {name}")
continue
fname = os.path.join(root, name)
with open(fname, "r", encoding='utf-8') as po_file:
if params["verbose"]:
print(f"Importing translations from {name}")
text = process_po_file(po_file.read())
with open(tr_file, "wt", encoding='utf-8') as tr_out:
tr_out.write(text)
# from https://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python/600612#600612
# Creates a directory if it doesn't exist, silently does
# nothing if it already exists
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else: raise
# Converts the template dictionary to a text to be written as a file
# dKeyStrings is a dictionary of localized string to source file sets
# dOld is a dictionary of existing translations and comments from
# the previous version of this text
def strings_to_text(dkeyStrings, dOld, mod_name, header_comments):
lOut = [f"# textdomain: {mod_name}\n"]
if header_comments is not None:
lOut.append(header_comments)
dGroupedBySource = {}
for key in dkeyStrings:
sourceList = list(dkeyStrings[key])
sourceList.sort()
sourceString = "\n".join(sourceList)
listForSource = dGroupedBySource.get(sourceString, [])
listForSource.append(key)
dGroupedBySource[sourceString] = listForSource
lSourceKeys = list(dGroupedBySource.keys())
lSourceKeys.sort()
for source in lSourceKeys:
localizedStrings = dGroupedBySource[source]
localizedStrings.sort()
lOut.append("")
lOut.append(source)
lOut.append("")
for localizedString in localizedStrings:
val = dOld.get(localizedString, {})
translation = val.get("translation", "")
comment = val.get("comment")
if len(localizedString) > doublespace_threshold and not lOut[-1] == "":
lOut.append("")
if comment != None:
lOut.append(comment)
lOut.append(f"{localizedString}={translation}")
if len(localizedString) > doublespace_threshold:
lOut.append("")
unusedExist = False
for key in dOld:
if key not in dkeyStrings:
val = dOld[key]
translation = val.get("translation")
comment = val.get("comment")
# only keep an unused translation if there was translated
# text or a comment associated with it
if translation != None and (translation != "" or comment):
if not unusedExist:
unusedExist = True
lOut.append("\n\n##### not used anymore #####\n")
if len(key) > doublespace_threshold and not lOut[-1] == "":
lOut.append("")
if comment != None:
lOut.append(comment)
lOut.append(f"{key}={translation}")
if len(key) > doublespace_threshold:
lOut.append("")
return "\n".join(lOut) + '\n'
# Writes a template.txt file
# dkeyStrings is the dictionary returned by generate_template
def write_template(templ_file, dkeyStrings, mod_name):
# read existing template file to preserve comments
existing_template = import_tr_file(templ_file)
text = strings_to_text(dkeyStrings, existing_template[0], mod_name, existing_template[2])
mkdir_p(os.path.dirname(templ_file))
with open(templ_file, "wt", encoding='utf-8') as template_file:
template_file.write(text)
# Gets all translatable strings from a lua file
def read_lua_file_strings(lua_file):
lOut = []
with open(lua_file, encoding='utf-8') as text_file:
text = text_file.read()
#TODO remove comments here
text = re.sub(pattern_concat, "", text)
strings = []
for s in pattern_lua_s.findall(text):
strings.append(s[1])
for s in pattern_lua_bracketed_s.findall(text):
strings.append(s)
for s in pattern_lua_fs.findall(text):
strings.append(s[1])
for s in pattern_lua_bracketed_fs.findall(text):
strings.append(s)
for s in strings:
s = re.sub(r'"\.\.\s+"', "", s)
s = re.sub("@[^@=0-9]", "@@", s)
s = s.replace('\\"', '"')
s = s.replace("\\'", "'")
s = s.replace("\n", "@n")
s = s.replace("\\n", "@n")
s = s.replace("=", "@=")
lOut.append(s)
return lOut
# Gets strings from an existing translation file
# returns both a dictionary of translations
# and the full original source text so that the new text
# can be compared to it for changes.
# Returns also header comments in the third return value.
def import_tr_file(tr_file):
dOut = {}
text = None
header_comment = None
if os.path.exists(tr_file):
with open(tr_file, "r", encoding='utf-8') as existing_file :
# save the full text to allow for comparison
# of the old version with the new output
text = existing_file.read()
existing_file.seek(0)
# a running record of the current comment block
# we're inside, to allow preceeding multi-line comments
# to be retained for a translation line
latest_comment_block = None
for line in existing_file.readlines():
line = line.rstrip('\n')
if line[:3] == "###":
if header_comment is None:
# Save header comments
header_comment = latest_comment_block
# Stip textdomain line
tmp_h_c = ""
for l in header_comment.split('\n'):
if not l.startswith("# textdomain:"):
tmp_h_c += l + '\n'
header_comment = tmp_h_c
# Reset comment block if we hit a header
latest_comment_block = None
continue
if line[:1] == "#":
# Save the comment we're inside
if not latest_comment_block:
latest_comment_block = line
else:
latest_comment_block = latest_comment_block + "\n" + line
continue
match = pattern_tr.match(line)
if match:
# this line is a translated line
outval = {}
outval["translation"] = match.group(2)
if latest_comment_block:
# if there was a comment, record that.
outval["comment"] = latest_comment_block
latest_comment_block = None
dOut[match.group(1)] = outval
return (dOut, text, header_comment)
# Walks all lua files in the mod folder, collects translatable strings,
# and writes it to a template.txt file
# Returns a dictionary of localized strings to source file sets
# that can be used with the strings_to_text function.
def generate_template(folder, mod_name):
dOut = {}
for root, dirs, files in os.walk(folder):
for name in files:
if fnmatch.fnmatch(name, "*.lua"):
fname = os.path.join(root, name)
found = read_lua_file_strings(fname)
if params["verbose"]:
print(f"{fname}: {str(len(found))} translatable strings")
for s in found:
sources = dOut.get(s, set())
sources.add(f"### {os.path.basename(fname)} ###")
dOut[s] = sources
if len(dOut) == 0:
return None
templ_file = os.path.join(folder, "locale/template.txt")
write_template(templ_file, dOut, mod_name)
return dOut
# Updates an existing .tr file, copying the old one to a ".old" file
# if any changes have happened
# dNew is the data used to generate the template, it has all the
# currently-existing localized strings
def update_tr_file(dNew, mod_name, tr_file):
if params["verbose"]:
print(f"updating {tr_file}")
tr_import = import_tr_file(tr_file)
dOld = tr_import[0]
textOld = tr_import[1]
textNew = strings_to_text(dNew, dOld, mod_name, tr_import[2])
if textOld and textOld != textNew:
print(f"{tr_file} has changed.")
if not params["no-old-file"]:
shutil.copyfile(tr_file, f"{tr_file}.old")
with open(tr_file, "w", encoding='utf-8') as new_tr_file:
new_tr_file.write(textNew)
# Updates translation files for the mod in the given folder
def update_mod(folder):
print(folder)
modname = get_modname(folder)
if modname is not None:
process_po_files(folder, modname)
print(f"Updating translations for {modname}")
data = generate_template(folder, modname)
if data == None:
print(f"No translatable strings found in {modname}")
else:
for tr_file in get_existing_tr_files(folder):
update_tr_file(data, modname, os.path.join(folder, "locale/", tr_file))
else:
print(f"\033[31mUnable to find modname in folder {folder}.\033[0m", file=_stderr)
#exit(1)
# Determines if the folder being pointed to is a mod or a mod pack
# and then runs update_mod accordingly
def update_folder(folder):
is_modpack = os.path.exists(os.path.join(folder, "modpack.txt")) or os.path.exists(os.path.join(folder, "modpack.conf"))
if is_modpack:
subfolders = [f.path for f in os.scandir(folder) if f.is_dir()]
for subfolder in subfolders:
update_mod(subfolder + "/")
else:
update_mod(folder)
print("Done.")
def run_all_subfolders(folder):
for modfolder in [f.path for f in os.scandir(folder) if f.is_dir()]:
update_folder(modfolder + "/")
main()

View file

@ -0,0 +1 @@
name=lcdlib

View file

@ -2,6 +2,23 @@
## V2.04.00 (2020-11-20)
### Additions
- Add minetest.translator support (issue #56)
- Add German translation
- Add new minetest v5 nodes
### Removals
### Changes
- Switch from LGPL to AGPL v3
### Fixes
- tubelib_addons2:doorblock works incorrectly (issue #55)
## V2.03.12 (2020-07-23)
### Additions

View file

@ -3,9 +3,9 @@
SaferLua [safer_lua]
====================
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
data_struct.lua:

View file

@ -3,9 +3,9 @@
SaferLua [safer_lua]
====================
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
environ.lua:

View file

@ -3,9 +3,9 @@
SaferLua [safer_lua]
====================
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
environ.lua:

View file

@ -3,9 +3,9 @@
SaferLua [safer_lua]
====================
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
scanner.lua:

View file

@ -3,9 +3,9 @@
sl_controller
=============
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
battery.lua:

View file

@ -3,9 +3,9 @@
sl_controller
=============
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
commands.lua:

View file

@ -3,9 +3,9 @@
sl_controller
=============
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
controller.lua:

View file

@ -3,9 +3,9 @@
sl_controller
=============
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
]]--

View file

@ -3,9 +3,9 @@
sl_controller
=============
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
server.lua:

View file

@ -3,9 +3,9 @@
sl_controller
=============
Copyright (C) 2018-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
terminal.lua:

View file

@ -3,9 +3,9 @@
SmartLine
=========
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
button.lua:
@ -13,9 +13,11 @@
]]--
-- Load support for I18n
local S = smartline.S
local function switch_on(pos, node)
if tubelib.data_not_corrupted(pos) then
if tubelib.data_not_corrupted(pos, true) then
node.name = "smartline:button_active"
minetest.swap_node(pos, node)
minetest.sound_play("button", {
@ -40,7 +42,7 @@ local function switch_on(pos, node)
end
local function switch_off(pos)
if tubelib.data_not_corrupted(pos) then
if tubelib.data_not_corrupted(pos, true) then
local node = minetest.get_node(pos)
node.name = "smartline:button"
minetest.swap_node(pos, node)
@ -64,7 +66,7 @@ end
minetest.register_node("smartline:button", {
description = "SmartLine Button/Switch",
description = S("SmartLine Button/Switch"),
inventory_image = "smartline_button_inventory.png",
tiles = {
-- up, down, right, left, back, front
@ -89,22 +91,23 @@ minetest.register_node("smartline:button", {
local own_num = tubelib.add_node(pos, "smartline:button")
meta:set_string("own_num", own_num)
meta:set_string("formspec", "size[5,6]"..
"dropdown[0.2,0;3;type;switch,button 2s,button 4s,button 8s,button 16s;1]"..
"field[0.5,2;3,1;numbers;Insert destination block number(s);]" ..
"dropdown[0.2,0;3;type;"..S("switch,button 2s,button 4s,button 8s,button 16s")..";1]"..
"field[0.5,2;3,1;numbers;"..S("Insert destination block number(s)")..";]" ..
"checkbox[1,3;public;public;false]"..
"button_exit[1,4;2,1;exit;Save]")
"button_exit[1,4;2,1;exit;"..S("Save").."]")
meta:set_string("placer_name", placer:get_player_name())
meta:set_string("public", "false")
meta:set_int("cycle_time", 0)
meta:set_string("infotext", "SmartLine Button "..own_num)
meta:set_string("infotext", S("SmartLine Button").." "..own_num)
end,
on_receive_fields = function(pos, formname, fields, player)
local meta = minetest.get_meta(pos)
print(dump(fields))
if tubelib.check_numbers(fields.numbers) then
meta:set_string("numbers", fields.numbers)
local own_num = meta:get_string("own_num")
meta:set_string("infotext", "SmartLine Button "..own_num..", connected with block "..fields.numbers)
meta:set_string("infotext", S("SmartLine Button").." "..own_num..", "..S("connected with block").." "..fields.numbers)
else
return
end
@ -153,7 +156,7 @@ minetest.register_node("smartline:button", {
minetest.register_node("smartline:button_active", {
description = "SmartLine Button/Switch",
description = S("SmartLine Button/Switch"),
tiles = {
-- up, down, right, left, back, front
"smartline.png",

View file

@ -3,9 +3,9 @@
SmartLine
=========
Copyright (C) 2018-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
collector.lua:
@ -14,6 +14,9 @@
]]--
-- Load support for I18n
local S = smartline.S
local CYCLE_TIME = 1
local tStates = {stopped = 0, running = 0, standby = 1, blocked = 2, fault = 3, defect = 4}
@ -30,11 +33,11 @@ local function formspec(meta)
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"field[0.3,0.6;9,1;poll_numbers;Node numbers to read the states from:;"..poll_numbers.."]" ..
"field[0.3,2;9,1;event_number;Node number to send the events to:;"..event_number.."]" ..
"label[1.3,2.8;Send an event if state is equal or larget than:]"..
"field[0.3,0.6;9,1;poll_numbers;"..S("Node numbers to read the states from:")..";"..poll_numbers.."]" ..
"field[0.3,2;9,1;event_number;"..S("Node number to send the events to:")..";"..event_number.."]" ..
"label[1.3,2.8;"..S("Send an event if state is equal or larget than:").."]"..
"dropdown[1.2,3.4;7,4;severity;1 standby,2 blocked,3 fault,4 defect;"..dropdown_pos.."]"..
"button_exit[3,5;2,1;exit;Save]"
"button_exit[3,5;2,1;exit;"..S("Save").."]"
end
@ -50,7 +53,7 @@ local function send_event(meta)
else
tubelib.send_message(event_number, owner, nil, "off", own_number)
end
meta:set_string("infotext", "SmartLine State Collector "..own_number..': "'..lStates[state]..'"')
meta:set_string("infotext", S("SmartLine State Collector").." "..own_number..': "'..lStates[state]..'"')
meta:set_int("stored_state", state)
meta:set_int("state", 0)
end
@ -74,7 +77,7 @@ local function on_timer(pos,elapsed)
if poll_numbers == "" then
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "SmartLine State Collector "..own_number..": stopped")
meta:set_string("infotext", S("SmartLine State Collector").." "..own_number..": stopped")
meta:set_int("state", 0)
meta:set_int("stored_state", 0)
return false
@ -94,7 +97,7 @@ local function on_timer(pos,elapsed)
end
minetest.register_node("smartline:collector", {
description = "SmartLine State Collector",
description = S("SmartLine State Collector"),
inventory_image = "smartline_collector_inventory.png",
tiles = {
-- up, down, right, left, back, front
@ -121,7 +124,7 @@ minetest.register_node("smartline:collector", {
meta:set_string("poll_numbers", "")
meta:set_string("event_number", "")
meta:set_string("formspec", formspec(meta))
meta:set_string("infotext", "SmartLine State Collector "..own_number)
meta:set_string("infotext", S("SmartLine State Collector").." "..own_number)
meta:set_string("owner", placer:get_player_name())
end,
@ -145,7 +148,7 @@ minetest.register_node("smartline:collector", {
if not timer:is_started() then
timer:start(CYCLE_TIME)
end
meta:set_string("infotext", "SmartLine State Collector "..own_number..": running")
meta:set_string("infotext", S("SmartLine State Collector").." "..own_number..": running")
else
if timer:is_started() then
timer:stop()

View file

@ -3,9 +3,9 @@
SmartLine
=========
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
command.lua:

View file

@ -3,9 +3,9 @@
SmartLine
=========
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
controller.lua:

View file

@ -3,15 +3,17 @@
SmartLine
=========
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
display.lua:
]]--
-- Load support for I18n
local S = smartline.S
lcdlib.register_display_entity("smartline:entity")
@ -42,7 +44,7 @@ local lcd_box = {
}
minetest.register_node("smartline:display", {
description = "SmartLine Display",
description = S("SmartLine Display"),
inventory_image = 'smartline_display_inventory.png',
tiles = {"smartline_display.png"},
drawtype = "nodebox",

View file

@ -5,9 +5,9 @@
Part of the SmartLine mod
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
action.lua

View file

@ -5,9 +5,9 @@
Part of the SmartLine mod
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
balancer.lua

View file

@ -3,9 +3,9 @@
ICTA Controller
===============
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
battery.lua

View file

@ -5,9 +5,9 @@
Part of the SmartLine mod
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
command.lua:

View file

@ -5,9 +5,9 @@
Part of the SmartLine mod
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
condition.lua

View file

@ -5,9 +5,9 @@
Part of the SmartLine mod
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
controller.lua

View file

@ -3,9 +3,9 @@
ICTA Controller
===============
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
edit.lua

View file

@ -5,9 +5,9 @@
Part of the SmartLine mod
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
formspec.lua:

View file

@ -5,9 +5,9 @@
Part of the SmartLine mod
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
stopwatch.lua

View file

@ -5,9 +5,9 @@
Part of the SmartLine mod
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
submenu.lua

View file

@ -3,15 +3,18 @@
SmartLine
=========
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
]]--
smartline = {}
-- Load support for I18n
smartline.S = minetest.get_translator("smartline")
local MP = minetest.get_modpath("smartline")
dofile(MP.."/display.lua")

View file

@ -0,0 +1,85 @@
# textdomain: smartline
### button.lua ###
Insert destination block number(s)=Zielblocknummer(n) eingeben
SmartLine Button=SmartLine Taster
SmartLine Button/Switch=SmartLine Taster/Schalter
connected with block=verbunden mit Block
switch,button 2s,button 4s,button 8s,button 16s=Schalter,Taster 2s,Taster 4s,Taster 8s,Taster 16s
### button.lua ###
### collector.lua ###
### playerdetector.lua ###
### repeater.lua ###
Save=Speichern
### collector.lua ###
Node number to send the events to:=Knotennummer, an den die Events gesendet werden sollen:
Node numbers to read the states from:=Knotennummers, von wo der Status gelesen werden soll:
Send an event if state is equal or larget than:=Sende einen Event, wenn der Status gleich oder größer ist als:
SmartLine State Collector=SmartLine Status Sammler
### display.lua ###
SmartLine Display=SmartLine Display
### playerdetector.lua ###
Input the number(s) of the receiving node(s).=Gib die Nummer(n) der Empfangsblöcke ein.
Input the player name(s) separated by blanks,=Gebe sie Spielernamen getrennt durch Leerzeichen ein,
Player Detector=Spieler Detektor
Player Detector Help=Spieler Detektor Hilfe
Player name(s):=Spielername(n):
Receiver node numbers:=Empfangsblocknummer(n):
Separate numbers via blanks, like '0123 0234'.=Separiere die Nummern mit Leerzeichen, wie '0123 0234'.
SmartLine Player Detector=SmartLine Spieler Detektor
or leave it blank for all players.=oder lasse es leer für alle Spieler.
### playerdetector.lua ###
### sequencer.lua ###
### timer.lua ###
close=schließen
help=Hilfe
### repeater.lua ###
Destination node numbers=Zielknotennummern
SmartLine Repeater=SmartLine Wiederholer
connected with=verbunden mit
fault (overloaded)=Fehler (überlastet)
not connected=nicht verbunden
### sequencer.lua ###
Offset/s=Offset/s
Run endless=Laufe endlos
SmartLine Sequencer=SmartLine Sequenzer
SmartLine Sequencer Help@n @nDefine a sequence of commands to control other machines.@nNumbers(s) are the node numbers, the command shall sent to.@nThe commands 'on'/'off' are used for machines and other nodes.@nOffset is the time to the next line in seconds (1..999).@nIf endless is set, the Sequencer restarts again and again.@nThe command ' ' does nothing, only consuming the offset time.@n=SmartLine Sequenzer Hilfe@n @nDefiniere eine Sequenz von Kommandos um andere Maschinen zu steuern.@nNummern sind Blocknummern, wo die Kommandos hingesendet werden sollen@nDas Kommando 'on'/'off' wird für Maschinen und andere Blöcke verwendet@nOffset ist die Zeit zur nächsten Zeile in Sekunden (1..999).@nWird 'endlos' angeklickt, startet der Sequenzer immer wieder neu.@nDas Kommando ' ' macht nichts, die die Zeit zu verbrauchen.@n
running=läuft
stopped=gestoppt
### sequencer.lua ###
### timer.lua ###
Command=Kommando
Number(s)=Nummer(m)
### signaltower.lua ###
SmartLine Signal Tower=SmartLine Signalturm
### timer.lua ###
SmartLine Timer=SmartLine Timer
SmartLine Timer Help@n@nThe Timer is for a daytime controlled sending of commands@ne.g. to turn street lights on/off. The timer checks the @ntime every few seconds. If the block was just loaded, @nthe timer will check the last 4 hours for commands@nthat still need to be executed.=SmartLine Timer Hilfe@n@nDer Timer st zum Tageszeit abhängigem Senden von Kommandos@nDer Timer prüft die regeln alle paar Sekunden.@nFalls die Block gerade erst aktiviert wurde (Spieler kommt in die Nähe),@nwerden auch die Kommandos der letzten 4 Spielstunden@ngeprüft und ggf. ausgeführt.
Time=Zeit

View file

@ -0,0 +1,85 @@
# textdomain: smartline
### button.lua ###
Insert destination block number(s)=
SmartLine Button=
SmartLine Button/Switch=
connected with block=
switch,button 2s,button 4s,button 8s,button 16s=
### button.lua ###
### collector.lua ###
### playerdetector.lua ###
### repeater.lua ###
Save=
### collector.lua ###
Node number to send the events to:=
Node numbers to read the states from:=
Send an event if state is equal or larget than:=
SmartLine State Collector=
### display.lua ###
SmartLine Display=
### playerdetector.lua ###
Input the number(s) of the receiving node(s).=
Input the player name(s) separated by blanks,=
Player Detector=
Player Detector Help=
Player name(s):=
Receiver node numbers:=
Separate numbers via blanks, like '0123 0234'.=
SmartLine Player Detector=
or leave it blank for all players.=
### playerdetector.lua ###
### sequencer.lua ###
### timer.lua ###
close=
help=
### repeater.lua ###
Destination node numbers=
SmartLine Repeater=
connected with=
fault (overloaded)=
not connected=
### sequencer.lua ###
Offset/s=
Run endless=
SmartLine Sequencer=
SmartLine Sequencer Help@n @nDefine a sequence of commands to control other machines.@nNumbers(s) are the node numbers, the command shall sent to.@nThe commands 'on'/'off' are used for machines and other nodes.@nOffset is the time to the next line in seconds (1..999).@nIf endless is set, the Sequencer restarts again and again.@nThe command ' ' does nothing, only consuming the offset time.@n=
running=
stopped=
### sequencer.lua ###
### timer.lua ###
Command=
Number(s)=
### signaltower.lua ###
SmartLine Signal Tower=
### timer.lua ###
SmartLine Timer=
SmartLine Timer Help@n@nThe Timer is for a daytime controlled sending of commands@ne.g. to turn street lights on/off. The timer checks the @ntime every few seconds. If the block was just loaded, @nthe timer will check the last 4 hours for commands@nthat still need to be executed.=
Time=

View file

@ -3,15 +3,18 @@
SmartLine
=========
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
playerdetector.lua:
]]--
-- Load support for I18n
local S = smartline.S
local function switch_on(pos)
local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos)
@ -56,15 +59,19 @@ local function scan_for_player(pos)
end
local function formspec_help()
local help = table.concat({
S("Input the number(s) of the receiving node(s)."),
S("Separate numbers via blanks, like '0123 0234'."),
S("Input the player name(s) separated by blanks,"),
S("or leave it blank for all players.")
}, "\n")
return "size[10,9]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[3,0;Player Detector Help]"..
"label[0,1;Input the number(s) of the receiving node(s).\n"..
"Separate numbers via blanks, like '0123 0234'.\n\n"..
"Input the player name(s) separated by blanks,\nor empty for all players.]"..
"button_exit[4,8;2,1;exit;close]"
"label[3,0;"..S("Player Detector Help").."]"..
"label[0,1;"..help.."]"..
"button_exit[4,8;2,1;exit2;"..S("close").."]"
end
@ -73,26 +80,27 @@ local function formspec(numbers, names)
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[2,0;Player Detector]"..
"field[0.3,1;8,1;numbers;Receiver node numbers:;"..numbers.."]" ..
"field[0.3,2.5;8,1;names;Player name(s):;"..names.."]" ..
"button_exit[5,3.5;2,1;exit;Save]"..
"button[1,3.5;1,1;help;help]"
"label[2,0;"..S("Player Detector").."]"..
"field[0.3,1;8,1;numbers;"..S("Receiver node numbers:")..";"..numbers.."]" ..
"field[0.3,2.5;8,1;names;"..S("Player name(s):")..";"..names.."]" ..
"button_exit[5,3.5;2,1;exit1;"..S("Save").."]"..
"button[1,3.5;1,1;help;"..S("help").."]"
end
local function on_receive_fields(pos, formname, fields, player)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
if player:get_player_name() == owner then
if fields.exit == "Save" then
print(dump(fields))
if fields.exit1 then
if tubelib.check_numbers(fields.numbers) then
meta:set_string("numbers", fields.numbers)
end
meta:set_string("names", fields.names)
meta:set_string("formspec", formspec(fields.numbers, fields.names))
elseif fields.help ~= nil then
elseif fields.help then
meta:set_string("formspec", formspec_help())
elseif fields.exit == "close" then
elseif fields.exit2 then
local numbers = meta:get_string("numbers")
local names = meta:get_string("names")
meta:set_string("formspec", formspec(numbers, names))
@ -101,7 +109,7 @@ local function on_receive_fields(pos, formname, fields, player)
end
minetest.register_node("smartline:playerdetector", {
description = "SmartLine Player Detector",
description = S("SmartLine Player Detector"),
inventory_image = "smartline_detector_inventory.png",
tiles = {
-- up, down, right, left, back, front
@ -127,7 +135,7 @@ minetest.register_node("smartline:playerdetector", {
local numbers = meta:get_string("numbers") or ""
local names = meta:get_string("names") or ""
meta:set_string("formspec", formspec(numbers, names))
meta:set_string("infotext", "SmartLine Player Detector "..number)
meta:set_string("infotext", S("SmartLine Player Detector").." "..number)
meta:set_string("owner", placer:get_player_name())
minetest.get_node_timer(pos):start(1)
end,
@ -159,7 +167,7 @@ minetest.register_node("smartline:playerdetector", {
})
minetest.register_node("smartline:playerdetector_active", {
description = "SmartLine Player Detector",
description = S("SmartLine Player Detector"),
tiles = {
-- up, down, right, left, back, front
"smartline.png",

View file

@ -3,9 +3,9 @@
SmartLine
=========
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
repeater.lua:
@ -13,17 +13,20 @@
]]--
-- Load support for I18n
local S = smartline.S
local OVER_LOAD_MAX = 5
local function formspec(meta)
local numbers = meta:get_string("numbers")
return "size[7,5]"..
"field[0.5,2;6,1;number;Destination node numbers;"..numbers.."]" ..
"button_exit[1,3;2,1;exit;Save]"
"field[0.5,2;6,1;number;"..S("Destination node numbers")..";"..numbers.."]" ..
"button_exit[1,3;2,1;exit;"..S("Save").."]"
end
minetest.register_node("smartline:repeater", {
description = "SmartLine Repeater",
description = S("SmartLine Repeater"),
inventory_image = "smartline_repeater_inventory.png",
tiles = {
-- up, down, right, left, back, front
@ -48,7 +51,7 @@ minetest.register_node("smartline:repeater", {
local own_number = tubelib.add_node(pos, "smartline:repeater")
meta:set_string("own_number", own_number)
meta:set_string("formspec", formspec(meta))
meta:set_string("infotext", "SmartLine Repeater "..own_number..": not connected")
meta:set_string("infotext", S("SmartLine Repeater").." "..own_number..": "..S("not connected"))
meta:set_string("owner", placer:get_player_name())
meta:set_int("overload_cnt", 0)
minetest.get_node_timer(pos):start(1)
@ -64,7 +67,7 @@ minetest.register_node("smartline:repeater", {
if tubelib.check_numbers(fields.number) then
meta:set_string("numbers", fields.number)
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "SmartLine Repeater "..own_number..": connected with "..fields.number)
meta:set_string("infotext", S("SmartLine Repeater").." "..own_number..": "..S("connected with").." "..fields.number)
meta:set_string("formspec", formspec(meta))
end
@ -114,12 +117,12 @@ tubelib.register_node("smartline:repeater", {}, {
meta:set_int("overload_cnt", overload_cnt)
if overload_cnt > OVER_LOAD_MAX then
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "SmartLine Repeater "..own_number..": fault (overloaded)")
meta:set_string("infotext", S("SmartLine Repeater").." "..own_number..": "..S("fault (overloaded)"))
minetest.get_node_timer(pos):stop()
return false
elseif topic == "set_numbers" then
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "SmartLine Repeater "..own_number..": connected with "..payload)
meta:set_string("infotext", S("SmartLine Repeater").." "..own_number..": "..S("connected with").." "..payload)
meta:set_string("numbers", payload)
meta:set_string("formspec", formspec(meta))
return true

View file

@ -3,9 +3,9 @@
SmartLine
=========
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
sequencer.lua:
@ -13,11 +13,15 @@
]]--
-- Load support for I18n
local S = smartline.S
local RUNNING_STATE = 1
local STOP_STATE = 0
local NUM_SLOTS = 8
local sHELP = [[label[0,0;SmartLine Sequencer Help
local sHELP = "label[0,0;"..
S([[SmartLine Sequencer Help
Define a sequence of commands to control other machines.
Numbers(s) are the node numbers, the command shall sent to.
@ -25,8 +29,8 @@ The commands 'on'/'off' are used for machines and other nodes.
Offset is the time to the next line in seconds (1..999).
If endless is set, the Sequencer restarts again and again.
The command ' ' does nothing, only consuming the offset time.
]
]]
]])..
"]"
local sAction = ",on,off"
@ -39,15 +43,15 @@ local function formspec(state, rules, endless)
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[0,0;Number(s)]label[2.1,0;Command]label[6.4,0;Offset/s]"}
"label[0,0;"..S("Number(s)").."]label[2.1,0;"..S("Command").."]label[6.4,0;"..S("Offset/s").."]"}
for idx, rule in ipairs(rules or {}) do
tbl[#tbl+1] = "field[0.2,"..(-0.2+idx)..";2,1;num"..idx..";;"..(rule.num or "").."]"
tbl[#tbl+1] = "dropdown[2,"..(-0.4+idx)..";3.9,1;act"..idx..";"..sAction..";"..(rule.act or "").."]"
tbl[#tbl+1] = "field[6.2,"..(-0.2+idx)..";2,1;offs"..idx..";;"..(rule.offs or "").."]"
end
tbl[#tbl+1] = "checkbox[0,8.5;endless;Run endless;"..endless.."]"
tbl[#tbl+1] = "button[4.5,8.5;1.5,1;help;help]"
tbl[#tbl+1] = "checkbox[0,8.5;endless;"..S("Run endless")..";"..endless.."]"
tbl[#tbl+1] = "button[4.5,8.5;1.5,1;help;"..S("help").."]"
tbl[#tbl+1] = "image_button[6.5,8.5;1,1;".. tubelib.state_button(state) ..";button;]"
return table.concat(tbl)
@ -58,10 +62,10 @@ local function formspec_help()
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"field[0,0;0,0;_type_;;help]"..
"field[0,0;0,0;_type_;;"..S("help").."]"..
sHELP..
--"label[0.2,0;test]"..
"button[11.5,9;1.5,1;close;close]"
"button[11.5,9;1.5,1;close;"..S("close").."]"
end
local function stop_the_sequencer(pos)
@ -69,7 +73,7 @@ local function stop_the_sequencer(pos)
local meta = minetest.get_meta(pos)
local number = meta:get_string("number")
meta:set_int("running", STOP_STATE)
meta:set_string("infotext", "SmartLine Sequencer "..number..": stopped")
meta:set_string("infotext", S("SmartLine Sequencer").." "..number..": "..S("stopped"))
local rules = minetest.deserialize(meta:get_string("rules"))
local endless = meta:get_int("endless") or 0
meta:set_string("formspec", formspec(tubelib.STOPPED, rules, endless))
@ -120,7 +124,7 @@ local function check_rules(pos, elapsed)
if index == 1 and offs < 1 then
offs = 2
end
meta:set_string("infotext", "SmartLine Sequencer "..number..": running ("..index.."/"..NUM_SLOTS..")")
meta:set_string("infotext", S("SmartLine Sequencer").." "..number..": "..S("running").." ("..index.."/"..NUM_SLOTS..")")
meta:set_int("index", index)
if offs > 0 then
minetest.after(0, restart_timer, pos, offs)
@ -142,7 +146,7 @@ local function start_the_sequencer(pos)
local number = meta:get_string("number")
meta:set_int("running", RUNNING_STATE)
meta:set_int("index", 1)
meta:set_string("infotext", "SmartLine Sequencer "..number..": running (1/"..NUM_SLOTS..")")
meta:set_string("infotext", S("SmartLine Sequencer").." "..number..": "..S("running").." (1/"..NUM_SLOTS..")")
local rules = minetest.deserialize(meta:get_string("rules"))
local endless = meta:get_int("endless") or 0
meta:set_string("formspec", formspec(tubelib.RUNNING, rules, endless))
@ -202,7 +206,7 @@ local function on_receive_fields(pos, formname, fields, player)
end
minetest.register_node("smartline:sequencer", {
description = "SmartLine Sequencer",
description = S("SmartLine Sequencer"),
inventory_image = "smartline_sequencer_inventory.png",
wield_image = "smartline_sequencer_inventory.png",
stack_max = 1,
@ -237,7 +241,7 @@ minetest.register_node("smartline:sequencer", {
meta:set_int("endless", 0)
meta:get_int("running", STOP_STATE)
meta:set_string("formspec", formspec(tubelib.STOPPED, rules, 0))
meta:set_string("infotext", "SmartLine Sequencer "..number)
meta:set_string("infotext", S("SmartLine Sequencer").." "..number)
end,
on_receive_fields = on_receive_fields,

View file

@ -3,15 +3,17 @@
SmartLine
=========
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
signaltower.lua:
]]--
-- Load support for I18n
local S = smartline.S
local function switch_on(pos, node, color)
local meta = minetest.get_meta(pos)
@ -28,7 +30,7 @@ local function switch_off(pos, node)
end
minetest.register_node("smartline:signaltower", {
description = "SmartLine Signal Tower",
description = S("SmartLine Signal Tower"),
tiles = {
'smartline_signaltower_top.png',
'smartline_signaltower_top.png',
@ -47,7 +49,7 @@ minetest.register_node("smartline:signaltower", {
local number = tubelib.add_node(pos, "smartline:signaltower")
local meta = minetest.get_meta(pos)
meta:set_string("state", "off")
meta:set_string("infotext", "SmartLine Signal Tower "..number)
meta:set_string("infotext", S("SmartLine Signal Tower").." "..number)
end,
on_rightclick = function(pos, node, clicker)
@ -71,7 +73,7 @@ minetest.register_node("smartline:signaltower", {
for _,color in ipairs({"green", "amber", "red"}) do
minetest.register_node("smartline:signaltower_"..color, {
description = "SmartLine Signal Tower",
description = S("SmartLine Signal Tower"),
tiles = {
'smartline_signaltower_top.png',
'smartline_signaltower_top.png',

View file

@ -3,9 +3,9 @@
SmartLine
=========
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
timer.lua:
@ -13,13 +13,20 @@
]]--
-- Load support for I18n
local S = smartline.S
local CYCLE_TIME = 8
local sHELP = [[label[0,0;SmartLine Timer Help
local sHELP = "label[0,0;"..
S([[SmartLine Timer Help
tbd
]
]]
The Timer is for a daytime controlled sending of commands
e.g. to turn street lights on/off. The timer checks the
time every few seconds. If the block was just loaded,
the timer will check the last 4 hours for commands
that still need to be executed.]])..
"]"
local tTime = {
@ -45,7 +52,7 @@ local function formspec(events, numbers, actions)
default.gui_bg_img..
default.gui_slots..
"label[0,0;Time]label[2.3,0;Number(s)]label[4.5,0;Command]"..
"label[0,0;"..S("Time").."]label[2.3,0;"..S("Number(s)").."]label[4.5,0;"..S("Command").."]"..
"dropdown[0,1;2,1;e1;"..sTime..";"..events[1].."]"..
"field[2.3,1.2;2,1;n1;;"..numbers[1].."]" ..
"dropdown[4.5,1;3,1;a1;"..sAction..";"..tAction[actions[1]].."]"..
@ -70,8 +77,8 @@ local function formspec(events, numbers, actions)
"field[2.3,6.2;2,1;n6;;"..numbers[6].."]" ..
"dropdown[4.5,6;3,1;a6;"..sAction..";"..tAction[actions[6]].."]"..
"button[4.5,7;1.5,1;help;help]"..
"button_exit[6.5,7;1.5,1;exit;close]"
"button[4.5,7;1.5,1;help;"..S("help").."]"..
"button_exit[6.5,7;1.5,1;exit;"..S("close").."]"
end
local function formspec_help()
@ -79,10 +86,10 @@ local function formspec_help()
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"field[0,0;0,0;_type_;;help]"..
"field[0,0;0,0;_type_;;"..S("help").."]"..
sHELP..
--"label[0.2,0;test]"..
"button[11.5,9;1.5,1;close;close]"
"button[11.5,9;1.5,1;close;"..S("close").."]"
end
local function check_rules(pos,elapsed)
@ -120,7 +127,7 @@ local function check_rules(pos,elapsed)
done = {false,false,false,false,false,false}
end
meta:set_string("done", minetest.serialize(done))
meta:set_string("infotext","SmartLine Timer ("..own_num..")"..hour..":00")
meta:set_string("infotext", S("SmartLine Timer").." "..own_num..": "..hour..":00")
return true
end
return false
@ -128,7 +135,7 @@ end
minetest.register_node("smartline:timer", {
description = "SmartLine Timer",
description = S("SmartLine Timer"),
inventory_image = "smartline_timer_inventory.png",
wield_image = "smartline_timer_inventory.png",
stack_max = 1,

View file

@ -3,16 +3,19 @@
TechPack Stairway
=================
Copyright (C) 2019 Joachim Stolberg
Copyright (C) 2019-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
init.lua
]]--
S = minetest.get_translator("techpack_stairway")
minetest.register_node("techpack_stairway:grating", {
description = "TechPack Grating",
description = S("TechPack Grating"),
tiles = {
'techpack_stairway_bottom.png',
'techpack_stairway_bottom.png',
@ -43,7 +46,7 @@ minetest.register_node("techpack_stairway:grating", {
})
minetest.register_node("techpack_stairway:handrail1", {
description = "TechPack Handrail 1",
description = S("TechPack Handrail 1"),
tiles = {
'techpack_stairway_bottom.png',
'techpack_stairway_bottom.png',
@ -74,7 +77,7 @@ minetest.register_node("techpack_stairway:handrail1", {
})
minetest.register_node("techpack_stairway:handrail2", {
description = "TechPack Handrail 2",
description = S("TechPack Handrail 2"),
tiles = {
'techpack_stairway_bottom.png',
'techpack_stairway_bottom.png',
@ -107,7 +110,7 @@ minetest.register_node("techpack_stairway:handrail2", {
})
minetest.register_node("techpack_stairway:handrail3", {
description = "TechPack Handrail 3",
description = S("TechPack Handrail 3"),
tiles = {
'techpack_stairway_bottom.png',
'techpack_stairway_bottom.png',
@ -140,7 +143,7 @@ minetest.register_node("techpack_stairway:handrail3", {
})
minetest.register_node("techpack_stairway:handrail4", {
description = "TechPack Handrail 4",
description = S("TechPack Handrail 4"),
tiles = {
'techpack_stairway_bottom.png',
'techpack_stairway_bottom.png',
@ -175,7 +178,7 @@ minetest.register_node("techpack_stairway:handrail4", {
})
minetest.register_node("techpack_stairway:bridge1", {
description = "TechPack Bridge 1",
description = S("TechPack Bridge 1"),
tiles = {
'techpack_stairway_bottom.png',
'techpack_stairway_bottom.png',
@ -207,7 +210,7 @@ minetest.register_node("techpack_stairway:bridge1", {
})
minetest.register_node("techpack_stairway:bridge2", {
description = "TechPack Bridge 2",
description = S("TechPack Bridge 2"),
tiles = {
'techpack_stairway_bottom.png',
'techpack_stairway_bottom.png',
@ -240,7 +243,7 @@ minetest.register_node("techpack_stairway:bridge2", {
})
minetest.register_node("techpack_stairway:bridge3", {
description = "TechPack Bridge 3",
description = S("TechPack Bridge 3"),
tiles = {
'techpack_stairway_bottom.png',
'techpack_stairway_bottom.png',
@ -273,7 +276,7 @@ minetest.register_node("techpack_stairway:bridge3", {
})
minetest.register_node("techpack_stairway:bridge4", {
description = "TechPack Bridge 4",
description = S("TechPack Bridge 4"),
tiles = {
'techpack_stairway_bottom.png',
'techpack_stairway_bottom.png',
@ -307,7 +310,7 @@ minetest.register_node("techpack_stairway:bridge4", {
})
minetest.register_node("techpack_stairway:stairway", {
description = "TechPack Stairway",
description = S("TechPack Stairway"),
tiles = {
'techpack_stairway_steps.png',
'techpack_stairway_steps.png',
@ -345,7 +348,7 @@ minetest.register_node("techpack_stairway:stairway", {
})
minetest.register_node("techpack_stairway:ladder1", {
description = "TechPack Ladder 1",
description = S("TechPack Ladder 1"),
tiles = {
'techpack_stairway_steps.png',
'techpack_stairway_steps.png',
@ -376,7 +379,7 @@ minetest.register_node("techpack_stairway:ladder1", {
})
minetest.register_node("techpack_stairway:ladder2", {
description = "TechPack Ladder 2",
description = S("TechPack Ladder 2"),
tiles = {
'techpack_stairway_steps.png',
'techpack_stairway_steps.png',
@ -408,7 +411,7 @@ minetest.register_node("techpack_stairway:ladder2", {
})
minetest.register_node("techpack_stairway:ladder3", {
description = "TechPack Ladder 3",
description = S("TechPack Ladder 3"),
tiles = {
'techpack_stairway_steps.png',
'techpack_stairway_steps.png',
@ -439,8 +442,39 @@ minetest.register_node("techpack_stairway:ladder3", {
sounds = default.node_sound_metal_defaults(),
})
minetest.register_node("techpack_stairway:ladder4", {
description = S("TechPack Ladder 4"),
tiles = {
'techpack_stairway_ladder.png',
},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-17/32, -17/32, 15/32, 17/32, 17/32, 17/32},
--{-17/32, -17/32, -17/32, -15/32, 17/32, 17/32},
--{-17/32, -17/32, -17/32, 17/32, 17/32, -15/32},
--{ 15/32, -17/32, -17/32, 17/32, 17/32, 17/32},
},
},
selection_box = {
type = "fixed",
fixed = {-8/16, -8/16, 6/16, 8/16, 8/16, 8/16},
},
climbable = true,
paramtype2 = "facedir",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky = 2},
sounds = default.node_sound_metal_defaults(),
})
minetest.register_node("techpack_stairway:lattice", {
description = "TechPack Lattice",
description = S("TechPack Lattice"),
tiles = {
'techpack_stairway_lattice.png',
},
@ -470,6 +504,53 @@ minetest.register_node("techpack_stairway:lattice", {
sounds = default.node_sound_metal_defaults(),
})
minetest.register_node("techpack_stairway:lattice_slop", {
description = S("TechPack Lattice Slope"),
tiles = {
'techpack_stairway_lattice.png',
},
drawtype = "mesh",
mesh="techpack_stairway_slope.obj",
selection_box = {
type = "fixed",
fixed = {
{-8/16, 4/16, 4/16, 8/16, 8/16, 8/16},
{-8/16, 0/16, 0/16, 8/16, 4/16, 8/16},
{-8/16, -4/16, -4/16, 8/16, 0/16, 8/16},
{-8/16, -8/16, -8/16, 8/16, -4/16, 8/16},
},
},
collision_box = {
type = "fixed",
fixed = {
{-8/16, 4/16, 4/16, 8/16, 8/16, 8/16},
{-8/16, 0/16, 0/16, 8/16, 4/16, 8/16},
{-8/16, -4/16, -4/16, 8/16, 0/16, 8/16},
{-8/16, -8/16, -8/16, 8/16, -4/16, 8/16},
},
},
after_place_node = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
local dir = minetest.facedir_to_dir(node.param2)
if pointed_thing.under.y >= pointed_thing.above.y then
local newparam2 = ({[0] = 8, [1] = 17, [2] = 22, [3] = 15})[node.param2]
if newparam2 then
node.param2 = newparam2
minetest.swap_node(pos, node)
end
end
end,
paramtype2 = "facedir",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky = 2},
sounds = default.node_sound_metal_defaults(),
})
minetest.register_craft({
output = "techpack_stairway:grating 4",
@ -516,6 +597,15 @@ minetest.register_craft({
},
})
minetest.register_craft({
output = "techpack_stairway:ladder4 8",
recipe = {
{"dye:dark_grey", "default:tin_ingot", "default:coal_lump"},
{"", "default:steel_ingot", ""},
{"", "default:steel_ingot", ""},
},
})
minetest.register_craft({
output = "techpack_stairway:lattice 2",
recipe = {
@ -525,6 +615,10 @@ minetest.register_craft({
},
})
minetest.register_craft({
output = "techpack_stairway:lattice_slop 2",
recipe = {{"techpack_stairway:lattice"}},
})
minetest.register_craft({
output = "techpack_stairway:handrail2",

View file

@ -0,0 +1,22 @@
# textdomain: techpack_stairway
### init.lua ###
TechPack Bridge 1=TechPack Brücke 1
TechPack Bridge 2=TechPack Brücke 2
TechPack Bridge 3=TechPack Brücke 3
TechPack Bridge 4=TechPack Brücke 4
TechPack Grating=TechPack Gitterrost
TechPack Handrail 1=TechPack Geländer 1
TechPack Handrail 2=TechPack Geländer 2
TechPack Handrail 3=TechPack Geländer 3
TechPack Handrail 4=TechPack Geländer 4
TechPack Ladder 1=TechPack Leiter 1
TechPack Ladder 2=TechPack Leiter 2
TechPack Ladder 3=TechPack Leiter 3
TechPack Ladder 4=TechPack Leiter 4
TechPack Lattice=TechPack Gitterrahmen
TechPack Lattice Slope=TechPack Gitterrahmenrampe
TechPack Stairway=TechPack Treppe

View file

@ -0,0 +1,22 @@
# textdomain: techpack_stairway
### init.lua ###
TechPack Bridge 1=
TechPack Bridge 2=
TechPack Bridge 3=
TechPack Bridge 4=
TechPack Grating=
TechPack Handrail 1=
TechPack Handrail 2=
TechPack Handrail 3=
TechPack Handrail 4=
TechPack Ladder 1=
TechPack Ladder 2=
TechPack Ladder 3=
TechPack Ladder 4=
TechPack Lattice=
TechPack Lattice Slope=
TechPack Stairway=

View file

@ -3,23 +3,25 @@
TechPack Warehouse
==================
Copyright (C) 2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
box_copper.lua
]]--
-- Load support for I18n
local S = techpack_warehouse.S
--- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
local wh = techpack_warehouse
local NODE_NAME = "techpack_warehouse:box_copper"
local DESCRIPTION = "Warehouse Box Copper"
local DESCRIPTION = S("Warehouse Box Copper")
local INV_SIZE = 1200
local BACKGROUND_IMG = "default_copper_block.png"

View file

@ -3,23 +3,25 @@
TechPack Warehouse
==================
Copyright (C) 2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
box_gold.lua
]]--
-- Load support for I18n
local S = techpack_warehouse.S
--- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
local wh = techpack_warehouse
local NODE_NAME = "techpack_warehouse:box_gold"
local DESCRIPTION = "Warehouse Box Gold"
local DESCRIPTION = S("Warehouse Box Gold")
local INV_SIZE = 3600
local BACKGROUND_IMG = "default_gold_block.png"

View file

@ -3,23 +3,25 @@
TechPack Warehouse
==================
Copyright (C) 2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
box_steel.lua
]]--
-- Load support for I18n
local S = techpack_warehouse.S
--- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
local wh = techpack_warehouse
local NODE_NAME = "techpack_warehouse:box_steel"
local DESCRIPTION = "Warehouse Box Steel"
local DESCRIPTION = S("Warehouse Box Steel")
local INV_SIZE = 400
local BACKGROUND_IMG = "default_steel_block.png"

View file

@ -3,17 +3,19 @@
TechPack Warehouse
==================
Copyright (C) 2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
common.lua
]]--
-- Load support for I18n
local S = techpack_warehouse.S
--- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -49,10 +51,10 @@ local function formspec(self, pos, meta)
"list[context;input;1,3.6;8,1;]"..
"image_button[9,3.6;1,1;techpack_warehouse_input_inv.png;input;;true;false;]"..
"tooltip[shift;Pass-through storage for unconfigured items (turn on/off)]"..
"tooltip[filter;Filter: To configure the 8 storages]"..
"tooltip[storage;Storage: All items will be stored here]"..
"tooltip[input;Input: Put items will be moved to the storage, if configured]"..
"tooltip[shift;"..S("Pass-through storage for unconfigured items (turn on/off)").."]"..
"tooltip[filter;"..S("Filter: To configure the 8 storages").."]"..
"tooltip[storage;"..S("Storage: All items will be stored here").."]"..
"tooltip[input;"..S("Input: Put items will be moved to the storage, if configured").."]"..
"list[current_player;main;1,5.3;8,4;]"..
"listring[context;shift]"..

View file

@ -3,9 +3,9 @@
TechPack Warehouse
==================
Copyright (C) 2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
init.lua
@ -14,6 +14,10 @@
techpack_warehouse = {}
-- Load support for I18n
techpack_warehouse.S = minetest.get_translator("techpack_warehouse")
dofile(minetest.get_modpath("techpack_warehouse") .. "/common.lua")
dofile(minetest.get_modpath("techpack_warehouse") .. "/box_steel.lua")
dofile(minetest.get_modpath("techpack_warehouse") .. "/box_copper.lua")

View file

@ -0,0 +1,22 @@
# textdomain: techpack_warehouse
### box_copper.lua ###
Warehouse Box Copper=
### box_gold.lua ###
Warehouse Box Gold=
### box_steel.lua ###
Warehouse Box Steel=
### common.lua ###
Filter: To configure the 8 storages=
Input: Put items will be moved to the storage, if configured=
Pass-through storage for unconfigured items (turn on/off)=
Storage: All items will be stored here=

View file

@ -3,15 +3,18 @@
Tube Library
============
Copyright (C) 2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
basalt.lua:
]]--
-- Load support for I18n
local S = tubelib.S
if tubelib.basalt_stone_enabled then
-- Replace default:stone with tubelib:basalt which is useless for ore generation.
default.cool_lava = function(pos, node)
@ -25,14 +28,14 @@ if tubelib.basalt_stone_enabled then
end
minetest.register_node("tubelib:basalt_stone", {
description = "Basalt Stone",
description = S("Basalt Stone"),
tiles = {"default_stone.png^[brighten"},
groups = {cracky = 3, stone = 1},
drop = "default:silver_sand",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("tubelib:basalt_stone_brick", {
description = "Basalt Stone Brick",
description = S("Basalt Stone Brick"),
paramtype2 = "facedir",
place_param2 = 0,
tiles = {"default_stone_brick.png^[brighten"},
@ -42,7 +45,7 @@ if tubelib.basalt_stone_enabled then
})
minetest.register_node("tubelib:basalt_stone_block", {
description = "Basalt Stone Block",
description = S("Basalt Stone Block"),
tiles = {"default_stone_block.png^[brighten"},
is_ground_content = false,
groups = {cracky = 2, stone = 1},

View file

@ -3,9 +3,9 @@
Tube Library
============
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
blackhole.lua:
@ -24,9 +24,11 @@
-- | |/
-- +--------+
-- Load support for I18n
local S = tubelib.S
minetest.register_node("tubelib:blackhole", {
description = "Tubelib Black Hole",
description = S("Tubelib Black Hole"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -42,7 +44,7 @@ minetest.register_node("tubelib:blackhole", {
local number = tubelib.add_node(pos, "tubelib:blackhole") -- <<=== tubelib
meta:set_string("number", number)
meta:set_int("disappeared", 0)
meta:set_string("infotext","0 items disappeared")
meta:set_string("infotext", "0 "..S("items disappeared"))
end,
after_dig_node = function(pos)
@ -79,7 +81,7 @@ tubelib.register_node("tubelib:blackhole", {}, {
local meta = minetest.get_meta(pos)
local disappeared = meta:get_int("disappeared") + item:get_count()
meta:set_int("disappeared", disappeared)
meta:set_string("infotext", disappeared.." items disappeared")
meta:set_string("infotext", disappeared.." "..S("items disappeared"))
return true
end
return false

View file

@ -3,9 +3,9 @@
Tube Library
============
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
button.lua:
@ -14,9 +14,11 @@
]]--
-- Load support for I18n
local S = tubelib.S
local function switch_on(pos, node)
if tubelib.data_not_corrupted(pos) then
if tubelib.data_not_corrupted(pos, true) then
node.name = "tubelib:button_active"
minetest.swap_node(pos, node)
minetest.sound_play("button", {
@ -41,7 +43,7 @@ local function switch_on(pos, node)
end
local function switch_off(pos)
if tubelib.data_not_corrupted(pos) then
if tubelib.data_not_corrupted(pos, true) then
local node = minetest.get_node(pos)
node.name = "tubelib:button"
minetest.swap_node(pos, node)
@ -65,7 +67,7 @@ end
minetest.register_node("tubelib:button", {
description = "Tubelib Button/Switch",
description = S("Tubelib Button/Switch"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -81,14 +83,14 @@ minetest.register_node("tubelib:button", {
local own_num = tubelib.add_node(pos, "tubelib:button")
meta:set_string("own_num", own_num)
meta:set_string("formspec", "size[7.5,6]"..
"dropdown[0.2,0;3;type;switch,button 2s,button 4s,button 8s,button 16s;1]"..
"field[0.5,2;7,1;numbers;Insert destination node number(s);]" ..
"checkbox[1,3;public;public;false]"..
"button_exit[2,4;3,1;exit;Save]")
"dropdown[0.2,0;3;type;"..S("switch,button 2s,button 4s,button 8s,button 16s")..";1]"..
"field[0.5,2;7,1;numbers;"..S("Insert destination node number(s)")..";]" ..
"checkbox[1,3;public;"..S("public")..";false]"..
"button_exit[2,4;3,1;exit;"..S("Save").."]")
meta:set_string("placer_name", placer:get_player_name())
meta:set_string("public", "false")
meta:set_int("cycle_time", 0)
meta:set_string("infotext", "Tubelib Button "..own_num)
meta:set_string("infotext", S("Tubelib Button").." "..own_num)
end,
on_receive_fields = function(pos, formname, fields, player)
@ -96,7 +98,7 @@ minetest.register_node("tubelib:button", {
if tubelib.check_numbers(fields.numbers) then -- <<=== tubelib
meta:set_string("numbers", fields.numbers)
local own_num = meta:get_string("own_num")
meta:set_string("infotext", "Tubelib Button "..own_num..", connected with block "..fields.numbers)
meta:set_string("infotext", S("Tubelib Button").." "..own_num..", "..S("connected with block").." "..fields.numbers)
else
return
end
@ -142,7 +144,7 @@ minetest.register_node("tubelib:button", {
minetest.register_node("tubelib:button_active", {
description = "Tubelib Button/Switch",
description = S("Tubelib Button/Switch"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',

View file

@ -3,9 +3,9 @@
Tube Library
============
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
command.lua:
@ -607,9 +607,11 @@ function tubelib.temporary_remove_node(pos, number, name, add_data)
add_data.name = name
TemporaryRemovedNodes[key] = add_data
else
local data = table.copy(TemporaryRemovedNodes[key])
TemporaryRemovedNodes[key] = nil
return data
if TemporaryRemovedNodes[key] then
local data = table.copy(TemporaryRemovedNodes[key])
TemporaryRemovedNodes[key] = nil
return data
end
end
end

View file

@ -1,5 +1,8 @@
-- Load support for I18n
local S = tubelib.S
minetest.register_node("tubelib:defect_dummy", {
description = "Corrupted Tubelib Node",
description = S("Corrupted Tubelib Node"),
tiles = {
"tubelib_front.png",
"tubelib_front.png",
@ -22,7 +25,7 @@ local function already_reported(pos)
end
function tubelib.data_not_corrupted(pos)
function tubelib.data_not_corrupted(pos, has_no_info)
if minetest.pos_to_string(pos) ~= minetest.get_meta(pos):get_string("my_pos") then
-- node number corrupt?
local meta = minetest.get_meta(pos)
@ -42,6 +45,13 @@ function tubelib.data_not_corrupted(pos)
report(pos)
end
end
-- button like odes
if has_no_info then
minetest.get_meta(pos):get_string("my_pos", minetest.pos_to_string(pos))
return true
end
-- node moved?
local info = tubelib.get_node_info(number)
if not info or not vector.equals(info.pos, pos) then

View file

@ -3,9 +3,9 @@
Tube Library
============
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
distributor.lua:
@ -19,8 +19,10 @@
response is "running", "stopped", "standby", "defect", or "not supported"
]]--
-- Load support for I18n
local S = tubelib.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -62,7 +64,7 @@ local State = tubelib.NodeStates:new({
node_name_passive = "tubelib:distributor",
node_name_active = "tubelib:distributor_active",
node_name_defect = "tubelib:distributor_defect",
infotext_name = "Tubelib Distributor",
infotext_name = S("Tubelib Distributor"),
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
aging_factor = 10,
@ -353,7 +355,7 @@ local function change_filter_settings(pos, slot, val)
end
minetest.register_node("tubelib:distributor", {
description = "Tubelib Distributor",
description = S("Tubelib Distributor"),
tiles = {
-- up, down, right, left, back, front
'tubelib_distributor.png',
@ -413,7 +415,7 @@ minetest.register_node("tubelib:distributor", {
minetest.register_node("tubelib:distributor_active", {
description = "Tubelib Distributor",
description = S("Tubelib Distributor"),
tiles = {
-- up, down, right, left, back, front
{
@ -451,7 +453,7 @@ minetest.register_node("tubelib:distributor_active", {
})
minetest.register_node("tubelib:distributor_defect", {
description = "Tubelib Distributor",
description = S("Tubelib Distributor"),
tiles = {
-- up, down, right, left, back, front
'tubelib_distributor.png',

View file

@ -3,17 +3,20 @@
Tube Library
============
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
forceload.lua:
]]--
-- Load support for I18n
local S = tubelib.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -109,22 +112,22 @@ local function formspec(player)
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[0,0;List of your Forceload Blocks:]"
"label[0,0;"..S("List of your Forceload Blocks")..":]"
for idx,pos in ipairs(lPos) do
local pos1, pos2 = calc_area(pos)
local ypos = 0.2 + idx * 0.4
tRes[#tRes+1] = "label[0,"..ypos..";"..idx.."]"
tRes[#tRes+1] = "label[0.8,"..ypos..";"..S(pos1).."]"
tRes[#tRes+1] = "label[3.2,"..ypos..";to]"
tRes[#tRes+1] = "label[4,"..ypos..";"..S(pos2).."]"
tRes[#tRes+1] = "label[0.8,"..ypos..";"..P2S(pos1).."]"
tRes[#tRes+1] = "label[3.2,"..ypos..";"..S("to").."]"
tRes[#tRes+1] = "label[4,"..ypos..";"..P2S(pos2).."]"
end
return table.concat(tRes)
end
minetest.register_node("tubelib:forceload", {
description = "Tubelib Forceload Block",
description = S("Tubelib Forceload Block"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -145,13 +148,13 @@ minetest.register_node("tubelib:forceload", {
if add_pos(pos, placer) then
minetest.forceload_block(pos, true)
local pos1, pos2, num, max = get_data(pos, placer)
M(pos):set_string("infotext", "Area "..S(pos1).." to "..S(pos2).." loaded!\n"..
"Punch the block to make the area visible.")
chat(placer, "Area ("..num.."/"..max..") "..S(pos1).." to "..S(pos2).." loaded!")
M(pos):set_string("infotext", S("Area").." "..P2S(pos1).." "..S("to").." "..P2S(pos2).." "..S("loaded!").."\n"..
S("Punch the block to make the area visible."))
chat(placer, S("Area").." ("..num.."/"..max..") "..P2S(pos1).." "..S("to").." "..P2S(pos2).." "..S("loaded!"))
tubelib.mark_region(placer:get_player_name(), pos1, pos2)
M(pos):set_string("owner", placer:get_player_name())
else
chat(placer, "Area already loaded or max. number of Forceload Blocks reached!")
chat(placer, S("Area already loaded or max. number of Forceload Blocks reached!"))
minetest.remove_node(pos)
return itemstack
end

View file

@ -3,9 +3,9 @@
Tube Library
============
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
History:
@ -34,6 +34,10 @@ tubelib = {
NodeDef = {}, -- node registration info
}
-- Load support for I18n
tubelib.S = minetest.get_translator("tubelib")
local S = tubelib.S
tubelib.version = 2.00
tubelib.max_num_forceload_blocks = tonumber(minetest.setting_get("tubelib_max_num_forceload_blocks")) or 10
@ -78,7 +82,7 @@ minetest.register_lbm({
})
minetest.register_craftitem("tubelib:wlanchip", {
description = "Tubelib WLAN Chip",
description = S("Tubelib WLAN Chip"),
inventory_image = "tubelib_wlanchip.png",
})

View file

@ -3,9 +3,9 @@
Tube Library
============
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
lamp.lua:
@ -18,6 +18,9 @@
]]--
-- Load support for I18n
local S = tubelib.S
local function switch_on(pos, node)
node.name = "tubelib:lamp_on"
minetest.swap_node(pos, node)
@ -29,7 +32,7 @@ local function switch_off(pos, node)
end
minetest.register_node("tubelib:lamp", {
description = "Tubelib Lamp",
description = S("Tubelib Lamp"),
tiles = {
'tubelib_lamp.png',
},
@ -37,7 +40,7 @@ minetest.register_node("tubelib:lamp", {
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "tubelib:lamp") -- <<=== tubelib
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Tubelib Lamp "..number)
meta:set_string("infotext", S("Tubelib Lamp").." "..number)
end,
on_rightclick = function(pos, node, clicker)
@ -60,7 +63,7 @@ minetest.register_node("tubelib:lamp", {
})
minetest.register_node("tubelib:lamp_on", {
description = "Tubelib Lamp",
description = S("Tubelib Lamp"),
tiles = {
'tubelib_lamp.png',
},

View file

@ -3,9 +3,9 @@
Tube Library
============
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
legacy_nodes.lua:

View file

@ -0,0 +1,69 @@
# textdomain: tubelib
### basalt.lua ###
Basalt Stone=
Basalt Stone Block=
Basalt Stone Brick=
### blackhole.lua ###
Tubelib Black Hole=
items disappeared=
### button.lua ###
Insert destination node number(s)=
Save=
Tubelib Button=
Tubelib Button/Switch=
connected with block=
public=
switch,button 2s,button 4s,button 8s,button 16s=
### defect.lua ###
Corrupted Tubelib Node=
### distributor.lua ###
Tubelib Distributor=
### forceload.lua ###
Area=
Area already loaded or max. number of Forceload Blocks reached!=
List of your Forceload Blocks=
Punch the block to make the area visible.=
Tubelib Forceload Block=
loaded!=
to=
### init.lua ###
Tubelib WLAN Chip=
### lamp.lua ###
Tubelib Lamp=
### pusher.lua ###
Tubelib Pusher=
### repairkit.lua ###
Tubelib End Wrench (use @= read status, place @= destroy)=
Tubelib Repair Kit=
[Tubelib] Node repaired=
[Tubelib] state=
aging=
counter=
### tubes.lua ###
Tubelib Tube=

View file

@ -0,0 +1,69 @@
# textdomain: tubelib
### basalt.lua ###
Basalt Stone=Basaltstein
Basalt Stone Block=Basaltsteinblock
Basalt Stone Brick=Basaltsteinziegel
### blackhole.lua ###
Tubelib Black Hole=Tubelib Schwarzes Loch
items disappeared=Gegenstände verschwunden
### button.lua ###
Insert destination node number(s)=Zielblocknummer(n) eingeben
Save=Speichern
Tubelib Button=Tubelib Taster
Tubelib Button/Switch=Tubelib Taster/Schalter
connected with block=verbunden mit Block
public=öffentlich
switch,button 2s,button 4s,button 8s,button 16s=Schalter,Taster 2s,Taster 4s,Taster 8s,Taster 16s
### defect.lua ###
Corrupted Tubelib Node=beschädigter Tubelib Block
### distributor.lua ###
Tubelib Distributor=Tubelib Verteiler
### forceload.lua ###
Area=Bereich
Area already loaded or max. number of Forceload Blocks reached!=Bereich bereits geladen oder max. Anzahl von Forceload Blöcken erreicht!
List of your Forceload Blocks=Liste deiner Forceload Blöcke
Punch the block to make the area visible.=Schlage den Block um den Bereich anzuzeigen
Tubelib Forceload Block=Tubelib Forceload Block
loaded!=geladen!
to=bis
### init.lua ###
Tubelib WLAN Chip=Tubelib WLAN Chip
### lamp.lua ###
Tubelib Lamp=Tubelib Lampe
### pusher.lua ###
Tubelib Pusher=Tubelib Schieber
### repairkit.lua ###
Tubelib End Wrench (use @= read status, place @= destroy)=Tubelib Gabelschlüssel (benutzen @= Status lesen, platzieren @= zerstören)
Tubelib Repair Kit=Tubelib Reparatur Kit
[Tubelib] Node repaired=[Tubelib] Block repariert
[Tubelib] state=Tubelib Zustand
aging=altern
counter=Zähler
### tubes.lua ###
Tubelib Tube=Tubelib Röhre

View file

@ -3,10 +3,10 @@
Tube Library
============
Copyright (C) 2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
Code derived from wordedit (sfan5, Anthony Zhang (Uberi/Temperest), and Brett O'Donnell (cornernote))
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
mark.lua:

View file

@ -3,9 +3,9 @@
Tube Library
============
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
node_states.lua:

View file

@ -3,9 +3,9 @@
Tube Library
============
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
pusher.lua:
@ -29,8 +29,10 @@
-- | |/
-- +--------+
-- Load support for I18n
local S = tubelib.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -42,7 +44,7 @@ local State = tubelib.NodeStates:new({
node_name_passive = "tubelib:pusher",
node_name_active = "tubelib:pusher_active",
node_name_defect = "tubelib:pusher_defect",
infotext_name = "Tubelib Pusher",
infotext_name = S("Tubelib Pusher"),
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
@ -75,7 +77,7 @@ local function keep_running(pos, elapsed)
end
minetest.register_node("tubelib:pusher", {
description = "Tubelib Pusher",
description = S("Tubelib Pusher"),
tiles = {
-- up, down, right, left, back, front
'tubelib_pusher1.png',
@ -117,7 +119,7 @@ minetest.register_node("tubelib:pusher", {
minetest.register_node("tubelib:pusher_active", {
description = "Tubelib Pusher",
description = S("Tubelib Pusher"),
tiles = {
-- up, down, right, left, back, front
{
@ -182,7 +184,7 @@ minetest.register_node("tubelib:pusher_active", {
})
minetest.register_node("tubelib:pusher_defect", {
description = "Tubelib Pusher",
description = S("Tubelib Pusher"),
tiles = {
-- up, down, right, left, back, front
'tubelib_pusher1.png',

View file

@ -3,16 +3,18 @@
Tube Library
============
Copyright (C) 2017-2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
repairkit.lua:
]]--
-- Load support for I18n
local S = tubelib.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -29,7 +31,7 @@ local function repair_node(itemstack, user, pointed_thing)
local pos = pointed_thing.under
if pos then
if tubelib.repair_node(pos) then
minetest.chat_send_player(user:get_player_name(), "[Tubelib] Node repaired")
minetest.chat_send_player(user:get_player_name(), S("[Tubelib] Node repaired"))
itemstack:take_item()
return itemstack
end
@ -47,14 +49,14 @@ local function read_state(itemstack, user, pointed_thing)
local aging = tubelib.send_request(number, "aging", nil)
if state and counter and aging then
if type(counter) ~= "number" then counter = "unknown" end
minetest.chat_send_player(user:get_player_name(), "[Tubelib] state ="..state..", counter = "..counter..", aging = "..aging)
minetest.chat_send_player(user:get_player_name(), S("[Tubelib] state").." ="..state..", "..S("counter").." = "..counter..", "..S("aging").." = "..aging)
end
end
end
end
minetest.register_craftitem("tubelib:repairkit", {
description = "Tubelib Repair Kit",
description = S("Tubelib Repair Kit"),
inventory_image = "tubelib_repairkit.png",
wield_image = "tubelib_repairkit.png^[transformR270",
groups = {cracky=1, book=1},
@ -64,7 +66,7 @@ minetest.register_craftitem("tubelib:repairkit", {
minetest.register_node("tubelib:end_wrench", {
description = "Tubelib End Wrench (use = read status, place = destroy)",
description = S("Tubelib End Wrench (use = read status, place = destroy)"),
inventory_image = "tubelib_end_wrench.png",
wield_image = "tubelib_end_wrench.png",
groups = {cracky=1, book=1},

View file

@ -3,9 +3,9 @@
Tube Library
============
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
states.lua:

View file

@ -3,15 +3,18 @@
Tubes based on tubelib2
=======================
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
tubes.lua: Node registration and API functions to move items via tubes
]]--
-- Load support for I18n
local S = tubelib.S
-- used for registered nodes
tubelib.KnownNodes = {
["tubelib:tubeS"] = true,
@ -33,7 +36,7 @@ local Tube = tubelib2.Tube:new({
tubelib.Tube = Tube
minetest.register_node("tubelib:tubeS", {
description = "Tubelib Tube",
description = S("Tubelib Tube"),
tiles = { -- Top, base, right, left, front, back
"tubelib_tube.png^[transformR90",
"tubelib_tube.png^[transformR90",
@ -80,7 +83,7 @@ minetest.register_node("tubelib:tubeS", {
})
minetest.register_node("tubelib:tubeA", {
description = "Tubelib Tube",
description = S("Tubelib Tube"),
tiles = { -- Top, base, right, left, front, back
"tubelib_knee2.png",
"tubelib_hole2.png^[transformR180",

View file

@ -3,9 +3,9 @@
Tubelib Addons
==============
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
The autocrafter is derived from pipeworks:
@ -15,8 +15,10 @@
]]--
-- Load support for I18n
local S = tubelib_addons1.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -47,7 +49,7 @@ local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:autocrafter",
node_name_active = "tubelib_addons1:autocrafter_active",
node_name_defect = "tubelib_addons1:autocrafter_defect",
infotext_name = "Tubelib Autocrafter",
infotext_name = S("Tubelib Autocrafter"),
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
@ -287,7 +289,7 @@ end
minetest.register_node("tubelib_addons1:autocrafter", {
description = "Tubelib Autocrafter",
description = S("Tubelib Autocrafter"),
drawtype = "normal",
tiles = {
'tubelib_front.png',
@ -335,7 +337,7 @@ minetest.register_node("tubelib_addons1:autocrafter", {
})
minetest.register_node("tubelib_addons1:autocrafter_active", {
description = "Tubelib Autocrafter",
description = S("Tubelib Autocrafter"),
drawtype = "normal",
tiles = {
'tubelib_front.png',
@ -368,7 +370,7 @@ minetest.register_node("tubelib_addons1:autocrafter_active", {
})
minetest.register_node("tubelib_addons1:autocrafter_defect", {
description = "Tubelib Autocrafter",
description = S("Tubelib Autocrafter"),
drawtype = "normal",
tiles = {
'tubelib_front.png',

View file

@ -3,15 +3,18 @@
Tubelib Addons 1
================
Copyright (C) 2017-2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
chest.lua
]]--
-- Load support for I18n
local S = tubelib_addons1.S
local PlayerActions = {}
local InventoryState = {}
@ -74,7 +77,7 @@ local function formspec()
end
minetest.register_node("tubelib_addons1:chest", {
description = "Tubelib Protected Chest",
description = S("Tubelib Protected Chest"),
tiles = {
-- up, down, right, left, back, front
"default_chest_top.png^tubelib_addons1_frame.png",
@ -97,7 +100,7 @@ minetest.register_node("tubelib_addons1:chest", {
meta:set_string("number", number)
meta:set_string("owner", placer:get_player_name())
meta:set_string("formspec", formspec())
meta:set_string("infotext", "Tubelib Protected Chest "..number)
meta:set_string("infotext", S("Tubelib Protected Chest").." "..number)
end,
can_dig = function(pos, player)
@ -157,7 +160,7 @@ tubelib.register_node("tubelib_addons1:chest", {}, {
local meta = minetest.get_meta(pos)
meta:set_string("dest_num", payload)
local number = meta:get_string("number")
meta:set_string("infotext", "Tubelib Protected Chest "..number.." connected with "..payload)
meta:set_string("infotext", S("Tubelib Protected Chest").." "..number.." "..S("connected with").." "..payload)
return true
end
else

View file

@ -3,15 +3,17 @@
Tubelib Addons 1
================
Copyright (C) 2017-2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
detector.lua:
]]--
-- Load support for I18n
local S = tubelib_addons1.S
local function switch_on(pos)
if tubelib.data_not_corrupted(pos) then
@ -42,7 +44,7 @@ end
minetest.register_node("tubelib_addons1:detector", {
description = "Tubelib Detector",
description = S("Tubelib Detector"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -58,10 +60,10 @@ minetest.register_node("tubelib_addons1:detector", {
local own_num = tubelib.add_node(pos, "tubelib_addons1:detector")
meta:set_string("own_num", own_num)
meta:set_string("formspec", "size[7.5,3]"..
"field[0.5,1;7,1;numbers;Insert destination node number(s);]" ..
"button_exit[2,2;3,1;exit;Save]")
"field[0.5,1;7,1;numbers;"..S("Insert destination node number(s)")..";]" ..
"button_exit[2,2;3,1;exit;"..S("Save").."]")
meta:set_string("placer_name", placer:get_player_name())
meta:set_string("infotext", "Tubelib Detector, unconfigured")
meta:set_string("infotext", S("Tubelib Detector, unconfigured"))
end,
on_receive_fields = function(pos, formname, fields, player)
@ -69,10 +71,10 @@ minetest.register_node("tubelib_addons1:detector", {
if tubelib.check_numbers(fields.numbers) then
meta:set_string("numbers", fields.numbers)
local own_num = meta:get_string("own_num")
meta:set_string("infotext", "Tubelib Detector, connected")
meta:set_string("infotext", S("Tubelib Detector, connected"))
meta:set_string("formspec", "size[7.5,3]"..
"field[0.5,1;7,1;numbers;Insert destination node number(s);"..fields.numbers.."]" ..
"button_exit[2,2;3,1;exit;Save]")
"field[0.5,1;7,1;numbers;"..S("Insert destination node number(s)")..";"..fields.numbers.."]" ..
"button_exit[2,2;3,1;exit;"..S("Save").."]")
end
end,
@ -91,7 +93,7 @@ minetest.register_node("tubelib_addons1:detector", {
minetest.register_node("tubelib_addons1:detector_active", {
description = "Tubelib Detector",
description = S("Tubelib Detector"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',

View file

@ -3,9 +3,9 @@
Tubelib Addons 1
================
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
fermenter.lua
@ -15,8 +15,10 @@
]]--
-- Load support for I18n
local S = tubelib_addons1.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -46,7 +48,7 @@ end
local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:fermenter",
node_name_defect = "tubelib_addons1:fermenter_defect",
infotext_name = "Tubelib Fermenter",
infotext_name = S("Tubelib Fermenter"),
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
@ -161,7 +163,7 @@ local function on_receive_fields(pos, formname, fields, player)
end
minetest.register_node("tubelib_addons1:fermenter", {
description = "Tubelib Fermenter",
description = S("Tubelib Fermenter"),
inventory_image = "tubelib_addons1_fermenter_inventory.png",
tiles = {
-- up, down, right, left, back, front
@ -192,7 +194,7 @@ minetest.register_node("tubelib_addons1:fermenter", {
State:node_init(pos, number)
else
minetest.remove_node(pos)
minetest.chat_send_player(placer:get_player_name(), "Fermenter will not fit there")
minetest.chat_send_player(placer:get_player_name(), S("Fermenter will not fit there"))
return true
end
end,
@ -231,7 +233,7 @@ minetest.register_node("tubelib_addons1:fermenter", {
})
minetest.register_node("tubelib_addons1:fermenter_defect", {
description = "Tubelib Fermenter defect",
description = S("Tubelib Fermenter defect"),
inventory_image = "tubelib_addons1_fermenter_inventory.png",
tiles = {
-- up, down, right, left, back, front
@ -263,7 +265,7 @@ minetest.register_node("tubelib_addons1:fermenter_defect", {
State:defect(pos, M(pos))
else
minetest.remove_node(pos)
minetest.chat_send_player(placer:get_player_name(), "Fermenter will not fit there")
minetest.chat_send_player(placer:get_player_name(), S("Fermenter will not fit there"))
return true
end
end,
@ -303,7 +305,7 @@ minetest.register_node("tubelib_addons1:fermenter_defect", {
})
minetest.register_node("tubelib_addons1:fermenter_top", {
description = "Tubelib Fermenter Top",
description = S("Tubelib Fermenter Top"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -323,19 +325,19 @@ minetest.register_node("tubelib_addons1:fermenter_top", {
})
minetest.register_craftitem("tubelib_addons1:biogas", {
description = "Bio Gas",
description = S("Bio Gas"),
inventory_image = "tubelib_addons1_biogas.png",
})
if minetest.global_exists("unified_inventory") then
unified_inventory.register_craft_type("fermenting", {
description = "Fermenter",
description = S("Fermenter"),
icon = "tubelib_addons1_fermenter_inventory.png",
width = 2,
height = 2,
})
unified_inventory.register_craft_type("reforming", {
description = "Reformer",
description = S("Reformer"),
icon = "tubelib_addons1_reformer_inventory.png",
width = 2,
height = 2,

View file

@ -3,15 +3,18 @@
Tubelib Addons 1
================
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
funnel.lua
]]--
-- Load support for I18n
local S = tubelib_addons1.S
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
@ -60,7 +63,7 @@ local function scan_for_objects(pos, elapsed)
end
minetest.register_node("tubelib_addons1:funnel", {
description = "Tubelib Funnel",
description = S("Tubelib Funnel"),
tiles = {
-- up, down, right, left, back, front
'tubelib_addons1_funnel_top.png',

View file

@ -3,9 +3,9 @@
Tubelib Addons 1
================
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
grinder.lua
@ -14,8 +14,10 @@
]]--
-- Load support for I18n
local S = tubelib_addons1.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -49,7 +51,7 @@ local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:grinder",
node_name_active = "tubelib_addons1:grinder_active",
node_name_defect = "tubelib_addons1:grinder_defect",
infotext_name = "Tubelib Grinder",
infotext_name = S("Tubelib Grinder"),
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
@ -120,7 +122,7 @@ local function on_receive_fields(pos, formname, fields, player)
end
minetest.register_node("tubelib_addons1:grinder", {
description = "Tubelib Grinder",
description = S("Tubelib Grinder"),
tiles = {
-- up, down, right, left, back, front
'tubelib_addons1_grinder.png',
@ -170,7 +172,7 @@ minetest.register_node("tubelib_addons1:grinder", {
minetest.register_node("tubelib_addons1:grinder_active", {
description = "Tubelib Grinder",
description = S("Tubelib Grinder"),
tiles = {
-- up, down, right, left, back, front
{
@ -207,7 +209,7 @@ minetest.register_node("tubelib_addons1:grinder_active", {
})
minetest.register_node("tubelib_addons1:grinder_defect", {
description = "Tubelib Grinder",
description = S("Tubelib Grinder"),
tiles = {
-- up, down, right, left, back, front
'tubelib_addons1_grinder.png',
@ -296,7 +298,7 @@ tubelib.register_node("tubelib_addons1:grinder",
if minetest.global_exists("unified_inventory") then
unified_inventory.register_craft_type("grinding", {
description = "Grinding",
description = S("Grinding"),
icon = 'tubelib_addons1_grinder.png',
width = 1,
height = 1,

View file

@ -3,9 +3,9 @@
Tubelib Addons 1
================
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
harvester.lua
@ -19,8 +19,10 @@
]]--
-- Load support for I18n
local S = tubelib_addons1.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -56,8 +58,8 @@ local function formspec(self, pos, meta)
default.gui_bg_img..
default.gui_slots..
"dropdown[0,0;1.5;radius;4,6,8,10,12,14,16;"..radius.."]"..
"label[1.6,0.2;Area radius]"..
"checkbox[0,1;endless;Run endless;"..endless.."]"..
"label[1.6,0.2;"..S("Area radius").."]"..
"checkbox[0,1;endless;"..S("Run endless")..";"..endless.."]"..
"list[context;main;5,0;4,4;]"..
"list[context;fuel;1.5,3;1,1;]"..
"item_image[1.5,3;1,1;tubelib_addons1:biofuel]"..
@ -72,7 +74,7 @@ end
local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:harvester_base",
node_name_defect = "tubelib_addons1:harvester_defect",
infotext_name = "Tubelib Harvester",
infotext_name = S("Tubelib Harvester"),
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
@ -254,8 +256,8 @@ local function keep_running(pos, elapsed)
if harvest_field(this, meta) then
meta:set_string("this", minetest.serialize(this))
meta:set_string("infotext",
"Tubelib Harvester "..this.number..
": running ("..this.idx.."/"..this.max..")")
S("Tubelib Harvester").." "..this.number..
S(": running (")..this.idx.."/"..this.max..")")
State:keep_running(pos, meta, COUNTDOWN_TICKS, this.num_items)
else
State:blocked(pos, meta)
@ -300,7 +302,7 @@ local function on_receive_fields(pos, formname, fields, player)
end
minetest.register_node("tubelib_addons1:harvester_base", {
description = "Tubelib Harvester Base",
description = S("Tubelib Harvester Base"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -356,7 +358,7 @@ minetest.register_node("tubelib_addons1:harvester_base", {
})
minetest.register_node("tubelib_addons1:harvester_defect", {
description = "Tubelib Harvester Base",
description = S("Tubelib Harvester Base"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',

View file

@ -3,13 +3,17 @@
Tubelib Addons 1
================
Copyright (C) 2017,2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
]]--
tubelib_addons1 = {}
-- Load support for I18n
tubelib_addons1.S = minetest.get_translator("tubelib_addons1")
dofile(minetest.get_modpath("tubelib_addons1") .. "/quarry.lua")
dofile(minetest.get_modpath("tubelib_addons1") .. "/grinder.lua")

View file

@ -3,17 +3,19 @@
Tubelib Addons 1
================
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
liquidsampler.lua
]]--
-- Load support for I18n
local S = tubelib_addons1.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -43,7 +45,7 @@ local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:liquidsampler",
node_name_active = "tubelib_addons1:liquidsampler_active",
node_name_defect = "tubelib_addons1:liquidsampler_defect",
infotext_name = "Liquid Sampler",
infotext_name = S("Liquid Sampler"),
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
@ -128,7 +130,7 @@ local function on_receive_fields(pos, formname, fields, player)
end
minetest.register_node("tubelib_addons1:liquidsampler", {
description = "Liquid Sampler",
description = S("Liquid Sampler"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -180,7 +182,7 @@ minetest.register_node("tubelib_addons1:liquidsampler", {
})
minetest.register_node("tubelib_addons1:liquidsampler_active", {
description = "Liquid Sampler",
description = S("Liquid Sampler"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -216,7 +218,7 @@ minetest.register_node("tubelib_addons1:liquidsampler_active", {
})
minetest.register_node("tubelib_addons1:liquidsampler_defect", {
description = "Liquid Sampler",
description = S("Liquid Sampler"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',

View file

@ -0,0 +1,75 @@
# textdomain: tubelib_addons1
### autocrafter.lua ###
Tubelib Autocrafter=
### chest.lua ###
Tubelib Protected Chest=
connected with=
### detector.lua ###
Insert destination node number(s)=
Save=
Tubelib Detector=
Tubelib Detector, connected=
Tubelib Detector, unconfigured=
### fermenter.lua ###
Bio Gas=
Fermenter=
Fermenter will not fit there=
Reformer=
Tubelib Fermenter=
Tubelib Fermenter Top=
Tubelib Fermenter defect=
### funnel.lua ###
Tubelib Funnel=
### grinder.lua ###
Grinding=
Tubelib Grinder=
### harvester.lua ###
: running (=
Area radius=
Tubelib Harvester=
Tubelib Harvester Base=
### harvester.lua ###
### quarry.lua ###
Run endless=
### liquidsampler.lua ###
Liquid Sampler=
### pusher_fast.lua ###
Fast Pusher=
### quarry.lua ###
Digging depth=
Start level=
Tubelib Quarry=
[Tubelib Quarry] Area is protected!=
running=
### reformer.lua ###
Bio Fuel=
Reformer will not fit there=
Tubelib Reformer=
Tubelib Reformer Top=
Tubelib Reformer defect=

View file

@ -0,0 +1,75 @@
# textdomain: tubelib_addons1
### autocrafter.lua ###
Tubelib Autocrafter=Tubelib Autocrafter
### chest.lua ###
Tubelib Protected Chest=Tubelib geschützte Kiste
connected with=verbunden mit
### detector.lua ###
Insert destination node number(s)=Geben Sie die Zielknotennummer(n) ein.
Save=Speichern
Tubelib Detector=Tubelib Detektor
Tubelib Detector, connected=Tubelib Detektor, verbunden
Tubelib Detector, unconfigured=Tubelib Detektor, nicht konfiguriert
### fermenter.lua ###
Bio Gas=Biogas
Fermenter=Fermenter
Fermenter will not fit there=Fermenter wird dort nicht passen
Reformer=Reformer
Tubelib Fermenter=Tubelib Fermenter
Tubelib Fermenter Top=Tubelib Fermenter Oberteil
Tubelib Fermenter defect=Tubelib Fermenter defekt
### funnel.lua ###
Tubelib Funnel=Tubelib Trichter
### grinder.lua ###
Grinding=Mahlen
Tubelib Grinder=Tubelib Mühle
### harvester.lua ###
: running (=: läuft (
Area radius=Flächenradius
Tubelib Harvester=Tubelib Ernter
Tubelib Harvester Base=Tubelib Ernter Basis
### harvester.lua ###
### quarry.lua ###
Run endless=endlos laufen
### liquidsampler.lua ###
Liquid Sampler=Flüssigkeitsaufnehmer
### pusher_fast.lua ###
Fast Pusher=Schneller Schieber
### quarry.lua ###
Digging depth=Grabetiefe
Start level=Startebene
Tubelib Quarry=Tubelib Steinbrecher
[Tubelib Quarry] Area is protected!=[Tubelib Steinbrecher] Gebiet ist geschützt!
running=läuft
### reformer.lua ###
Bio Fuel=Biotreibstoff
Reformer will not fit there=Reformer wird dort nicht passen
Tubelib Reformer=Tubelib Reformer
Tubelib Reformer Top=Tubelib Reformer Oberteil
Tubelib Reformer defect=Tubelib Reformer defekt

View file

@ -3,15 +3,13 @@
Tubelib Addons 1
================
Copyright (C) 2017,2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
]]--
tubelib_addons1 = {}
-- tables needed for Harvester
tubelib_addons1.FarmingNodes = {}
tubelib_addons1.Flowers = {}
@ -68,6 +66,7 @@ fn("default:jungleleaves")
fn("default:bush_leaves")
fn("default:acacia_bush_leaves")
fn("default:blueberry_bush_leaves")
fn("default:cactus", "default:cactus", "default:cactus")
fn("default:papyrus", "default:papyrus", "default:papyrus")
@ -77,6 +76,7 @@ fn("default:apple")
if farming.mod ~= "redo" then
dn("farming:wheat_8", "farming:wheat", "farming:wheat_1")
dn("farming:cotton_8", "farming:cotton", "farming:cotton_1")
dn("farming:blueberry_bush_leaves_with_berries", "default:blueberries", "farming:blueberry_bush_leaves")
end
-------------------------------------------------------------------------------
@ -117,7 +117,7 @@ end
-- Ethereal Farming
-------------------------------------------------------------------------------
fn("ethereal:strawberry_8", "ethereal:strawberry 2", "ethereal:strawberry 1")
fn("ethereal:onion_5", "ethereal:wild_onion_plant 2", "ethereal:onion_1")
fn("ethereal:onion_5", "ethereal:wild_onion_plant 2", "ethereal:onion_1")
fn("ethereal:willow_trunk", "ethereal:willow_trunk", "ethereal:willow_sapling")
@ -162,24 +162,28 @@ gn("default:ice")
gn("default:snowblock")
gn("default:snow")
gn("default:obsidian")
gn("default:mese")
gn("stairs:stair_cobble")
gn("stairs:stair_mossycobble")
gn("stairs:stair_desert_cobble")
gn("default:permafrost")
gn("default:permafrost_with_moss")
gn("default:permafrost_with_stones")
gn("default:stone", "default:cobble")
gn("default:desert_stone", "default:desert_cobble")
gn("default:sandstone", "default:sandstone")
gn("default:desert_sandstone", "default:desert_sandstone")
gn("default:silver_sandstone", "default:silver_sandstone")
gn("default:clay", "default:clay_lump")
gn("default:stone_with_coal", "default:coal_lump")
gn("default:stone_with_iron", "default:iron_lump")
gn("default:stone_with_copper", "default:copper_lump")
gn("default:stone_with_gold", "default:gold_lump")
gn("default:stone_with_tin", "default:tin_lump")
gn("default:stone_with_mese", "default:mese_crystal")
gn("default:stone_with_diamond", "default:diamond")
gn("default:dirt_with_grass", "default:dirt")
@ -188,6 +192,13 @@ gn("default:dirt_with_dry_grass", "default:dirt")
gn("default:dirt_with_snow", "default:dirt")
gn("default:dirt_with_rainforest_litter", "default:dirt")
gn("default:dirt_with_grass", "default:dirt")
gn("default:dirt_with_coniferous_litter", "default:dirt")
gn("default:dry_dirt", "default:dry_dirt")
gn("default:dry_dirt_with_dry_grass", "default:dry_dirt")
gn("default:dirt_with_coniferous_litter")
gn("default:dirt_with_coniferous_litter")
gn("default:dirt_with_coniferous_litter")
gn("default:coral_skeleton", "default:coral_skeleton")
gn("default:coral_orange", "default:coral_skeleton")

View file

@ -3,9 +3,9 @@
Tubelib Addons 1
================
Copyright (C) 2017-2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
pusher_fast.lua:
@ -29,8 +29,10 @@
-- | |/
-- +--------+
-- Load support for I18n
local S = tubelib_addons1.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -42,7 +44,7 @@ local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:pusher_fast",
node_name_active = "tubelib_addons1:pusher_fast_active",
node_name_defect = "tubelib_addons1:pusher_fast_defect",
infotext_name = "Fast Pusher",
infotext_name = S("Fast Pusher"),
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
@ -75,7 +77,7 @@ local function keep_running(pos, elapsed)
end
minetest.register_node("tubelib_addons1:pusher_fast", {
description = "Fast Pusher",
description = S("Fast Pusher"),
tiles = {
-- up, down, right, left, back, front
'tubelib_addons1_pusher.png',
@ -117,7 +119,7 @@ minetest.register_node("tubelib_addons1:pusher_fast", {
minetest.register_node("tubelib_addons1:pusher_fast_active", {
description = "Fast Pusher",
description = S("Fast Pusher"),
tiles = {
-- up, down, right, left, back, front
{
@ -182,7 +184,7 @@ minetest.register_node("tubelib_addons1:pusher_fast_active", {
})
minetest.register_node("tubelib_addons1:pusher_fast_defect", {
description = "Fast Pusher",
description = S("Fast Pusher"),
tiles = {
-- up, down, right, left, back, front
'tubelib_addons1_pusher.png',

View file

@ -3,9 +3,9 @@
Tubelib Addons 1
================
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
quarry.lua
@ -20,8 +20,11 @@
]]--
-- Load support for I18n
local S = tubelib_addons1.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -55,10 +58,10 @@ local function formspec(self, pos, meta)
default.gui_bg_img..
default.gui_slots..
"dropdown[0,0;1.5;level;2,1,0,-1,-2,-3,-5,-10,-15,-20;"..Level2Idx[start_level].."]"..
"label[1.6,0.2;Start level]"..
"label[1.6,0.2;"..S("Start level").."]"..
"dropdown[0,1;1.5;depth;1,2,3,5,10,15,20,25,50,100;"..Depth2Idx[depth].."]"..
"label[1.6,1.2;Digging depth]"..
"checkbox[0,2;endless;Run endless;"..endless.."]"..
"label[1.6,1.2;"..S("Digging depth").."]"..
"checkbox[0,2;endless;"..S("Run endless")..";"..endless.."]"..
"list[context;main;5,0;4,4;]"..
"list[context;fuel;1.5,3;1,1;]"..
"item_image[1.5,3;1,1;tubelib_addons1:biofuel]"..
@ -74,7 +77,7 @@ local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:quarry",
node_name_active = "tubelib_addons1:quarry_active",
node_name_defect = "tubelib_addons1:quarry_defect",
infotext_name = "Tubelib Quarry",
infotext_name = S("Tubelib Quarry"),
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
@ -209,10 +212,10 @@ local function quarry_next_node(pos, meta)
return
end
meta:set_int("idx", idx)
meta:set_string("quarry_pos", S(quarry_pos))
meta:set_string("quarry_pos", P2S(quarry_pos))
if minetest.is_protected(quarry_pos, owner) then
minetest.chat_send_player(owner, "[Tubelib Quarry] Area is protected!")
minetest.chat_send_player(owner, S("[Tubelib Quarry] Area is protected!"))
State:fault(pos, meta)
return
end
@ -226,15 +229,15 @@ local function quarry_next_node(pos, meta)
if inv:room_for_item("main", ItemStack(order.drop)) then
minetest.remove_node(quarry_pos)
inv:add_item("main", ItemStack(order.drop))
meta:set_string("infotext", "Tubelib Quarry "..number..
": running "..idx.."/"..(start_y-quarry_pos.y+1))
meta:set_string("infotext", S("Tubelib Quarry").." "..number..
": "..S("running").." "..idx.."/"..(start_y-quarry_pos.y+1))
State:keep_running(pos, meta, COUNTDOWN_TICKS, 1)
else
State:blocked(pos, meta)
end
else
meta:set_string("infotext", "Tubelib Quarry "..number..
": running "..idx.."/"..(start_y-quarry_pos.y+1))
meta:set_string("infotext", S("Tubelib Quarry").." "..number..
": "..S("running").." "..idx.."/"..(start_y-quarry_pos.y+1))
end
end
end
@ -284,7 +287,7 @@ local function on_receive_fields(pos, formname, fields, player)
end
minetest.register_node("tubelib_addons1:quarry", {
description = "Tubelib Quarry",
description = S("Tubelib Quarry"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -336,7 +339,7 @@ minetest.register_node("tubelib_addons1:quarry", {
})
minetest.register_node("tubelib_addons1:quarry_active", {
description = "Tubelib Quarry",
description = S("Tubelib Quarry"),
tiles = {
-- up, down, right, left, back, front
@ -374,7 +377,7 @@ minetest.register_node("tubelib_addons1:quarry_active", {
})
minetest.register_node("tubelib_addons1:quarry_defect", {
description = "Tubelib Quarry",
description = S("Tubelib Quarry"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',

View file

@ -3,9 +3,9 @@
Tubelib Addons 1
================
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
reformer.lua
@ -15,8 +15,10 @@
]]--
-- Load support for I18n
local S = tubelib_addons1.S
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
@ -46,7 +48,7 @@ end
local State = tubelib.NodeStates:new({
node_name_passive = "tubelib_addons1:reformer",
node_name_defect = "tubelib_addons1:reformer_defect",
infotext_name = "Tubelib Reformer",
infotext_name = S("Tubelib Reformer"),
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
has_item_meter = true,
@ -157,7 +159,7 @@ end
minetest.register_node("tubelib_addons1:reformer", {
description = "Tubelib Reformer",
description = S("Tubelib Reformer"),
inventory_image = "tubelib_addons1_reformer_inventory.png",
tiles = {
-- up, down, right, left, back, front
@ -188,7 +190,7 @@ minetest.register_node("tubelib_addons1:reformer", {
State:node_init(pos, number)
else
minetest.remove_node(pos)
minetest.chat_send_player(placer:get_player_name(), "Reformer will not fit there")
minetest.chat_send_player(placer:get_player_name(), S("Reformer will not fit there"))
return true
end
end,
@ -227,7 +229,7 @@ minetest.register_node("tubelib_addons1:reformer", {
})
minetest.register_node("tubelib_addons1:reformer_defect", {
description = "Tubelib Reformer defect",
description = S("Tubelib Reformer defect"),
inventory_image = "tubelib_addons1_reformer_inventory.png",
tiles = {
-- up, down, right, left, back, front
@ -259,7 +261,7 @@ minetest.register_node("tubelib_addons1:reformer_defect", {
State:defect(pos, M(pos))
else
minetest.remove_node(pos)
minetest.chat_send_player(placer:get_player_name(), "Reformer will not fit there")
minetest.chat_send_player(placer:get_player_name(), S("Reformer will not fit there"))
return true
end
end,
@ -300,7 +302,7 @@ minetest.register_node("tubelib_addons1:reformer_defect", {
minetest.register_node("tubelib_addons1:reformer_top", {
description = "Tubelib Reformer Top",
description = S("Tubelib Reformer Top"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -320,7 +322,7 @@ minetest.register_node("tubelib_addons1:reformer_top", {
})
minetest.register_craftitem("tubelib_addons1:biofuel", {
description = "Bio Fuel",
description = S("Bio Fuel"),
inventory_image = "tubelib_addons1_biofuel.png",
})

View file

@ -3,15 +3,18 @@
Tubelib Addons 2
================
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
accesscontrol.lua:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local function switch_on(pos, meta)
if tubelib.data_not_corrupted(pos) then
minetest.sound_play("tubelib_addons2_door", {
@ -47,9 +50,9 @@ local function formspec1(numbers)
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"field[0.5,1;5,1;numbers;Door block numbers:;"..numbers.."]" ..
"field[0.5,2.5;5,1;code;Access code (4 digits):;]" ..
"button_exit[1.5,3.5;2,1;exit;Save]"
"field[0.5,1;5,1;numbers;"..S("Door block numbers:")..";"..numbers.."]" ..
"field[0.5,2.5;5,1;code;"..S("Access code (4 digits):")..";]" ..
"button_exit[1.5,3.5;2,1;exit;"..S("Save").."]"
end
local function formspec2(code)
@ -57,7 +60,7 @@ local function formspec2(code)
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"field[0.5,1;3.6,1;code;Enter access code;"..code.."]" ..
"field[0.5,1;3.6,1;code;"..S("Enter access code")..";"..code.."]" ..
"button[0.4,2;1,1;b1;1]" ..
"button[1.6,2;1,1;b2;2]" ..
"button[2.8,2;1,1;b3;3]" ..
@ -67,11 +70,11 @@ local function formspec2(code)
"button[0.4,4;1,1;b7;7]" ..
"button[1.6,4;1,1;b8;8]" ..
"button[2.8,4;1,1;b9;9]" ..
"button_exit[1.6,5;1,1;ok;OK]"
"button_exit[1.6,5;1,1;ok;"..S("OK").."]"
end
minetest.register_node("tubelib_addons2:accesscontrol", {
description = "Tubelib Access Lock",
description = S("Tubelib Access Lock"),
tiles = {
-- up, down, right, left, back, front
'default_steel_block.png',
@ -99,7 +102,7 @@ minetest.register_node("tubelib_addons2:accesscontrol", {
meta:set_string("numbers", fields.numbers)
meta:set_string("code", fields.code)
meta:mark_as_private("code")
meta:set_string("infotext", "Tubelib Access Lock, Enter access code")
meta:set_string("infotext", S("Tubelib Access Lock, Enter access code"))
meta:set_string("formspec", formspec2(""))
end
end

View file

@ -3,15 +3,17 @@
Tubelib Addons 2
================
Copyright (C) 2017-2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
ceilinglamp.lua:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local function switch_on(pos, node)
node.name = "tubelib_addons2:ceilinglamp_on"
@ -27,7 +29,7 @@ local function switch_off(pos, node)
end
minetest.register_node("tubelib_addons2:ceilinglamp", {
description = "Tubelib Ceiling Lamp",
description = S("Tubelib Ceiling Lamp"),
tiles = {
-- up, down, right, left, back, front
'tubelib_addons2_ceilinglamp_top.png',
@ -53,7 +55,7 @@ minetest.register_node("tubelib_addons2:ceilinglamp", {
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "tubelib_addons2:ceilinglamp")
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Tubelib Ceiling Lamp "..number)
meta:set_string("infotext", S("Tubelib Ceiling Lamp").." "..number)
end,
on_rightclick = function(pos, node, clicker)
@ -76,7 +78,7 @@ minetest.register_node("tubelib_addons2:ceilinglamp", {
})
minetest.register_node("tubelib_addons2:ceilinglamp_on", {
description = "Tubelib Ceiling Lamp",
description = S("Tubelib Ceiling Lamp"),
tiles = {
-- up, down, right, left, back, front
'tubelib_addons2_ceilinglamp_top.png',

View file

@ -3,15 +3,18 @@
Tubelib Addons 2
================
Copyright (C) 2017-2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
colorlamp.lua:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local tColors = {"#0000FF", "#00FFFF", "#00FF00", "#FFFF00", "#FF0000", "#FF00FF",
"#FFFFFF", "#000000", "#3BC23B", "#CA3131", "#FFA500", "#FFC0CB"}
local sColor = "1,2,3,4,5,6,7,8,9,10,11,12"
@ -24,7 +27,7 @@ local function switch_node(pos, num, player)
minetest.swap_node(pos, node)
local number = meta:get_int("number")
number = string.format("%.04u", number)
meta:set_string("infotext", "Tubelib Color Lamp "..number)
meta:set_string("infotext", S("Tubelib Color Lamp").." "..number)
if num ~= "" then
meta:set_int("color", num)
end
@ -32,7 +35,7 @@ local function switch_node(pos, num, player)
end
minetest.register_node("tubelib_addons2:lamp", {
description = "Tubelib Color Lamp",
description = S("Tubelib Color Lamp"),
tiles = {"tubelib_addons2_lamp.png^[colorize:#000000:100"},
after_place_node = function(pos, placer)
@ -43,7 +46,7 @@ minetest.register_node("tubelib_addons2:lamp", {
meta:set_string("formspec", "size[3,2]"..
"label[0,0;Select color]"..
"dropdown[0,0.5;3;type;"..sColor..";1]"..
"button_exit[0.5,1.5;2,1;exit;Save]")
"button_exit[0.5,1.5;2,1;exit;"..S("Save").."]")
meta:set_int("color", 1)
end,
@ -96,7 +99,7 @@ minetest.register_craft({
for idx,color in ipairs(tColors) do
minetest.register_node("tubelib_addons2:lamp"..idx, {
description = "Tubelib Color Lamp",
description = S("Tubelib Color Lamp"),
tiles = {
"tubelib_addons2_lamp.png^[colorize:"..color..":120",
},

View file

@ -3,15 +3,18 @@
Tubelib Addons 2
================
Copyright (C) 2017-2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
colorlamp_ud.lua which requires the mod unifieddyes:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local function switch_on(pos, node, player)
if player == nil or not minetest.is_protected(pos, player:get_player_name()) then
node.name = "tubelib_addons2:lamp_on"
@ -27,13 +30,13 @@ local function switch_off(pos, node, player)
end
minetest.register_node("tubelib_addons2:lamp_off", {
description = "Tubelib Color Lamp",
description = S("Tubelib Color Lamp"),
tiles = {"tubelib_addons2_lamp.png^[colorize:#000000:100"},
after_place_node = function(pos, placer, itemstack, pointed_thing)
local number = tubelib.add_node(pos, "tubelib_addons2:lamp_off")
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Tubelib Color Lamp "..number)
meta:set_string("infotext", S("Tubelib Color Lamp").." "..number)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
@ -60,7 +63,7 @@ minetest.register_node("tubelib_addons2:lamp_off", {
minetest.register_node("tubelib_addons2:lamp_on", {
description = "Tubelib Color Lamp",
description = S("Tubelib Color Lamp"),
tiles = {"tubelib_addons2_lamp.png"},
on_rightclick = switch_off,
@ -108,7 +111,7 @@ minetest.register_craft({
--
for idx=1,12 do
minetest.register_node("tubelib_addons2:lamp"..idx, {
description = "Tubelib Color Lamp "..idx,
description = S("Tubelib Color Lamp").." "..idx,
tiles = {"tubelib_addons2_lamp.png"},
paramtype = 'light',
groups = {choppy=2, cracky=1, not_in_creative_inventory=1},
@ -143,7 +146,7 @@ minetest.register_lbm({
minetest.swap_node(pos, node)
local number = meta:get_int("number") or 0
number = string.format("%.04u", number)
meta:set_string("infotext", "Tubelib Color Lamp "..number)
meta:set_string("infotext", S("Tubelib Color Lamp").." "..number)
end
})

View file

@ -3,15 +3,18 @@
Tubelib Addons 2
================
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
doorblock.lua:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local sTextures = "Gate Wood,Aspen Wood,Jungle Wood,Pine Wood,"..
"Cobblestone,Sandstone,Stone,Desert Sandstone,"..
"Copper,Steel,Tin,Coral,"..
@ -32,7 +35,7 @@ local tPgns = {"tubelib_addon2_door.png", "default_aspen_wood.png", "default_jun
local not_in_inventory=nil
for idx,pgn in ipairs(tPgns) do
minetest.register_node("tubelib_addons2:doorblock"..idx, {
description = "Tubelib Door Block",
description = S("Tubelib Door Block"),
tiles = {
pgn.."^[transformR90",
pgn,
@ -54,11 +57,11 @@ for idx,pgn in ipairs(tPgns) do
local node = minetest.get_node(pos)
local number = tubelib.add_node(pos, node.name)
meta:set_string("number", number)
meta:set_string("infotext", "Tubelib Door Block "..number)
meta:set_string("infotext", S("Tubelib Door Block").." "..number)
meta:set_string("formspec", "size[3,2]"..
"label[0,0;Select texture]"..
"label[0,0;"..S("Select texture").."]"..
"dropdown[0,0.5;3;type;"..sTextures..";1]"..
"button_exit[0.5,1.5;2,1;exit;Save]")
"button_exit[0.5,1.5;2,1;exit;"..S("Save").."]")
end,
on_receive_fields = function(pos, formname, fields, player)

View file

@ -3,15 +3,18 @@
Tubelib Addons 2
================
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
gateblock.lua:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local NUM_TEXTURES = 20
local sTextures = "Wood,Aspen Wood,Jungle Wood,Pine Wood,"..
@ -34,21 +37,20 @@ local tPgns = {"default_wood.png", "default_aspen_wood.png", "default_junglewood
"default_copper_block.png", "default_steel_block.png", "default_tin_block.png", "default_coral_skeleton.png",
"default_glass.png", "default_obsidian_glass.png", "default_ice.png", "tubelib_addon2_gate.png"}
local not_in_inventory=nil
for idx,pgn in ipairs(tPgns) do
minetest.register_node("tubelib_addons2:gateblock"..idx, {
description = "Tubelib Gate Block",
description = S("Tubelib Gate Block"),
tiles = {pgn},
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos)
local number = tubelib.add_node(pos, node.name)
meta:set_string("number", number)
meta:set_string("infotext", "Tubelib Gate Block "..number)
meta:set_string("infotext", S("Tubelib Gate Block").." "..number)
meta:set_string("formspec", "size[3,2]"..
"label[0,0;Select texture]"..
"dropdown[0,0.5;3;type;"..sTextures..";"..NUM_TEXTURES.."]"..
"button_exit[0.5,1.5;2,1;exit;Save]")
"button_exit[0.5,1.5;2,1;exit;"..S("Save").."]")
end,
on_receive_fields = function(pos, formname, fields, player)
@ -73,13 +75,11 @@ for idx,pgn in ipairs(tPgns) do
paramtype2 = "facedir",
sunlight_propagates = true,
sounds = default.node_sound_stone_defaults(),
groups = {cracky=2, choppy=2, crumbly=2, not_in_creative_inventory=not_in_inventory},
groups = {cracky=2, choppy=2, crumbly=2, not_in_creative_inventory = idx == NUM_TEXTURES and 0 or 1},
is_ground_content = false,
drop = "tubelib_addons2:gateblock1",
})
not_in_inventory = 1
tubelib.register_node("tubelib_addons2:gateblock"..idx, {}, {
on_recv_message = function(pos, topic, payload)
local node = minetest.get_node(pos)

View file

@ -3,15 +3,18 @@
Tubelib Addons 2
================
Copyright (C) 2017-2019 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
industriallamp.lua:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local function switch_on(pos, node)
if string.sub(node.name, -3) ~= "_on" then
node.name = node.name.."_on"
@ -32,7 +35,7 @@ end
local function register_lamp(tbl)
local num, tiles, tiles_on, node_box, size = tbl.num, tbl.tiles, tbl.tiles_on, tbl.node_box, tbl.size
minetest.register_node("tubelib_addons2:industriallamp"..num, {
description = "Tubelib Industrial Lamp "..num,
description = S("Tubelib Industrial Lamp").." "..num,
tiles = tiles,
drawtype = "nodebox",
node_box = node_box,
@ -48,7 +51,7 @@ local function register_lamp(tbl)
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "tubelib_addons2:industriallamp"..num)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Tubelib Industrial Lamp "..num..": "..number)
meta:set_string("infotext", S("Tubelib Industrial Lamp").." "..num..": "..number)
end,
on_rightclick = function(pos, node, clicker)
@ -72,7 +75,7 @@ local function register_lamp(tbl)
})
minetest.register_node("tubelib_addons2:industriallamp"..num.."_on", {
description = "Tubelib Industrial Lamp "..num,
description = S("Tubelib Industrial Lamp").." "..num,
tiles = tiles_on,
drawtype = "nodebox",
node_box = node_box,
@ -87,7 +90,7 @@ local function register_lamp(tbl)
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "tubelib_addons2:industriallamp"..num)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Tubelib Industrial Lamp "..num..": "..number)
meta:set_string("infotext", S("Tubelib Industrial Lamp").." "..num..": "..number)
end,
on_rightclick = function(pos, node, clicker)

View file

@ -3,13 +3,19 @@
Tubelib Addons 2
================
Copyright (C) 2017,2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
]]--
tubelib_addons2 = {}
-- Load support for I18n
tubelib_addons2.S = minetest.get_translator("tubelib_addons2")
dofile(minetest.get_modpath("tubelib_addons2") .. "/timer.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/sequencer.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/gateblock.lua")

View file

@ -3,15 +3,17 @@
Tubelib Addons 2
================
Copyright (C) 2017-2018 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
invisiblelamp.lua:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local function switch_on(pos, node)
node.name = "tubelib_addons2:invisiblelamp_on"
@ -27,7 +29,7 @@ local function switch_off(pos, node)
end
minetest.register_node("tubelib_addons2:invisiblelamp", {
description = "Tubelib Invisible Lamp",
description = S("Tubelib Invisible Lamp"),
drawtype = "glasslike_framed_optional",
tiles = {"tubelib_addons2_invisiblelamp.png"},
inventory_image = 'tubelib_addons2_invisiblelamp_inventory.png',
@ -35,7 +37,7 @@ minetest.register_node("tubelib_addons2:invisiblelamp", {
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "tubelib_addons2:invisiblelamp")
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Tubelib Invisible Lamp "..number)
meta:set_string("infotext", S("Tubelib Invisible Lamp").." "..number)
end,
on_rightclick = function(pos, node, clicker)
@ -58,7 +60,7 @@ minetest.register_node("tubelib_addons2:invisiblelamp", {
})
minetest.register_node("tubelib_addons2:invisiblelamp_on", {
description = "Tubelib Invisible Lamp",
description = S("Tubelib Invisible Lamp"),
drawtype = "glasslike_framed_optional",
tiles = {"tubelib_addons2_invisiblelamp.png"},

View file

@ -0,0 +1,115 @@
# textdomain: tubelib_addons2
### accesscontrol.lua ###
Access code (4 digits):=
Door block numbers:=
Enter access code=
OK=
Tubelib Access Lock=
Tubelib Access Lock, Enter access code=
### accesscontrol.lua ###
### colorlamp.lua ###
### doorblock.lua ###
### gateblock.lua ###
### logic_not.lua ###
### mesecons_converter.lua ###
### repeater.lua ###
Save=
### ceilinglamp.lua ###
Tubelib Ceiling Lamp=
### colorlamp.lua ###
### colorlamp_ud.lua ###
Tubelib Color Lamp=
### doorblock.lua ###
Select texture=
Tubelib Door Block=
### gateblock.lua ###
Tubelib Gate Block=
### industriallamp.lua ###
Tubelib Industrial Lamp=
### invisiblelamp.lua ###
Tubelib Invisible Lamp=
### logic_not.lua ###
Tubelib Logic Not=
### logic_not.lua ###
### mesecons_converter.lua ###
### repeater.lua ###
: connected with=
: not connected=
Destination node numbers=
### mesecons_converter.lua ###
Tubelib Mesecons Converter=
### mesecons_converter.lua ###
### repeater.lua ###
: fault (overloaded)=
### programmer.lua ###
Tubelib Programmer=
[Tubelib Programmer] Error: programmer not supported!=
[Tubelib Programmer] Unknown node on=
[Tubelib Programmer] foreign or unknown node!=
[Tubelib Programmer] node programmed!=
[Tubelib Programmer] number=
[Tubelib Programmer] programmer reset=
read=
### repeater.lua ###
Tubelib Repeater=
### sequencer.lua ###
Define a sequence of commands@nto control other machines.=
If endless is set, the Sequencer@nrestarts again and again.=
Numbers(s) are the node numbers,@nthe command shall sent to.=
Offset is the time to the@nnext line in seconds (1..999).=
Run endless=
Sequencer Help=
The command ' ' does nothing,@nonly consuming the offset time.=
The commands 'on'/'off' are used@n for machines and other nodes.=
Tubelib Sequencer=
exit=
help=
### sequencer.lua ###
### timer.lua ###
Command=
### streetlamp.lua ###
Tubelib Street Lamp=
### timer.lua ###
Number(s)=
Time=
Tubelib Timer=

View file

@ -0,0 +1,118 @@
# textdomain: tubelib_addons2
### accesscontrol.lua ###
Access code (4 digits):=Zugangscode (4 Zahlen):
Door block numbers:=Türblocknummern:
Enter access code=Zugangscode eingeben
OK=OK
Tubelib Access Lock=Tubelib Zugangsschloss
Tubelib Access Lock, Enter access code=Tubelib Zugangsschloss, Zugangscode eingeben
### accesscontrol.lua ###
### colorlamp.lua ###
### doorblock.lua ###
### gateblock.lua ###
### logic_not.lua ###
### mesecons_converter.lua ###
### repeater.lua ###
Save=Speichern
### ceilinglamp.lua ###
Tubelib Ceiling Lamp=Tubelib Deckenleuchte
### colorlamp.lua ###
### colorlamp_ud.lua ###
Tubelib Color Lamp=Tubelib Farblampe
### doorblock.lua ###
Select texture=Wähle Textur
Tubelib Door Block=Tubelib Türblock
### gateblock.lua ###
Tubelib Gate Block=Tubelib Torblock
### industriallamp.lua ###
Tubelib Industrial Lamp=Tubelib Industrielampe
### invisiblelamp.lua ###
Tubelib Invisible Lamp=Tubelib Unsichtbare Lampe
### logic_not.lua ###
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Tubelib Logic Not=Tubelib Logisches NOT
### logic_not.lua ###
### mesecons_converter.lua ###
### repeater.lua ###
: connected with=: verbunden mit
: not connected=: nicht verbunden
Destination node numbers=Zielknotennummern
### mesecons_converter.lua ###
Tubelib Mesecons Converter=Tubelib Mesecons Konverter
### mesecons_converter.lua ###
### repeater.lua ###
: fault (overloaded)=: Fehler (überlastet)
### programmer.lua ###
Tubelib Programmer=Tubelib Programmer
[Tubelib Programmer] Error: programmer not supported!=[Tubelib Programmer] Fehler: Programmer wird nicht unterstützt!
[Tubelib Programmer] Unknown node on=[Tubelib Programmer] Unbekannter Knoten an
[Tubelib Programmer] foreign or unknown node!=[Tubelib Programmer] fremder oder unbekannter Knoten!
[Tubelib Programmer] node programmed!=[Tubelib Programmer] Knoten programmiert!
[Tubelib Programmer] number=[Tubelib Programmer] Nummer
[Tubelib Programmer] programmer reset=[Tubelib Programmer] Programmer zurückgesetzt
read=lesen
### repeater.lua ###
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Tubelib Repeater=Tubelib Repeater
### sequencer.lua ###
Define a sequence of commands@nto control other machines.=Definieren Sie eine Folge von Befehlen@nandere Maschinen zu steuern.
If endless is set, the Sequencer@nrestarts again and again.=Wenn endlos eingestellt ist, wird der Sequenzer@nimmer wieder neu gestartet.
Numbers(s) are the node numbers,@nthe command shall sent to.=Zahlen sind die Knotennummern,@nzu denen der Befehl gesendet werden soll.
Offset is the time to the@nnext line in seconds (1..999).=Offset ist die Zeit bis zur@nnächste Zeile in Sekunden (1..999).
Run endless=Laufe endlos
Sequencer Help=Sequenzer-Hilfe
The command ' ' does nothing,@nonly consuming the offset time.=Der Befehl '' macht nichts,@nverbraucht nur die Wartezeit.
The commands 'on'/'off' are used@n for machines and other nodes.=Die Befehle 'ein'/'aus' werden@nfür Maschinen und andere Knoten verwendet.
Tubelib Sequencer=Tubelib Sequenzer
exit=raus
help=Hilfe
### sequencer.lua ###
### timer.lua ###
Command=Befehl
### streetlamp.lua ###
Tubelib Street Lamp=Tubelib Straßenlaterne
### timer.lua ###
Number(s)=Nummer(n)
Time=Zeit
Tubelib Timer=Tubelib Timer

View file

@ -3,24 +3,27 @@
Tubelib Addons 2
================
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
logic_not.lua:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local function formspec(meta)
local numbers = meta:get_string("numbers")
return "size[7,5]"..
"field[0.5,2;6,1;number;Destination node numbers;"..numbers.."]" ..
"button_exit[1,3;2,1;exit;Save]"
"field[0.5,2;6,1;number;"..S("Destination node numbers")..";"..numbers.."]" ..
"button_exit[1,3;2,1;exit;"..S("Save").."]"
end
minetest.register_node("tubelib_addons2:logic_not", {
description = "Tubelib Logic Not",
description = S("Tubelib Logic Not"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -33,7 +36,7 @@ minetest.register_node("tubelib_addons2:logic_not", {
local own_number = tubelib.add_node(pos, "tubelib_addons2:logic_not")
meta:set_string("own_number", own_number)
meta:set_string("formspec", formspec(meta))
meta:set_string("infotext", "Tubelib Logic Not "..own_number..": not connected")
meta:set_string("infotext", S("Tubelib Logic Not").." "..own_number..S(": not connected"))
meta:set_string("owner", placer:get_player_name())
end,
@ -47,7 +50,7 @@ minetest.register_node("tubelib_addons2:logic_not", {
if tubelib.check_numbers(fields.number) then
meta:set_string("numbers", fields.number)
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "Tubelib Logic Not "..own_number..": connected with "..fields.number)
meta:set_string("infotext", S("Tubelib Logic Not").." "..own_number..S(": connected with").." "..fields.number)
meta:set_string("formspec", formspec(meta))
end
end,
@ -82,7 +85,7 @@ tubelib.register_node("tubelib_addons2:logic_not", {}, {
local numbers = meta:get_string("numbers")
local own_number = meta:get_string("own_number")
if topic == "set_numbers" then
meta:set_string("infotext", "Tubelib Logic Not "..own_number..": connected with "..payload)
meta:set_string("infotext", S("Tubelib Logic Not").." "..own_number..S(": connected with").." "..payload)
meta:set_string("numbers", payload)
meta:set_string("formspec", formspec(meta))
return true

View file

@ -3,22 +3,25 @@
Tubelib Addons 2
================
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
mesecons_converter.lua:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local OVER_LOAD_MAX = 5
local function formspec(meta)
local numbers = meta:get_string("numbers")
return "size[7,5]"..
"field[0.5,2;6,1;number;Destination node numbers;"..numbers.."]" ..
"button_exit[1,3;2,1;exit;Save]"
"field[0.5,2;6,1;number;"..S("Destination node numbers")..";"..numbers.."]" ..
"button_exit[1,3;2,1;exit;"..S("Save").."]"
end
local function send_message(pos, topic, payload)
@ -29,7 +32,7 @@ local function send_message(pos, topic, payload)
meta:set_int("overload_cnt", overload_cnt)
if overload_cnt > OVER_LOAD_MAX then
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "Tubelib Mesecons Converter "..own_number..": fault (overloaded)")
meta:set_string("infotext", S("Tubelib Mesecons Converter").." "..own_number..S(": fault (overloaded)"))
minetest.get_node_timer(pos):stop()
return
else
@ -42,7 +45,7 @@ local function send_message(pos, topic, payload)
end
minetest.register_node("tubelib_addons2:mesecons_converter", {
description = "Tubelib Mesecons Converter",
description = S("Tubelib Mesecons Converter"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -55,7 +58,7 @@ minetest.register_node("tubelib_addons2:mesecons_converter", {
local own_number = tubelib.add_node(pos, "tubelib_addons2:mesecons_converter")
meta:set_string("own_number", own_number)
meta:set_string("formspec", formspec(meta))
meta:set_string("infotext", "Tubelib Mesecons Converter "..own_number..": not connected")
meta:set_string("infotext", S("Tubelib Mesecons Converter").." "..own_number..S(": not connected"))
meta:set_string("owner", placer:get_player_name())
-- send_message is called 24 times after the node is placed
meta:set_int("overload_cnt", -24)
@ -72,7 +75,7 @@ minetest.register_node("tubelib_addons2:mesecons_converter", {
if tubelib.check_numbers(fields.number) then
meta:set_string("numbers", fields.number)
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "Tubelib Mesecons Converter "..own_number..": connected with "..fields.number)
meta:set_string("infotext", S("Tubelib Mesecons Converter").." "..own_number..S(": connected with").." "..fields.number)
meta:set_string("formspec", formspec(meta))
end
@ -145,7 +148,7 @@ tubelib.register_node("tubelib_addons2:mesecons_converter", {}, {
elseif topic == "set_numbers" then
local meta = minetest.get_meta(pos)
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "Tubelib Mesecons Converter "..own_number..": connected with "..payload)
meta:set_string("infotext", S("Tubelib Mesecons Converter").." "..own_number..S(": connected with").." "..payload)
meta:set_string("numbers", payload)
meta:set_string("formspec", formspec(meta))
end

View file

@ -3,15 +3,18 @@
Tubelib Addons 2
================
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
programmer.lua:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local function join_to_string(tbl)
local t = {}
for key,_ in pairs(tbl) do
@ -23,7 +26,7 @@ end
local function reset_programmer(itemstack, user, pointed_thing)
user:set_attribute("tubelib_prog_numbers", nil)
minetest.chat_send_player(user:get_player_name(), "[Tubelib Programmer] programmer reset")
minetest.chat_send_player(user:get_player_name(), S("[Tubelib Programmer] programmer reset"))
return itemstack
end
@ -35,9 +38,9 @@ local function read_number(itemstack, user, pointed_thing)
local numbers = minetest.deserialize(user:get_attribute("tubelib_prog_numbers")) or {}
numbers[number] = true
user:set_attribute("tubelib_prog_numbers", minetest.serialize(numbers))
minetest.chat_send_player(user:get_player_name(), "[Tubelib Programmer] number "..number.." read")
minetest.chat_send_player(user:get_player_name(), S("[Tubelib Programmer] number").." "..number.." "..S("read"))
else
minetest.chat_send_player(user:get_player_name(), "[Tubelib Programmer] Unknown node on "..minetest.pos_to_string(pos))
minetest.chat_send_player(user:get_player_name(), S("[Tubelib Programmer] Unknown node on").." "..minetest.pos_to_string(pos))
end
else
return reset_programmer(itemstack, user, pointed_thing)
@ -55,14 +58,14 @@ local function program_numbers(itemstack, placer, pointed_thing)
local text = join_to_string(numbers)
local player_name = placer:get_player_name()
if meta and meta:get_string("owner") ~= player_name then
minetest.chat_send_player(player_name, "[Tubelib Programmer] foreign or unknown node!")
minetest.chat_send_player(player_name, S("[Tubelib Programmer] foreign or unknown node!"))
return itemstack
end
local res = tubelib.send_request(node_number, "set_numbers", text)
if res == true then
minetest.chat_send_player(player_name, "[Tubelib Programmer] node programmed!")
minetest.chat_send_player(player_name, S("[Tubelib Programmer] node programmed!"))
else
minetest.chat_send_player(player_name, "[Tubelib Programmer] Error: programmer not supported!")
minetest.chat_send_player(player_name, S("[Tubelib Programmer] Error: programmer not supported!"))
end
return itemstack
else
@ -71,7 +74,7 @@ local function program_numbers(itemstack, placer, pointed_thing)
end
minetest.register_craftitem("tubelib_addons2:programmer", {
description = "Tubelib Programmer",
description = S("Tubelib Programmer"),
inventory_image = "tubelib_addons2_programmer.png",
stack_max = 1,
wield_image = "tubelib_addons2_programmer_wield.png",

View file

@ -3,26 +3,29 @@
Tubelib Addons 2
================
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2020 Joachim Stolberg
LGPLv2.1+
AGPL v3
See LICENSE.txt for more information
repeater.lua:
]]--
-- Load support for I18n
local S = tubelib_addons2.S
local OVER_LOAD_MAX = 5
local function formspec(meta)
local numbers = meta:get_string("numbers")
return "size[7,5]"..
"field[0.5,2;6,1;number;Destination node numbers;"..numbers.."]" ..
"button_exit[1,3;2,1;exit;Save]"
"field[0.5,2;6,1;number;"..S("Destination node numbers")..";"..numbers.."]" ..
"button_exit[1,3;2,1;exit;"..S("Save").."]"
end
minetest.register_node("tubelib_addons2:repeater", {
description = "Tubelib Repeater",
description = S("Tubelib Repeater"),
tiles = {
-- up, down, right, left, back, front
'tubelib_front.png',
@ -35,7 +38,7 @@ minetest.register_node("tubelib_addons2:repeater", {
local own_number = tubelib.add_node(pos, "tubelib_addons2:repeater")
meta:set_string("own_number", own_number)
meta:set_string("formspec", formspec(meta))
meta:set_string("infotext", "Tubelib Repeater "..own_number..": not connected")
meta:set_string("infotext", S("Tubelib Repeater").." "..own_number..S(": not connected"))
meta:set_string("owner", placer:get_player_name())
meta:set_int("overload_cnt", 0)
minetest.get_node_timer(pos):start(1)
@ -51,7 +54,7 @@ minetest.register_node("tubelib_addons2:repeater", {
if tubelib.check_numbers(fields.number) then
meta:set_string("numbers", fields.number)
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "Tubelib Repeater "..own_number..": connected with "..fields.number)
meta:set_string("infotext", S("Tubelib Repeater").." "..own_number..S(": connected with").." "..fields.number)
meta:set_string("formspec", formspec(meta))
end
@ -101,12 +104,12 @@ tubelib.register_node("tubelib_addons2:repeater", {}, {
meta:set_int("overload_cnt", overload_cnt)
if overload_cnt > OVER_LOAD_MAX then
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "Tubelib Repeater "..own_number..": fault (overloaded)")
meta:set_string("infotext", S("Tubelib Repeater").." "..own_number..S(": fault (overloaded)"))
minetest.get_node_timer(pos):stop()
return false
elseif topic == "set_numbers" then
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "Tubelib Repeater "..own_number..": connected with "..payload)
meta:set_string("infotext", S("Tubelib Repeater").." "..own_number..S(": connected with").." "..payload)
meta:set_string("numbers", payload)
meta:set_string("formspec", formspec(meta))
return true

Some files were not shown because too many files have changed in this diff Show more