Disable inventory access on client side due to minetest core issues

This commit is contained in:
Joachim Stolberg 2023-04-01 19:09:04 +02:00
parent 1fcadc9ff7
commit 2e24ccbdcd

View File

@ -29,7 +29,7 @@ local menu = techage.menu
local function formspec(pos) local function formspec(pos)
local ndef = minetest.registered_nodes["techage:ta5_hl_chest"] local ndef = minetest.registered_nodes["techage:ta5_hl_chest"]
local status = M(pos):get_string("conn_status") local status = M(pos):get_string("conn_status")
if hyperloop.is_client(pos) or hyperloop.is_server(pos) then if hyperloop.is_server(pos) then
local title = ndef.description .. " " .. status local title = ndef.description .. " " .. status
return "size[8,9]".. return "size[8,9]"..
"box[0,-0.1;7.8,0.5;#c6e8ff]" .. "box[0,-0.1;7.8,0.5;#c6e8ff]" ..
@ -38,6 +38,13 @@ local function formspec(pos)
"list[current_player;main;0,5.3;8,4;]".. "list[current_player;main;0,5.3;8,4;]"..
"listring[context;main]".. "listring[context;main]"..
"listring[current_player;main]" "listring[current_player;main]"
elseif hyperloop.is_client(pos) then
local title = ndef.description .. " " .. status
return "size[8,9]"..
"box[0,-0.1;7.8,0.5;#c6e8ff]" ..
"label[0.2,-0.1;" .. minetest.colorize( "#000000", title) .. "]" ..
"label[0.2,2;Inventory access on client side disabled\ndue to minetest core issues!]" ..
"list[current_player;main;0,5.3;8,4;]"
else else
return menu.generate_formspec(pos, ndef, hyperloop.SUBMENU) return menu.generate_formspec(pos, ndef, hyperloop.SUBMENU)
end end
@ -47,6 +54,9 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
if techage.hyperloop.is_client(pos) then
return 0
end
shared_inv.before_inv_access(pos, listname) shared_inv.before_inv_access(pos, listname)
local inv = minetest.get_inventory({type="node", pos=pos}) local inv = minetest.get_inventory({type="node", pos=pos})
if inv and inv:room_for_item(listname, stack) then if inv and inv:room_for_item(listname, stack) then
@ -59,6 +69,9 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
if techage.hyperloop.is_client(pos) then
return 0
end
shared_inv.before_inv_access(pos, listname) shared_inv.before_inv_access(pos, listname)
local inv = minetest.get_inventory({type="node", pos=pos}) local inv = minetest.get_inventory({type="node", pos=pos})
if inv and inv:contains_item(listname, stack) then if inv and inv:contains_item(listname, stack) then
@ -71,6 +84,9 @@ local function allow_metadata_inventory_move(pos, from_list, from_index, to_list
if shared_inv.before_inv_access(pos, "main") then if shared_inv.before_inv_access(pos, "main") then
return 0 return 0
end end
if techage.hyperloop.is_client(pos) then
return 0
end
return count return count
end end