From 7eb2cc561f5eb9a7d2b607220f3613114007adad Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Wed, 27 Feb 2019 12:02:26 +0100 Subject: [PATCH] added creative_maxstack mod --- creative_maxstack/depends.txt | 1 + creative_maxstack/init.lua | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 creative_maxstack/depends.txt create mode 100644 creative_maxstack/init.lua diff --git a/creative_maxstack/depends.txt b/creative_maxstack/depends.txt new file mode 100644 index 0000000..c327490 --- /dev/null +++ b/creative_maxstack/depends.txt @@ -0,0 +1 @@ +creative diff --git a/creative_maxstack/init.lua b/creative_maxstack/init.lua new file mode 100644 index 0000000..cee9596 --- /dev/null +++ b/creative_maxstack/init.lua @@ -0,0 +1,15 @@ + +local orig_update_creative_inventory = creative.update_creative_inventory +function creative.update_creative_inventory(player_name, tab_content) + -- do original stuff + orig_update_creative_inventory(player_name, tab_content) + + -- Set all stacks to maximum count + local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name}) + local list = player_inv:get_list("main") + for _, stack in ipairs(list) do + stack:set_count(stack:get_stack_max()) + end + + player_inv:set_list("main", list) +end