mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-05 23:33:51 +01:00
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,9 +91,13 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
|
||||
end
|
||||
end
|
||||
|
||||
local leftover = puncher:get_inventory():add_item("main", "carts:cart")
|
||||
if not leftover:is_empty() then
|
||||
minetest.add_item(self.object:getpos(), leftover)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user