mirror of
https://github.com/minetest-mods/technic.git
synced 2024-08-20 13:34:12 +02:00
UI update
This commit is contained in:
parent
4a15b8504e
commit
ab14c44c49
@ -78,6 +78,7 @@ unified_inventory.refill = minetest.create_detached_inventory(player_name.."refi
|
|||||||
end,
|
end,
|
||||||
on_put = function(inv, listname, index, stack, player)
|
on_put = function(inv, listname, index, stack, player)
|
||||||
inv:set_stack(listname, index, ItemStack(stack:get_name().." "..stack:get_stack_max()))
|
inv:set_stack(listname, index, ItemStack(stack:get_name().." "..stack:get_stack_max()))
|
||||||
|
minetest.sound_play("electricity", {to_player=player_name, gain = 1.0})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
unified_inventory.refill:set_size("main", 1)
|
unified_inventory.refill:set_size("main", 1)
|
||||||
@ -282,25 +283,26 @@ end
|
|||||||
-- register_on_player_receive_fields
|
-- register_on_player_receive_fields
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
|
|
||||||
-- main buttons
|
-- main buttons
|
||||||
if fields.craft then
|
if fields.craft then
|
||||||
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,"craft"))
|
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,"craft"))
|
||||||
|
minetest.sound_play("click", {to_player=player_name, gain = 0.1})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields.craftguide then
|
if fields.craftguide then
|
||||||
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,"craftguide"))
|
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,"craftguide"))
|
||||||
|
minetest.sound_play("click", {to_player=player_name, gain = 0.1})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields.bags then
|
if fields.bags then
|
||||||
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,"bags"))
|
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,"bags"))
|
||||||
|
minetest.sound_play("click", {to_player=player_name, gain = 0.1})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- bags
|
-- bags
|
||||||
for i=1,4 do
|
for i=1,4 do
|
||||||
local page = "bag"..i
|
local page = "bag"..i
|
||||||
@ -309,20 +311,23 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
page = "bags"
|
page = "bags"
|
||||||
end
|
end
|
||||||
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,page))
|
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,page))
|
||||||
|
minetest.sound_play("click", {to_player=player_name, gain = 0.1})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Miscellaneous
|
-- Miscellaneous
|
||||||
if fields.home_gui_set then
|
if fields.home_gui_set then
|
||||||
unified_inventory.set_home(player, player:getpos())
|
unified_inventory.set_home(player, player:getpos())
|
||||||
local home = homepos[player_name]
|
local home = homepos[player_name]
|
||||||
if home ~= nil then
|
if home ~= nil then
|
||||||
|
minetest.sound_play("dingdong", {to_player=player_name, gain = 1.0})
|
||||||
minetest.chat_send_player(player_name, "Home position set to: "..math.floor(home.x)..","..math.floor(home.y)..","..math.floor(home.z))
|
minetest.chat_send_player(player_name, "Home position set to: "..math.floor(home.x)..","..math.floor(home.y)..","..math.floor(home.z))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if fields.home_gui_go then
|
if fields.home_gui_go then
|
||||||
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,"craft"))
|
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,"craft"))
|
||||||
|
minetest.sound_play("teleport", {to_player=player_name, gain = 1.0})
|
||||||
unified_inventory.go_home(player)
|
unified_inventory.go_home(player)
|
||||||
end
|
end
|
||||||
if fields.misc_set_day then
|
if fields.misc_set_day then
|
||||||
@ -357,27 +362,27 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
local pagemax = math.floor((unified_inventory.filtered_items_list_size[player_name]-1) / (80) + 1)
|
local pagemax = math.floor((unified_inventory.filtered_items_list_size[player_name]-1) / (80) + 1)
|
||||||
|
|
||||||
if fields.start_list then
|
if fields.start_list then
|
||||||
minetest.sound_play("click", {to_player=player_name, gain = 0.3})
|
minetest.sound_play("paperflip1", {to_player=player_name, gain = 1.0})
|
||||||
start_i = 1
|
start_i = 1
|
||||||
end
|
end
|
||||||
if fields.rewind1 then
|
if fields.rewind1 then
|
||||||
minetest.sound_play("click", {to_player=player_name, gain = 0.3})
|
minetest.sound_play("paperflip1", {to_player=player_name, gain = 1.0})
|
||||||
start_i = start_i - 1
|
start_i = start_i - 1
|
||||||
end
|
end
|
||||||
if fields.forward1 then
|
if fields.forward1 then
|
||||||
minetest.sound_play("click", {to_player=player_name, gain = 0.3})
|
minetest.sound_play("paperflip1", {to_player=player_name, gain = 1.0})
|
||||||
start_i = start_i + 1
|
start_i = start_i + 1
|
||||||
end
|
end
|
||||||
if fields.rewind3 then
|
if fields.rewind3 then
|
||||||
minetest.sound_play("click", {to_player=player_name, gain = 0.3})
|
minetest.sound_play("paperflip1", {to_player=player_name, gain = 1.0})
|
||||||
start_i = start_i - 3
|
start_i = start_i - 3
|
||||||
end
|
end
|
||||||
if fields.forward3 then
|
if fields.forward3 then
|
||||||
minetest.sound_play("click", {to_player=player_name, gain = 0.3})
|
minetest.sound_play("paperflip1", {to_player=player_name, gain = 1.0})
|
||||||
start_i = start_i + 3
|
start_i = start_i + 3
|
||||||
end
|
end
|
||||||
if fields.end_list then
|
if fields.end_list then
|
||||||
minetest.sound_play("click", {to_player=player_name, gain = 0.3})
|
minetest.sound_play("paperflip1", {to_player=player_name, gain = 1.0})
|
||||||
start_i = pagemax
|
start_i = pagemax
|
||||||
end
|
end
|
||||||
if start_i < 1 then
|
if start_i < 1 then
|
||||||
@ -397,7 +402,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
for i=0,80,1 do
|
for i=0,80,1 do
|
||||||
local button="item_button"..list_index
|
local button="item_button"..list_index
|
||||||
if fields[button] then
|
if fields[button] then
|
||||||
minetest.sound_play("click", {to_player=player_name, gain = 0.3})
|
minetest.sound_play("click", {to_player=player_name, gain = 0.1})
|
||||||
if minetest.setting_getbool("creative_mode")==false then
|
if minetest.setting_getbool("creative_mode")==false then
|
||||||
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,"craftguide"))
|
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,"craftguide"))
|
||||||
page="craftguide"
|
page="craftguide"
|
||||||
@ -425,10 +430,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
if fields.searchbutton then
|
if fields.searchbutton then
|
||||||
unified_inventory.apply_filter(player, fields.searchbox)
|
unified_inventory.apply_filter(player, fields.searchbox)
|
||||||
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,unified_inventory.current_page[player_name]))
|
unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,unified_inventory.current_page[player_name]))
|
||||||
|
minetest.sound_play("paperflip2", {to_player=player_name, gain = 1.0})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- alternate button
|
-- alternate button
|
||||||
if fields.alternate then
|
if fields.alternate then
|
||||||
|
minetest.sound_play("click", {to_player=player_name, gain = 0.1})
|
||||||
local item_name=unified_inventory.current_item[player_name]
|
local item_name=unified_inventory.current_item[player_name]
|
||||||
if item_name then
|
if item_name then
|
||||||
local alternates = 0
|
local alternates = 0
|
||||||
|
BIN
unified_inventory/sounds/dingdong.ogg
Normal file
BIN
unified_inventory/sounds/dingdong.ogg
Normal file
Binary file not shown.
BIN
unified_inventory/sounds/electricity.ogg
Normal file
BIN
unified_inventory/sounds/electricity.ogg
Normal file
Binary file not shown.
BIN
unified_inventory/sounds/paperflip1.ogg
Normal file
BIN
unified_inventory/sounds/paperflip1.ogg
Normal file
Binary file not shown.
BIN
unified_inventory/sounds/paperflip2.ogg
Normal file
BIN
unified_inventory/sounds/paperflip2.ogg
Normal file
Binary file not shown.
BIN
unified_inventory/sounds/teleport.ogg
Normal file
BIN
unified_inventory/sounds/teleport.ogg
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user