From 47cd917363a02e549a32a417c2dd4ba70af4c282 Mon Sep 17 00:00:00 2001 From: tacigar Date: Tue, 6 Dec 2016 13:23:41 +0900 Subject: [PATCH 1/3] add get_wield_item_stack function --- maidroid/api.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/maidroid/api.lua b/maidroid/api.lua index 5c60f1e..de78200 100644 --- a/maidroid/api.lua +++ b/maidroid/api.lua @@ -120,6 +120,15 @@ function maidroid.maidroid.set_yaw_by_direction(self, direction) self.object:setyaw(math.atan2(direction.z, direction.x) + math.pi / 2) end +-- maidroid.maidroid.get_wield_item_info returns the maidroid's wield item's stack. +function maidroid.maidroid.get_wield_item_stack(self) + local inv = self:get_inventory() + if inv:is_empty("wield_item") then + return nil + end + return inv:get_stack(1) +end + --------------------------------------------------------------------- -- maidroid.manufacturing_data represents a table that contains manufacturing data. From aebdd7f0b077bbfab819999deb82b1deb112ba53 Mon Sep 17 00:00:00 2001 From: tacigar Date: Tue, 6 Dec 2016 13:25:06 +0900 Subject: [PATCH 2/3] fix get_wield_item_stack function --- maidroid/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maidroid/api.lua b/maidroid/api.lua index de78200..f050264 100644 --- a/maidroid/api.lua +++ b/maidroid/api.lua @@ -126,7 +126,7 @@ function maidroid.maidroid.get_wield_item_stack(self) if inv:is_empty("wield_item") then return nil end - return inv:get_stack(1) + return inv:get_stack("wield_item", 1) end --------------------------------------------------------------------- From e6a25f523434a7d48b56abda901b4c8343c9a24b Mon Sep 17 00:00:00 2001 From: tacigar Date: Tue, 6 Dec 2016 13:27:14 +0900 Subject: [PATCH 3/3] set maidroid's field --- maidroid/api.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/maidroid/api.lua b/maidroid/api.lua index f050264..7f5fade 100644 --- a/maidroid/api.lua +++ b/maidroid/api.lua @@ -434,6 +434,7 @@ function maidroid.register_maidroid(product_name, def) get_look_direction = maidroid.maidroid.get_look_direction, set_animation = maidroid.maidroid.set_animation, set_yaw_by_direction = maidroid.maidroid.set_yaw_by_direction, + get_wield_item_stack = maidroid.maidroid.get_wield_item_stack, }) -- register a spawner for debugging maidroid mods.