Cannot pick up bee/bunny/kitten/rat if no room in inventory

This commit is contained in:
tenplus1 2015-03-23 21:28:07 +00:00
parent 7888cc7f7e
commit c3a7455d16
4 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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