minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
- if not minetest.setting_getbool("creative_mode") then
+ if not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(placer:get_player_name())) then
itemstack:take_item()
end
return itemstack
if not self.driver then
self.removed = true
local inv = puncher:get_inventory()
- if not minetest.setting_getbool("creative_mode")
+ if not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(puncher:get_player_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
boat = minetest.add_entity(pointed_thing.under, "boats:boat")
if boat then
boat:setyaw(placer:get_look_horizontal())
- if not minetest.setting_getbool("creative_mode") then
+ if not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(placer:get_player_name())) then
itemstack:take_item()
end
end
end
-- return if keep inventory set or in creative mode
- if bones_mode == "keep" or minetest.setting_getbool("creative_mode") then
+ if bones_mode == "keep" or (creative and creative.is_enabled_for
+ and creative.is_enabled_for(player:get_player_name())) then
return
end
end
-- Pick up cart
local inv = puncher:get_inventory()
- if not minetest.setting_getbool("creative_mode")
+ if not (creative and creative.is_enabled_for
++ and creative.is_enabled_for(puncher:get_player_name()))
or not inv:contains_item("main", "carts:cart") then
local leftover = inv:add_item("main", "carts:cart")
-- If no room in inventory add a replacement cart to the world
minetest.sound_play({name = "default_place_node_metal", gain = 0.5},
{pos = pointed_thing.above})
- if not minetest.setting_getbool("creative_mode") then
+ if not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(placer:get_player_name())) then
itemstack:take_item()
end
return itemstack
dofile(minetest.get_modpath("creative") .. "/inventory.lua")
-if minetest.setting_getbool("creative_mode") then
+if creative_mode_cache then
-- Dig time is modified according to difference (leveldiff) between tool
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of
-- leveldiff and 1.
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
-- set GUI
- if not minetest.setting_getbool("creative_mode") then
+ if not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(player:get_player_name())) then
player:set_inventory_formspec(default.gui_survival_form)
end
player:hud_set_hotbar_image("gui_hotbar.png")
minetest.log("action", player_name .. " places node "
.. sapling_name .. " at " .. minetest.pos_to_string(pos))
- local take_item = not minetest.setting_getbool("creative_mode")
+ local take_item = not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(player_name))
local newnode = {name = sapling_name}
local ndef = minetest.registered_nodes[sapling_name]
minetest.set_node(pos, newnode)
meta:set_string("infotext", "Owned by " .. pn)
end
- if not minetest.setting_getbool("creative_mode") then
+ if not (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) then
itemstack:take_item()
end
meta:set_string("owner", pn)
meta:set_string("infotext", "Owned by "..pn)
- return minetest.setting_getbool("creative_mode")
+ return (creative and creative.is_enabled_for and creative.is_enabled_for(pn))
end
def.on_blast = function() end
gain = 0.5,
})
- if not minetest.setting_getbool("creative_mode") then
+ if not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(user:get_player_name())) then
-- wear tool
local wdef = itemstack:get_definition()
itemstack:add_wear(65535/(uses-1))
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name = plantname, param2 = 1})
tick(pt.above)
- if not minetest.setting_getbool("creative_mode") then
+ if not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(placer:get_player_name())) then
itemstack:take_item()
end
return itemstack
"fire_flint_and_steel",
{pos = sound_pos, gain = 0.5, max_hear_distance = 8}
)
+ local player_name = user:get_player_name()
if pointed_thing.type == "node" then
local node_under = minetest.get_node(pointed_thing.under).name
local nodedef = minetest.registered_nodes[node_under]
if not nodedef then
return
end
- local player_name = user:get_player_name()
if minetest.is_protected(pointed_thing.under, player_name) then
minetest.chat_send_player(player_name, "This area is protected")
return
minetest.set_node(pointed_thing.above, {name = "fire:basic_flame"})
end
end
- if not minetest.setting_getbool("creative_mode") then
+ if not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(player_name)) then
-- Wear tool
local wdef = itemstack:get_definition()
itemstack:add_wear(1000)
if not minetest.is_protected(pos, player_name) then
minetest.set_node(pos, {name = "flowers:waterlily",
param2 = math.random(0, 3)})
- if not minetest.setting_getbool("creative_mode") then
+ if not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(player_name)) then
itemstack:take_item()
end
else
minetest.check_for_falling(pos)
end
- if not minetest.setting_getbool("creative_mode") then
+ if not (creative and creative.is_enabled_for
+ and creative.is_enabled_for(user:get_player_name())) then
itemstack:add_wear(65535 / ((uses or 200) - 1))
end
on_place = function(itemstack, placer, pointed_thing)
local under = minetest.get_node(pointed_thing.under)
local wield_item = itemstack:get_name()
+ local creative_enabled = (creative and creative.is_enabled_for
+ and creative.is_enabled_for(placer:get_player_name()))
if under and wield_item == under.name then
-- place slab using under node orientation
return
end
minetest.set_node(pointed_thing.under, {name = recipeitem, param2 = p2})
- if not minetest.setting_getbool("creative_mode") then
+ if not creative_enabled then
itemstack:take_item()
end
return itemstack
-- else attempt to place node with proper param2
minetest.item_place_node(ItemStack(wield_item), placer, pointed_thing, p2)
- if not minetest.setting_getbool("creative_mode") then
+ if not creative_enabled then
itemstack:take_item()
end
return itemstack