From adbb2f037a7f6a523e52a0613d511b5cb9d9543c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Sch=C3=B6tz?= Date: Tue, 20 Apr 2021 22:19:35 +0200 Subject: [PATCH 01/21] Adds string for '@1 was slain by @2' (deathmessage for mob with nametag) to template.txt and mcl_death_messages.de.tr --- mods/HUD/mcl_death_messages/locale/mcl_death_messages.de.tr | 1 + mods/HUD/mcl_death_messages/locale/template.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/mods/HUD/mcl_death_messages/locale/mcl_death_messages.de.tr b/mods/HUD/mcl_death_messages/locale/mcl_death_messages.de.tr index b9ef6680..389a3288 100644 --- a/mods/HUD/mcl_death_messages/locale/mcl_death_messages.de.tr +++ b/mods/HUD/mcl_death_messages/locale/mcl_death_messages.de.tr @@ -10,6 +10,7 @@ @1 drowned.=@1 ertrank. @1 ran out of oxygen.=@1 ging die Luft aus. @1 was killed by @2.=@1 wurde von @2 getötet. +@1 was slain by @2.=@1 wurde von @2 getötet. @1 was killed.=@1 wurde getötet. @1 was killed by a mob.=@1 wurde von einem Mob getötet. @1 was burned to death by a blaze's fireball.=@1 wurde von einem Feuerball einer Lohe zu Tode verbrannt. diff --git a/mods/HUD/mcl_death_messages/locale/template.txt b/mods/HUD/mcl_death_messages/locale/template.txt index db074f75..e748ae5d 100644 --- a/mods/HUD/mcl_death_messages/locale/template.txt +++ b/mods/HUD/mcl_death_messages/locale/template.txt @@ -10,6 +10,7 @@ @1 drowned.= @1 ran out of oxygen.= @1 was killed by @2.= +@1 was slain by @2.= @1 was killed.= @1 was killed by a mob.= @1 was burned to death by a blaze's fireball.= From 48091cecab173d64a877d2d9e361da999fa0e0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Sch=C3=B6tz?= Date: Sat, 24 Apr 2021 09:06:56 +0200 Subject: [PATCH 02/21] mcl_enchanting: Add missing translation strings for enchantment table to template.txt and german, french, russian translations. --- .../locale/mcl_enchanting.de.tr | 8 ++++++++ .../locale/mcl_enchanting.fr.tr | 13 +++++++++++-- .../locale/mcl_enchanting.ru.tr | 19 +++++++++++++++++-- mods/ITEMS/mcl_enchanting/locale/template.txt | 12 ++++++++++-- 4 files changed, 46 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr index 68077578..7facdd55 100644 --- a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.de.tr @@ -97,4 +97,12 @@ The target item is not enchantable.=Der Zielgegenstand ist nicht verzauberbar. '@1' is not a valid number.='@1' ist keine gültige Zahl. Enchanted Book=Verzaubertes Buch Enchanting Table=Zaubertisch +Spend experience, and lapis to enchant various items.=Verbrauche Erfahrung und Lapislazuli, um verschiedene Gegenstände zu verzaubern. +Enchanting Tables will let you enchant armors, tools, weapons, and books with various abilities. But, at the cost of some experience, and lapis lazuli.=Mit Zaubertischen kannst Du Rüstungen, Werkzeuge, Waffen und Bücher mit verschiedenen Fähigkeiten verzaubern. Das kostet aber Erfahrung und Lapislazuli. +Rightclick the Enchanting Table to open the enchanting menu.=Rechtsklick auf den Zaubertisch öffnet das Verzaubern-Menü +Place a tool, armor, weapon or book into the top left slot, and then place 1-3 Lapis Lazuli in the slot to the right.=Platziere ein Werkzeug, eine Waffe oder ein Buch im oberen linken Slot und platziere dann 1-3 Lapislazuli im rechten Slot. +After placing your items in the slots, the enchanting options will be shown. Hover over the options to read what is available to you.=Nachdem Du Deine Gegenstände in den Slots platziert hast, werden die Verzauberungs-Optionen angezeigt. Fahre mit der Maus über die Optionen, um die angebotenen Verzauberungen zu sehen. +These options are randomized, and dependent on experience level; but the enchantment strength can be increased.=Die Auswahl wird zufällig generiert und hängt von Deinem Erfahrungslevel ab; Du kannst die Stärker der Verzauberung aber erhöhen. +To increase the enchantment strength, place bookshelves around the enchanting table. However, you will need to keep 1 air node between the table, & the bookshelves to empower the enchanting table.=Um die Stärker der Verzauberung zu erhöhen, platziere Bücherregale um den Zaubertisch. Damit die Verstärkung funktioniert, muss zwischen Tisch und Bücherregalen aber ein Block Freiraum sein. +After finally selecting your enchantment; left-click on the selection, and you will see both the lapis lazuli and your experience levels consumed. And, an enchanted item left in its place.=Nachdem Du Deine Verzauberung ausgewählt hast, klicke links auf die Auswahl. Nun werden Lapislazuli und Erfahrung verbraucht und durch einen verzauberten Gegenstand ersetzt. Enchant=Verzaubern diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr index 582f0e59..5a5a4b4f 100644 --- a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.fr.tr @@ -1,4 +1,5 @@ # textdomain: mcl_enchanting +# Disclaimer: Some of these texts were machine-translated and should be reviewed by someone competent Aqua Affinity=Affinité aquatique Increases underwater mining speed.=Augmente la vitesse de minage sous-marine. Bane of Arthropods=Fléau des arthropodes @@ -76,8 +77,8 @@ Reflects some of the damage taken when hit, at the cost of reducing durability w Unbreaking=Solidité Increases item durability.=Augmente la durabilité des objets. Inventory=Inventaire -@1 × Lapis Lazuli=@1 × Lapis Lazuli -Enchantment levels: @1=Niveaux d'enchantement: @1 +@1 Lapis Lazuli=@1 Lapis Lazuli +@1 Enchantment Levels=Niveaux d'enchantement: @1 Level requirement: @1=Niveau requis: @1 Enchant an item=Enchanter un objet []= [] @@ -97,4 +98,12 @@ The target item is not enchantable.=L'objet cible n'est pas enchantable. '@1' is not a valid number.='@1' n'est pas un nombre valide. Enchanted Book=Livre enchanté Enchanting Table=Table d'enchantement +Spend experience, and lapis to enchant various items.=Dépensez de l'expérience et du lapis pour enchanter divers objets. +Enchanting Tables will let you enchant armors, tools, weapons, and books with various abilities. But, at the cost of some experience, and lapis lazuli.=Les tables d'enchantement vous permettront d'enchanter des armures, des outils, des armes et des livres avec diverses capacités. Mais, au prix d'un peu d'expérience, et de lapis-lazuli. +Rightclick the Enchanting Table to open the enchanting menu.=Faites un clic droit sur la table d'enchantement pour ouvrir le menu d'enchantement. +Place a tool, armor, weapon or book into the top left slot, and then place 1-3 Lapis Lazuli in the slot to the right.=Placez un outil, une armure, une arme ou un livre dans la fente supérieure gauche, puis placez 1-3 Lapis Lazuli dans la fente de droite. +After placing your items in the slots, the enchanting options will be shown. Hover over the options to read what is available to you.=Après avoir placé vos objets dans les emplacements, les options d'enchantement s'afficheront. Passez la souris sur les options pour lire ce qui est disponible pour vous. +These options are randomized, and dependent on experience level; but the enchantment strength can be increased.=Ces options sont aléatoires et dépendent du niveau d'expérience, mais la force de l'enchantement peut être augmentée. +To increase the enchantment strength, place bookshelves around the enchanting table. However, you will need to keep 1 air node between the table, & the bookshelves to empower the enchanting table.=Pour augmenter la puissance de l'enchantement, placez des étagères autour de la table d'enchantement. Cependant, vous devrez garder un nœud aérien entre la table et les étagères pour renforcer la table d'enchantement. +After finally selecting your enchantment; left-click on the selection, and you will see both the lapis lazuli and your experience levels consumed. And, an enchanted item left in its place.=Après avoir finalement sélectionné votre enchantement, cliquez avec le bouton gauche de la souris sur la sélection, et vous verrez le lapis-lazuli et vos niveaux d'expérience consommés. Et, un objet enchanté laissé à sa place. Enchant=Enchantement diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ru.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ru.tr index 6ea2038b..ac695b2f 100644 --- a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ru.tr +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.ru.tr @@ -1,4 +1,5 @@ # textdomain: mcl_enchanting +# Disclaimer: Some of these texts were machine-translated and should be reviewed by someone competent Aqua Affinity=Родство с водой Increases underwater mining speed.=Увеличивает скорость добычи под водой. Bane of Arthropods=Бич членистоногих @@ -76,8 +77,8 @@ Reflects some of the damage taken when hit, at the cost of reducing durability w Unbreaking=Нерушимость Increases item durability.=Увеличивает прочность предмета. Inventory=Инвентарь -@1 × Lapis Lazuli=@1 × Ляпис-лазурь -Enchantment levels: @1=Уровень зачаровывания: @1 +@1 Lapis Lazuli=@1 Ляпис-лазурь +@1 Enchantment Levels=@1 Уровень зачаровывания Level requirement: @1=Требуемый уровень: @1 Enchant an item=Зачаровать предмет []=<игрок> <зачарование> [<уровень>] @@ -97,4 +98,18 @@ The target item is not enchantable.=Указана незачаровываем '@1' is not a valid number.='@1' не является допустимым числом. Enchanted Book=Зачарованная книга Enchanting Table=Стол зачаровывания +Spend experience, and lapis to enchant various items.=Проведите время, и ляпис, чтобы очаровать различные предметы. +Enchanting Tables will let you enchant armors, tools, weapons, and books with various abilities. But, at the cost of some experience, and lapis lazuli.=Волшебные столы позволят вам очаровать доспехами, инструментами, оружием и книгами с различными способностями. Но, ценой некоторого опыта, и ляпис-лазурь. +Rightclick the Enchanting Table to open the enchanting menu.=Щелкните правой кнопкой мыши Зачаровывающий стол, чтобы открыть зачаровывающее меню. +Place a tool, armor, weapon or book into the top left slot, and then place 1-3 Lapis Lazuli in the slot to the right.=Поместите инструмент, броню, оружие или книгу в верхний левый паз, а затем поместите 1-3 лазурита в паз справа. +After placing your items in the slots, the enchanting options will be shown. Hover over the options to read what is available to you.=После размещения Ваших элементов в слотах, будут показаны волшебные опции. Наведите курсор на опции, чтобы прочитать, что доступно для вас. +These options are randomized, and dependent on experience level; but the enchantment strength can be increased.=Эти варианты рандомизированы и зависят от уровня опыта; но сила очарования может быть увеличена. +To increase the enchantment strength, place bookshelves around the enchanting table. However, you will need to keep 1 air node between the table, & the bookshelves to empower the enchanting table.=Чтобы увеличить силу очарования, разместите книжные полки вокруг очаровательного стола. Однако, вам нужно будет держать 1 воздушный узел между столом и книжными полками, чтобы придать силу очаровательному столу. +After finally selecting your enchantment; left-click on the selection, and you will see both the lapis lazuli and your experience levels consumed. And, an enchanted item left in its place.=После того, как вы, наконец, выбрали свое очарование; щелкните левой кнопкой мыши по выбору, и вы увидите, как лазурь ляпис и ваш уровень опыта потребляется. И очарованная вещь, оставленная на своем месте. Enchant=Зачарование + + +##### not used anymore ##### + +@1 × Lapis Lazuli=@1 × Ляпис-лазурь +Enchantment levels: @1=Уровень зачаровывания: @1 diff --git a/mods/ITEMS/mcl_enchanting/locale/template.txt b/mods/ITEMS/mcl_enchanting/locale/template.txt index f186ef37..ac8139b6 100644 --- a/mods/ITEMS/mcl_enchanting/locale/template.txt +++ b/mods/ITEMS/mcl_enchanting/locale/template.txt @@ -76,8 +76,8 @@ Reflects some of the damage taken when hit, at the cost of reducing durability w Unbreaking= Increases item durability.= Inventory= -@1 × Lapis Lazuli= -Enchantment levels: @1= +@1 Lapis Lazuli= +@1 Enchantment Levels= Level requirement: @1= Enchant an item= []= @@ -97,4 +97,12 @@ The target item is not enchantable.= '@1' is not a valid number.= Enchanted Book= Enchanting Table= +Spend experience, and lapis to enchant various items.= +Enchanting Tables will let you enchant armors, tools, weapons, and books with various abilities. But, at the cost of some experience, and lapis lazuli.= +Rightclick the Enchanting Table to open the enchanting menu.= +Place a tool, armor, weapon or book into the top left slot, and then place 1-3 Lapis Lazuli in the slot to the right.= +After placing your items in the slots, the enchanting options will be shown. Hover over the options to read what is available to you.= +These options are randomized, and dependent on experience level; but the enchantment strength can be increased.= +To increase the enchantment strength, place bookshelves around the enchanting table. However, you will need to keep 1 air node between the table, & the bookshelves to empower the enchanting table.= +After finally selecting your enchantment; left-click on the selection, and you will see both the lapis lazuli and your experience levels consumed. And, an enchanted item left in its place.= Enchant= From 7d44596c6da8d4683abd014d54f2130f5bde5870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Sch=C3=B6tz?= Date: Mon, 26 Apr 2021 08:34:33 +0200 Subject: [PATCH 03/21] mcl_bows: Increase chance for critical from 20% to 25% bow.lua Increase chance from 20% to 25% bow.lua Adjust helptexts arrow.lua Adjust helptexts mcl_bows.(de,es,fr,ru).tr template.txt: Adjust helptexts --- mods/ITEMS/mcl_bows/arrow.lua | 2 +- mods/ITEMS/mcl_bows/bow.lua | 6 +++--- mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr | 4 ++-- mods/ITEMS/mcl_bows/locale/mcl_bows.es.tr | 6 +++--- mods/ITEMS/mcl_bows/locale/mcl_bows.fr.tr | 4 ++-- mods/ITEMS/mcl_bows/locale/mcl_bows.ru.tr | 4 ++-- mods/ITEMS/mcl_bows/locale/template.txt | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index e8e3ec16..035dd122 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -22,7 +22,7 @@ minetest.register_craftitem("mcl_bows:arrow", { description = S("Arrow"), _tt_help = S("Ammunition").."\n"..S("Damage from bow: 1-10").."\n"..S("Damage from dispenser: 3"), _doc_items_longdesc = S("Arrows are ammunition for bows and dispensers.").."\n".. -S("An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 20% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.").."\n".. +S("An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 25% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.").."\n".. S("Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons."), _doc_items_usagehelp = S("To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it."), inventory_image = "mcl_bows_arrow_inv.png", diff --git a/mods/ITEMS/mcl_bows/bow.lua b/mods/ITEMS/mcl_bows/bow.lua index 4ea2066b..2630cc9e 100644 --- a/mods/ITEMS/mcl_bows/bow.lua +++ b/mods/ITEMS/mcl_bows/bow.lua @@ -129,7 +129,7 @@ minetest.register_tool("mcl_bows:bow", { description = S("Bow"), _tt_help = S("Launches arrows"), _doc_items_longdesc = S("Bows are ranged weapons to shoot arrows at your foes.").."\n".. -S("The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 20% of a critical hit, dealing 10 damage instead."), +S("The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 25% of a critical hit, dealing 10 damage instead."), _doc_items_usagehelp = S("To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot."), _doc_items_durability = BOW_DURABILITY, inventory_image = "mcl_bows_bow.png", @@ -256,9 +256,9 @@ controls.register_on_release(function(player, key, time) local is_critical = false if charge >= BOW_CHARGE_TIME_FULL then speed = BOW_MAX_SPEED - local r = math.random(1,5) + local r = math.random(1,4) if r == 1 then - -- 20% chance for critical hit + -- 25% chance for critical hit damage = 10 is_critical = true else diff --git a/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr b/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr index c3b42681..bfe4868e 100644 --- a/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr +++ b/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr @@ -1,12 +1,12 @@ # textdomain: mcl_bows Arrow=Pfeil Arrows are ammunition for bows and dispensers.=Pfeile sind Munition für Bögen und Werfer. -An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 20% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Ein Bogen von einem Pfeil richtet regulär 1-9 Schaden an. Mit voller Zugkraft gibt es eine 20%-ige Chance auf einen kritischen Treffer mit 10 Schaden. Ein Pfeil aus einem Werfer richtet immer 3 Schaden an. +An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 25% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Ein Bogen von einem Pfeil richtet regulär 1-9 Schaden an. Mit voller Zugkraft gibt es eine 25%-ige Chance auf einen kritischen Treffer mit 10 Schaden. Ein Pfeil aus einem Werfer richtet immer 3 Schaden an. Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons.=Pfeile können in festen Blöcken stecken bleiben und wieder aufgesammelt werden. Sie können auf Holzknöpfe drücken. To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it.=Um Pfeile als Munition für dne Bogen zu benutzen, platzieren Sie sie einfach irgendwo im Inventar, sie werden automatisch benutzt. Um Pfeile als Munition für Werfer zu benutzen, platzieren Sie sie ins Inventar eines Werferr. Um einen steckengebliebenen Pfeil aufzusammeln, gehen Sie einfach zu ihm hin. Bow=Bogen Bows are ranged weapons to shoot arrows at your foes.=Bogen sind Fernwaffen, um Pfeile auf Ihre Feinde zu schießen. -The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 20% of a critical hit, dealing 10 damage instead.=Die Geschwindigkeit und der Schaden des Bogens erhöht sich, je länger sie den Bogen spannen. Der reguläre Schaden des Pfeiles ist zwischen 1 und 9. Ist der Bogen voll gespannt, gibt es eine 20%-ig Change für einen kritischen Treffer, der 10 Schaden anrichtet. +The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 25% of a critical hit, dealing 10 damage instead.=Die Geschwindigkeit und der Schaden des Bogens erhöht sich, je länger sie den Bogen spannen. Der reguläre Schaden des Pfeiles ist zwischen 1 und 9. Ist der Bogen voll gespannt, gibt es eine 25%-ig Change für einen kritischen Treffer, der 10 Schaden anrichtet. To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot.=Um den Bogen zu benutzen, muss sich im Inventar mindestens ein Pfeil befinden (außer im Kreativmodus). Halten sie die rechte Maustaste gedrückt zum Spannen, lassen Sie sie los zum Schießen. Bow=Bogen Ammunition=Munition diff --git a/mods/ITEMS/mcl_bows/locale/mcl_bows.es.tr b/mods/ITEMS/mcl_bows/locale/mcl_bows.es.tr index 539afdcf..f065463f 100644 --- a/mods/ITEMS/mcl_bows/locale/mcl_bows.es.tr +++ b/mods/ITEMS/mcl_bows/locale/mcl_bows.es.tr @@ -1,11 +1,11 @@ # textdomain: mcl_bows Arrow=Flecha Arrows are ammunition for bows and dispensers.=Las flechas son municiones para arcos y dispensadores. -An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 20% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Una flecha disparada desde un arco tiene un daño regular de 1-9. A plena carga, hay un 20% de posibilidades de que un golpe crítico inflija 10 daños en su lugar. Una flecha disparada desde un dispensador siempre causa 3 de daño. +An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 25% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Una flecha disparada desde un arco tiene un daño regular de 1-9. A plena carga, hay un 25% de posibilidades de que un golpe crítico inflija 10 daños en su lugar. Una flecha disparada desde un dispensador siempre causa 3 de daño. Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons.=Las flechas pueden atascarse en bloques sólidos y pueden recuperarse nuevamente. También son capaces de presionar botones de madera. To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it.=Para usar flechas como municiones para un arco, simplemente colóquelas en cualquier parte de su inventario, se usarán automáticamente. Para usar flechas como municiones para un dispensador, colóquelas en el inventario del dispensador. Para recuperar una flecha que se pega en un bloque, simplemente camine cerca de ella. Bow=Arco Bows are ranged weapons to shoot arrows at your foes.=Los arcos son armas a distancia para disparar flechas a tus enemigos. -The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 20% of a critical hit, dealing 10 damage instead.=La velocidad y el daño de la flecha aumentan cuanto más tiempo tenses. El daño regular de la flecha está entre 1 y 9. A plena carga, también hay un 20% de un golpe crítico, que en vez de eso causa 10 de daño. +The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 25% of a critical hit, dealing 10 damage instead.=La velocidad y el daño de la flecha aumentan cuanto más tiempo tenses. El daño regular de la flecha está entre 1 y 9. A plena carga, también hay un 25% de un golpe crítico, que en vez de eso causa 10 de daño. To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot.=Para usar el arco, primero debes de tener al menos una flecha en cualquier parte de su inventario (a menos que esté en modo creativo). Mantenga presionado el botón derecho del mouse para tensar, suelte para disparar. -Bow=Arco \ No newline at end of file +Bow=Arco diff --git a/mods/ITEMS/mcl_bows/locale/mcl_bows.fr.tr b/mods/ITEMS/mcl_bows/locale/mcl_bows.fr.tr index 313081e4..9d4d8824 100644 --- a/mods/ITEMS/mcl_bows/locale/mcl_bows.fr.tr +++ b/mods/ITEMS/mcl_bows/locale/mcl_bows.fr.tr @@ -1,12 +1,12 @@ # textdomain: mcl_bows Arrow=Flèche Arrows are ammunition for bows and dispensers.=Les flèches sont des munitions pour les arcs et les distributeurs. -An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 20% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Une flèche tirée d'un arc a des dégâts réguliers de 1 à 9. À pleine charge, il y a 20% de chances qu'un coup critique inflige 10 dégâts à la place. Une flèche tirée depuis un distributeur inflige toujours 3 dégâts. +An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 25% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Une flèche tirée d'un arc a des dégâts réguliers de 1 à 9. À pleine charge, il y a 25% de chances qu'un coup critique inflige 10 dégâts à la place. Une flèche tirée depuis un distributeur inflige toujours 3 dégâts. Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons.=Les flèches peuvent se coincer sur des blocs solides et peuvent être récupérées à nouveau. Ils sont également capables de pousser des boutons en bois. To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it.=Pour utiliser des flèches comme munitions pour un arc, il suffit de les placer n'importe où dans votre inventaire, elles seront utilisées automatiquement. Pour utiliser des flèches comme munitions pour un distributeur, placez-les dans l'inventaire du distributeur. Pour récupérer une flèche qui colle dans un bloc, il vous suffit de vous en approcher. Bow=Arc Bows are ranged weapons to shoot arrows at your foes.=Les arcs sont des armes à distance pour tirer des flèches sur vos ennemis. -The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 20% of a critical hit, dealing 10 damage instead.=La vitesse et les dégâts de la flèche augmentent plus vous chargez. Les dégâts réguliers de la flèche sont compris entre 1 et 9. À pleine charge, il y a également 20% d'un coup critique, infligeant 10 dégâts à la place. +The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 25% of a critical hit, dealing 10 damage instead.=La vitesse et les dégâts de la flèche augmentent plus vous chargez. Les dégâts réguliers de la flèche sont compris entre 1 et 9. À pleine charge, il y a également 25% d'un coup critique, infligeant 10 dégâts à la place. To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot.=Pour utiliser l'arc, vous devez d'abord avoir au moins une flèche n'importe où dans votre inventaire (sauf en mode créatif). Maintenez enfoncé le bouton droit de la souris pour charger, relâchez pour tirer. Bow=Arc Ammunition=Munition diff --git a/mods/ITEMS/mcl_bows/locale/mcl_bows.ru.tr b/mods/ITEMS/mcl_bows/locale/mcl_bows.ru.tr index 6a1b7ed3..6ac4262c 100644 --- a/mods/ITEMS/mcl_bows/locale/mcl_bows.ru.tr +++ b/mods/ITEMS/mcl_bows/locale/mcl_bows.ru.tr @@ -1,12 +1,12 @@ # textdomain: mcl_bows Arrow=Стрела Arrows are ammunition for bows and dispensers.=Стрелы - это боеприпасы для луков и диспенсеров. -An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 20% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Стрела, выпущенная из лука, обычно наносит урон 1-9. При полном натяжении есть 20-процентный шанс критического удара с уроном 10. Стрела из диспенсера всегда наносит урон уровня 3. +An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 25% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Стрела, выпущенная из лука, обычно наносит урон 1-9. При полном натяжении есть 25-процентный шанс критического удара с уроном 10. Стрела из диспенсера всегда наносит урон уровня 3. Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons.=Стрелы могут застревать в твёрдых блоках, их можно подбирать для повторного использования. Они также способны нажимать деревянные кнопки. To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it.=Чтобы использовать стрелы в качестве боеприпасов для лука, просто положите их в любую ячейку вашего инвентаря, и они будут использоваться автоматически. Чтобы использовать стрелы в качестве боеприпасов для диспенсера, поместите их в инвентарь диспенсера. Чтобы взять стрелу, застрявшую в блоке, просто пройдите рядом с ней. Bow=Лук Bows are ranged weapons to shoot arrows at your foes.=Лук - это оружие дальнего боя, чтобы стрелять стрелами по вашим врагам. -The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 20% of a critical hit, dealing 10 damage instead.=Скорость и урон стрелы увеличиваются, пока вы её натягиваете. Обычный урон стрелы находится между 1 и 9. При полном натяжении есть 20-процентный шанс критического удара с уроном 10. +The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 25% of a critical hit, dealing 10 damage instead.=Скорость и урон стрелы увеличиваются, пока вы её натягиваете. Обычный урон стрелы находится между 1 и 9. При полном натяжении есть 25-процентный шанс критического удара с уроном 10. To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot.=Чтобы использовать лук, нужно иметь хотя бы одну стрелу в вашем инвентаре (за исключением творческого режима). Удерживайте правую клавишу мыши, чтобы натягивать тетиву, затем отпустите, чтобы выстрелить. Bow=Лук Ammunition=Боеприпасы diff --git a/mods/ITEMS/mcl_bows/locale/template.txt b/mods/ITEMS/mcl_bows/locale/template.txt index 228b6170..f25ce44e 100644 --- a/mods/ITEMS/mcl_bows/locale/template.txt +++ b/mods/ITEMS/mcl_bows/locale/template.txt @@ -1,12 +1,12 @@ # textdomain: mcl_bows Arrow= Arrows are ammunition for bows and dispensers.= -An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 20% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.= +An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 25% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.= Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons.= To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it.= Bow= Bows are ranged weapons to shoot arrows at your foes.= -The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 20% of a critical hit, dealing 10 damage instead.= +The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 25% of a critical hit, dealing 10 damage instead.= To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot.= Bow= Ammunition= From 9f61cfffaaededef91b1ef4535ecdb0b754ac1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Sch=C3=B6tz?= Date: Mon, 26 Apr 2021 08:38:05 +0200 Subject: [PATCH 04/21] mcl_bows: Cleanup translation files with script Reordered translation-strings Duplicates were removed Gaps were detected for spanish and filled with machine-translation --- mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr | 9 ++++----- mods/ITEMS/mcl_bows/locale/mcl_bows.es.tr | 5 ++++- mods/ITEMS/mcl_bows/locale/mcl_bows.fr.tr | 9 ++++----- mods/ITEMS/mcl_bows/locale/mcl_bows.ru.tr | 9 ++++----- mods/ITEMS/mcl_bows/locale/template.txt | 9 ++++----- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr b/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr index bfe4868e..085d565d 100644 --- a/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr +++ b/mods/ITEMS/mcl_bows/locale/mcl_bows.de.tr @@ -1,15 +1,14 @@ # textdomain: mcl_bows Arrow=Pfeil +Ammunition=Munition +Damage from bow: 1-10=Schaden vom Bogen: 1-10 +Damage from dispenser: 3=Schaden vom Werfer: 3 Arrows are ammunition for bows and dispensers.=Pfeile sind Munition für Bögen und Werfer. An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 25% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Ein Bogen von einem Pfeil richtet regulär 1-9 Schaden an. Mit voller Zugkraft gibt es eine 25%-ige Chance auf einen kritischen Treffer mit 10 Schaden. Ein Pfeil aus einem Werfer richtet immer 3 Schaden an. Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons.=Pfeile können in festen Blöcken stecken bleiben und wieder aufgesammelt werden. Sie können auf Holzknöpfe drücken. To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it.=Um Pfeile als Munition für dne Bogen zu benutzen, platzieren Sie sie einfach irgendwo im Inventar, sie werden automatisch benutzt. Um Pfeile als Munition für Werfer zu benutzen, platzieren Sie sie ins Inventar eines Werferr. Um einen steckengebliebenen Pfeil aufzusammeln, gehen Sie einfach zu ihm hin. Bow=Bogen +Launches arrows=Verschießt Pfeile Bows are ranged weapons to shoot arrows at your foes.=Bogen sind Fernwaffen, um Pfeile auf Ihre Feinde zu schießen. The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 25% of a critical hit, dealing 10 damage instead.=Die Geschwindigkeit und der Schaden des Bogens erhöht sich, je länger sie den Bogen spannen. Der reguläre Schaden des Pfeiles ist zwischen 1 und 9. Ist der Bogen voll gespannt, gibt es eine 25%-ig Change für einen kritischen Treffer, der 10 Schaden anrichtet. To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot.=Um den Bogen zu benutzen, muss sich im Inventar mindestens ein Pfeil befinden (außer im Kreativmodus). Halten sie die rechte Maustaste gedrückt zum Spannen, lassen Sie sie los zum Schießen. -Bow=Bogen -Ammunition=Munition -Damage from bow: 1-10=Schaden vom Bogen: 1-10 -Damage from dispenser: 3=Schaden vom Werfer: 3 -Launches arrows=Verschießt Pfeile diff --git a/mods/ITEMS/mcl_bows/locale/mcl_bows.es.tr b/mods/ITEMS/mcl_bows/locale/mcl_bows.es.tr index f065463f..d1c286f9 100644 --- a/mods/ITEMS/mcl_bows/locale/mcl_bows.es.tr +++ b/mods/ITEMS/mcl_bows/locale/mcl_bows.es.tr @@ -1,11 +1,14 @@ # textdomain: mcl_bows Arrow=Flecha +Ammunition=Munición +Damage from bow: 1-10=Daño del arco: 1-10 +Damage from dispenser: 3=Daño del dispensador: 3 Arrows are ammunition for bows and dispensers.=Las flechas son municiones para arcos y dispensadores. An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 25% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Una flecha disparada desde un arco tiene un daño regular de 1-9. A plena carga, hay un 25% de posibilidades de que un golpe crítico inflija 10 daños en su lugar. Una flecha disparada desde un dispensador siempre causa 3 de daño. Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons.=Las flechas pueden atascarse en bloques sólidos y pueden recuperarse nuevamente. También son capaces de presionar botones de madera. To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it.=Para usar flechas como municiones para un arco, simplemente colóquelas en cualquier parte de su inventario, se usarán automáticamente. Para usar flechas como municiones para un dispensador, colóquelas en el inventario del dispensador. Para recuperar una flecha que se pega en un bloque, simplemente camine cerca de ella. Bow=Arco +Launches arrows=Dispara flechas Bows are ranged weapons to shoot arrows at your foes.=Los arcos son armas a distancia para disparar flechas a tus enemigos. The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 25% of a critical hit, dealing 10 damage instead.=La velocidad y el daño de la flecha aumentan cuanto más tiempo tenses. El daño regular de la flecha está entre 1 y 9. A plena carga, también hay un 25% de un golpe crítico, que en vez de eso causa 10 de daño. To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot.=Para usar el arco, primero debes de tener al menos una flecha en cualquier parte de su inventario (a menos que esté en modo creativo). Mantenga presionado el botón derecho del mouse para tensar, suelte para disparar. -Bow=Arco diff --git a/mods/ITEMS/mcl_bows/locale/mcl_bows.fr.tr b/mods/ITEMS/mcl_bows/locale/mcl_bows.fr.tr index 9d4d8824..e5bb9f8a 100644 --- a/mods/ITEMS/mcl_bows/locale/mcl_bows.fr.tr +++ b/mods/ITEMS/mcl_bows/locale/mcl_bows.fr.tr @@ -1,15 +1,14 @@ # textdomain: mcl_bows Arrow=Flèche +Ammunition=Munition +Damage from bow: 1-10=Dégâts de l'arc: 1-10 +Damage from dispenser: 3=Dégâts du distributeur: 3 Arrows are ammunition for bows and dispensers.=Les flèches sont des munitions pour les arcs et les distributeurs. An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 25% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Une flèche tirée d'un arc a des dégâts réguliers de 1 à 9. À pleine charge, il y a 25% de chances qu'un coup critique inflige 10 dégâts à la place. Une flèche tirée depuis un distributeur inflige toujours 3 dégâts. Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons.=Les flèches peuvent se coincer sur des blocs solides et peuvent être récupérées à nouveau. Ils sont également capables de pousser des boutons en bois. To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it.=Pour utiliser des flèches comme munitions pour un arc, il suffit de les placer n'importe où dans votre inventaire, elles seront utilisées automatiquement. Pour utiliser des flèches comme munitions pour un distributeur, placez-les dans l'inventaire du distributeur. Pour récupérer une flèche qui colle dans un bloc, il vous suffit de vous en approcher. Bow=Arc +Launches arrows=Lance des flèches Bows are ranged weapons to shoot arrows at your foes.=Les arcs sont des armes à distance pour tirer des flèches sur vos ennemis. The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 25% of a critical hit, dealing 10 damage instead.=La vitesse et les dégâts de la flèche augmentent plus vous chargez. Les dégâts réguliers de la flèche sont compris entre 1 et 9. À pleine charge, il y a également 25% d'un coup critique, infligeant 10 dégâts à la place. To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot.=Pour utiliser l'arc, vous devez d'abord avoir au moins une flèche n'importe où dans votre inventaire (sauf en mode créatif). Maintenez enfoncé le bouton droit de la souris pour charger, relâchez pour tirer. -Bow=Arc -Ammunition=Munition -Damage from bow: 1-10=Dégâts de l'arc: 1-10 -Damage from dispenser: 3=Dégâts du distributeur: 3 -Launches arrows=Lance des flèches diff --git a/mods/ITEMS/mcl_bows/locale/mcl_bows.ru.tr b/mods/ITEMS/mcl_bows/locale/mcl_bows.ru.tr index 6ac4262c..d19c2efd 100644 --- a/mods/ITEMS/mcl_bows/locale/mcl_bows.ru.tr +++ b/mods/ITEMS/mcl_bows/locale/mcl_bows.ru.tr @@ -1,15 +1,14 @@ # textdomain: mcl_bows Arrow=Стрела +Ammunition=Боеприпасы +Damage from bow: 1-10=Урон от лука: 1-10 +Damage from dispenser: 3=Урон от диспенсера: 3 Arrows are ammunition for bows and dispensers.=Стрелы - это боеприпасы для луков и диспенсеров. An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 25% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.=Стрела, выпущенная из лука, обычно наносит урон 1-9. При полном натяжении есть 25-процентный шанс критического удара с уроном 10. Стрела из диспенсера всегда наносит урон уровня 3. Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons.=Стрелы могут застревать в твёрдых блоках, их можно подбирать для повторного использования. Они также способны нажимать деревянные кнопки. To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it.=Чтобы использовать стрелы в качестве боеприпасов для лука, просто положите их в любую ячейку вашего инвентаря, и они будут использоваться автоматически. Чтобы использовать стрелы в качестве боеприпасов для диспенсера, поместите их в инвентарь диспенсера. Чтобы взять стрелу, застрявшую в блоке, просто пройдите рядом с ней. Bow=Лук +Launches arrows=Пускает стрелы Bows are ranged weapons to shoot arrows at your foes.=Лук - это оружие дальнего боя, чтобы стрелять стрелами по вашим врагам. The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 25% of a critical hit, dealing 10 damage instead.=Скорость и урон стрелы увеличиваются, пока вы её натягиваете. Обычный урон стрелы находится между 1 и 9. При полном натяжении есть 25-процентный шанс критического удара с уроном 10. To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot.=Чтобы использовать лук, нужно иметь хотя бы одну стрелу в вашем инвентаре (за исключением творческого режима). Удерживайте правую клавишу мыши, чтобы натягивать тетиву, затем отпустите, чтобы выстрелить. -Bow=Лук -Ammunition=Боеприпасы -Damage from bow: 1-10=Урон от лука: 1-10 -Damage from dispenser: 3=Урон от диспенсера: 3 -Launches arrows=Пускает стрелы diff --git a/mods/ITEMS/mcl_bows/locale/template.txt b/mods/ITEMS/mcl_bows/locale/template.txt index f25ce44e..98afc9c4 100644 --- a/mods/ITEMS/mcl_bows/locale/template.txt +++ b/mods/ITEMS/mcl_bows/locale/template.txt @@ -1,15 +1,14 @@ # textdomain: mcl_bows Arrow= +Ammunition= +Damage from bow: 1-10= +Damage from dispenser: 3= Arrows are ammunition for bows and dispensers.= An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 25% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.= Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons.= To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it.= Bow= +Launches arrows= Bows are ranged weapons to shoot arrows at your foes.= The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 25% of a critical hit, dealing 10 damage instead.= To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot.= -Bow= -Ammunition= -Damage from bow: 1-10= -Damage from dispenser: 3= -Launches arrows= From 27828b6317f5f509588b2c5482109fc504bfb02a Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 8 Apr 2021 01:46:01 +0200 Subject: [PATCH 05/21] Do not crash server if world border is depowered --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index 7986c290..7ad5a2bd 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -483,11 +483,13 @@ function mesecon.turnoff(pos, link) for _, r in ipairs(mesecon.rule2meta(f.link, mesecon.rules.mcl_alldirs_spread)) do local np = vector.add(f.pos, r) local n = mesecon.get_node_force(np) - if mesecon.is_receptor_on(n.name) then - local receptorrules = mesecon.receptor_get_rules(n) - for _, rr in pairs(receptorrules) do - if rr.spread and vector.equals(mesecon.invertRule(rr), r) then - return false + if not (mesecon.get_node_force(np) == nil) then + if mesecon.is_receptor_on(n.name) then + local receptorrules = mesecon.receptor_get_rules(n) + for _, rr in pairs(receptorrules) do + if rr.spread and vector.equals(mesecon.invertRule(rr), r) then + return false + end end end end From 0c13293f431f0e2379ea062db1abd04484f92ef2 Mon Sep 17 00:00:00 2001 From: E Date: Mon, 3 May 2021 11:24:35 -0400 Subject: [PATCH 06/21] tools: add a luacheckrc generator tools/make-luacheck-files.sh will generate a .luacheckrc with the following rules: - any rules set in the project header (.luacheck.head) - each mod is allowed to use a single global sharing its mod name - mod dependency information is parsed, and those mods' globals are permitted for read access --- .luacheck.head | 17 +++++++ tools/make-luacheck-files.sh | 95 ++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 .luacheck.head create mode 100755 tools/make-luacheck-files.sh diff --git a/.luacheck.head b/.luacheck.head new file mode 100644 index 00000000..bf49be42 --- /dev/null +++ b/.luacheck.head @@ -0,0 +1,17 @@ +std = "min" + +read_globals = { + "ItemStack", + "dump", "dump2", + "vector", + "VoxelArea", + "minetest", + "PseudoRandom", + "PerlinNoise", + "PcgRandom", + + string = {fields = {"split", "trim"}}, + table = {fields = {"copy", "getn", "indexof", "insert_all"}}, + math = {fields = {"hypot", "round"}}, +} + diff --git a/tools/make-luacheck-files.sh b/tools/make-luacheck-files.sh new file mode 100755 index 00000000..fa954ff7 --- /dev/null +++ b/tools/make-luacheck-files.sh @@ -0,0 +1,95 @@ +#!/bin/sh +# +# make-luacheck-files.sh +# v1 - E - Initial version + +set -ue + +if [ ! -d "mods" ] || [ ! -r ".luacheck.head" ]; then + printf "error: this script needs to be run from the mineclonia project root\n" 1>&2 + exit 1 +fi + +# We need these to be explicitly NOT expanded. +# shellcheck disable=2016 +{ + # This creates a luacheckrc-compatible line from a mod (supplied on + # the command line with -v MOD="mod_name"), a directory (-v DIR="..."), + # and a list of dependencies (via STDIN). The `read_globals` section is + # skipped if there are no dependencies (-v EMPTY=1). + AWK_DEPS2LCHECK=' + BEGIN { + printf("files[\"" DIR "\"] = { globals = { \"" MOD "\" }"); + if (!EMPTY) { + printf(", read_globals = { "); + } + }; + + # Without a pattern, this will match on empty lines + # and mess up the entry. We clean up the extra commas + # later in the script. + /.+/{ + sub("?$", ""); + sub("\xd", ""); + printf("\"" $1 "\", "); + }; + + END { + if (!EMPTY) { + printf("}"); + } + printf(" }\n"); + };' + + # This takes any line that contains 'depends' and an equal sign + # and spits out each (comma-separated) entry on its own line. + SED_MODCONF2DEPS=' + /depends *=/{ + s/.*depends *=//; + s/, ?/\n/g; + p; + }' + + HEADER=' +------------------------------------------------------------------- +-- THIS FILE WAS AUTOGENERATED BY tools/make-luacheck-files.sh ! -- +-- DO NOT EDIT BY HAND. YOUR CHANGES WILL BE LOST NEXT RUN! -- +------------------------------------------------------------------- + +' +} + +find mods -type d -print | while read -r DIR; do + if [ -r "$DIR/depends.txt" ]; then + printf "found: %s (%s)\n" "$DIR" "depends.txt" 1>&2 + # depends.txt is a simple newline-delimited file, + # so we can just read it in. + DEPS="$(cat "$DIR/depends.txt")" + elif [ -r "$DIR/mod.conf" ]; then + printf "found: %s (%s)\n" "$DIR" "mod.conf" 1>&2 + # mod.conf needs some more help to get usable + # data out of it. + DEPS="$(sed -n -r -e "$SED_MODCONF2DEPS" "$DIR/mod.conf")" + else + # Empty dir, or not a mod dir. + continue + fi + + EMPTY=0 + if [ -z "$DEPS" ]; then + EMPTY=1 + fi + + # Get only the last chunk of the directory + # for the mod name. + MOD="${DIR##*/}" + + # Now we run through it through the formatter, + # and remove any rogue trailing commas. + { awk -v DIR="$DIR" -v EMPTY="$EMPTY" -v MOD="$MOD" -- "$AWK_DEPS2LCHECK" | sed -e "s/, }/ }/"; } <<-EOF + $DEPS + EOF +done > .luacheck.files + +# Put the final thing together with the warning header +{ printf "%s" "$HEADER"; cat .luacheck.head .luacheck.files; } > .luacheckrc From 02a8496b5f72e8ae0523f9aa7075f9d96ce56ee2 Mon Sep 17 00:00:00 2001 From: E Date: Mon, 3 May 2021 11:28:57 -0400 Subject: [PATCH 07/21] luacheck: include a generated luacheck config --- .luacheckrc | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 .luacheckrc diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 00000000..6cd60584 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,163 @@ + +------------------------------------------------------------------- +-- THIS FILE WAS AUTOGENERATED BY tools/make-luacheck-files.sh ! -- +-- DO NOT EDIT BY HAND. YOUR CHANGES WILL BE LOST NEXT RUN! -- +------------------------------------------------------------------- + +std = "min" + +read_globals = { + "ItemStack", + "dump", "dump2", + "vector", + "VoxelArea", + "minetest", + "PseudoRandom", + "PerlinNoise", + "PcgRandom", + + string = {fields = {"split", "trim"}}, + table = {fields = {"copy", "getn", "indexof", "insert_all"}}, + math = {fields = {"hypot", "round"}}, +} + +files["mods/CORE/_mcl_autogroup"] = { globals = { "_mcl_autogroup" } } +files["mods/CORE/biomeinfo"] = { globals = { "biomeinfo" } } +files["mods/CORE/controls"] = { globals = { "controls" } } +files["mods/CORE/flowlib"] = { globals = { "flowlib" } } +files["mods/CORE/mcl_explosions"] = { globals = { "mcl_explosions" }, read_globals = { "mcl_particles", "mcl_fire" } } +files["mods/CORE/mcl_init"] = { globals = { "mcl_init" } } +files["mods/CORE/mcl_loot"] = { globals = { "mcl_loot" } } +files["mods/CORE/mcl_particles"] = { globals = { "mcl_particles" } } +files["mods/CORE/mcl_sounds"] = { globals = { "mcl_sounds" } } +files["mods/CORE/mcl_util"] = { globals = { "mcl_util" }, read_globals = { "mcl_init" } } +files["mods/CORE/mcl_worlds"] = { globals = { "mcl_worlds" }, read_globals = { "mcl_init" } } +files["mods/CORE/mcl_autogroup"] = { globals = { "mcl_autogroup" } } +files["mods/ENTITIES/drippingwater"] = { globals = { "drippingwater" }, read_globals = { "mcl_core" } } +files["mods/ENTITIES/mcl_boats"] = { globals = { "mcl_boats" }, read_globals = { "mcl_player", "mcl_core", "doc_identifier" } } +files["mods/ENTITIES/mcl_burning"] = { globals = { "mcl_burning" } } +files["mods/ENTITIES/mcl_falling_nodes"] = { globals = { "mcl_falling_nodes" } } +files["mods/ENTITIES/mcl_item_entity"] = { globals = { "mcl_item_entity" }, read_globals = { "flowlib", "mcl_enchanting" } } +files["mods/ENTITIES/mcl_minecarts"] = { globals = { "mcl_minecarts" }, read_globals = { "mcl_explosions", "mcl_core", "mcl_sounds", "mcl_player", "mcl_achievements", "mcl_chests", "mcl_furnaces", "mesecons_commandblock", "mcl_hoppers", "mcl_tnt", "mesecons", "doc_identifier" } } +files["mods/ENTITIES/mcl_mobs"] = { globals = { "mcl_mobs" }, read_globals = { "mcl_particles", "mcl_weather", "mcl_explosions", "mcl_hunger", "mcl_worlds", "invisibility", "lucky_block", "cmi", "doc_identifier", "mcl_armor", "mcl_portals", "mcl_experience" } } +files["mods/ENTITIES/mcl_paintings"] = { globals = { "mcl_paintings" } } +files["mods/ENTITIES/mobs_mc"] = { globals = { "mobs_mc" }, read_globals = { "mcl_init", "mcl_particles", "default", "mcl_mobs", "mcl_tnt", "mcl_bows", "mcl_throwing", "mcl_fishing", "bones", "mesecons_materials", "mobs_mc_gameconfig", "doc_items" } } +files["mods/ENTITIES/mobs_mc_gameconfig"] = { globals = { "mobs_mc_gameconfig" }, read_globals = { "mcl_init", "mcl_core" } } +files["mods/ENVIRONMENT/lightning"] = { globals = { "lightning" }, read_globals = { "mcl_fire", "mcl_death_messages" } } +files["mods/ENVIRONMENT/mcl_moon"] = { globals = { "mcl_moon" } } +files["mods/ENVIRONMENT/mcl_void_damage"] = { globals = { "mcl_void_damage" }, read_globals = { "mcl_worlds", "mcl_death_messages" } } +files["mods/ENVIRONMENT/mcl_weather"] = { globals = { "mcl_weather" }, read_globals = { "mcl_init", "mcl_worlds", "lightning" } } +files["mods/HELP/doc/doc"] = { globals = { "doc" }, read_globals = { "unified_inventory", "sfinv_buttons", "central_message", "inventory_plus" } } +files["mods/HELP/doc/doc_identifier"] = { globals = { "doc_identifier" }, read_globals = { "doc", "doc_items", "doc_basics", "mcl_core" } } +files["mods/HELP/doc/doc_items"] = { globals = { "doc_items" }, read_globals = { "doc" } } +files["mods/HELP/mcl_craftguide"] = { globals = { "mcl_craftguide" }, read_globals = { "mcl_core", "mcl_compass", "mcl_clock", "doc", "sfinv", "sfinv_buttons" } } +files["mods/HELP/mcl_doc"] = { globals = { "mcl_doc" }, read_globals = { "doc", "doc_items" } } +files["mods/HELP/mcl_doc_basics"] = { globals = { "mcl_doc_basics" }, read_globals = { "doc" } } +files["mods/HELP/mcl_tt"] = { globals = { "mcl_tt" }, read_globals = { "tt", "mcl_enchanting" } } +files["mods/HELP/tt"] = { globals = { "tt" } } +files["mods/HUD/awards"] = { globals = { "awards" }, read_globals = { "sfinv", "unified_inventory" } } +files["mods/HUD/hudbars"] = { globals = { "hudbars" } } +files["mods/HUD/mcl_achievements"] = { globals = { "mcl_achievements" }, read_globals = { "awards" } } +files["mods/HUD/mcl_base_textures"] = { globals = { "mcl_base_textures" } } +files["mods/HUD/mcl_death_messages"] = { globals = { "mcl_death_messages" } } +files["mods/HUD/mcl_formspec"] = { globals = { "mcl_formspec" } } +files["mods/HUD/mcl_formspec_prepend"] = { globals = { "mcl_formspec_prepend" }, read_globals = { "mcl_init" } } +files["mods/HUD/mcl_hbarmor"] = { globals = { "mcl_hbarmor" }, read_globals = { "hudbars", "mcl_armor" } } +files["mods/HUD/mcl_inventory"] = { globals = { "mcl_inventory" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_player", "_mcl_autogroup", "mcl_armor", "mcl_brewing", "mcl_potions", "mcl_enchanting" } } +files["mods/HUD/show_wielded_item"] = { globals = { "show_wielded_item" }, read_globals = { "hudbars" } } +files["mods/ITEMS/REDSTONE/mcl_comparators"] = { globals = { "mcl_comparators" }, read_globals = { "mesecons", "mcl_sounds", "doc", "screwdriver" } } +files["mods/ITEMS/REDSTONE/mcl_dispensers"] = { globals = { "mcl_dispensers" }, read_globals = { "mcl_init", "mcl_formspec", "mesecons", "mcl_sounds", "mcl_tnt", "mcl_worlds", "mcl_core", "mcl_nether", "mcl_armor_stand", "mcl_armor", "doc", "screwdriver" } } +files["mods/ITEMS/REDSTONE/mcl_droppers"] = { globals = { "mcl_droppers" }, read_globals = { "mcl_init", "mcl_formspec", "mesecons", "mcl_util", "doc", "screwdriver" } } +files["mods/ITEMS/REDSTONE/mcl_observers"] = { globals = { "mcl_observers" }, read_globals = { "mesecons", "mcl_util" } } +files["mods/ITEMS/REDSTONE/mesecons"] = { globals = { "mesecons" }, read_globals = { "mcl_sounds", "mcl_core", "doc" } } +files["mods/ITEMS/REDSTONE/mesecons_alias"] = { globals = { "mesecons_alias" }, read_globals = { "mesecons" } } +files["mods/ITEMS/REDSTONE/mesecons_button"] = { globals = { "mesecons_button" }, read_globals = { "mesecons", "doc" } } +files["mods/ITEMS/REDSTONE/mesecons_commandblock"] = { globals = { "mesecons_commandblock" }, read_globals = { "mesecons", "doc", "doc_items" } } +files["mods/ITEMS/REDSTONE/mesecons_delayer"] = { globals = { "mesecons_delayer" }, read_globals = { "mesecons", "doc", "screwdriver" } } +files["mods/ITEMS/REDSTONE/mesecons_lightstone"] = { globals = { "mesecons_lightstone" }, read_globals = { "mesecons", "doc" } } +files["mods/ITEMS/REDSTONE/mesecons_mvps"] = { globals = { "mesecons_mvps" }, read_globals = { "mesecons" } } +files["mods/ITEMS/REDSTONE/mesecons_noteblock"] = { globals = { "mesecons_noteblock" }, read_globals = { "mesecons", "mcl_particles" } } +files["mods/ITEMS/REDSTONE/mesecons_pistons"] = { globals = { "mesecons_pistons" }, read_globals = { "mesecons", "mesecons_mvps", "mcl_mobitems", "doc", "screwdriver" } } +files["mods/ITEMS/REDSTONE/mesecons_pressureplates"] = { globals = { "mesecons_pressureplates" }, read_globals = { "mesecons", "doc" } } +files["mods/ITEMS/REDSTONE/mesecons_solarpanel"] = { globals = { "mesecons_solarpanel" }, read_globals = { "mesecons", "doc" } } +files["mods/ITEMS/REDSTONE/mesecons_torch"] = { globals = { "mesecons_torch" }, read_globals = { "mesecons", "mcl_torches", "doc" } } +files["mods/ITEMS/REDSTONE/mesecons_walllever"] = { globals = { "mesecons_walllever" }, read_globals = { "mesecons", "doc" } } +files["mods/ITEMS/REDSTONE/mesecons_wires"] = { globals = { "mesecons_wires" }, read_globals = { "mesecons", "doc" } } +files["mods/ITEMS/mcl_anvils"] = { globals = { "mcl_anvils" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_sounds", "mcl_core", "screwdriver", "tt", "mcl_enchanting" } } +files["mods/ITEMS/mcl_armor"] = { globals = { "mcl_armor" }, read_globals = { "mcl_core", "mcl_player", "mcl_fire", "ethereal", "bakedclay", "mcl_enchanting" } } +files["mods/ITEMS/mcl_armor_stand"] = { globals = { "mcl_armor_stand" }, read_globals = { "mcl_armor", "mcl_core", "mcl_sounds", "mcl_stairs", "screwdriver" } } +files["mods/ITEMS/mcl_banners"] = { globals = { "mcl_banners" }, read_globals = { "mcl_sounds", "mcl_core", "mcl_wool", "mcl_cauldrons", "doc", "screwdriver" } } +files["mods/ITEMS/mcl_beds"] = { globals = { "mcl_beds" }, read_globals = { "playerphysics", "mcl_sounds", "mcl_worlds", "mcl_wool", "mcl_dye", "mcl_explosions", "mcl_weather", "mcl_spawn", "doc" } } +files["mods/ITEMS/mcl_books"] = { globals = { "mcl_books" }, read_globals = { "mcl_init", "mcl_core", "mcl_sounds", "mcl_mobitems", "mcl_dye" } } +files["mods/ITEMS/mcl_bows"] = { globals = { "mcl_bows" }, read_globals = { "controls", "awards", "mcl_achievements", "mcl_core", "mcl_mobitems", "playerphysics", "doc", "doc_identifier", "mesecons_button", "mcl_particles", "mcl_enchanting" } } +files["mods/ITEMS/mcl_brewing"] = { globals = { "mcl_brewing" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_sounds", "mcl_potions", "mcl_mobitems", "mcl_core", "doc", "screwdriver" } } +files["mods/ITEMS/mcl_buckets"] = { globals = { "mcl_buckets" }, read_globals = { "mcl_worlds", "mcl_core", "mclx_core", "doc" } } +files["mods/ITEMS/mcl_cake"] = { globals = { "mcl_cake" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_hunger", "mcl_buckets", "mcl_farming", "mcl_mobitems", "doc" } } +files["mods/ITEMS/mcl_cauldrons"] = { globals = { "mcl_cauldrons" }, read_globals = { "mcl_core", "mclx_core", "mcl_sounds", "doc" } } +files["mods/ITEMS/mcl_chests"] = { globals = { "mcl_chests" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_core", "mcl_sounds", "mcl_end", "mesecons", "doc", "screwdriver" } } +files["mods/ITEMS/mcl_clock"] = { globals = { "mcl_clock" }, read_globals = { "mcl_init", "mcl_worlds", "mesecons", "doc" } } +files["mods/ITEMS/mcl_cocoas"] = { globals = { "mcl_cocoas" }, read_globals = { "mcl_sounds", "mcl_core", "doc" } } +files["mods/ITEMS/mcl_colorblocks"] = { globals = { "mcl_colorblocks" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_dye", "doc", "screwdriver" } } +files["mods/ITEMS/mcl_compass"] = { globals = { "mcl_compass" }, read_globals = { "mcl_core", "mcl_worlds", "mesecons", "doc" } } +files["mods/ITEMS/mcl_core"] = { globals = { "mcl_core" }, read_globals = { "mcl_autogroup", "mcl_init", "mcl_sounds", "mcl_particles", "mcl_util", "mcl_worlds", "doc_items", "doc", "mcl_enchanting" } } +files["mods/ITEMS/mcl_crafting_table"] = { globals = { "mcl_crafting_table" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_sounds" } } +files["mods/ITEMS/mcl_doors"] = { globals = { "mcl_doors" }, read_globals = { "mcl_core", "mcl_sounds", "doc?", "screwdriver?", "mesecons" } } +files["mods/ITEMS/mcl_dye"] = { globals = { "mcl_dye" }, read_globals = { "mcl_core", "mcl_flowers", "mcl_mobitems", "mcl_cocoas" } } +files["mods/ITEMS/mcl_enchanting"] = { globals = { "mcl_enchanting" }, read_globals = { "tt", "walkover", "mcl_sounds", "screwdriver" } } +files["mods/ITEMS/mcl_end"] = { globals = { "mcl_end" }, read_globals = { "mcl_sounds", "mcl_util", "doc_items", "mcl_worlds", "mcl_structures" } } +files["mods/ITEMS/mcl_farming"] = { globals = { "mcl_farming" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_wool", "mcl_torches", "mcl_weather", "mcl_armor", "mobs_mc", "doc" } } +files["mods/ITEMS/mcl_fences"] = { globals = { "mcl_fences" }, read_globals = { "mcl_core", "mcl_sounds", "doc", "screwdriver" } } +files["mods/ITEMS/mcl_fire"] = { globals = { "mcl_fire" }, read_globals = { "mcl_core", "mcl_worlds", "mcl_sounds", "mcl_particles", "mcl_portals" } } +files["mods/ITEMS/mcl_fishing"] = { globals = { "mcl_fishing" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_loot", "mcl_mobs", "mcl_enchanting" } } +files["mods/ITEMS/mcl_flowerpots"] = { globals = { "mcl_flowerpots" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_farming", "mcl_flowers", "doc" } } +files["mods/ITEMS/mcl_flowers"] = { globals = { "mcl_flowers" }, read_globals = { "mcl_core", "mcl_util", "mcl_sounds", "screwdriver", "doc" } } +files["mods/ITEMS/mcl_furnaces"] = { globals = { "mcl_furnaces" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_core", "mcl_sounds", "mcl_craftguide", "mcl_achievements", "mcl_particles", "doc", "screwdriver" } } +files["mods/ITEMS/mcl_heads"] = { globals = { "mcl_heads" }, read_globals = { "mcl_sounds", "mcl_armor", "screwdriver", "doc" } } +files["mods/ITEMS/mcl_hoppers"] = { globals = { "mcl_hoppers" }, read_globals = { "mcl_core", "mcl_formspec", "mcl_sounds", "mcl_util", "doc", "screwdriver" } } +files["mods/ITEMS/mcl_itemframes"] = { globals = { "mcl_itemframes" }, read_globals = { "mcl_core", "mcl_sounds", "screwdriver" } } +files["mods/ITEMS/mcl_jukebox"] = { globals = { "mcl_jukebox" }, read_globals = { "mcl_core", "mcl_sounds" } } +files["mods/ITEMS/mcl_maps"] = { globals = { "mcl_maps" } } +files["mods/ITEMS/mcl_mobitems"] = { globals = { "mcl_mobitems" }, read_globals = { "mcl_core", "mcl_hunger" } } +files["mods/ITEMS/mcl_mobspawners"] = { globals = { "mcl_mobspawners" }, read_globals = { "mcl_sounds", "mcl_mobs" } } +files["mods/ITEMS/mcl_monster_eggs"] = { globals = { "mcl_monster_eggs" }, read_globals = { "mcl_sounds", "mobs_mc" } } +files["mods/ITEMS/mcl_mushrooms"] = { globals = { "mcl_mushrooms" }, read_globals = { "mcl_sounds", "mcl_util", "doc" } } +files["mods/ITEMS/mcl_nether"] = { globals = { "mcl_nether" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_util", "walkover", "mcl_death_messages", "doc_items", "doc", "screwdriver" } } +files["mods/ITEMS/mcl_ocean"] = { globals = { "mcl_ocean" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_dye", "doc", "doc_items", "screwdriver" } } +files["mods/ITEMS/mcl_portals"] = { globals = { "mcl_portals" }, read_globals = { "mcl_init", "mcl_worlds", "mcl_core", "mcl_nether", "mcl_end", "mcl_particles", "mcl_spawn", "awards", "doc" } } +files["mods/ITEMS/mcl_potions"] = { globals = { "mcl_potions" }, read_globals = { "mcl_core", "mcl_farming", "mcl_mobitems", "mcl_fishing", "mcl_bows", "mcl_end", "mcl_weather", "playerphysics" } } +files["mods/ITEMS/mcl_signs"] = { globals = { "mcl_signs" }, read_globals = { "mcl_sounds", "mcl_core", "doc" } } +files["mods/ITEMS/mcl_sponges"] = { globals = { "mcl_sponges" }, read_globals = { "mcl_sounds", "mcl_core", "mclx_core" } } +files["mods/ITEMS/mcl_stairs"] = { globals = { "mcl_stairs" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_nether", "mcl_end", "mcl_ocean" } } +files["mods/ITEMS/mcl_throwing"] = { globals = { "mcl_throwing" }, read_globals = { "mcl_core", "mcl_mobitems", "doc", "mcl_fishing" } } +files["mods/ITEMS/mcl_tnt"] = { globals = { "mcl_tnt" }, read_globals = { "mcl_explosions", "mcl_particles", "mcl_sounds", "mcl_mobitems", "mcl_death_messages", "doc_identifier", "mesecons" } } +files["mods/ITEMS/mcl_tools"] = { globals = { "mcl_tools" }, read_globals = { "mcl_sounds" } } +files["mods/ITEMS/mcl_torches"] = { globals = { "mcl_torches" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_particles", "doc" } } +files["mods/ITEMS/mcl_totems"] = { globals = { "mcl_totems" }, read_globals = { "mobs_mc" } } +files["mods/ITEMS/mcl_walls"] = { globals = { "mcl_walls" }, read_globals = { "mcl_core", "mcl_end", "mcl_ocean", "mcl_nether", "mcl_sounds", "doc" } } +files["mods/ITEMS/mcl_wool"] = { globals = { "mcl_wool" }, read_globals = { "mcl_sounds", "doc" } } +files["mods/ITEMS/mclx_core"] = { globals = { "mclx_core" }, read_globals = { "mcl_core", "doc" } } +files["mods/ITEMS/mclx_fences"] = { globals = { "mclx_fences" }, read_globals = { "mcl_fences" } } +files["mods/ITEMS/mclx_stairs"] = { globals = { "mclx_stairs" }, read_globals = { "mcl_ocean", "mcl_core", "mcl_sounds", "mcl_nether", "mcl_end", "mcl_colorblocks", "mcl_stairs", "doc" } } +files["mods/ITEMS/xpanes"] = { globals = { "xpanes" }, read_globals = { "mcl_sounds", "mcl_core", "doc" } } +files["mods/MAPGEN/mcl_biomes"] = { globals = { "mcl_biomes" }, read_globals = { "mcl_init", "mcl_mapgen_core", "mcl_core", "mcl_worlds", "mcl_farming", "mcl_flowers", "mcl_end", "mcl_ocean" } } +files["mods/MAPGEN/mcl_dungeons"] = { globals = { "mcl_dungeons" }, read_globals = { "mcl_init", "mcl_core", "mcl_chests", "mcl_mobs", "mcl_mobspawners", "mcl_mapgen_core", "mobs_mc" } } +files["mods/MAPGEN/mcl_mapgen_core"] = { globals = { "mcl_mapgen_core" }, read_globals = { "mcl_init", "mcl_core", "biomeinfo", "mclx_core", "mcl_worlds", "mcl_cocoas", "mcl_sponges", "mcl_ocean", "mcl_stairs", "mcl_monster_eggs", "mcl_structures" } } +files["mods/MAPGEN/mcl_strongholds"] = { globals = { "mcl_strongholds" }, read_globals = { "mcl_init", "mcl_structures", "mcl_mapgen_core" } } +files["mods/MAPGEN/mcl_structures"] = { globals = { "mcl_structures" }, read_globals = { "mcl_loot" } } +files["mods/MAPGEN/mcl_villages"] = { globals = { "mcl_villages" }, read_globals = { "mcl_util", "mcl_mapgen_core", "mcl_structures", "mcl_core", "mcl_loot", "mcl_farming", "mobs_mc" } } +files["mods/MAPGEN/tsm_railcorridors"] = { globals = { "tsm_railcorridors" }, read_globals = { "mcl_init", "mcl_worlds", "mcl_core", "mcl_mapgen_core", "mcl_loot", "mcl_tnt", "mcl_farming", "mcl_mobspawners", "mcl_minecarts" } } +files["mods/MISC/findbiome"] = { globals = { "findbiome" }, read_globals = { "biomeinfo" } } +files["mods/MISC/mcl_commands"] = { globals = { "mcl_commands" }, read_globals = { "mcl_death_messages" } } +files["mods/MISC/mcl_temp_helper_recipes"] = { globals = { "mcl_temp_helper_recipes" }, read_globals = { "mcl_core", "mcl_mobitems", "mcl_end", "mcl_nether", "mcl_ocean", "mcl_stairs", "xpanes" } } +files["mods/MISC/mcl_wip"] = { globals = { "mcl_wip" }, read_globals = { "mcl_core", "mcl_fishing", "mcl_maps", "mcl_minecarts", "doc_identifier", "mobs_mc", "mcl_comparators", "mcl_minecarts", "mcl_paintings", "mcl_potions" } } +files["mods/PLAYER/mcl_death_drop"] = { globals = { "mcl_death_drop" }, read_globals = { "mcl_armor", "mcl_enchanting" } } +files["mods/PLAYER/mcl_hunger"] = { globals = { "mcl_hunger" }, read_globals = { "hudbars", "mcl_death_messages" } } +files["mods/PLAYER/mcl_meshhand"] = { globals = { "mcl_meshhand" }, read_globals = { "mcl_tools", "mcl_skins" } } +files["mods/PLAYER/mcl_player_init"] = { globals = { "mcl_player_init" } } +files["mods/PLAYER/mcl_playerinfo"] = { globals = { "mcl_playerinfo" }, read_globals = { "mcl_init", "mcl_core", "mcl_particles", "mcl_death_messages" } } +files["mods/PLAYER/mcl_playerplus"] = { globals = { "mcl_playerplus" }, read_globals = { "mcl_init", "mcl_core", "mcl_particles", "mcl_hunger", "mcl_death_messages", "playerphysics", "mcl_playerinfo", "mcl_weather", "mcl_spawn", "mcl_enchanting" } } +files["mods/PLAYER/mcl_skins"] = { globals = { "mcl_skins" }, read_globals = { "mcl_player", "mcl_inventory", "intllib", "mcl_armor" } } +files["mods/PLAYER/mcl_spawn"] = { globals = { "mcl_spawn" }, read_globals = { "mcl_init" } } +files["mods/PLAYER/mcl_sprint"] = { globals = { "mcl_sprint" }, read_globals = { "mcl_playerinfo", "playerphysics", "mcl_hunger" } } +files["mods/PLAYER/playerphysics"] = { globals = { "playerphysics" } } +files["mods/PLAYER/wieldview"] = { globals = { "wieldview" }, read_globals = { "mcl_armor" } } From b1fbbfdd352ff4e02d2b4373e516585a5abb9dd6 Mon Sep 17 00:00:00 2001 From: E Date: Mon, 3 May 2021 13:33:19 -0400 Subject: [PATCH 08/21] tools: remove inline scripting from make-luacheck-files - the awk script was moved to its own file (deps-to-luacheck.awk) with minor changes, including added commentary, slightly more rigorous error checking, and using a different separator model to avoid a second stage to remove trailing commas - SED_MODCONF2DEPS was moved to a containing function, and commented - the awk command itself is now easier on the eyes --- tools/deps-to-luacheck.awk | 41 +++++++++++++++++++++ tools/make-luacheck-files.sh | 70 +++++++++++++----------------------- 2 files changed, 65 insertions(+), 46 deletions(-) create mode 100644 tools/deps-to-luacheck.awk diff --git a/tools/deps-to-luacheck.awk b/tools/deps-to-luacheck.awk new file mode 100644 index 00000000..19aab14a --- /dev/null +++ b/tools/deps-to-luacheck.awk @@ -0,0 +1,41 @@ +BEGIN { + if (!DIR || !MOD) { + printf("error: DIR and MOD must be set.\n"); + _panic=1; + exit 1; + } + + printf("files[\"" DIR "\"] = { globals = { \"" MOD "\" }"); + + if (!EMPTY) { + printf(", read_globals = { "); + } +}; + +# Without a pattern, this will match on empty lines +# and mess up the entry. We clean up the extra commas +# later in the script. +/.+/{ + # Get rid of the optional (?) mark from + # depends.txt entries. + sub("?$", ""); + + # Some files have CRLF, so get rid of those + # too. + sub("\xd", ""); + + SEP=", "; + if (NR == 1) { + SEP=""; + } + printf(SEP "\"" $1 "\""); +}; + +END { + if (!_panic) { + if (!EMPTY) { + printf(" }"); + } + printf(" }\n"); + } +}; diff --git a/tools/make-luacheck-files.sh b/tools/make-luacheck-files.sh index fa954ff7..507d6e93 100755 --- a/tools/make-luacheck-files.sh +++ b/tools/make-luacheck-files.sh @@ -2,6 +2,7 @@ # # make-luacheck-files.sh # v1 - E - Initial version +# v2 - E - Remove (most) inline scripts set -ue @@ -10,53 +11,27 @@ if [ ! -d "mods" ] || [ ! -r ".luacheck.head" ]; then exit 1 fi -# We need these to be explicitly NOT expanded. -# shellcheck disable=2016 -{ - # This creates a luacheckrc-compatible line from a mod (supplied on - # the command line with -v MOD="mod_name"), a directory (-v DIR="..."), - # and a list of dependencies (via STDIN). The `read_globals` section is - # skipped if there are no dependencies (-v EMPTY=1). - AWK_DEPS2LCHECK=' - BEGIN { - printf("files[\"" DIR "\"] = { globals = { \"" MOD "\" }"); - if (!EMPTY) { - printf(", read_globals = { "); - } - }; - - # Without a pattern, this will match on empty lines - # and mess up the entry. We clean up the extra commas - # later in the script. - /.+/{ - sub("?$", ""); - sub("\xd", ""); - printf("\"" $1 "\", "); - }; - - END { - if (!EMPTY) { - printf("}"); - } - printf(" }\n"); - };' - - # This takes any line that contains 'depends' and an equal sign - # and spits out each (comma-separated) entry on its own line. - SED_MODCONF2DEPS=' - /depends *=/{ - s/.*depends *=//; - s/, ?/\n/g; - p; - }' - - HEADER=' +HEADER=' ------------------------------------------------------------------- -- THIS FILE WAS AUTOGENERATED BY tools/make-luacheck-files.sh ! -- -- DO NOT EDIT BY HAND. YOUR CHANGES WILL BE LOST NEXT RUN! -- ------------------------------------------------------------------- ' + +# This takes any line that contains 'depends' and an equal sign +# and spits out each (comma-separated) entry on its own line. +modconf2deps() { + sed -n -r -e ' + # Match any lines like "depends = asdfada" + /depends *=/{ + # Get rid of the "depends =" part + s/.*depends *=//; + # Convert commas to newlines + s/, */\n/g; + # Record the output + p; + }' } find mods -type d -print | while read -r DIR; do @@ -69,7 +44,7 @@ find mods -type d -print | while read -r DIR; do printf "found: %s (%s)\n" "$DIR" "mod.conf" 1>&2 # mod.conf needs some more help to get usable # data out of it. - DEPS="$(sed -n -r -e "$SED_MODCONF2DEPS" "$DIR/mod.conf")" + DEPS="$(modconf2deps < "$DIR/mod.conf")" else # Empty dir, or not a mod dir. continue @@ -84,10 +59,13 @@ find mods -type d -print | while read -r DIR; do # for the mod name. MOD="${DIR##*/}" - # Now we run through it through the formatter, - # and remove any rogue trailing commas. - { awk -v DIR="$DIR" -v EMPTY="$EMPTY" -v MOD="$MOD" -- "$AWK_DEPS2LCHECK" | sed -e "s/, }/ }/"; } <<-EOF - $DEPS + # Now we run through it through the formatter + awk \ + -v DIR="$DIR" \ + -v EMPTY="$EMPTY" \ + -v MOD="$MOD" \ + -f tools/deps-to-luacheck.awk <<-EOF + $DEPS EOF done > .luacheck.files From e14265ff8e815bfa487f4e0c7831083e20f36c62 Mon Sep 17 00:00:00 2001 From: E Date: Sun, 16 May 2021 17:13:46 -0400 Subject: [PATCH 09/21] luacheck: remove luacheck generator, generate rules in .luacheckrc --- .luacheck.head | 17 --- .luacheckrc | 231 +++++++++++++---------------------- tools/deps-to-luacheck.awk | 41 ------- tools/make-luacheck-files.sh | 73 ----------- 4 files changed, 85 insertions(+), 277 deletions(-) delete mode 100644 .luacheck.head delete mode 100644 tools/deps-to-luacheck.awk delete mode 100755 tools/make-luacheck-files.sh diff --git a/.luacheck.head b/.luacheck.head deleted file mode 100644 index bf49be42..00000000 --- a/.luacheck.head +++ /dev/null @@ -1,17 +0,0 @@ -std = "min" - -read_globals = { - "ItemStack", - "dump", "dump2", - "vector", - "VoxelArea", - "minetest", - "PseudoRandom", - "PerlinNoise", - "PcgRandom", - - string = {fields = {"split", "trim"}}, - table = {fields = {"copy", "getn", "indexof", "insert_all"}}, - math = {fields = {"hypot", "round"}}, -} - diff --git a/.luacheckrc b/.luacheckrc index 6cd60584..9970dac6 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -1,9 +1,3 @@ - -------------------------------------------------------------------- --- THIS FILE WAS AUTOGENERATED BY tools/make-luacheck-files.sh ! -- --- DO NOT EDIT BY HAND. YOUR CHANGES WILL BE LOST NEXT RUN! -- -------------------------------------------------------------------- - std = "min" read_globals = { @@ -21,143 +15,88 @@ read_globals = { math = {fields = {"hypot", "round"}}, } -files["mods/CORE/_mcl_autogroup"] = { globals = { "_mcl_autogroup" } } -files["mods/CORE/biomeinfo"] = { globals = { "biomeinfo" } } -files["mods/CORE/controls"] = { globals = { "controls" } } -files["mods/CORE/flowlib"] = { globals = { "flowlib" } } -files["mods/CORE/mcl_explosions"] = { globals = { "mcl_explosions" }, read_globals = { "mcl_particles", "mcl_fire" } } -files["mods/CORE/mcl_init"] = { globals = { "mcl_init" } } -files["mods/CORE/mcl_loot"] = { globals = { "mcl_loot" } } -files["mods/CORE/mcl_particles"] = { globals = { "mcl_particles" } } -files["mods/CORE/mcl_sounds"] = { globals = { "mcl_sounds" } } -files["mods/CORE/mcl_util"] = { globals = { "mcl_util" }, read_globals = { "mcl_init" } } -files["mods/CORE/mcl_worlds"] = { globals = { "mcl_worlds" }, read_globals = { "mcl_init" } } -files["mods/CORE/mcl_autogroup"] = { globals = { "mcl_autogroup" } } -files["mods/ENTITIES/drippingwater"] = { globals = { "drippingwater" }, read_globals = { "mcl_core" } } -files["mods/ENTITIES/mcl_boats"] = { globals = { "mcl_boats" }, read_globals = { "mcl_player", "mcl_core", "doc_identifier" } } -files["mods/ENTITIES/mcl_burning"] = { globals = { "mcl_burning" } } -files["mods/ENTITIES/mcl_falling_nodes"] = { globals = { "mcl_falling_nodes" } } -files["mods/ENTITIES/mcl_item_entity"] = { globals = { "mcl_item_entity" }, read_globals = { "flowlib", "mcl_enchanting" } } -files["mods/ENTITIES/mcl_minecarts"] = { globals = { "mcl_minecarts" }, read_globals = { "mcl_explosions", "mcl_core", "mcl_sounds", "mcl_player", "mcl_achievements", "mcl_chests", "mcl_furnaces", "mesecons_commandblock", "mcl_hoppers", "mcl_tnt", "mesecons", "doc_identifier" } } -files["mods/ENTITIES/mcl_mobs"] = { globals = { "mcl_mobs" }, read_globals = { "mcl_particles", "mcl_weather", "mcl_explosions", "mcl_hunger", "mcl_worlds", "invisibility", "lucky_block", "cmi", "doc_identifier", "mcl_armor", "mcl_portals", "mcl_experience" } } -files["mods/ENTITIES/mcl_paintings"] = { globals = { "mcl_paintings" } } -files["mods/ENTITIES/mobs_mc"] = { globals = { "mobs_mc" }, read_globals = { "mcl_init", "mcl_particles", "default", "mcl_mobs", "mcl_tnt", "mcl_bows", "mcl_throwing", "mcl_fishing", "bones", "mesecons_materials", "mobs_mc_gameconfig", "doc_items" } } -files["mods/ENTITIES/mobs_mc_gameconfig"] = { globals = { "mobs_mc_gameconfig" }, read_globals = { "mcl_init", "mcl_core" } } -files["mods/ENVIRONMENT/lightning"] = { globals = { "lightning" }, read_globals = { "mcl_fire", "mcl_death_messages" } } -files["mods/ENVIRONMENT/mcl_moon"] = { globals = { "mcl_moon" } } -files["mods/ENVIRONMENT/mcl_void_damage"] = { globals = { "mcl_void_damage" }, read_globals = { "mcl_worlds", "mcl_death_messages" } } -files["mods/ENVIRONMENT/mcl_weather"] = { globals = { "mcl_weather" }, read_globals = { "mcl_init", "mcl_worlds", "lightning" } } -files["mods/HELP/doc/doc"] = { globals = { "doc" }, read_globals = { "unified_inventory", "sfinv_buttons", "central_message", "inventory_plus" } } -files["mods/HELP/doc/doc_identifier"] = { globals = { "doc_identifier" }, read_globals = { "doc", "doc_items", "doc_basics", "mcl_core" } } -files["mods/HELP/doc/doc_items"] = { globals = { "doc_items" }, read_globals = { "doc" } } -files["mods/HELP/mcl_craftguide"] = { globals = { "mcl_craftguide" }, read_globals = { "mcl_core", "mcl_compass", "mcl_clock", "doc", "sfinv", "sfinv_buttons" } } -files["mods/HELP/mcl_doc"] = { globals = { "mcl_doc" }, read_globals = { "doc", "doc_items" } } -files["mods/HELP/mcl_doc_basics"] = { globals = { "mcl_doc_basics" }, read_globals = { "doc" } } -files["mods/HELP/mcl_tt"] = { globals = { "mcl_tt" }, read_globals = { "tt", "mcl_enchanting" } } -files["mods/HELP/tt"] = { globals = { "tt" } } -files["mods/HUD/awards"] = { globals = { "awards" }, read_globals = { "sfinv", "unified_inventory" } } -files["mods/HUD/hudbars"] = { globals = { "hudbars" } } -files["mods/HUD/mcl_achievements"] = { globals = { "mcl_achievements" }, read_globals = { "awards" } } -files["mods/HUD/mcl_base_textures"] = { globals = { "mcl_base_textures" } } -files["mods/HUD/mcl_death_messages"] = { globals = { "mcl_death_messages" } } -files["mods/HUD/mcl_formspec"] = { globals = { "mcl_formspec" } } -files["mods/HUD/mcl_formspec_prepend"] = { globals = { "mcl_formspec_prepend" }, read_globals = { "mcl_init" } } -files["mods/HUD/mcl_hbarmor"] = { globals = { "mcl_hbarmor" }, read_globals = { "hudbars", "mcl_armor" } } -files["mods/HUD/mcl_inventory"] = { globals = { "mcl_inventory" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_player", "_mcl_autogroup", "mcl_armor", "mcl_brewing", "mcl_potions", "mcl_enchanting" } } -files["mods/HUD/show_wielded_item"] = { globals = { "show_wielded_item" }, read_globals = { "hudbars" } } -files["mods/ITEMS/REDSTONE/mcl_comparators"] = { globals = { "mcl_comparators" }, read_globals = { "mesecons", "mcl_sounds", "doc", "screwdriver" } } -files["mods/ITEMS/REDSTONE/mcl_dispensers"] = { globals = { "mcl_dispensers" }, read_globals = { "mcl_init", "mcl_formspec", "mesecons", "mcl_sounds", "mcl_tnt", "mcl_worlds", "mcl_core", "mcl_nether", "mcl_armor_stand", "mcl_armor", "doc", "screwdriver" } } -files["mods/ITEMS/REDSTONE/mcl_droppers"] = { globals = { "mcl_droppers" }, read_globals = { "mcl_init", "mcl_formspec", "mesecons", "mcl_util", "doc", "screwdriver" } } -files["mods/ITEMS/REDSTONE/mcl_observers"] = { globals = { "mcl_observers" }, read_globals = { "mesecons", "mcl_util" } } -files["mods/ITEMS/REDSTONE/mesecons"] = { globals = { "mesecons" }, read_globals = { "mcl_sounds", "mcl_core", "doc" } } -files["mods/ITEMS/REDSTONE/mesecons_alias"] = { globals = { "mesecons_alias" }, read_globals = { "mesecons" } } -files["mods/ITEMS/REDSTONE/mesecons_button"] = { globals = { "mesecons_button" }, read_globals = { "mesecons", "doc" } } -files["mods/ITEMS/REDSTONE/mesecons_commandblock"] = { globals = { "mesecons_commandblock" }, read_globals = { "mesecons", "doc", "doc_items" } } -files["mods/ITEMS/REDSTONE/mesecons_delayer"] = { globals = { "mesecons_delayer" }, read_globals = { "mesecons", "doc", "screwdriver" } } -files["mods/ITEMS/REDSTONE/mesecons_lightstone"] = { globals = { "mesecons_lightstone" }, read_globals = { "mesecons", "doc" } } -files["mods/ITEMS/REDSTONE/mesecons_mvps"] = { globals = { "mesecons_mvps" }, read_globals = { "mesecons" } } -files["mods/ITEMS/REDSTONE/mesecons_noteblock"] = { globals = { "mesecons_noteblock" }, read_globals = { "mesecons", "mcl_particles" } } -files["mods/ITEMS/REDSTONE/mesecons_pistons"] = { globals = { "mesecons_pistons" }, read_globals = { "mesecons", "mesecons_mvps", "mcl_mobitems", "doc", "screwdriver" } } -files["mods/ITEMS/REDSTONE/mesecons_pressureplates"] = { globals = { "mesecons_pressureplates" }, read_globals = { "mesecons", "doc" } } -files["mods/ITEMS/REDSTONE/mesecons_solarpanel"] = { globals = { "mesecons_solarpanel" }, read_globals = { "mesecons", "doc" } } -files["mods/ITEMS/REDSTONE/mesecons_torch"] = { globals = { "mesecons_torch" }, read_globals = { "mesecons", "mcl_torches", "doc" } } -files["mods/ITEMS/REDSTONE/mesecons_walllever"] = { globals = { "mesecons_walllever" }, read_globals = { "mesecons", "doc" } } -files["mods/ITEMS/REDSTONE/mesecons_wires"] = { globals = { "mesecons_wires" }, read_globals = { "mesecons", "doc" } } -files["mods/ITEMS/mcl_anvils"] = { globals = { "mcl_anvils" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_sounds", "mcl_core", "screwdriver", "tt", "mcl_enchanting" } } -files["mods/ITEMS/mcl_armor"] = { globals = { "mcl_armor" }, read_globals = { "mcl_core", "mcl_player", "mcl_fire", "ethereal", "bakedclay", "mcl_enchanting" } } -files["mods/ITEMS/mcl_armor_stand"] = { globals = { "mcl_armor_stand" }, read_globals = { "mcl_armor", "mcl_core", "mcl_sounds", "mcl_stairs", "screwdriver" } } -files["mods/ITEMS/mcl_banners"] = { globals = { "mcl_banners" }, read_globals = { "mcl_sounds", "mcl_core", "mcl_wool", "mcl_cauldrons", "doc", "screwdriver" } } -files["mods/ITEMS/mcl_beds"] = { globals = { "mcl_beds" }, read_globals = { "playerphysics", "mcl_sounds", "mcl_worlds", "mcl_wool", "mcl_dye", "mcl_explosions", "mcl_weather", "mcl_spawn", "doc" } } -files["mods/ITEMS/mcl_books"] = { globals = { "mcl_books" }, read_globals = { "mcl_init", "mcl_core", "mcl_sounds", "mcl_mobitems", "mcl_dye" } } -files["mods/ITEMS/mcl_bows"] = { globals = { "mcl_bows" }, read_globals = { "controls", "awards", "mcl_achievements", "mcl_core", "mcl_mobitems", "playerphysics", "doc", "doc_identifier", "mesecons_button", "mcl_particles", "mcl_enchanting" } } -files["mods/ITEMS/mcl_brewing"] = { globals = { "mcl_brewing" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_sounds", "mcl_potions", "mcl_mobitems", "mcl_core", "doc", "screwdriver" } } -files["mods/ITEMS/mcl_buckets"] = { globals = { "mcl_buckets" }, read_globals = { "mcl_worlds", "mcl_core", "mclx_core", "doc" } } -files["mods/ITEMS/mcl_cake"] = { globals = { "mcl_cake" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_hunger", "mcl_buckets", "mcl_farming", "mcl_mobitems", "doc" } } -files["mods/ITEMS/mcl_cauldrons"] = { globals = { "mcl_cauldrons" }, read_globals = { "mcl_core", "mclx_core", "mcl_sounds", "doc" } } -files["mods/ITEMS/mcl_chests"] = { globals = { "mcl_chests" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_core", "mcl_sounds", "mcl_end", "mesecons", "doc", "screwdriver" } } -files["mods/ITEMS/mcl_clock"] = { globals = { "mcl_clock" }, read_globals = { "mcl_init", "mcl_worlds", "mesecons", "doc" } } -files["mods/ITEMS/mcl_cocoas"] = { globals = { "mcl_cocoas" }, read_globals = { "mcl_sounds", "mcl_core", "doc" } } -files["mods/ITEMS/mcl_colorblocks"] = { globals = { "mcl_colorblocks" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_dye", "doc", "screwdriver" } } -files["mods/ITEMS/mcl_compass"] = { globals = { "mcl_compass" }, read_globals = { "mcl_core", "mcl_worlds", "mesecons", "doc" } } -files["mods/ITEMS/mcl_core"] = { globals = { "mcl_core" }, read_globals = { "mcl_autogroup", "mcl_init", "mcl_sounds", "mcl_particles", "mcl_util", "mcl_worlds", "doc_items", "doc", "mcl_enchanting" } } -files["mods/ITEMS/mcl_crafting_table"] = { globals = { "mcl_crafting_table" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_sounds" } } -files["mods/ITEMS/mcl_doors"] = { globals = { "mcl_doors" }, read_globals = { "mcl_core", "mcl_sounds", "doc?", "screwdriver?", "mesecons" } } -files["mods/ITEMS/mcl_dye"] = { globals = { "mcl_dye" }, read_globals = { "mcl_core", "mcl_flowers", "mcl_mobitems", "mcl_cocoas" } } -files["mods/ITEMS/mcl_enchanting"] = { globals = { "mcl_enchanting" }, read_globals = { "tt", "walkover", "mcl_sounds", "screwdriver" } } -files["mods/ITEMS/mcl_end"] = { globals = { "mcl_end" }, read_globals = { "mcl_sounds", "mcl_util", "doc_items", "mcl_worlds", "mcl_structures" } } -files["mods/ITEMS/mcl_farming"] = { globals = { "mcl_farming" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_wool", "mcl_torches", "mcl_weather", "mcl_armor", "mobs_mc", "doc" } } -files["mods/ITEMS/mcl_fences"] = { globals = { "mcl_fences" }, read_globals = { "mcl_core", "mcl_sounds", "doc", "screwdriver" } } -files["mods/ITEMS/mcl_fire"] = { globals = { "mcl_fire" }, read_globals = { "mcl_core", "mcl_worlds", "mcl_sounds", "mcl_particles", "mcl_portals" } } -files["mods/ITEMS/mcl_fishing"] = { globals = { "mcl_fishing" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_loot", "mcl_mobs", "mcl_enchanting" } } -files["mods/ITEMS/mcl_flowerpots"] = { globals = { "mcl_flowerpots" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_farming", "mcl_flowers", "doc" } } -files["mods/ITEMS/mcl_flowers"] = { globals = { "mcl_flowers" }, read_globals = { "mcl_core", "mcl_util", "mcl_sounds", "screwdriver", "doc" } } -files["mods/ITEMS/mcl_furnaces"] = { globals = { "mcl_furnaces" }, read_globals = { "mcl_init", "mcl_formspec", "mcl_core", "mcl_sounds", "mcl_craftguide", "mcl_achievements", "mcl_particles", "doc", "screwdriver" } } -files["mods/ITEMS/mcl_heads"] = { globals = { "mcl_heads" }, read_globals = { "mcl_sounds", "mcl_armor", "screwdriver", "doc" } } -files["mods/ITEMS/mcl_hoppers"] = { globals = { "mcl_hoppers" }, read_globals = { "mcl_core", "mcl_formspec", "mcl_sounds", "mcl_util", "doc", "screwdriver" } } -files["mods/ITEMS/mcl_itemframes"] = { globals = { "mcl_itemframes" }, read_globals = { "mcl_core", "mcl_sounds", "screwdriver" } } -files["mods/ITEMS/mcl_jukebox"] = { globals = { "mcl_jukebox" }, read_globals = { "mcl_core", "mcl_sounds" } } -files["mods/ITEMS/mcl_maps"] = { globals = { "mcl_maps" } } -files["mods/ITEMS/mcl_mobitems"] = { globals = { "mcl_mobitems" }, read_globals = { "mcl_core", "mcl_hunger" } } -files["mods/ITEMS/mcl_mobspawners"] = { globals = { "mcl_mobspawners" }, read_globals = { "mcl_sounds", "mcl_mobs" } } -files["mods/ITEMS/mcl_monster_eggs"] = { globals = { "mcl_monster_eggs" }, read_globals = { "mcl_sounds", "mobs_mc" } } -files["mods/ITEMS/mcl_mushrooms"] = { globals = { "mcl_mushrooms" }, read_globals = { "mcl_sounds", "mcl_util", "doc" } } -files["mods/ITEMS/mcl_nether"] = { globals = { "mcl_nether" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_util", "walkover", "mcl_death_messages", "doc_items", "doc", "screwdriver" } } -files["mods/ITEMS/mcl_ocean"] = { globals = { "mcl_ocean" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_dye", "doc", "doc_items", "screwdriver" } } -files["mods/ITEMS/mcl_portals"] = { globals = { "mcl_portals" }, read_globals = { "mcl_init", "mcl_worlds", "mcl_core", "mcl_nether", "mcl_end", "mcl_particles", "mcl_spawn", "awards", "doc" } } -files["mods/ITEMS/mcl_potions"] = { globals = { "mcl_potions" }, read_globals = { "mcl_core", "mcl_farming", "mcl_mobitems", "mcl_fishing", "mcl_bows", "mcl_end", "mcl_weather", "playerphysics" } } -files["mods/ITEMS/mcl_signs"] = { globals = { "mcl_signs" }, read_globals = { "mcl_sounds", "mcl_core", "doc" } } -files["mods/ITEMS/mcl_sponges"] = { globals = { "mcl_sponges" }, read_globals = { "mcl_sounds", "mcl_core", "mclx_core" } } -files["mods/ITEMS/mcl_stairs"] = { globals = { "mcl_stairs" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_nether", "mcl_end", "mcl_ocean" } } -files["mods/ITEMS/mcl_throwing"] = { globals = { "mcl_throwing" }, read_globals = { "mcl_core", "mcl_mobitems", "doc", "mcl_fishing" } } -files["mods/ITEMS/mcl_tnt"] = { globals = { "mcl_tnt" }, read_globals = { "mcl_explosions", "mcl_particles", "mcl_sounds", "mcl_mobitems", "mcl_death_messages", "doc_identifier", "mesecons" } } -files["mods/ITEMS/mcl_tools"] = { globals = { "mcl_tools" }, read_globals = { "mcl_sounds" } } -files["mods/ITEMS/mcl_torches"] = { globals = { "mcl_torches" }, read_globals = { "mcl_core", "mcl_sounds", "mcl_particles", "doc" } } -files["mods/ITEMS/mcl_totems"] = { globals = { "mcl_totems" }, read_globals = { "mobs_mc" } } -files["mods/ITEMS/mcl_walls"] = { globals = { "mcl_walls" }, read_globals = { "mcl_core", "mcl_end", "mcl_ocean", "mcl_nether", "mcl_sounds", "doc" } } -files["mods/ITEMS/mcl_wool"] = { globals = { "mcl_wool" }, read_globals = { "mcl_sounds", "doc" } } -files["mods/ITEMS/mclx_core"] = { globals = { "mclx_core" }, read_globals = { "mcl_core", "doc" } } -files["mods/ITEMS/mclx_fences"] = { globals = { "mclx_fences" }, read_globals = { "mcl_fences" } } -files["mods/ITEMS/mclx_stairs"] = { globals = { "mclx_stairs" }, read_globals = { "mcl_ocean", "mcl_core", "mcl_sounds", "mcl_nether", "mcl_end", "mcl_colorblocks", "mcl_stairs", "doc" } } -files["mods/ITEMS/xpanes"] = { globals = { "xpanes" }, read_globals = { "mcl_sounds", "mcl_core", "doc" } } -files["mods/MAPGEN/mcl_biomes"] = { globals = { "mcl_biomes" }, read_globals = { "mcl_init", "mcl_mapgen_core", "mcl_core", "mcl_worlds", "mcl_farming", "mcl_flowers", "mcl_end", "mcl_ocean" } } -files["mods/MAPGEN/mcl_dungeons"] = { globals = { "mcl_dungeons" }, read_globals = { "mcl_init", "mcl_core", "mcl_chests", "mcl_mobs", "mcl_mobspawners", "mcl_mapgen_core", "mobs_mc" } } -files["mods/MAPGEN/mcl_mapgen_core"] = { globals = { "mcl_mapgen_core" }, read_globals = { "mcl_init", "mcl_core", "biomeinfo", "mclx_core", "mcl_worlds", "mcl_cocoas", "mcl_sponges", "mcl_ocean", "mcl_stairs", "mcl_monster_eggs", "mcl_structures" } } -files["mods/MAPGEN/mcl_strongholds"] = { globals = { "mcl_strongholds" }, read_globals = { "mcl_init", "mcl_structures", "mcl_mapgen_core" } } -files["mods/MAPGEN/mcl_structures"] = { globals = { "mcl_structures" }, read_globals = { "mcl_loot" } } -files["mods/MAPGEN/mcl_villages"] = { globals = { "mcl_villages" }, read_globals = { "mcl_util", "mcl_mapgen_core", "mcl_structures", "mcl_core", "mcl_loot", "mcl_farming", "mobs_mc" } } -files["mods/MAPGEN/tsm_railcorridors"] = { globals = { "tsm_railcorridors" }, read_globals = { "mcl_init", "mcl_worlds", "mcl_core", "mcl_mapgen_core", "mcl_loot", "mcl_tnt", "mcl_farming", "mcl_mobspawners", "mcl_minecarts" } } -files["mods/MISC/findbiome"] = { globals = { "findbiome" }, read_globals = { "biomeinfo" } } -files["mods/MISC/mcl_commands"] = { globals = { "mcl_commands" }, read_globals = { "mcl_death_messages" } } -files["mods/MISC/mcl_temp_helper_recipes"] = { globals = { "mcl_temp_helper_recipes" }, read_globals = { "mcl_core", "mcl_mobitems", "mcl_end", "mcl_nether", "mcl_ocean", "mcl_stairs", "xpanes" } } -files["mods/MISC/mcl_wip"] = { globals = { "mcl_wip" }, read_globals = { "mcl_core", "mcl_fishing", "mcl_maps", "mcl_minecarts", "doc_identifier", "mobs_mc", "mcl_comparators", "mcl_minecarts", "mcl_paintings", "mcl_potions" } } -files["mods/PLAYER/mcl_death_drop"] = { globals = { "mcl_death_drop" }, read_globals = { "mcl_armor", "mcl_enchanting" } } -files["mods/PLAYER/mcl_hunger"] = { globals = { "mcl_hunger" }, read_globals = { "hudbars", "mcl_death_messages" } } -files["mods/PLAYER/mcl_meshhand"] = { globals = { "mcl_meshhand" }, read_globals = { "mcl_tools", "mcl_skins" } } -files["mods/PLAYER/mcl_player_init"] = { globals = { "mcl_player_init" } } -files["mods/PLAYER/mcl_playerinfo"] = { globals = { "mcl_playerinfo" }, read_globals = { "mcl_init", "mcl_core", "mcl_particles", "mcl_death_messages" } } -files["mods/PLAYER/mcl_playerplus"] = { globals = { "mcl_playerplus" }, read_globals = { "mcl_init", "mcl_core", "mcl_particles", "mcl_hunger", "mcl_death_messages", "playerphysics", "mcl_playerinfo", "mcl_weather", "mcl_spawn", "mcl_enchanting" } } -files["mods/PLAYER/mcl_skins"] = { globals = { "mcl_skins" }, read_globals = { "mcl_player", "mcl_inventory", "intllib", "mcl_armor" } } -files["mods/PLAYER/mcl_spawn"] = { globals = { "mcl_spawn" }, read_globals = { "mcl_init" } } -files["mods/PLAYER/mcl_sprint"] = { globals = { "mcl_sprint" }, read_globals = { "mcl_playerinfo", "playerphysics", "mcl_hunger" } } -files["mods/PLAYER/playerphysics"] = { globals = { "playerphysics" } } -files["mods/PLAYER/wieldview"] = { globals = { "wieldview" }, read_globals = { "mcl_armor" } } +-- A config option to allow r/w access to mods which contain +-- this one. It only avoids a couple warnings, and may not be +-- the behavior we want, so it's disabled by default. +local allow_parents=false + +local lfs = require "lfs" + +-- Seed the queue with the mods/ directory +local queue={ {"mods"} } + +local function check(dir) + -- Get the string of the directory path + local sdir=table.concat(dir, "/") + -- Save the top-level directory name as a + -- fallback in case there's no mod.conf, + -- or no name= directive. + local name=dir[#dir] + + -- Is there a mod.conf? + if lfs.attributes(sdir.."/mod.conf", "mode") == "file" then + local deps={} + for line in io.lines(sdir.."/mod.conf") do + -- Use name= if it's there + name=string.match(line, "name *= *([a-zA-Z0-9_]+)") or name + -- Get the dependency entries (if they're there) + local ents=string.match(line, "depends *=(.*)$") + if ents then + -- Split them in to the comma-separated names + for m in string.gmatch(ents, "([a-zA-Z0-9_]+),?") do + table.insert(deps, m) + end + end + end + + local glb={ name } + if allow_parents then + for _, v in pairs(dir) do + -- Skip ALL-CAPS names since those tend + -- to be collections of mods instead of + -- mods themselves. + if not string.match(v, "^[A-Z]+$") then + table.insert(glb, v) + end + end + end + + -- Tell Luacheck what the directory is allowed to do + files[sdir]={ + globals = glb, + read_globals = deps, + } + elseif lfs.attributes(sdir.."/init.lua", "mode") == "file" then + -- No mod.conf, but there's an init.lua here. + local glb={ name } + if allow_parents then + for _, v in pairs(dir) do + -- Again, skip ALL-CAPS. + if not string.match(v, "^[A-Z]+$") then + table.insert(glb, v) + end + end + end + + files[sdir]={ globals=glb } + end + + -- Queue any child directories + for d in lfs.dir(sdir) do + -- Skip hidden directories and parent/current directories. + if lfs.attributes(sdir.."/"..d, "mode") == "directory" and not string.match(d, "^%.") then + -- Copy dir in to nd (New Dir) + local nd={} + for k, v in pairs(dir) do + nd[k]=v + end + nd[#nd+1]=d + table.insert(queue, nd) + end + end +end + +while #queue > 0 do + -- Pop an entry and process it. + check(table.remove(queue, 1)) +end diff --git a/tools/deps-to-luacheck.awk b/tools/deps-to-luacheck.awk deleted file mode 100644 index 19aab14a..00000000 --- a/tools/deps-to-luacheck.awk +++ /dev/null @@ -1,41 +0,0 @@ -BEGIN { - if (!DIR || !MOD) { - printf("error: DIR and MOD must be set.\n"); - _panic=1; - exit 1; - } - - printf("files[\"" DIR "\"] = { globals = { \"" MOD "\" }"); - - if (!EMPTY) { - printf(", read_globals = { "); - } -}; - -# Without a pattern, this will match on empty lines -# and mess up the entry. We clean up the extra commas -# later in the script. -/.+/{ - # Get rid of the optional (?) mark from - # depends.txt entries. - sub("?$", ""); - - # Some files have CRLF, so get rid of those - # too. - sub("\xd", ""); - - SEP=", "; - if (NR == 1) { - SEP=""; - } - printf(SEP "\"" $1 "\""); -}; - -END { - if (!_panic) { - if (!EMPTY) { - printf(" }"); - } - printf(" }\n"); - } -}; diff --git a/tools/make-luacheck-files.sh b/tools/make-luacheck-files.sh deleted file mode 100755 index 507d6e93..00000000 --- a/tools/make-luacheck-files.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh -# -# make-luacheck-files.sh -# v1 - E - Initial version -# v2 - E - Remove (most) inline scripts - -set -ue - -if [ ! -d "mods" ] || [ ! -r ".luacheck.head" ]; then - printf "error: this script needs to be run from the mineclonia project root\n" 1>&2 - exit 1 -fi - -HEADER=' -------------------------------------------------------------------- --- THIS FILE WAS AUTOGENERATED BY tools/make-luacheck-files.sh ! -- --- DO NOT EDIT BY HAND. YOUR CHANGES WILL BE LOST NEXT RUN! -- -------------------------------------------------------------------- - -' - -# This takes any line that contains 'depends' and an equal sign -# and spits out each (comma-separated) entry on its own line. -modconf2deps() { - sed -n -r -e ' - # Match any lines like "depends = asdfada" - /depends *=/{ - # Get rid of the "depends =" part - s/.*depends *=//; - # Convert commas to newlines - s/, */\n/g; - # Record the output - p; - }' -} - -find mods -type d -print | while read -r DIR; do - if [ -r "$DIR/depends.txt" ]; then - printf "found: %s (%s)\n" "$DIR" "depends.txt" 1>&2 - # depends.txt is a simple newline-delimited file, - # so we can just read it in. - DEPS="$(cat "$DIR/depends.txt")" - elif [ -r "$DIR/mod.conf" ]; then - printf "found: %s (%s)\n" "$DIR" "mod.conf" 1>&2 - # mod.conf needs some more help to get usable - # data out of it. - DEPS="$(modconf2deps < "$DIR/mod.conf")" - else - # Empty dir, or not a mod dir. - continue - fi - - EMPTY=0 - if [ -z "$DEPS" ]; then - EMPTY=1 - fi - - # Get only the last chunk of the directory - # for the mod name. - MOD="${DIR##*/}" - - # Now we run through it through the formatter - awk \ - -v DIR="$DIR" \ - -v EMPTY="$EMPTY" \ - -v MOD="$MOD" \ - -f tools/deps-to-luacheck.awk <<-EOF - $DEPS - EOF -done > .luacheck.files - -# Put the final thing together with the warning header -{ printf "%s" "$HEADER"; cat .luacheck.head .luacheck.files; } > .luacheckrc From b6fc8885593505eada1d8fa7e76ae82e9ab2ebd5 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Fri, 12 Mar 2021 00:10:50 +0100 Subject: [PATCH 10/21] Add API for mcl_jukebox --- mods/ITEMS/mcl_jukebox/init.lua | 63 +++++++++++++++------------------ 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/mods/ITEMS/mcl_jukebox/init.lua b/mods/ITEMS/mcl_jukebox/init.lua index db9f2531..b9f762a5 100644 --- a/mods/ITEMS/mcl_jukebox/init.lua +++ b/mods/ITEMS/mcl_jukebox/init.lua @@ -1,5 +1,8 @@ local S = minetest.get_translator("mcl_jukebox") +mcl_jukebox = {} +mcl_jukebox.registered_records = {} + -- Player name-indexed table containing the currently heard track local active_tracks = {} @@ -10,47 +13,30 @@ local active_huds = {} -- Used to make sure that minetest.after only applies to the latest HUD change event local hud_sequence_numbers = {} --- List of music -local recorddata = { - -- { title, author, identifier } - { "The Evil Sister (Jordach's Mix)", "SoundHelix", "13" } , - { "The Energetic Rat (Jordach's Mix)", "SoundHelix", "wait" }, - { "Eastern Feeling", "Jordach", "blocks"}, - { "Minetest", "Jordach", "far" }, - { "Credit Roll (Jordach's HD Mix)", "Junichi Masuda", "chirp" }, - { "Winter Feeling", "Tom Peter", "strad" }, - { "Synthgroove (Jordach's Mix)", "HeroOfTheWinds", "mellohi" }, - { "The Clueless Frog (Jordach's Mix)", "SoundHelix", "mall" }, -} -local records = #recorddata - -for r=1, records do - local doc = false - local entryname, longdesc, usagehelp - if r == 1 then - doc = true - entryname = S("Music Disc") - longdesc = S("A music disc holds a single music track which can be used in a jukebox to play music.") - usagehelp = S("Place a music disc into an empty jukebox to play the music. Use the jukebox again to retrieve the music disc. The music can only be heard by you, not by other players.") - end - minetest.register_craftitem("mcl_jukebox:record_"..r, { +function mcl_jukebox.register_record(title, author, identifier, image, sound) + mcl_jukebox.registered_records["mcl_jukebox:record_"..identifier] = {title, author, identifier, image, sound} + local entryname = S("Music Disc") + local longdesc = S("A music disc holds a single music track which can be used in a jukebox to play music.") + local usagehelp = S("Place a music disc into an empty jukebox to play the music. Use the jukebox again to retrieve the music disc. The music can only be heard by you, not by other players.") + minetest.register_craftitem(":mcl_jukebox:record_"..identifier, { description = core.colorize("#55FFFF", S("Music Disc")) .. "\n" .. - core.colorize("#989898", S("@1—@2", recorddata[r][2], recorddata[r][1])), - _doc_items_create_entry = doc, + core.colorize("#989898", S("@1—@2", author, title)), + _doc_items_create_entry = true, _doc_items_entry_name = entryname, _doc_items_longdesc = longdesc, _doc_items_usagehelp = usagehelp, - inventory_image = "mcl_jukebox_record_"..recorddata[r][3]..".png", + --inventory_image = "mcl_jukebox_record_"..recorddata[r][3]..".png", + inventory_image = image, stack_max = 1, - groups = { music_record = r }, + groups = { music_record = 1 }, }) end -local function now_playing(player, track_id) +local function now_playing(player, name) local playername = player:get_player_name() local hud = active_huds[playername] - local text = S("Now playing: @1—@2", recorddata[track_id][2], recorddata[track_id][1]) + local text = S("Now playing: @1—@2", mcl_jukebox.registered_records[name][2], mcl_jukebox.registered_records[name][1]) if not hud_sequence_numbers[playername] then hud_sequence_numbers[playername] = 1 @@ -106,18 +92,18 @@ minetest.register_craft({ }) local play_record = function(pos, itemstack, player) - local record_id = minetest.get_item_group(itemstack:get_name(), "music_record") - if record_id ~= 0 then + local name = itemstack:get_name() + if mcl_jukebox.registered_records[name] then local cname = player:get_player_name() if active_tracks[cname] ~= nil then minetest.sound_stop(active_tracks[cname]) active_tracks[cname] = nil end - active_tracks[cname] = minetest.sound_play("mcl_jukebox_track_"..record_id, { + active_tracks[cname] = minetest.sound_play(mcl_jukebox.registered_records[name][5], { to_player = cname, gain = 1, }) - now_playing(player, record_id) + now_playing(player, name) return true end return false @@ -239,3 +225,12 @@ minetest.register_craft({ recipe = "mcl_jukebox:jukebox", burntime = 15, }) + +mcl_jukebox.register_record("The Evil Sister (Jordach's Mix)", "SoundHelix", "13", "mcl_jukebox_record_13.png", "mcl_jukebox_track_1") +mcl_jukebox.register_record("The Energetic Rat (Jordach's Mix)", "SoundHelix", "wait", "mcl_jukebox_record_wait.png", "mcl_jukebox_track_2") +mcl_jukebox.register_record("Eastern Feeling", "Jordach", "blocks", "mcl_jukebox_record_blocks.png", "mcl_jukebox_track_3") +mcl_jukebox.register_record("Minetest", "Jordach", "far", "mcl_jukebox_record_far.png", "mcl_jukebox_track_4") +mcl_jukebox.register_record("Credit Roll (Jordach's HD Mix)", "Junichi Masuda", "chirp", "mcl_jukebox_record_chirp.png", "mcl_jukebox_track_5") +mcl_jukebox.register_record("Winter Feeling", "Tom Peter", "strad", "mcl_jukebox_record_strad.png", "mcl_jukebox_track_6") +mcl_jukebox.register_record("Synthgroove (Jordach's Mix)", "HeroOfTheWinds", "mellohi", "mcl_jukebox_record_mellohi.png", "mcl_jukebox_track_7") +mcl_jukebox.register_record("The Clueless Frog (Jordach's Mix)", "SoundHelix", "mall", "mcl_jukebox_record_mall.png", "mcl_jukebox_track_8") \ No newline at end of file From 20b7b6ff994892822d421d7b9c0c6753ea972dc4 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Fri, 12 Mar 2021 00:24:34 +0100 Subject: [PATCH 11/21] Add API documentation for mcl_jukeboxe --- mods/ITEMS/mcl_jukebox/API.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 mods/ITEMS/mcl_jukebox/API.md diff --git a/mods/ITEMS/mcl_jukebox/API.md b/mods/ITEMS/mcl_jukebox/API.md new file mode 100644 index 00000000..85900ede --- /dev/null +++ b/mods/ITEMS/mcl_jukebox/API.md @@ -0,0 +1,18 @@ +# mcl_jukebox + +## mcl_jukebox.register_record(title, author, identifier, image, sound) + +* title: title of the track +* author: author of the track +* identifier: short string used in the item registration +* image: the texture of the track +* sound: sound file of the track + +## mcl_jukebox.registered_records + +Table indexed by item name containing: +* title: title of the track +* author: author of the track +* identifier: short string used in the item registration +* image: the texture of the track +* sound: sound file of the track \ No newline at end of file From e858ea623388934e319c1485ab4f810e1147f03d Mon Sep 17 00:00:00 2001 From: AFCMS Date: Fri, 12 Mar 2021 15:36:24 +0100 Subject: [PATCH 12/21] Add backward compatibility for mcl_jukeboxes --- mods/ITEMS/mcl_jukebox/init.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_jukebox/init.lua b/mods/ITEMS/mcl_jukebox/init.lua index b9f762a5..c5bd3d26 100644 --- a/mods/ITEMS/mcl_jukebox/init.lua +++ b/mods/ITEMS/mcl_jukebox/init.lua @@ -233,4 +233,14 @@ mcl_jukebox.register_record("Minetest", "Jordach", "far", "mcl_jukebox_record_fa mcl_jukebox.register_record("Credit Roll (Jordach's HD Mix)", "Junichi Masuda", "chirp", "mcl_jukebox_record_chirp.png", "mcl_jukebox_track_5") mcl_jukebox.register_record("Winter Feeling", "Tom Peter", "strad", "mcl_jukebox_record_strad.png", "mcl_jukebox_track_6") mcl_jukebox.register_record("Synthgroove (Jordach's Mix)", "HeroOfTheWinds", "mellohi", "mcl_jukebox_record_mellohi.png", "mcl_jukebox_track_7") -mcl_jukebox.register_record("The Clueless Frog (Jordach's Mix)", "SoundHelix", "mall", "mcl_jukebox_record_mall.png", "mcl_jukebox_track_8") \ No newline at end of file +mcl_jukebox.register_record("The Clueless Frog (Jordach's Mix)", "SoundHelix", "mall", "mcl_jukebox_record_mall.png", "mcl_jukebox_track_8") + +--add backward compatibility +minetest.register_alias("mcl_jukebox:record_1", "mcl_jukebox:record_13") +minetest.register_alias("mcl_jukebox:record_2", "mcl_jukebox:record_wait") +minetest.register_alias("mcl_jukebox:record_3", "mcl_jukebox:record_blocks") +minetest.register_alias("mcl_jukebox:record_4", "mcl_jukebox:record_far") +minetest.register_alias("mcl_jukebox:record_5", "mcl_jukebox:record_chirp") +minetest.register_alias("mcl_jukebox:record_6", "mcl_jukebox:record_strad") +minetest.register_alias("mcl_jukebox:record_7", "mcl_jukebox:record_mellohi") +minetest.register_alias("mcl_jukebox:record_8", "mcl_jukebox:record_mall") \ No newline at end of file From 5f0710a486459ebd620001c6e74899a629eb03ba Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 15 Jun 2021 17:33:43 +0200 Subject: [PATCH 13/21] Make jukebox accept and play old music records With the introduction of the mcl_jukebox API, all music record items were given new names. Old music record items were aliased, but never worked with the jukebox. Apparently no one tested existing records. By explicitly looking up the item name in minetest.registered_aliases, the jukebox accepts old records, plays them, and gives out new records. --- mods/ITEMS/mcl_jukebox/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_jukebox/init.lua b/mods/ITEMS/mcl_jukebox/init.lua index c5bd3d26..cc5e97ee 100644 --- a/mods/ITEMS/mcl_jukebox/init.lua +++ b/mods/ITEMS/mcl_jukebox/init.lua @@ -92,7 +92,9 @@ minetest.register_craft({ }) local play_record = function(pos, itemstack, player) - local name = itemstack:get_name() + local item_name = itemstack:get_name() + -- ensure the jukebox uses the new record names for old records + local name = minetest.registered_aliases[item_name] or item_name if mcl_jukebox.registered_records[name] then local cname = player:get_player_name() if active_tracks[cname] ~= nil then From 7ccdbc5905aac78be6c323a45e73ebbdb933fee1 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 15 Jun 2021 23:22:37 +0200 Subject: [PATCH 14/21] Document that music_record group, if it exists, is always 1 --- GROUPS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GROUPS.md b/GROUPS.md index f94b0497..860dcfb1 100644 --- a/GROUPS.md +++ b/GROUPS.md @@ -149,7 +149,7 @@ These groups are used mostly for informational purposes * `trapdoor=2`: Open trapdoor * `glass=1`: Glass (full cubes only) * `rail=1`: Rail -* `music_record`: Music Disc (rating is track ID) +* `music_record=1`: Music Disc * `tnt=1`: Block is TNT * `boat=1`: Boat * `minecart=1`: Minecart From 79766bff23facb9e5c4caa81597cbd1b6477d648 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 15 Jun 2021 01:13:24 +0200 Subject: [PATCH 15/21] Fix server crash when players dig unknown nodes Digging unknown nodes crashes the Clamity Minetest server, which runs modified Minetest: https://github.com/ClamityAnarchy/minetest Crashes did occur with commit d5434bf008 of that Minetest version. This commit makes unknown nodes explicitly not harvestable. --- mods/CORE/_mcl_autogroup/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mods/CORE/_mcl_autogroup/init.lua b/mods/CORE/_mcl_autogroup/init.lua index c8475d0b..d714db7d 100644 --- a/mods/CORE/_mcl_autogroup/init.lua +++ b/mods/CORE/_mcl_autogroup/init.lua @@ -207,6 +207,10 @@ end function mcl_autogroup.can_harvest(nodename, toolname) local ndef = minetest.registered_nodes[nodename] + if not ndef then + return false + end + if minetest.get_item_group(nodename, "dig_immediate") >= 2 then return true end From 764ff5512a26bc66cbe94a39b8132a57fe940f7f Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Fri, 26 Mar 2021 17:51:13 +0100 Subject: [PATCH 16/21] Fix server crash when boat passenger sneaks The crash occured when a player who is not a driver of a boat sneaked. --- mods/ENTITIES/mcl_boats/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index 168e76b7..71ead146 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -243,7 +243,7 @@ function boat.on_step(self, dtime, moveresult) else local ctrl = self._passenger:get_player_control() if ctrl and ctrl.sneak then - detach_player(self._passenger, true) + detach_object(self._passenger, true) self._passenger = nil end end From 2aafb2f2d01a6ece9ed4642a7081c53dbf22f773 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sat, 19 Jun 2021 01:13:40 +0200 Subject: [PATCH 17/21] Fix server crash when dispensing an unknown item --- mods/ITEMS/REDSTONE/mcl_dispensers/init.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua index b6d0d2ef..4e8b2d2e 100644 --- a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua @@ -129,6 +129,19 @@ local dispenserdef = { local stack_id = stacks[r].stackpos local stackdef = stack:get_definition() local iname = stack:get_name() + if not minetest.registered_items[iname] then + minetest.log( + "warning", + "Trying to dispense unknown item " .. + "“" .. iname .. "” " .. + "near (" .. + pos.x .. ", " .. + pos.y .. ", " .. + pos.z .. + ")" + ) + return + end local igroups = minetest.registered_items[iname].groups --[===[ Dispense item ]===] From 2feab24dd3cf09c35aa9a4a8594879077c727417 Mon Sep 17 00:00:00 2001 From: E Date: Tue, 18 May 2021 20:52:24 -0400 Subject: [PATCH 18/21] Allow more layers for banners with gradients At some point in the past, Minetest had a bug that caused rendering issues with transparent textures, like those used for banner gradients. As a workaround, the number of allowed layers was reduced for banners containing gradients. The engine bug has since been fixed, but the limit was never removed. This commit removes the limit. See also: https://git.minetest.land/Mineclonia/Mineclonia/pulls/72#issuecomment-23564 and https://github.com/minetest/minetest/issues/6210 --- mods/ITEMS/mcl_banners/patterncraft.lua | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/mods/ITEMS/mcl_banners/patterncraft.lua b/mods/ITEMS/mcl_banners/patterncraft.lua index 2192e36b..3f007937 100644 --- a/mods/ITEMS/mcl_banners/patterncraft.lua +++ b/mods/ITEMS/mcl_banners/patterncraft.lua @@ -8,9 +8,6 @@ local N = function(s) return s end -- Maximum number of layers which can be put on a banner by crafting. local max_layers_crafting = 12 --- Maximum number of layers when banner includes a gradient (workaround, see below). -local max_layers_gradient = 3 - -- Max. number lines in the descriptions for the banner layers. -- This is done to avoid huge tooltips. local max_layer_lines = 6 @@ -398,16 +395,6 @@ local banner_pattern_craft = function(itemstack, player, old_craft_grid, craft_i if #layers >= max_layers_crafting then return ItemStack("") end - -- Lower layer limit when banner includes any gradient. - -- Workaround to circumvent Minetest bug (https://github.com/minetest/minetest/issues/6210) - -- TODO: Remove this restriction when bug #6210 is fixed. - if #layers >= max_layers_gradient then - for l=1, #layers do - if layers[l].pattern == "gradient" or layers[l].pattern == "gradient_up" then - return ItemStack("") - end - end - end local matching_pattern local max_i = player:get_inventory():get_size("craft") From eb7b99d59eb96cf7c94b305c430001ce6b293d4c Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 20 Jun 2021 19:02:35 +0200 Subject: [PATCH 19/21] Make fully grown beetroot drop 1 to 4 seeds when harvested As beetroot often did not drop seeds, players could end up with no seeds when trying to farm beetroot. This patch guarantees that at least one beetroot seed is dropped when harvesting beetroot. --- mods/ITEMS/mcl_farming/beetroot.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index 7caf5103..dc5475eb 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -98,14 +98,15 @@ minetest.register_node("mcl_farming:beetroot", { drawtype = "plantlike", drop = { --[[ drops 1 beetroot guaranteed. - drops 0-3 beetroot seeds: - 0 seeds: 42.18% - 1 seed: 14.06% - 2 seeds: 18.75% - 3 seeds: 25% ]] - max_items = 2, + drops 1-4 beetroot seeds: + 1 seed: 42.18% + 2 seeds: 14.06% + 3 seeds: 18.75% + 4 seeds: 25% ]] + max_items = 3, items = { { items = {"mcl_farming:beetroot_item"}, rarity = 1 }, + { items = {"mcl_farming:beetroot_seeds 1"}, rarity = 1 }, { items = {"mcl_farming:beetroot_seeds 3"}, rarity = 4 }, { items = {"mcl_farming:beetroot_seeds 2"}, rarity = 4 }, { items = {"mcl_farming:beetroot_seeds 1"}, rarity = 4 }, From 0b92dc1f2644f0aaeecd794a26155927762ccd28 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Tue, 22 Jun 2021 00:16:57 +0200 Subject: [PATCH 20/21] Show screwdriver in creative inventory --- mods/ITEMS/screwdriver/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/screwdriver/init.lua b/mods/ITEMS/screwdriver/init.lua index ec4f1a2a..255fb2f1 100644 --- a/mods/ITEMS/screwdriver/init.lua +++ b/mods/ITEMS/screwdriver/init.lua @@ -176,7 +176,7 @@ minetest.register_tool("screwdriver:screwdriver", { description = S("Screwdriver"), inventory_image = "screwdriver.png", wield_image = "screwdriver.png^[transformFX", - groups = { tool = 1, not_in_creative_inventory = 1 }, + groups = { tool = 1 }, on_use = function(itemstack, user, pointed_thing) screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, 200) return itemstack From 1e42c378956b374b8d866dfa5aa0076bc186e099 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 23 Jun 2021 03:06:24 +0200 Subject: [PATCH 21/21] Reduce snow layer silk touch drop amount MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was possible to duplicate snow layers by placing them and then mining them using a tool enchanted with silk touch. This commit fixes the “snow dupe” by reducing the amount of snow layers dropped in this case by one. --- mods/ITEMS/mcl_core/nodes_base.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index cc6a0e6a..50d7d562 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -1032,7 +1032,7 @@ for i=1,8 do drop = "mcl_throwing:snowball "..(i+1), _mcl_blast_resistance = 0.1, _mcl_hardness = 0.1, - _mcl_silk_touch_drop = {"mcl_core:snow " .. (i+1)}, + _mcl_silk_touch_drop = {"mcl_core:snow " .. i}, }) end