fix drops and taking whole stack while trading

This commit is contained in:
epCode 2021-03-25 16:59:00 -07:00
parent b815502b66
commit 915f88f21e
1 changed files with 8 additions and 2 deletions

View File

@ -108,10 +108,10 @@ local piglin = {
on_rightclick = function(self, clicker)
if clicker:is_player() and clicker:get_wielded_item():get_name() == "mcl_core:gold_ingot" and self.state ~= "attack" and self.gold_items < 3 then
local item_gold = clicker:get_wielded_item()
item_gold:take_item(1)
clicker:set_wielded_item(item_gold)
self.state = "stand"
self.object:set_animation({x=0,y=79})
item_gold:take_item(1)
clicker:set_wielded_item(item)
self.trading = true
self.gold_items = self.gold_items + 1
self.object:set_bone_position("Wield_Item", vector.new(-1.5,4.9,1.8), vector.new(135,0,90))
@ -160,6 +160,12 @@ sword_piglin.on_spawn = function(self)
self.weapon = self.base_texture[2]
self.object:set_bone_position("Wield_Item", vector.new(0,3.9,1.3), vector.new(90,0,0))
end
sword_piglin.drops = {
{name = "mcl_tools:sword_gold",
chance = 10,
min = 1,
max = 1,},
}
sword_piglin.attack_type = "dogfight"
sword_piglin.animation = {
stand_speed = 30,