1
0
mirror of https://github.com/minetest/minetest_game.git synced 2025-06-28 04:40:22 +02:00

Use Minetest 5.3 'minetest.is_creative_enabled' API (#2795)

This commit is contained in:
Maksim
2020-12-13 18:59:19 +01:00
committed by GitHub
parent 9c29019301
commit e6aec880de
19 changed files with 34 additions and 65 deletions

View File

@ -119,8 +119,7 @@ function boat.on_punch(self, puncher)
if not self.driver then
self.removed = true
local inv = puncher:get_inventory()
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(name))
if not minetest.is_creative_enabled(name)
or not inv:contains_item("main", "boats:boat") then
local leftover = inv:add_item("main", "boats:boat")
-- if no room in inventory add a replacement boat to the world
@ -268,8 +267,7 @@ minetest.register_craftitem("boats:boat", {
boat:set_yaw(placer:get_look_horizontal())
end
local player_name = placer and placer:get_player_name() or ""
if not (creative and creative.is_enabled_for and
creative.is_enabled_for(player_name)) then
if not minetest.is_creative_enabled(player_name) then
itemstack:take_item()
end
end