Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix multinode trouble in field mode #50

Merged
merged 4 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
20240225 * SwissalpS patched a crash situation with multinode-nodes. Thanks frogTheSecond and Huhhila for detecting and reporting.
20221107 * fluxionary fixed typo unkown -> unknown
20220830 * SwissalpS fixed de translation typo. Thanks Niklp09 for reporting.
20220626 * SwissalpS fixed case where other drops were prefered from actual node that user tried to set to.
20220624 * SX added technic.plus compat fix
Expand Down
2 changes: 1 addition & 1 deletion blabla.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ rbi.drops_on_dig = S('Drops on dig:')
rbi.nothing = S('nothing.')
rbi.may_drop_on_dig = S('May drop on dig:')
rbi.can_be_fuel = S('This can be used as a fuel.')
rbi.unkown_recipe = S('Error: Unkown recipe.')
rbi.unknown_recipe = S('Error: Unknown recipe.')
rbi.log_reg_craft_method_wrong_arguments = '[replacer] register_craft_method invalid arguments given.'
rbi.log_reg_craft_method_overriding_method = '[replacer] register_craft_method overriding existing method '
rbi.log_reg_craft_method_added = '[replacer] register_craft_method method added: %s %s'
Expand Down
2 changes: 1 addition & 1 deletion compat/ehlphabet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local skip = {}
for _, n in ipairs(exceptions) do skip[n] = true end

local function ehlphabet_number_sticker(item_name)
if not item_name or not 'string' == type(item_name) then return end
if not item_name or 'string' ~= type(item_name) then return end

return item_name:match('^ehlphabet:([0-9]+)'),
item_name:find('_sticker$') and true
Expand Down
4 changes: 2 additions & 2 deletions compat/letters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if not minetest.get_modpath('letters') then return end
-- for inspection tool
local S = replacer.S
local function add_recipe_u(item_name, _, recipes)
if not item_name or not 'string' == type(item_name) then return end
if not item_name or 'string' ~= type(item_name) then return end

