Guide: Allow to move back and forth in alternates
This commit is contained in:
parent
23a27b38ae
commit
a1e7b650ab
@ -160,8 +160,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
{to_player=player_name, gain = 1.0})
|
{to_player=player_name, gain = 1.0})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- alternate button
|
-- alternate buttons
|
||||||
if not fields.alternate then
|
if not (fields.alternate or fields.alternate_prev) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.sound_play("click",
|
minetest.sound_play("click",
|
||||||
@ -178,10 +178,18 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
if alternates <= 1 then
|
if alternates <= 1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local alternate = unified_inventory.alternate[player_name] + 1
|
local alternate
|
||||||
|
if fields.alternate then
|
||||||
|
alternate = unified_inventory.alternate[player_name] + 1
|
||||||
if alternate > alternates then
|
if alternate > alternates then
|
||||||
alternate = 1
|
alternate = 1
|
||||||
end
|
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.alternate[player_name] = alternate
|
||||||
unified_inventory.set_inventory_formspec(player,
|
unified_inventory.set_inventory_formspec(player,
|
||||||
unified_inventory.current_page[player_name])
|
unified_inventory.current_page[player_name])
|
||||||
|
@ -51,6 +51,10 @@ Copy to craft grid: = Ins Fertigungsraster kopieren:
|
|||||||
All = Alles
|
All = Alles
|
||||||
Alternate = Alternative
|
Alternate = Alternative
|
||||||
Crafting Grid = Fertigungsraster
|
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
|
Recipe %d of %d = Rezept %d von %d
|
||||||
Usage %d of %d = Verwendung %d von %d
|
Usage %d of %d = Verwendung %d von %d
|
||||||
No recipes = Keine Rezepte
|
No recipes = Keine Rezepte
|
||||||
|
@ -53,6 +53,10 @@ Copy to craft grid: =
|
|||||||
All =
|
All =
|
||||||
Alternate =
|
Alternate =
|
||||||
Crafting Grid =
|
Crafting Grid =
|
||||||
|
Show next recipe =
|
||||||
|
Show next usage =
|
||||||
|
Show previous recipe =
|
||||||
|
Show previous usage =
|
||||||
Recipe %d of %d =
|
Recipe %d of %d =
|
||||||
Usage %d of %d =
|
Usage %d of %d =
|
||||||
No recipes =
|
No recipes =
|
||||||
|
13
register.lua
13
register.lua
@ -207,6 +207,14 @@ local role_text = {
|
|||||||
recipe = "Result",
|
recipe = "Result",
|
||||||
usage = "Ingredient",
|
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 = {
|
local other_dir = {
|
||||||
recipe = "usage",
|
recipe = "usage",
|
||||||
usage = "recipe",
|
usage = "recipe",
|
||||||
@ -313,7 +321,10 @@ unified_inventory.register_page("craftguide", {
|
|||||||
if alternates and alternates > 1 then
|
if alternates and alternates > 1 then
|
||||||
formspec = formspec.."label[5.5,"..(formspecy + 1.6)..";"
|
formspec = formspec.."label[5.5,"..(formspecy + 1.6)..";"
|
||||||
..string.format(F(recipe_text[dir]), alternate, alternates).."]"
|
..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
|
end
|
||||||
return {formspec = formspec}
|
return {formspec = formspec}
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user