don't show formspec when fed with bread and already healed
This commit is contained in:
parent
a4c1828b7f
commit
06dec8f865
10
formspec.lua
10
formspec.lua
@ -72,10 +72,12 @@ guards.on_rightclick = function(self, clicker)
|
||||
|
||||
-- heal with bread
|
||||
local item = clicker:get_wielded_item()
|
||||
if(item and item:get_name() == "farming:bread" and self.health < (self.hp_max or self.health)) then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
self.health = math.min((self.hp_max or self.health), self.health + 10)
|
||||
if(item and item:get_name() == "farming:bread") then
|
||||
if(self.health < (self.hp_max or self.health)) then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
self.health = math.min((self.hp_max or self.health), self.health + 10)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user