local input, letter = item_name:match('^(.+)_letter_(.)u$')
if not input then return end
Expand All @@ -21,7 +21,7 @@ replacer.register_craft_method('letters:upper', 'letters:letter_cutter_upper', a


local function add_recipe_l(item_name, _, recipes)
if not item_name or not 'string' == type(item_name) then return end
if not item_name or 'string' ~= type(item_name) then return end

local input, letter = item_name:match('^(.+)_letter_(.)l$')
if not input then return end
Expand Down
2 changes: 1 addition & 1 deletion compat/wine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ in_out['wine:glass_coffee_liquor'] = 'farming:coffee_beans'
in_out['wine:glass_champagne'] = 'wine:glass_champagne_raw'

local function add_recipe(item_name, _, recipes)
if not 'string' == type(item_name)
if 'string' ~= type(item_name)
or not item_name:find('^wine:glass_') then return end

-- this one is an exception
Expand Down
2 changes: 1 addition & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
-- Changelog: see CHANGELOG file

replacer = {}
replacer.version = 20220830
replacer.version = 20240225

replacer.has_bakedclay = minetest.get_modpath('bakedclay')
replacer.has_basic_dyes = minetest.get_modpath('dye')
Expand Down
4 changes: 2 additions & 2 deletions inspect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function replacer.inspect(_, player, pointed_thing, right_clicked)
chat(player_name, r.inspect_entity(pointed_thing.ref, player))
return nil
elseif 'node' ~= pointed_thing.type then
chat(player_name, S('Sorry, this is an unkown something of type "@1". '
chat(player_name, S('Sorry, this is an unknown something of type "@1". '
.. 'No information available.', pointed_thing.type))
return nil
end
Expand Down Expand Up @@ -734,7 +734,7 @@ function replacer.inspect_show_crafting(player_name, node_name, fields)
else
--pd('unhandled recipe encountered', recipe)
--r.play_sound(player_name, true)
formspec = formspec .. 'label[3,1;' .. mfe(rbi.unkown_recipe) .. ']'
formspec = formspec .. 'label[3,1;' .. mfe(rbi.unknown_recipe) .. ']'
end
-- output item on the right
if recipe.output then
Expand Down
4 changes: 2 additions & 2 deletions locale/replacer.de.tr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Drops on dig:=Lässt fallen beim Graben:
nothing.=nichts.
May drop on dig:=Kann beim Graben fallen lassen:
This can be used as a fuel.=Dies kann als Brennstoff verwendet werden.
Error: Unkown recipe.=Fehler: Unbekanntes Rezept.
Error: Unknown recipe.=Fehler: Unbekanntes Rezept.
scoop up=schöpfen
pour out=ausgiessen
filling=auffüllen
Expand Down Expand Up @@ -83,7 +83,7 @@ Store near group:wood, light < 12.=In der Nähe der Holzgruppe@n(group:wood) lag
Replacing nodes of type "@1" is not allowed on this server. Replacement failed.=Node des Typs „@1“ dürfen auf diesem Server nicht ersetzt werden. Versuch fehlgeschlagen.
Protected at @1=Geschützt bei @1
printing=Drucken
Sorry, this is an unkown something of type "@1". No information available.=Tut mir leid, das ist etwas unbekanntes vom Typ „@1“. Keine Informationen verfügbar.
Sorry, this is an unknown something of type "@1". No information available.=Tut mir leid, das ist etwas unbekanntes vom Typ „@1“. Keine Informationen verfügbar.
Can deal @1 damage.=Kann @1 Schaden verursachen.
Has @1 armour.=Hat @1 Rüstung.
This is your fellow player "@1"=Dies ist dein Mitspieler „@1“
Expand Down
4 changes: 2 additions & 2 deletions locale/replacer.es.tr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Drops on dig:=Cae en excavación:
nothing.=nada.
May drop on dig:=Puede caer en excavación:
This can be used as a fuel.=Esto se puede usar como combustible.
Error: Unkown recipe.=Error: Receta desconocida.
Error: Unknown recipe.=Error: Receta desconocida.
scoop up=recoger
pour out=derramar
filling=llena
Expand Down Expand Up @@ -83,7 +83,7 @@ Store near group:wood, light < 12.=Almacenar cerca del grupo de madera@n(group:w
Replacing nodes of type "@1" is not allowed on this server. Replacement failed.=No se permite reemplazar nodos de tipo "@1" en este servidor. Reemplazo fallido.
Protected at @1=Protegido en @1
printing=impresión
Sorry, this is an unkown something of type "@1". No information available.=Lo sentimos, esto es algo desconocido de tipo "@1". No hay información disponible.
Sorry, this is an unknown something of type "@1". No information available.=Lo sentimos, esto es algo desconocido de tipo "@1". No hay información disponible.
Can deal @1 damage.=Puede causar daño @1.
Has @1 armour.=Tiene armadura @1.
This is your fellow player "@1"=Este es tu compañero de juego "@1"
Expand Down
4 changes: 2 additions & 2 deletions locale/replacer.fi.tr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Drops on dig:=Pudotukset kaivamaan:
nothing.=ei mitään.
May drop on dig:=Saattaa pudota kaivamaan:
This can be used as a fuel.=Tätä voidaan käyttää polttoaineena.
Error: Unkown recipe.=Virhe: Tuntematon resepti.
Error: Unknown recipe.=Virhe: Tuntematon resepti.
scoop up=kauhoa
pour out=kaataa
filling=täyttää
Expand Down Expand Up @@ -83,7 +83,7 @@ Store near group:wood, light < 12.=Varasto lähellä group:wood,@nkevyt < 12.
Replacing nodes of type "@1" is not allowed on this server. Replacement failed.=Tyypin "@1" solmujen korvaaminen ei ole sallittua tässä palvelimessa. Vaihto epäonnistui.
Protected at @1=Suojattu @1
printing=painatus
Sorry, this is an unkown something of type "@1". No information available.=Anteeksi, tämä on tuntematon asia, jonka tyyppi on "@1". Tietoja ei ole saatavilla.
Sorry, this is an unknown something of type "@1". No information available.=Anteeksi, tämä on tuntematon asia, jonka tyyppi on "@1". Tietoja ei ole saatavilla.
Can deal @1 damage.=Voi tehdä @1 vahinkoa.
Has @1 armour.=Siinä on @1-panssari.
This is your fellow player "@1"=Tämä on pelikaverisi "@1"
Expand Down
4 changes: 2 additions & 2 deletions locale/replacer.fr.tr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Drops on dig:=Gouttes sur creuser :
nothing.=rien.
May drop on dig:=Peut tomber en creusant :
This can be used as a fuel.=Cela peut être utilisé comme carburant.
Error: Unkown recipe.=Erreur : recette inconnue.
Error: Unknown recipe.=Erreur : recette inconnue.
scoop up=ramasser
pour out=déverser
filling=remplir
Expand Down Expand Up @@ -83,7 +83,7 @@ Store near group:wood, light < 12.=Entreposer près du groupe @ngroup:wood, lum
Replacing nodes of type "@1" is not allowed on this server. Replacement failed.=Le remplacement de nœuds de type "@1" n'est pas autorisé sur ce serveur. Échec du remplacement.
Protected at @1=Protégé à @1
printing=impression
Sorry, this is an unkown something of type "@1". No information available.=Désolé, c'est quelque chose d'inconnu de type "@1". Aucune information disponible.
Sorry, this is an unknown something of type "@1". No information available.=Désolé, c'est quelque chose d'inconnu de type "@1". Aucune information disponible.
Can deal @1 damage.=Peut infliger @1 dégâts.
Has @1 armour.=A @1 armure.
This is your fellow player "@1"=C'est votre coéquipier "@1"
Expand Down
4 changes: 2 additions & 2 deletions locale/replacer.it.tr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Drops on dig:=Gocce allo scavo:
nothing.=niente.
May drop on dig:=Può cadere durante lo scavo:
This can be used as a fuel.=Questo può essere usato come carburante.
Error: Unkown recipe.=Errore: ricetta sconosciuta.
Error: Unknown recipe.=Errore: ricetta sconosciuta.
scoop up=raccogliere
pour out=versare
filling=riempire
Expand Down Expand Up @@ -83,7 +83,7 @@ Store near group:wood, light < 12.=Negozio vicino al gruppo group:wood,@nluce <
Replacing nodes of type "@1" is not allowed on this server. Replacement failed.=La sostituzione dei nodi di tipo "@1" non è consentita su questo server. Sostituzione non riuscita.
Protected at @1=Protetto a @1
printing=stampa
Sorry, this is an unkown something of type "@1". No information available.=Siamo spiacenti, questo è un qualcosa sconosciuto di tipo "@1". Nessuna informazione disponibile.
Sorry, this is an unknown something of type "@1". No information available.=Siamo spiacenti, questo è un qualcosa sconosciuto di tipo "@1". Nessuna informazione disponibile.
Can deal @1 damage.=Può infliggere @1 danno.
Has @1 armour.=Ha @1 armatura.
This is your fellow player "@1"=Questo è il tuo compagno di gioco "@1"
Expand Down
4 changes: 2 additions & 2 deletions locale/replacer.pt.tr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Drops on dig:=Gotas na escavação:
nothing.=nada.
May drop on dig:=Pode cair na escavação:
This can be used as a fuel.=Isso pode ser usado como combustível.
Error: Unkown recipe.=Erro: receita desconhecida.
Error: Unknown recipe.=Erro: receita desconhecida.
scoop up=escavar
pour out=derramar
filling=encher
Expand Down Expand Up @@ -83,7 +83,7 @@ Store near group:wood, light < 12.=Armazenar perto do grupo group:wood,@nluz < 1
Replacing nodes of type "@1" is not allowed on this server. Replacement failed.=A substituição de nós do tipo "@1" não é permitida neste servidor. Falha na substituição.
Protected at @1=Protegido em @1
printing=impressão
Sorry, this is an unkown something of type "@1". No information available.=Desculpe, isso é algo desconhecido do tipo "@1". Nenhuma informação disponível.
Sorry, this is an unknown something of type "@1". No information available.=Desculpe, isso é algo desconhecido do tipo "@1". Nenhuma informação disponível.
Can deal @1 damage.=Pode causar @1 de dano.
Has @1 armour.=Tem armadura @1.
This is your fellow player "@1"=Este é seu colega jogador "@1"
Expand Down
4 changes: 2 additions & 2 deletions locale/replacer.ru.tr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Drops on dig:=Выпадает при раскопках:
nothing.=ничего.
May drop on dig:=Может выпасть при раскопках:
This can be used as a fuel.=Это можно использовать в качестве топлива.
Error: Unkown recipe.=Ошибка: Неизвестный рецепт.
Error: Unknown recipe.=Ошибка: Неизвестный рецепт.
scoop up=зачерпнуть
pour out=вылить
filling=заполнить
Expand Down Expand Up @@ -83,7 +83,7 @@ Store near group:wood, light < 12.=Хранить рядом с группой
Replacing nodes of type "@1" is not allowed on this server. Replacement failed.=Замена узлов типа "@1" на этом сервере запрещена. Замена не удалась.
Protected at @1=Защищено в @1
printing=печать
Sorry, this is an unkown something of type "@1". No information available.=Извините, это неизвестное что-то типа "@1". Информация отсутствует.
Sorry, this is an unknown something of type "@1". No information available.=Извините, это неизвестное что-то типа "@1". Информация отсутствует.
Can deal @1 damage.=Может нанести @1 урона.
Has @1 armour.=Имеет @1 броню.
This is your fellow player "@1"=Это ваш товарищ по игре "@1"
Expand Down
4 changes: 2 additions & 2 deletions locale/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Drops on dig:=
nothing.=
May drop on dig:=
This can be used as a fuel.=
Error: Unkown recipe.=
Error: Unknown recipe.=
scoop up=
pour out=
filling=
Expand Down Expand Up @@ -83,7 +83,7 @@ Store near group:wood, light < 12.=
Replacing nodes of type "@1" is not allowed on this server. Replacement failed.=
Protected at @1=
printing=
Sorry, this is an unkown something of type "@1". No information available.=
Sorry, this is an unknown something of type "@1". No information available.=
Can deal @1 damage.=
Has @1 armour.=
This is your fellow player "@1"=
Expand Down
12 changes: 12 additions & 0 deletions replacer/replacer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,18 @@ function replacer.on_use(itemstack, player, pt, right_clicked)
end
end
end
-- with multinode-nodes it is possible to click the
-- node in a way that none of the coordinates of
-- ``normal`` is 0, leading to empty ``dirs`` and crash
-- when passing nil to vector functions.
-- Player can click on another part of the node to
-- have success.
if 0 == #dirs then
r.play_sound(name, true)
r.inform(name, rb.no_pos)
return
end

-- The normal is used as offset to test if the searched position
-- is next to the field; the offset goes in the other direction when
-- a right click happens
Expand Down