mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2024-08-20 13:24:10 +02:00
Merge pull request #62 from Wuzzy2/alternate_prev
Allow to move back and forth in alternate recipes and usages in craft guide
This commit is contained in:
commit
fc879df761
@ -160,8 +160,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
{to_player=player_name, gain = 1.0})
|
||||
end
|
||||
|
||||
-- alternate button
|
||||
if not fields.alternate then
|
||||
-- alternate buttons
|
||||
if not (fields.alternate or fields.alternate_prev) then
|
||||
return
|
||||
end
|
||||
minetest.sound_play("click",
|
||||
@ -178,9 +178,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if alternates <= 1 then
|
||||
return
|
||||
end
|
||||
local alternate = unified_inventory.alternate[player_name] + 1
|
||||
if alternate > alternates then
|
||||
alternate = 1
|
||||
local alternate
|
||||
if fields.alternate then
|
||||
alternate = unified_inventory.alternate[player_name] + 1
|
||||
if alternate > alternates then
|
||||
alternate = 1
|
||||
end
|
||||
elseif fields.alternate_prev then
|
||||
alternate = unified_inventory.alternate[player_name] - 1
|
||||
if alternate < 1 then
|
||||
alternate = alternates
|
||||
end
|
||||
end
|
||||
unified_inventory.alternate[player_name] = alternate
|
||||
unified_inventory.set_inventory_formspec(player,
|
||||
|
@ -51,6 +51,10 @@ Copy to craft grid: = Ins Fertigungsraster kopieren:
|
||||
All = Alles
|
||||
Alternate = Alternative
|
||||
Crafting Grid = Fertigungsraster
|
||||
Show next recipe = Nächstes Rezept zeigen
|
||||
Show next usage = Nächste Verwendung zeigen
|
||||
Show previous recipe = Vorheriges Rezept zeigen
|
||||
Show previous usage = Vorherige Verwendung zeigen
|
||||
Recipe %d of %d = Rezept %d von %d
|
||||
Usage %d of %d = Verwendung %d von %d
|
||||
No recipes = Keine Rezepte
|
||||
|
@ -53,6 +53,10 @@ Copy to craft grid: =
|
||||
All =
|
||||
Alternate =
|
||||
Crafting Grid =
|
||||
Show next recipe =
|
||||
Show next usage =
|
||||
Show previous recipe =
|
||||
Show previous usage =
|
||||
Recipe %d of %d =
|
||||
Usage %d of %d =
|
||||
No recipes =
|
||||
|
13
register.lua
13
register.lua
@ -207,6 +207,14 @@ local role_text = {
|
||||
recipe = "Result",
|
||||
usage = "Ingredient",
|
||||
}
|
||||
local next_alt_text = {
|
||||
recipe = "Show next recipe",
|
||||
usage = "Show next usage",
|
||||
}
|
||||
local prev_alt_text = {
|
||||
recipe = "Show previous recipe",
|
||||
usage = "Show previous usage",
|
||||
}
|
||||
local other_dir = {
|
||||
recipe = "usage",
|
||||
usage = "recipe",
|
||||
@ -313,7 +321,10 @@ unified_inventory.register_page("craftguide", {
|
||||
if alternates and alternates > 1 then
|
||||
formspec = formspec.."label[5.5,"..(formspecy + 1.6)..";"
|
||||
..string.format(F(recipe_text[dir]), alternate, alternates).."]"
|
||||
.."button[5.5,"..(formspecy + 2)..";2,1;alternate;" .. F("Alternate") .. "]"
|
||||
.."image_button[5.5,"..(formspecy + 2)..";1,1;ui_left_icon.png;alternate_prev;]"
|
||||
.."image_button[6.5,"..(formspecy + 2)..";1,1;ui_right_icon.png;alternate;]"
|
||||
.."tooltip[alternate_prev;"..F(prev_alt_text[dir]).."]"
|
||||
.."tooltip[alternate;"..F(next_alt_text[dir]).."]"
|
||||
end
|
||||
return {formspec = formspec}
|
||||
end,
|
||||
|
Loading…
Reference in New Issue
Block a user