forked from minetest/minetest_game
Carts: Take creative mode into account
This commit makes the carts mod not add the cart item to the player's inventory if running with creative mode and the player already has it.
This commit is contained in:
parent
1a6ad498d7
commit
788ae97ba1
@ -91,10 +91,14 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
|
||||
end
|
||||
end
|
||||
|
||||
local leftover = puncher:get_inventory():add_item("main", "carts:cart")
|
||||
local inv = puncher:get_inventory()
|
||||
if not minetest.setting_getbool("creative_mode")
|
||||
or not inv:contains_item("main", "carts:cart") then
|
||||
local leftover = inv:add_item("main", "carts:cart")
|
||||
if not leftover:is_empty() then
|
||||
minetest.add_item(self.object:getpos(), leftover)
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user