mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-23 01:35:40 +01:00
DevTest: Move detached inv tests to chest mod
This commit is contained in:
@@ -1,24 +1,3 @@
|
||||
minetest.register_chatcommand("test_inv", {
|
||||
params = "",
|
||||
description = "Test: Modify player's inventory formspec",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
player:set_inventory_formspec(
|
||||
"size[13,7.5]"..
|
||||
"image[6,0.6;1,2;player.png]"..
|
||||
"list[current_player;main;5,3.5;8,4;]"..
|
||||
"list[current_player;craft;8,0;3,3;]"..
|
||||
"list[current_player;craftpreview;12,1;1,1;]"..
|
||||
"list[detached:test_inventory;main;0,0;4,6;0]"..
|
||||
"button[0.5,7;2,1;button1;Button 1]"..
|
||||
"button_exit[2.5,7;2,1;button2;Exit Button]")
|
||||
return true, "Done."
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("test_bulk_set_node", {
|
||||
params = "",
|
||||
description = "Test: Bulk-set 9×9×9 stone nodes",
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
-- Create a detached inventory
|
||||
local inv = minetest.create_detached_inventory("test_inventory", {
|
||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
experimental.print_to_everything("allow move asked")
|
||||
return count -- Allow all
|
||||
end,
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
experimental.print_to_everything("allow put asked")
|
||||
return 1 -- Allow only 1
|
||||
end,
|
||||
allow_take = function(inv, listname, index, stack, player)
|
||||
experimental.print_to_everything("allow take asked")
|
||||
return 4 -- Allow 4 at max
|
||||
end,
|
||||
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
experimental.print_to_everything(player:get_player_name().." moved items")
|
||||
end,
|
||||
on_put = function(inv, listname, index, stack, player)
|
||||
experimental.print_to_everything(player:get_player_name().." put items")
|
||||
end,
|
||||
on_take = function(inv, listname, index, stack, player)
|
||||
experimental.print_to_everything(player:get_player_name().." took items")
|
||||
end,
|
||||
})
|
||||
inv:set_size("main", 4*6)
|
||||
inv:add_item("main", "experimental:callback_node")
|
||||
inv:add_item("main", "experimental:particle_spawner")
|
||||
|
||||
|
||||
@@ -2,14 +2,5 @@
|
||||
-- Experimental things
|
||||
--
|
||||
|
||||
experimental = {}
|
||||
|
||||
dofile(minetest.get_modpath("experimental").."/detached.lua")
|
||||
dofile(minetest.get_modpath("experimental").."/commands.lua")
|
||||
|
||||
function experimental.print_to_everything(msg)
|
||||
minetest.log("action", msg)
|
||||
minetest.chat_send_all(msg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user