Support creative mode for minecarts

This commit is contained in:
Wuzzy 2017-08-15 02:51:40 +02:00
parent 307622b4d7
commit 24336d43c4

@ -82,8 +82,10 @@ function mcl_minecarts.cart:on_punch(puncher, time_from_last_punch, tool_capabil
end end
end end
if not minetest.settings:get_bool("creative_mode") then
minetest.add_item(self.object:getpos(), "mcl_minecarts:minecart")
end
self.object:remove() self.object:remove()
puncher:get_inventory():add_item("main", "mcl_minecarts:minecart")
return return
end end
@ -295,7 +297,9 @@ minetest.register_craftitem("mcl_minecarts:minecart", {
minetest.add_entity(pointed_thing.above, "mcl_minecarts:minecart") minetest.add_entity(pointed_thing.above, "mcl_minecarts:minecart")
else return end else return end
itemstack:take_item() if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item()
end
return itemstack return itemstack
end, end,
groups = { minecart = 1, transport = 1}, groups = { minecart = 1, transport = 1},