From a261693f9be9e5612528eb9047decc9ad861e0ec Mon Sep 17 00:00:00 2001 From: tacigar Date: Wed, 16 Nov 2016 15:36:53 +0900 Subject: [PATCH 1/2] [ADD] Add wield_item slot --- maidroid/api.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/maidroid/api.lua b/maidroid/api.lua index 38c6af9..1b0a417 100644 --- a/maidroid/api.lua +++ b/maidroid/api.lua @@ -226,6 +226,8 @@ function maidroid.register_maidroid(product_name, def) return stack:get_count() elseif listname == "core" and maidroid.is_core(stack:get_name()) then return stack:get_count() + elseif listname == "wield_item" then + return 0 end return 0 end, @@ -239,9 +241,17 @@ function maidroid.register_maidroid(product_name, def) update_infotext(self) end end, + + allow_take = function(inv, listname, index, stack, player) + if listname == "wield_item" then + return 0 + end + return stack:get_count() + end, }) inventory:set_size("main", 16) inventory:set_size("core", 1) + inventory:set_size("wield_item", 1) return inventory end @@ -260,6 +270,8 @@ function maidroid.register_maidroid(product_name, def) .. "list[current_player;main;0,6.2;8,3;8]" .. "button[7,0.25;1,0.875;apply_name;Apply]" .. "field[4.5,0.5;2.75,1;name;name;" .. nametag .. "]" + .. "label[5.5,1;wield]" + .. "list[detached:"..self.inventory_name..";wield_item;5.5,1.5;1,1;]" end -- on_activate is a callback function that is called when the object is created or recreated. From 56c143b05fd1e75b828bfc4d852655428ecef18a Mon Sep 17 00:00:00 2001 From: tacigar Date: Wed, 16 Nov 2016 15:38:16 +0900 Subject: [PATCH 2/2] [UPDATE] Change slot position --- maidroid/api.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maidroid/api.lua b/maidroid/api.lua index 1b0a417..5c60f1e 100644 --- a/maidroid/api.lua +++ b/maidroid/api.lua @@ -264,8 +264,8 @@ function maidroid.register_maidroid(product_name, def) .. default.gui_bg_img .. default.gui_slots .. "list[detached:"..self.inventory_name..";main;0,0;4,4;]" - .. "label[5.5,1;core]" - .. "list[detached:"..self.inventory_name..";core;5.5,1.5;1,1;]" + .. "label[4.5,1;core]" + .. "list[detached:"..self.inventory_name..";core;4.5,1.5;1,1;]" .. "list[current_player;main;0,5;8,1;]" .. "list[current_player;main;0,6.2;8,3;8]" .. "button[7,0.25;1,0.875;apply_name;Apply]"