Cannot pick up bee/bunny/kitten/rat if no room in inventory
This commit is contained in:
parent
7888cc7f7e
commit
c3a7455d16
2
bee.lua
2
bee.lua
@ -45,7 +45,7 @@ mobs:register_mob("mobs:bee", {
|
||||
},
|
||||
-- right click to pick up bee
|
||||
on_rightclick = function(self, clicker)
|
||||
if clicker:is_player() and clicker:get_inventory() then
|
||||
if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:bee") then
|
||||
clicker:get_inventory():add_item("main", "mobs:bee")
|
||||
self.object:remove()
|
||||
end
|
||||
|
@ -62,7 +62,7 @@ mobs:register_mob("mobs:bunny", {
|
||||
end
|
||||
return
|
||||
end
|
||||
if clicker:is_player() and clicker:get_inventory() then
|
||||
if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:bunny") then
|
||||
clicker:get_inventory():add_item("main", "mobs:bunny")
|
||||
self.object:remove()
|
||||
end
|
||||
|
@ -61,7 +61,7 @@ mobs:register_mob("mobs:kitten", {
|
||||
end
|
||||
return
|
||||
end
|
||||
if clicker:is_player() and clicker:get_inventory() then
|
||||
if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:kitten") then
|
||||
clicker:get_inventory():add_item("main", "mobs:kitten")
|
||||
self.object:remove()
|
||||
end
|
||||
|
2
rat.lua
2
rat.lua
@ -33,7 +33,7 @@ mobs:register_mob("mobs:rat", {
|
||||
light_damage = 0,
|
||||
-- right click to pick up rat
|
||||
on_rightclick = function(self, clicker)
|
||||
if clicker:is_player() and clicker:get_inventory() then
|
||||
if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:rat") then
|
||||
clicker:get_inventory():add_item("main", "mobs:rat")
|
||||
self.object:remove()
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user