forked from MineClone5/MineClone5
Use minetest.is_creative_enabled
This commit is contained in:
parent
47dd29c930
commit
c106a62979
|
@ -12,7 +12,6 @@ under the LGPLv2.1 license.
|
||||||
|
|
||||||
mcl_explosions = {}
|
mcl_explosions = {}
|
||||||
|
|
||||||
local creative_mode = minetest.settings:get_bool("creative_mode")
|
|
||||||
local mod_death_messages = minetest.get_modpath("mcl_death_messages") ~= nil
|
local mod_death_messages = minetest.get_modpath("mcl_death_messages") ~= nil
|
||||||
local mod_fire = minetest.get_modpath("mcl_fire") ~= nil
|
local mod_fire = minetest.get_modpath("mcl_fire") ~= nil
|
||||||
local CONTENT_FIRE = minetest.get_content_id("mcl_fire:fire")
|
local CONTENT_FIRE = minetest.get_content_id("mcl_fire:fire")
|
||||||
|
@ -143,7 +142,7 @@ end
|
||||||
-- Note that this function has been optimized, it contains code which has been
|
-- Note that this function has been optimized, it contains code which has been
|
||||||
-- inlined to avoid function calls and unnecessary table creation. This was
|
-- inlined to avoid function calls and unnecessary table creation. This was
|
||||||
-- measured to give a significant performance increase.
|
-- measured to give a significant performance increase.
|
||||||
local function trace_explode(pos, strength, raydirs, radius, drop_chance, fire, puncher)
|
local function trace_explode(pos, strength, raydirs, radius, drop_chance, fire, puncher, creative_enabled)
|
||||||
local vm = minetest.get_voxel_manip()
|
local vm = minetest.get_voxel_manip()
|
||||||
|
|
||||||
local emin, emax = vm:read_from_map(vector.subtract(pos, radius),
|
local emin, emax = vm:read_from_map(vector.subtract(pos, radius),
|
||||||
|
@ -308,7 +307,7 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance, fire,
|
||||||
|
|
||||||
-- Remove destroyed blocks and drop items
|
-- Remove destroyed blocks and drop items
|
||||||
for hash, idx in pairs(destroy) do
|
for hash, idx in pairs(destroy) do
|
||||||
local do_drop = not creative_mode and math.random() <= drop_chance
|
local do_drop = not creative_enabled and math.random() <= drop_chance
|
||||||
local on_blast = node_on_blast[data[idx]]
|
local on_blast = node_on_blast[data[idx]]
|
||||||
local remove = true
|
local remove = true
|
||||||
|
|
||||||
|
@ -384,7 +383,8 @@ function mcl_explosions.explode(pos, strength, info, puncher)
|
||||||
end
|
end
|
||||||
local shape = sphere_shapes[radius]
|
local shape = sphere_shapes[radius]
|
||||||
|
|
||||||
trace_explode(pos, strength, shape, radius, (info and info.drop_chance) or 1 / strength, info.fire == true, puncher)
|
local creative_enabled = minetest.is_creative_enabled("")
|
||||||
|
trace_explode(pos, strength, shape, radius, (info and info.drop_chance) or 1 / strength, info.fire == true, puncher, creative_enabled)
|
||||||
|
|
||||||
if not (info and info.no_sound) then
|
if not (info and info.no_sound) then
|
||||||
add_particles(pos, radius)
|
add_particles(pos, radius)
|
||||||
|
|
|
@ -92,7 +92,7 @@ end
|
||||||
-- Similar to minetest.rotate_node.
|
-- Similar to minetest.rotate_node.
|
||||||
function mcl_util.rotate_axis(itemstack, placer, pointed_thing)
|
function mcl_util.rotate_axis(itemstack, placer, pointed_thing)
|
||||||
mcl_util.rotate_axis_and_place(itemstack, placer, pointed_thing,
|
mcl_util.rotate_axis_and_place(itemstack, placer, pointed_thing,
|
||||||
minetest.settings:get_bool("creative_mode"),
|
minetest.is_creative_enabled(placer:get_player_name()),
|
||||||
placer:get_player_control().sneak)
|
placer:get_player_control().sneak)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
|
@ -133,7 +133,7 @@ function boat.on_punch(self, puncher)
|
||||||
if not self._driver then
|
if not self._driver then
|
||||||
self._removed = true
|
self._removed = true
|
||||||
-- Drop boat as item on the ground after punching
|
-- Drop boat as item on the ground after punching
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(puncher:get_player_name()) then
|
||||||
minetest.add_item(self.object:get_pos(), self._itemstring)
|
minetest.add_item(self.object:get_pos(), self._itemstring)
|
||||||
else
|
else
|
||||||
local inv = puncher:get_inventory()
|
local inv = puncher:get_inventory()
|
||||||
|
@ -328,7 +328,7 @@ for b=1, #boat_ids do
|
||||||
boat:get_luaentity()._itemstring = itemstring
|
boat:get_luaentity()._itemstring = itemstring
|
||||||
boat:set_properties({textures = { "mcl_boats_texture_"..images[b].."_boat.png" }})
|
boat:set_properties({textures = { "mcl_boats_texture_"..images[b].."_boat.png" }})
|
||||||
boat:set_yaw(placer:get_look_horizontal())
|
boat:set_yaw(placer:get_look_horizontal())
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -213,7 +213,7 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||||
-- by hand. Creative Mode is intentionally ignored in this case.
|
-- by hand. Creative Mode is intentionally ignored in this case.
|
||||||
|
|
||||||
local doTileDrops = minetest.settings:get_bool("mcl_doTileDrops", true)
|
local doTileDrops = minetest.settings:get_bool("mcl_doTileDrops", true)
|
||||||
if (digger ~= nil and minetest.settings:get_bool("creative_mode")) or doTileDrops == false then
|
if (digger ~= nil and minetest.is_creative_enabled(digger:get_player_name())) or doTileDrops == false then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Drop items and remove cart entity
|
-- Drop items and remove cart entity
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(puncher:get_player_name()) then
|
||||||
for d=1, #drop do
|
for d=1, #drop do
|
||||||
minetest.add_item(self.object:get_pos(), drop[d])
|
minetest.add_item(self.object:get_pos(), drop[d])
|
||||||
end
|
end
|
||||||
|
@ -190,13 +190,14 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
||||||
node = minetest.get_node(rou_pos)
|
node = minetest.get_node(rou_pos)
|
||||||
local g = minetest.get_item_group(node.name, "connect_to_raillike")
|
local g = minetest.get_item_group(node.name, "connect_to_raillike")
|
||||||
if g ~= self._railtype and self._railtype ~= nil then
|
if g ~= self._railtype and self._railtype ~= nil then
|
||||||
|
local player
|
||||||
-- Detach driver
|
-- Detach driver
|
||||||
if self._driver then
|
if self._driver then
|
||||||
if self._old_pos then
|
if self._old_pos then
|
||||||
self.object:set_pos(self._old_pos)
|
self.object:set_pos(self._old_pos)
|
||||||
end
|
end
|
||||||
mcl_player.player_attached[self._driver] = nil
|
mcl_player.player_attached[self._driver] = nil
|
||||||
local player = minetest.get_player_by_name(self._driver)
|
player = minetest.get_player_by_name(self._driver)
|
||||||
if player then
|
if player then
|
||||||
player:set_detach()
|
player:set_detach()
|
||||||
player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0})
|
player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0})
|
||||||
|
@ -211,7 +212,11 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Drop items and remove cart entity
|
-- Drop items and remove cart entity
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
local pname = ""
|
||||||
|
if player then
|
||||||
|
pname = player:get_player_name()
|
||||||
|
end
|
||||||
|
if not minetest.is_creative_enabled(pname) then
|
||||||
for d=1, #drop do
|
for d=1, #drop do
|
||||||
minetest.add_item(self.object:get_pos(), drop[d])
|
minetest.add_item(self.object:get_pos(), drop[d])
|
||||||
end
|
end
|
||||||
|
@ -486,7 +491,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Place a minecart at pointed_thing
|
-- Place a minecart at pointed_thing
|
||||||
mcl_minecarts.place_minecart = function(itemstack, pointed_thing)
|
mcl_minecarts.place_minecart = function(itemstack, pointed_thing, placer)
|
||||||
if not pointed_thing.type == "node" then
|
if not pointed_thing.type == "node" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -519,7 +524,11 @@ mcl_minecarts.place_minecart = function(itemstack, pointed_thing)
|
||||||
local cart_dir = mcl_minecarts:get_rail_direction(railpos, {x=1, y=0, z=0}, nil, nil, railtype)
|
local cart_dir = mcl_minecarts:get_rail_direction(railpos, {x=1, y=0, z=0}, nil, nil, railtype)
|
||||||
cart:set_yaw(minetest.dir_to_yaw(cart_dir))
|
cart:set_yaw(minetest.dir_to_yaw(cart_dir))
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
local pname = ""
|
||||||
|
if placer then
|
||||||
|
pname = placer:get_player_name()
|
||||||
|
end
|
||||||
|
if not minetest.is_creative_enabled(pname) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -548,7 +557,7 @@ local register_craftitem = function(itemstring, entity_id, description, tt_help,
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return mcl_minecarts.place_minecart(itemstack, pointed_thing)
|
return mcl_minecarts.place_minecart(itemstack, pointed_thing, placer)
|
||||||
end,
|
end,
|
||||||
_on_dispense = function(stack, pos, droppos, dropnode, dropdir)
|
_on_dispense = function(stack, pos, droppos, dropnode, dropdir)
|
||||||
-- Place minecart as entity on rail. If there's no rail, just drop it.
|
-- Place minecart as entity on rail. If there's no rail, just drop it.
|
||||||
|
@ -683,7 +692,7 @@ register_minecart(
|
||||||
if minetest.get_item_group(held:get_name(), "coal") == 1 then
|
if minetest.get_item_group(held:get_name(), "coal") == 1 then
|
||||||
self._fueltime = self._fueltime + 180
|
self._fueltime = self._fueltime + 180
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
held:take_item()
|
held:take_item()
|
||||||
local index = clicker:get_wield_index()
|
local index = clicker:get_wield_index()
|
||||||
local inv = clicker:get_inventory()
|
local inv = clicker:get_inventory()
|
||||||
|
@ -773,7 +782,7 @@ register_minecart(
|
||||||
end
|
end
|
||||||
local held = clicker:get_wielded_item()
|
local held = clicker:get_wielded_item()
|
||||||
if held:get_name() == "mcl_fire:flint_and_steel" then
|
if held:get_name() == "mcl_fire:flint_and_steel" then
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
held:add_wear(65535/65) -- 65 uses
|
held:add_wear(65535/65) -- 65 uses
|
||||||
local index = clicker:get_wield_index()
|
local index = clicker:get_wield_index()
|
||||||
local inv = clicker:get_inventory()
|
local inv = clicker:get_inventory()
|
||||||
|
|
|
@ -28,9 +28,8 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- creative check
|
-- creative check
|
||||||
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
|
|
||||||
function mobs.is_creative(name)
|
function mobs.is_creative(name)
|
||||||
return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
|
return minetest.is_creative_enabled(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +59,6 @@ local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false
|
||||||
local disable_blood = minetest.settings:get_bool("mobs_disable_blood")
|
local disable_blood = minetest.settings:get_bool("mobs_disable_blood")
|
||||||
local mobs_drop_items = minetest.settings:get_bool("mobs_drop_items") ~= false
|
local mobs_drop_items = minetest.settings:get_bool("mobs_drop_items") ~= false
|
||||||
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
local creative = minetest.settings:get_bool("creative_mode")
|
|
||||||
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false
|
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false
|
||||||
local remove_far = false
|
local remove_far = false
|
||||||
local difficulty = tonumber(minetest.settings:get("mob_difficulty")) or 1.0
|
local difficulty = tonumber(minetest.settings:get("mob_difficulty")) or 1.0
|
||||||
|
@ -1600,7 +1598,7 @@ local monster_attack = function(self)
|
||||||
|
|
||||||
if self.type ~= "monster"
|
if self.type ~= "monster"
|
||||||
or not damage_enabled
|
or not damage_enabled
|
||||||
or creative
|
or minetest.is_creative_enabled("")
|
||||||
or self.state == "attack"
|
or self.state == "attack"
|
||||||
or day_docile(self) then
|
or day_docile(self) then
|
||||||
return
|
return
|
||||||
|
@ -2674,7 +2672,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
||||||
|
|
||||||
-- add weapon wear manually
|
-- add weapon wear manually
|
||||||
-- Required because we have custom health handling ("health" property)
|
-- Required because we have custom health handling ("health" property)
|
||||||
if minetest.settings:get_bool("creative_mode") ~= true
|
if minetest.is_creative_enabled("") ~= true
|
||||||
and tool_capabilities then
|
and tool_capabilities then
|
||||||
if tool_capabilities.punch_attack_uses then
|
if tool_capabilities.punch_attack_uses then
|
||||||
-- Without this delay, the wear does not work. Quite hacky ...
|
-- Without this delay, the wear does not work. Quite hacky ...
|
||||||
|
@ -3933,7 +3931,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
mcl_mobspawners.setup_spawner(pointed_thing.under, itemstack:get_name())
|
mcl_mobspawners.setup_spawner(pointed_thing.under, itemstack:get_name())
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not mobs.is_creative(name) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -167,7 +167,11 @@ minetest.register_entity("mcl_paintings:painting", {
|
||||||
end,
|
end,
|
||||||
on_death = function(self, killer)
|
on_death = function(self, killer)
|
||||||
-- Drop as item on death
|
-- Drop as item on death
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
local kname = ""
|
||||||
|
if killer and killer:is_player() then
|
||||||
|
kname = killer:get_player_name()
|
||||||
|
end
|
||||||
|
if not minetest.is_creative_enabled(kname) then
|
||||||
local pos = self._pos
|
local pos = self._pos
|
||||||
if not pos then
|
if not pos then
|
||||||
pos = self.object:get_pos()
|
pos = self.object:get_pos()
|
||||||
|
@ -279,7 +283,7 @@ minetest.register_craftitem("mcl_paintings:painting", {
|
||||||
else
|
else
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -552,7 +552,7 @@ if c("totem") then
|
||||||
if player:get_breath() < 11 then
|
if player:get_breath() < 11 then
|
||||||
player:set_breath(10)
|
player:set_breath(10)
|
||||||
end
|
end
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
wield:take_item()
|
wield:take_item()
|
||||||
player:set_wielded_item(wield)
|
player:set_wielded_item(wield)
|
||||||
end
|
end
|
||||||
|
|
|
@ -123,7 +123,7 @@ local arrows = {
|
||||||
local throwing_shoot_arrow = function(itemstack, player)
|
local throwing_shoot_arrow = function(itemstack, player)
|
||||||
for _,arrow in ipairs(arrows) do
|
for _,arrow in ipairs(arrows) do
|
||||||
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
|
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
player:get_inventory():remove_item("main", arrow[1])
|
player:get_inventory():remove_item("main", arrow[1])
|
||||||
end
|
end
|
||||||
local playerpos = player:get_pos()
|
local playerpos = player:get_pos()
|
||||||
|
@ -171,7 +171,7 @@ if c("bow") then
|
||||||
inventory_image = "mcl_bows_bow.png",
|
inventory_image = "mcl_bows_bow.png",
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
if throwing_shoot_arrow(itemstack, user, pointed_thing) then
|
if throwing_shoot_arrow(itemstack, user, pointed_thing) then
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
itemstack:add_wear(65535/50)
|
itemstack:add_wear(65535/50)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -296,7 +296,7 @@ if c("egg") then
|
||||||
local ent2 = obj:get_luaentity()
|
local ent2 = obj:get_luaentity()
|
||||||
ent2.playername = player:get_player_name()
|
ent2.playername = player:get_player_name()
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ if c("snowball") then
|
||||||
local ent2 = obj:get_luaentity()
|
local ent2 = obj:get_luaentity()
|
||||||
ent2.playername = player:get_player_name()
|
ent2.playername = player:get_player_name()
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ mooshroom_def.on_rightclick = function(self, clicker)
|
||||||
local cow = minetest.add_entity(pos, "mobs_mc:cow")
|
local cow = minetest.add_entity(pos, "mobs_mc:cow")
|
||||||
cow:set_yaw(oldyaw)
|
cow:set_yaw(oldyaw)
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:add_wear(mobs_mc.misc.shears_wear)
|
item:add_wear(mobs_mc.misc.shears_wear)
|
||||||
clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
|
clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,7 +51,7 @@ mobs:register_mob("mobs_mc:creeper", {
|
||||||
end
|
end
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
if item:get_name() == mobs_mc.items.flint_and_steel then
|
if item:get_name() == mobs_mc.items.flint_and_steel then
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
-- Wear tool
|
-- Wear tool
|
||||||
local wdef = item:get_definition()
|
local wdef = item:get_definition()
|
||||||
item:add_wear(1000)
|
item:add_wear(1000)
|
||||||
|
|
|
@ -233,7 +233,7 @@ local horse = {
|
||||||
-- Put on saddle and take saddle from player's inventory
|
-- Put on saddle and take saddle from player's inventory
|
||||||
local w = clicker:get_wielded_item()
|
local w = clicker:get_wielded_item()
|
||||||
self._saddle = true
|
self._saddle = true
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
w:take_item()
|
w:take_item()
|
||||||
clicker:set_wielded_item(w)
|
clicker:set_wielded_item(w)
|
||||||
end
|
end
|
||||||
|
@ -257,7 +257,7 @@ local horse = {
|
||||||
local armor = minetest.get_item_group(iname, "horse_armor")
|
local armor = minetest.get_item_group(iname, "horse_armor")
|
||||||
self._horse_armor = iname
|
self._horse_armor = iname
|
||||||
local w = clicker:get_wielded_item()
|
local w = clicker:get_wielded_item()
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
w:take_item()
|
w:take_item()
|
||||||
clicker:set_wielded_item(w)
|
clicker:set_wielded_item(w)
|
||||||
end
|
end
|
||||||
|
|
|
@ -135,7 +135,7 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
if minetest.get_item_group(item:get_name(), "carpet") == 1 and not self.carpet then
|
if minetest.get_item_group(item:get_name(), "carpet") == 1 and not self.carpet then
|
||||||
for group, carpetdata in pairs(carpets) do
|
for group, carpetdata in pairs(carpets) do
|
||||||
if minetest.get_item_group(item:get_name(), group) == 1 then
|
if minetest.get_item_group(item:get_name(), group) == 1 then
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
clicker:set_wielded_item(item)
|
clicker:set_wielded_item(item)
|
||||||
end
|
end
|
||||||
|
|
|
@ -74,7 +74,7 @@ local ocelot = {
|
||||||
-- Try to tame ocelot (mobs:feed_tame is intentionally NOT used)
|
-- Try to tame ocelot (mobs:feed_tame is intentionally NOT used)
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
if is_food(item:get_name()) then
|
if is_food(item:get_name()) then
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
clicker:set_wielded_item(item)
|
clicker:set_wielded_item(item)
|
||||||
end
|
end
|
||||||
|
|
|
@ -64,7 +64,7 @@ mobs:register_mob("mobs_mc:parrot", {
|
||||||
self.health = 0
|
self.health = 0
|
||||||
-- Doomed to die
|
-- Doomed to die
|
||||||
self._doomed = true
|
self._doomed = true
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
clicker:set_wielded_item(item)
|
clicker:set_wielded_item(item)
|
||||||
end
|
end
|
||||||
|
|
|
@ -120,7 +120,7 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,},
|
max = 1,},
|
||||||
}
|
}
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
local inv = clicker:get_inventory()
|
local inv = clicker:get_inventory()
|
||||||
local stack = inv:get_stack("main", clicker:get_wield_index())
|
local stack = inv:get_stack("main", clicker:get_wield_index())
|
||||||
stack:take_item()
|
stack:take_item()
|
||||||
|
@ -142,7 +142,7 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
|
|
||||||
mobs.attach(self, clicker)
|
mobs.attach(self, clicker)
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
|
|
||||||
local inv = self.driver:get_inventory()
|
local inv = self.driver:get_inventory()
|
||||||
-- 26 uses
|
-- 26 uses
|
||||||
|
|
|
@ -166,7 +166,7 @@ mobs:register_mob("mobs_mc:sheep", {
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
textures = self.base_texture,
|
textures = self.base_texture,
|
||||||
})
|
})
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:add_wear(mobs_mc.misc.shears_wear)
|
item:add_wear(mobs_mc.misc.shears_wear)
|
||||||
clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
|
clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
|
||||||
end
|
end
|
||||||
|
@ -183,7 +183,7 @@ mobs:register_mob("mobs_mc:sheep", {
|
||||||
minetest.log("verbose", "[mobs_mc] " ..item:get_name() .. " " .. minetest.get_item_group(item:get_name(), "dye"))
|
minetest.log("verbose", "[mobs_mc] " ..item:get_name() .. " " .. minetest.get_item_group(item:get_name(), "dye"))
|
||||||
for group, colordata in pairs(colors) do
|
for group, colordata in pairs(colors) do
|
||||||
if minetest.get_item_group(item:get_name(), group) == 1 then
|
if minetest.get_item_group(item:get_name(), group) == 1 then
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
clicker:set_wielded_item(item)
|
clicker:set_wielded_item(item)
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,7 +50,7 @@ mobs:register_egg("mobs_mc:silverfish", S("Silverfish"), "mobs_mc_spawn_icon_sil
|
||||||
-- Monster egg blocks (Minetest Game)
|
-- Monster egg blocks (Minetest Game)
|
||||||
if minetest.get_modpath("default") and mobs_mc.create_monster_egg_nodes then
|
if minetest.get_modpath("default") and mobs_mc.create_monster_egg_nodes then
|
||||||
local spawn_silverfish = function(pos, oldnode, oldmetadata, digger)
|
local spawn_silverfish = function(pos, oldnode, oldmetadata, digger)
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(digger:get_player_name()) then
|
||||||
minetest.add_entity(pos, "mobs_mc:silverfish")
|
minetest.add_entity(pos, "mobs_mc:silverfish")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -119,7 +119,7 @@ mobs:register_mob("mobs_mc:snowman", {
|
||||||
minetest.sound_play("shears", {pos = pos}, true)
|
minetest.sound_play("shears", {pos = pos}, true)
|
||||||
|
|
||||||
-- Wear out
|
-- Wear out
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:add_wear(mobs_mc.misc.shears_wear)
|
item:add_wear(mobs_mc.misc.shears_wear)
|
||||||
clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
|
clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,7 +53,7 @@ local wolf = {
|
||||||
local dog, ent
|
local dog, ent
|
||||||
if tool:get_name() == mobs_mc.items.bone then
|
if tool:get_name() == mobs_mc.items.bone then
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
tool:take_item()
|
tool:take_item()
|
||||||
clicker:set_wielded_item(tool)
|
clicker:set_wielded_item(tool)
|
||||||
end
|
end
|
||||||
|
@ -154,7 +154,7 @@ dog.on_rightclick = function(self, clicker)
|
||||||
if new_hp > self.hp_max then
|
if new_hp > self.hp_max then
|
||||||
new_hp = self.hp_max
|
new_hp = self.hp_max
|
||||||
end
|
end
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
clicker:set_wielded_item(item)
|
clicker:set_wielded_item(item)
|
||||||
end
|
end
|
||||||
|
@ -172,7 +172,7 @@ dog.on_rightclick = function(self, clicker)
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
textures = self.base_texture
|
textures = self.base_texture
|
||||||
})
|
})
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
clicker:set_wielded_item(item)
|
clicker:set_wielded_item(item)
|
||||||
end
|
end
|
||||||
|
|
|
@ -128,7 +128,7 @@ local function init(player)
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
local inv = minetest.create_detached_inventory("creative_"..playername, {
|
local inv = minetest.create_detached_inventory("creative_"..playername, {
|
||||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||||
if minetest.settings:get_bool("creative_mode") then
|
if minetest.is_creative_enabled(playername) then
|
||||||
return count
|
return count
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
|
@ -138,7 +138,7 @@ local function init(player)
|
||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
allow_take = function(inv, listname, index, stack, player)
|
allow_take = function(inv, listname, index, stack, player)
|
||||||
if minetest.settings:get_bool("creative_mode") then
|
if minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
return -1
|
return -1
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
|
@ -151,7 +151,7 @@ end
|
||||||
-- Create the trash field
|
-- Create the trash field
|
||||||
local trash = minetest.create_detached_inventory("trash", {
|
local trash = minetest.create_detached_inventory("trash", {
|
||||||
allow_put = function(inv, listname, index, stack, player)
|
allow_put = function(inv, listname, index, stack, player)
|
||||||
if minetest.settings:get_bool("creative_mode") then
|
if minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
|
@ -459,7 +459,8 @@ end
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local page = nil
|
local page = nil
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
|
||||||
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if formname ~= "" or fields.quit == "true" then
|
if formname ~= "" or fields.quit == "true" then
|
||||||
|
@ -579,7 +580,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
if minetest.settings:get_bool("creative_mode") then
|
if minetest.is_creative_enabled("") then
|
||||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||||
-- Place infinite nodes, except for shulker boxes
|
-- Place infinite nodes, except for shulker boxes
|
||||||
local group = minetest.get_item_group(itemstack:get_name(), "shulker_box")
|
local group = minetest.get_item_group(itemstack:get_name(), "shulker_box")
|
||||||
|
|
|
@ -46,7 +46,7 @@ local function return_fields(player, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_inventory(player, armor_change_only)
|
local function set_inventory(player, armor_change_only)
|
||||||
if minetest.settings:get_bool("creative_mode") then
|
if minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
if armor_change_only then
|
if armor_change_only then
|
||||||
-- Stay on survival inventory plage if only the armor has been changed
|
-- Stay on survival inventory plage if only the armor has been changed
|
||||||
mcl_inventory.set_creative_formspec(player, 0, 0, nil, nil, "inv")
|
mcl_inventory.set_creative_formspec(player, 0, 0, nil, nil, "inv")
|
||||||
|
@ -137,13 +137,13 @@ end
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if fields.quit then
|
if fields.quit then
|
||||||
return_fields(player,"craft")
|
return_fields(player,"craft")
|
||||||
if not minetest.settings:get_bool("creative_mode") and (formname == "" or formname == "main") then
|
if not minetest.is_creative_enabled(player:get_player_name()) and (formname == "" or formname == "main") then
|
||||||
set_inventory(player)
|
set_inventory(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled("") then
|
||||||
mcl_inventory.update_inventory_formspec = function(player)
|
mcl_inventory.update_inventory_formspec = function(player)
|
||||||
set_inventory(player)
|
set_inventory(player)
|
||||||
end
|
end
|
||||||
|
@ -180,7 +180,7 @@ minetest.register_on_joinplayer(function(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- In Creative Mode, the initial inventory setup is handled in creative.lua
|
-- In Creative Mode, the initial inventory setup is handled in creative.lua
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
set_inventory(player)
|
set_inventory(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ minetest.register_on_joinplayer(function(player)
|
||||||
return_fields(player, "craft")
|
return_fields(player, "craft")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if minetest.settings:get_bool("creative_mode") then
|
if minetest.is_creative_enabled("") then
|
||||||
dofile(minetest.get_modpath("mcl_inventory").."/creative.lua")
|
dofile(minetest.get_modpath("mcl_inventory").."/creative.lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ end
|
||||||
local on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
local on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||||
local can_edit = true
|
local can_edit = true
|
||||||
-- Only allow write access in Creative Mode
|
-- Only allow write access in Creative Mode
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
can_edit = false
|
can_edit = false
|
||||||
end
|
end
|
||||||
local pname = player:get_player_name()
|
local pname = player:get_player_name()
|
||||||
|
@ -285,7 +285,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if index ~= nil and x ~= nil and y ~= nil and z ~= nil then
|
if index ~= nil and x ~= nil and y ~= nil and z ~= nil then
|
||||||
local pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
|
local pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
minetest.chat_send_player(player:get_player_name(), S("Editing the command block has failed! You can only change the command block in Creative Mode!"))
|
minetest.chat_send_player(player:get_player_name(), S("Editing the command block has failed! You can only change the command block in Creative Mode!"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -455,7 +455,7 @@ for colorid, colortab in pairs(mcl_banners.colors) do
|
||||||
banner_entity:set_yaw(final_yaw)
|
banner_entity:set_yaw(final_yaw)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos}, true)
|
minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos}, true)
|
||||||
|
|
|
@ -133,7 +133,7 @@ function mcl_beds.register_bed(name, def)
|
||||||
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
|
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
|
||||||
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
|
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -99,7 +99,7 @@ local ARROW_ENTITY={
|
||||||
|
|
||||||
-- Destroy arrow entity self at pos and drops it as an item
|
-- Destroy arrow entity self at pos and drops it as an item
|
||||||
local spawn_item = function(self, pos)
|
local spawn_item = function(self, pos)
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled("") then
|
||||||
local item = minetest.add_item(pos, "mcl_bows:arrow")
|
local item = minetest.add_item(pos, "mcl_bows:arrow")
|
||||||
item:set_velocity({x=0, y=0, z=0})
|
item:set_velocity({x=0, y=0, z=0})
|
||||||
item:set_yaw(self.object:get_yaw())
|
item:set_yaw(self.object:get_yaw())
|
||||||
|
@ -138,7 +138,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
local objects = minetest.get_objects_inside_radius(pos, 1)
|
local objects = minetest.get_objects_inside_radius(pos, 1)
|
||||||
for _,obj in ipairs(objects) do
|
for _,obj in ipairs(objects) do
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(obj:get_player_name()) then
|
||||||
if obj:get_inventory():room_for_item("main", "mcl_bows:arrow") then
|
if obj:get_inventory():room_for_item("main", "mcl_bows:arrow") then
|
||||||
obj:get_inventory():add_item("main", "mcl_bows:arrow")
|
obj:get_inventory():add_item("main", "mcl_bows:arrow")
|
||||||
minetest.sound_play("item_drop_pickup", {
|
minetest.sound_play("item_drop_pickup", {
|
||||||
|
|
|
@ -75,7 +75,7 @@ end
|
||||||
local player_shoot_arrow = function(itemstack, player, power, damage)
|
local player_shoot_arrow = function(itemstack, player, power, damage)
|
||||||
local arrow_stack, arrow_stack_id = get_arrow(player)
|
local arrow_stack, arrow_stack_id = get_arrow(player)
|
||||||
local arrow_itemstring
|
local arrow_itemstring
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
if not arrow_stack then
|
if not arrow_stack then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -209,7 +209,7 @@ controls.register_on_release(function(player, key, time)
|
||||||
has_shot = player_shoot_arrow(wielditem, player, speed, damage)
|
has_shot = player_shoot_arrow(wielditem, player, speed, damage)
|
||||||
|
|
||||||
wielditem:set_name("mcl_bows:bow")
|
wielditem:set_name("mcl_bows:bow")
|
||||||
if has_shot and minetest.settings:get_bool("creative_mode") == false then
|
if has_shot and not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
wielditem:add_wear(65535/BOW_DURABILITY)
|
wielditem:add_wear(65535/BOW_DURABILITY)
|
||||||
end
|
end
|
||||||
player:set_wielded_item(wielditem)
|
player:set_wielded_item(wielditem)
|
||||||
|
@ -224,7 +224,8 @@ controls.register_on_hold(function(player, key, time)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local inv = minetest.get_inventory({type="player", name=name})
|
local inv = minetest.get_inventory({type="player", name=name})
|
||||||
local wielditem = player:get_wielded_item()
|
local wielditem = player:get_wielded_item()
|
||||||
if bow_load[name] == nil and wielditem:get_name()=="mcl_bows:bow" and (minetest.settings:get_bool("creative_mode") or inv:contains_item("main", "mcl_bows:arrow")) then
|
local creative = minetest.is_creative_enabled(name)
|
||||||
|
if bow_load[name] == nil and wielditem:get_name()=="mcl_bows:bow" and (creative or inv:contains_item("main", "mcl_bows:arrow")) then
|
||||||
wielditem:set_name("mcl_bows:bow_0")
|
wielditem:set_name("mcl_bows:bow_0")
|
||||||
player:set_wielded_item(wielditem)
|
player:set_wielded_item(wielditem)
|
||||||
if minetest.get_modpath("playerphysics") then
|
if minetest.get_modpath("playerphysics") then
|
||||||
|
|
|
@ -141,7 +141,7 @@ function mcl_buckets.register_liquid(source_place, source_take, itemname, invent
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Handle bucket item and inventory stuff
|
-- Handle bucket item and inventory stuff
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
-- Add empty bucket and put it into inventory, if possible.
|
-- Add empty bucket and put it into inventory, if possible.
|
||||||
-- Drop empty bucket otherwise.
|
-- Drop empty bucket otherwise.
|
||||||
local new_bucket = ItemStack("mcl_buckets:bucket_empty")
|
local new_bucket = ItemStack("mcl_buckets:bucket_empty")
|
||||||
|
@ -220,7 +220,7 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
|
||||||
if liquiddef ~= nil and liquiddef.itemname ~= nil and (nn == liquiddef.source_take) then
|
if liquiddef ~= nil and liquiddef.itemname ~= nil and (nn == liquiddef.source_take) then
|
||||||
|
|
||||||
-- Fill bucket, but not in Creative Mode
|
-- Fill bucket, but not in Creative Mode
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
new_bucket = ItemStack({name = liquiddef.itemname, metadata = tostring(node.param2)})
|
new_bucket = ItemStack({name = liquiddef.itemname, metadata = tostring(node.param2)})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -234,14 +234,14 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
|
||||||
elseif nn == "mcl_cauldrons:cauldron_3" then
|
elseif nn == "mcl_cauldrons:cauldron_3" then
|
||||||
-- Take water out of full cauldron
|
-- Take water out of full cauldron
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
new_bucket = ItemStack("mcl_buckets:bucket_water")
|
new_bucket = ItemStack("mcl_buckets:bucket_water")
|
||||||
end
|
end
|
||||||
sound_take("mcl_core:water_source", pointed_thing.under)
|
sound_take("mcl_core:water_source", pointed_thing.under)
|
||||||
elseif nn == "mcl_cauldrons:cauldron_3r" then
|
elseif nn == "mcl_cauldrons:cauldron_3r" then
|
||||||
-- Take river water out of full cauldron
|
-- Take river water out of full cauldron
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
new_bucket = ItemStack("mcl_buckets:bucket_river_water")
|
new_bucket = ItemStack("mcl_buckets:bucket_river_water")
|
||||||
end
|
end
|
||||||
sound_take("mclx_core:river_water_source", pointed_thing.under)
|
sound_take("mclx_core:river_water_source", pointed_thing.under)
|
||||||
|
@ -259,7 +259,7 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
|
||||||
else
|
else
|
||||||
minetest.add_item(user:get_pos(), new_bucket)
|
minetest.add_item(user:get_pos(), new_bucket)
|
||||||
end
|
end
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -62,7 +62,7 @@ minetest.register_node("mcl_cake:cake", {
|
||||||
end
|
end
|
||||||
local newcake = minetest.do_item_eat(2, ItemStack("mcl_cake:cake_6"), ItemStack("mcl_cake:cake"), clicker, {type="nothing"})
|
local newcake = minetest.do_item_eat(2, ItemStack("mcl_cake:cake_6"), ItemStack("mcl_cake:cake"), clicker, {type="nothing"})
|
||||||
-- Check if we were allowed to eat
|
-- Check if we were allowed to eat
|
||||||
if newcake:get_name() ~= "mcl_cake:cake" or minetest.settings:get_bool("creative_mode") == true then
|
if newcake:get_name() ~= "mcl_cake:cake" or minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
minetest.add_node(pos,{type="node",name="mcl_cake:cake_6",param2=0})
|
minetest.add_node(pos,{type="node",name="mcl_cake:cake_6",param2=0})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -87,7 +87,7 @@ local register_slice = function(level, nodebox, desc)
|
||||||
end
|
end
|
||||||
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack(after_eat), ItemStack(this), clicker, {type="nothing"})
|
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack(after_eat), ItemStack(this), clicker, {type="nothing"})
|
||||||
-- Check if we were allowed to eat
|
-- Check if we were allowed to eat
|
||||||
if newcake:get_name() ~= this or minetest.settings:get_bool("creative_mode") == true then
|
if newcake:get_name() ~= this or minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
minetest.add_node(pos,{type="node",name=after_eat,param2=0})
|
minetest.add_node(pos,{type="node",name=after_eat,param2=0})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -101,7 +101,7 @@ local register_slice = function(level, nodebox, desc)
|
||||||
end
|
end
|
||||||
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack("mcl:cake:cake 0"), ItemStack("mcl_cake:cake_1"), clicker, {type="nothing"})
|
local newcake = minetest.do_item_eat(CAKE_HUNGER_POINTS, ItemStack("mcl:cake:cake 0"), ItemStack("mcl_cake:cake_1"), clicker, {type="nothing"})
|
||||||
-- Check if we were allowed to eat
|
-- Check if we were allowed to eat
|
||||||
if newcake:get_name() ~= this or minetest.settings:get_bool("creative_mode") == true then
|
if newcake:get_name() ~= this or minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
core.check_for_falling(pos)
|
core.check_for_falling(pos)
|
||||||
end
|
end
|
||||||
|
|
|
@ -845,7 +845,7 @@ for color, desc in pairs(boxtypes) do
|
||||||
local iinv_main = minetest.deserialize(imeta)
|
local iinv_main = minetest.deserialize(imeta)
|
||||||
ninv:set_list("main", iinv_main)
|
ninv:set_list("main", iinv_main)
|
||||||
ninv:set_size("main", 9*3)
|
ninv:set_size("main", 9*3)
|
||||||
if minetest.settings:get_bool("creative_mode") then
|
if minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
if not ninv:is_empty("main") then
|
if not ninv:is_empty("main") then
|
||||||
return nil
|
return nil
|
||||||
else
|
else
|
||||||
|
@ -867,7 +867,7 @@ for color, desc in pairs(boxtypes) do
|
||||||
local boxitem = ItemStack("mcl_chests:"..color.."_shulker_box")
|
local boxitem = ItemStack("mcl_chests:"..color.."_shulker_box")
|
||||||
boxitem:set_metadata(data)
|
boxitem:set_metadata(data)
|
||||||
|
|
||||||
if minetest.settings:get_bool("creative_mode") then
|
if minetest.is_creative_enabled("") then
|
||||||
if not inv:is_empty("main") then
|
if not inv:is_empty("main") then
|
||||||
minetest.add_item(pos, boxitem)
|
minetest.add_item(pos, boxitem)
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,7 +45,7 @@ function mcl_cocoas.place(itemstack, placer, pointed_thing, plantname)
|
||||||
|
|
||||||
minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}, true)
|
minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}, true)
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ function mcl_doors:register_door(name, def)
|
||||||
meta2:set_int("is_open", 0)
|
meta2:set_int("is_open", 0)
|
||||||
|
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(pn) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -337,7 +337,7 @@ minetest.register_craftitem("mcl_dye:white", {
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Use the bone meal on the ground
|
-- Use the bone meal on the ground
|
||||||
if(mcl_dye.apply_bone_meal(pointed_thing) and not minetest.settings:get_bool("creative_mode")) then
|
if(mcl_dye.apply_bone_meal(pointed_thing) and (not minetest.is_creative_enabled(user:get_player_name()))) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -538,7 +538,7 @@ local eat_chorus_fruit = function(itemstack, player, pointed_thing)
|
||||||
local count = itemstack:get_count()
|
local count = itemstack:get_count()
|
||||||
local new_itemstack = minetest.do_item_eat(4, nil, itemstack, player, pointed_thing)
|
local new_itemstack = minetest.do_item_eat(4, nil, itemstack, player, pointed_thing)
|
||||||
local new_count = new_itemstack:get_count()
|
local new_count = new_itemstack:get_count()
|
||||||
if count ~= new_count or new_itemstack:get_name() ~= "mcl_end:chorus_fruit" or (minetest.settings:get_bool("creative_mode") == true) then
|
if count ~= new_count or new_itemstack:get_name() ~= "mcl_end:chorus_fruit" or (minetest.is_creative_enabled(player:get_player_name()) == true) then
|
||||||
random_teleport(player)
|
random_teleport(player)
|
||||||
end
|
end
|
||||||
return new_itemstack
|
return new_itemstack
|
||||||
|
|
|
@ -29,7 +29,7 @@ minetest.register_entity("mcl_end:ender_eye", {
|
||||||
if self._age >= 3 then
|
if self._age >= 3 then
|
||||||
-- End of life
|
-- End of life
|
||||||
local r = math.random(1,5)
|
local r = math.random(1,5)
|
||||||
if r == 1 or minetest.settings:get_bool("creative_mode") then
|
if r == 1 or minetest.is_creative_enabled("") then
|
||||||
-- 20% chance to get destroyed completely.
|
-- 20% chance to get destroyed completely.
|
||||||
-- 100% if in Creative Mode
|
-- 100% if in Creative Mode
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
@ -89,7 +89,7 @@ minetest.register_craftitem("mcl_end:ender_eye", {
|
||||||
origin.y = origin.y + 1.5
|
origin.y = origin.y + 1.5
|
||||||
local strongholds = mcl_structures.get_registered_structures("stronghold")
|
local strongholds = mcl_structures.get_registered_structures("stronghold")
|
||||||
local dim = mcl_worlds.pos_to_dimension(origin)
|
local dim = mcl_worlds.pos_to_dimension(origin)
|
||||||
local is_creative = minetest.settings:get_bool("creative_mode")
|
local is_creative = minetest.is_creative_enabled(user:get_player_name())
|
||||||
|
|
||||||
-- Just drop the eye of ender if there are no strongholds
|
-- Just drop the eye of ender if there are no strongholds
|
||||||
if #strongholds <= 0 or dim ~= "overworld" then
|
if #strongholds <= 0 or dim ~= "overworld" then
|
||||||
|
|
|
@ -41,7 +41,7 @@ local hoe_on_place_function = function(wear_divisor)
|
||||||
end
|
end
|
||||||
|
|
||||||
if create_soil(pointed_thing.under, user:get_inventory()) then
|
if create_soil(pointed_thing.under, user:get_inventory()) then
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
itemstack:add_wear(65535/wear_divisor)
|
itemstack:add_wear(65535/wear_divisor)
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -90,7 +90,7 @@ function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -36,7 +36,7 @@ minetest.register_craftitem("mcl_fire:fire_charge", {
|
||||||
else
|
else
|
||||||
mcl_fire.set_fire(pointed_thing, user, false)
|
mcl_fire.set_fire(pointed_thing, user, false)
|
||||||
end
|
end
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,7 +47,7 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
|
||||||
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
|
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
|
||||||
minetest.sound_play(idef.sound.breaks, {pos=user:get_pos(), gain=0.5}, true)
|
minetest.sound_play(idef.sound.breaks, {pos=user:get_pos(), gain=0.5}, true)
|
||||||
end
|
end
|
||||||
if not minetest.settings:get_bool("creative_mode") and used == true then
|
if (not minetest.is_creative_enabled(user:get_player_name())) and used == true then
|
||||||
itemstack:add_wear(65535/65) -- 65 uses
|
itemstack:add_wear(65535/65) -- 65 uses
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -57,13 +57,13 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
|
||||||
-- Ignite air
|
-- Ignite air
|
||||||
if dropnode.name == "air" then
|
if dropnode.name == "air" then
|
||||||
minetest.add_node(droppos, {name="mcl_fire:fire"})
|
minetest.add_node(droppos, {name="mcl_fire:fire"})
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled("") then
|
||||||
stack:add_wear(65535/65) -- 65 uses
|
stack:add_wear(65535/65) -- 65 uses
|
||||||
end
|
end
|
||||||
-- Ignite TNT
|
-- Ignite TNT
|
||||||
elseif dropnode.name == "mcl_tnt:tnt" then
|
elseif dropnode.name == "mcl_tnt:tnt" then
|
||||||
tnt.ignite(droppos)
|
tnt.ignite(droppos)
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled("") then
|
||||||
stack:add_wear(65535/65) -- 65 uses
|
stack:add_wear(65535/65) -- 65 uses
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -101,7 +101,8 @@ local fish = function(itemstack, player)
|
||||||
if inv:room_for_item("main", item) then
|
if inv:room_for_item("main", item) then
|
||||||
inv:add_item("main", item)
|
inv:add_item("main", item)
|
||||||
end
|
end
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
|
||||||
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
local idef = itemstack:get_definition()
|
local idef = itemstack:get_definition()
|
||||||
itemstack:add_wear(65535/65) -- 65 uses
|
itemstack:add_wear(65535/65) -- 65 uses
|
||||||
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
|
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
|
||||||
|
@ -115,7 +116,7 @@ local fish = function(itemstack, player)
|
||||||
local node = minetest.get_node(epos)
|
local node = minetest.get_node(epos)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
if def.walkable then
|
if def.walkable then
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
local idef = itemstack:get_definition()
|
local idef = itemstack:get_definition()
|
||||||
itemstack:add_wear((65535/65)*2) -- if so and not creative then wear double like in MC.
|
itemstack:add_wear((65535/65)*2) -- if so and not creative then wear double like in MC.
|
||||||
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
|
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
|
||||||
|
|
|
@ -66,7 +66,7 @@ minetest.register_node("mcl_flowerpots:flower_pot", {
|
||||||
local flower_node = row[2]
|
local flower_node = row[2]
|
||||||
if item == flower_node then
|
if item == flower_node then
|
||||||
minetest.swap_node(pos, {name="mcl_flowerpots:flower_pot_"..flower})
|
minetest.swap_node(pos, {name="mcl_flowerpots:flower_pot_"..flower})
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -76,7 +76,7 @@ minetest.register_node("mcl_flowerpots:flower_pot", {
|
||||||
local flower_node = row[2]
|
local flower_node = row[2]
|
||||||
if item == flower_node then
|
if item == flower_node then
|
||||||
minetest.swap_node(pos, {name="mcl_flowerpots:flower_pot_"..flower})
|
minetest.swap_node(pos, {name="mcl_flowerpots:flower_pot_"..flower})
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -264,7 +264,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
|
||||||
minetest.sound_play(minetest.registered_nodes[itemstring].sounds.place, {pos = bottom, gain=1}, true)
|
minetest.sound_play(minetest.registered_nodes[itemstring].sounds.place, {pos = bottom, gain=1}, true)
|
||||||
minetest.set_node(bottom, {name=itemstring, param2=param2})
|
minetest.set_node(bottom, {name=itemstring, param2=param2})
|
||||||
minetest.set_node(top, {name=itemstring.."_top", param2=param2})
|
minetest.set_node(top, {name=itemstring.."_top", param2=param2})
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -419,7 +419,7 @@ minetest.register_node("mcl_flowers:waterlily", {
|
||||||
minetest.sound_play(idef.sounds.place, {pos=pointed_thing.above, gain=1}, true)
|
minetest.sound_play(idef.sounds.place, {pos=pointed_thing.above, gain=1}, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(player_name) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -88,7 +88,7 @@ local update_item_entity = function(pos, node, param2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local drop_item = function(pos, node, meta)
|
local drop_item = function(pos, node, meta)
|
||||||
if node.name == "mcl_itemframes:item_frame" and not minetest.settings:get_bool("creative_mode") then
|
if node.name == "mcl_itemframes:item_frame" and not minetest.is_creative_enabled("") then
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local item = inv:get_stack("main", 1)
|
local item = inv:get_stack("main", 1)
|
||||||
if not item:is_empty() then
|
if not item:is_empty() then
|
||||||
|
@ -151,7 +151,7 @@ minetest.register_node("mcl_itemframes:item_frame",{
|
||||||
meta:set_string("infotext", iname)
|
meta:set_string("infotext", iname)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -42,7 +42,7 @@ end
|
||||||
|
|
||||||
-- Checks if player is still allowed to display the minimap
|
-- Checks if player is still allowed to display the minimap
|
||||||
local function update_minimap(player)
|
local function update_minimap(player)
|
||||||
local creative = minetest.settings:get_bool("creative_mode")
|
local creative = minetest.is_creative_enabled(player:get_player_name())
|
||||||
if creative then
|
if creative then
|
||||||
player:hud_set_flags({minimap=true, minimap_radar = true})
|
player:hud_set_flags({minimap=true, minimap_radar = true})
|
||||||
else
|
else
|
||||||
|
@ -94,7 +94,7 @@ minetest.register_on_joinplayer(function(player)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local updatetimer = 0
|
local updatetimer = 0
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled("") then
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
updatetimer = updatetimer + dtime
|
updatetimer = updatetimer + dtime
|
||||||
if updatetimer > 0.1 then
|
if updatetimer > 0.1 then
|
||||||
|
|
|
@ -139,7 +139,7 @@ minetest.register_craftitem("mcl_mobitems:cooked_rabbit", {
|
||||||
local drink_milk = function(itemstack, player, pointed_thing)
|
local drink_milk = function(itemstack, player, pointed_thing)
|
||||||
local bucket = minetest.do_item_eat(0, "mcl_buckets:bucket_empty", itemstack, player, pointed_thing)
|
local bucket = minetest.do_item_eat(0, "mcl_buckets:bucket_empty", itemstack, player, pointed_thing)
|
||||||
-- Check if we were allowed to drink this (eat delay check)
|
-- Check if we were allowed to drink this (eat delay check)
|
||||||
if mcl_hunger.active and (bucket:get_name() ~= "mcl_mobitems:milk_bucket" or minetest.settings:get_bool("creative_mode") == true) then
|
if mcl_hunger.active and (bucket:get_name() ~= "mcl_mobitems:milk_bucket" or minetest.is_creative_enabled(player:get_player_name())) then
|
||||||
mcl_hunger.stop_poison(player)
|
mcl_hunger.stop_poison(player)
|
||||||
end
|
end
|
||||||
mcl_potions._reset_player_effects(player)
|
mcl_potions._reset_player_effects(player)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
local S = minetest.get_translator("mcl_monster_eggs")
|
local S = minetest.get_translator("mcl_monster_eggs")
|
||||||
|
|
||||||
local spawn_silverfish = function(pos, oldnode, oldmetadata, digger)
|
local spawn_silverfish = function(pos, oldnode, oldmetadata, digger)
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled("") then
|
||||||
minetest.add_entity(pos, "mobs_mc:silverfish")
|
minetest.add_entity(pos, "mobs_mc:silverfish")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -128,7 +128,7 @@ minetest.register_craftitem("mcl_nether:nether_wart_item", {
|
||||||
minetest.sound_play({name="default_place_node", gain=1.0}, {pos=placepos}, true)
|
minetest.sound_play({name="default_place_node", gain=1.0}, {pos=placepos}, true)
|
||||||
minetest.set_node(placepos, {name="mcl_nether:nether_wart_0", param2 = 3})
|
minetest.set_node(placepos, {name="mcl_nether:nether_wart_0", param2 = 3})
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -61,7 +61,7 @@ local function coral_on_place(itemstack, placer, pointed_thing)
|
||||||
if def_node.sounds then
|
if def_node.sounds then
|
||||||
minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }, true)
|
minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }, true)
|
||||||
end
|
end
|
||||||
if not (minetest.settings:get_bool("creative_mode")) then
|
if not minetest.is_creative_enabled(player_name) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ local function kelp_on_place(itemstack, placer, pointed_thing)
|
||||||
minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }, true)
|
minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }, true)
|
||||||
end
|
end
|
||||||
minetest.set_node(pos_under, node_under)
|
minetest.set_node(pos_under, node_under)
|
||||||
if not (minetest.settings:get_bool("creative_mode")) then
|
if not minetest.is_creative_enabled(player_name) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ local function sea_pickle_on_place(itemstack, placer, pointed_thing)
|
||||||
else
|
else
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
if not (minetest.settings:get_bool("creative_mode")) then
|
if not minetest.is_creative_enabled(player_name) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -70,7 +70,7 @@ local function seagrass_on_place(itemstack, placer, pointed_thing)
|
||||||
minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }, true)
|
minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }, true)
|
||||||
end
|
end
|
||||||
minetest.set_node(pos_under, node_under)
|
minetest.set_node(pos_under, node_under)
|
||||||
if not (minetest.settings:get_bool("creative_mode")) then
|
if not minetest.is_creative_enabled(player_name) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -405,7 +405,7 @@ minetest.override_item("mcl_end:ender_eye", {
|
||||||
minetest.sound_play(
|
minetest.sound_play(
|
||||||
"default_place_node_hard",
|
"default_place_node_hard",
|
||||||
{pos = pointed_thing.under, gain = 0.5, max_hear_distance = 16}, true)
|
{pos = pointed_thing.under, gain = 0.5, max_hear_distance = 16}, true)
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
itemstack:take_item() -- 1 use
|
itemstack:take_item() -- 1 use
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if get_water then
|
if get_water then
|
||||||
local creative = minetest.settings:get_bool("creative_mode") == true
|
local creative = minetest.is_creative_enabled(placer:get_player_name())
|
||||||
if from_liquid_source or creative then
|
if from_liquid_source or creative then
|
||||||
-- Replace with water bottle, if possible, otherwise
|
-- Replace with water bottle, if possible, otherwise
|
||||||
-- place the water potion at a place where's space
|
-- place the water potion at a place where's space
|
||||||
|
@ -210,7 +210,7 @@ minetest.register_craftitem("mcl_potions:water", {
|
||||||
-- Increase water level of cauldron by 1
|
-- Increase water level of cauldron by 1
|
||||||
minetest.set_node(pointed_thing.under, {name=cauldron})
|
minetest.set_node(pointed_thing.under, {name=cauldron})
|
||||||
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
|
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
|
||||||
if minetest.settings:get_bool("creative_mode") == true then
|
if minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
return itemstack
|
return itemstack
|
||||||
else
|
else
|
||||||
return "mcl_potions:glass_bottle"
|
return "mcl_potions:glass_bottle"
|
||||||
|
@ -256,7 +256,7 @@ minetest.register_craftitem("mcl_potions:river_water", {
|
||||||
-- Increase water level of cauldron by 1
|
-- Increase water level of cauldron by 1
|
||||||
minetest.set_node(pointed_thing.under, {name=cauldron})
|
minetest.set_node(pointed_thing.under, {name=cauldron})
|
||||||
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
|
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
|
||||||
if minetest.settings:get_bool("creative_mode") == true then
|
if minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
return itemstack
|
return itemstack
|
||||||
else
|
else
|
||||||
return "mcl_potions:glass_bottle"
|
return "mcl_potions:glass_bottle"
|
||||||
|
|
|
@ -81,7 +81,7 @@ local function register_lingering(name, descr, color, def)
|
||||||
local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
|
local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
|
||||||
obj:setvelocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
|
obj:setvelocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
|
||||||
obj:setacceleration({x=0, y=-9.8, z=0})
|
obj:setacceleration({x=0, y=-9.8, z=0})
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
end
|
end
|
||||||
return item
|
return item
|
||||||
|
|
|
@ -23,7 +23,7 @@ local function register_splash(name, descr, color, def)
|
||||||
local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
|
local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
|
||||||
obj:set_velocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
|
obj:set_velocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
|
||||||
obj:set_acceleration({x=0, y=-9.8, z=0})
|
obj:set_acceleration({x=0, y=-9.8, z=0})
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
end
|
end
|
||||||
return item
|
return item
|
||||||
|
|
|
@ -362,7 +362,7 @@ minetest.register_node("mcl_signs:wall_sign", {
|
||||||
if not success then
|
if not success then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
sign_info = signtext_info_standing[rotation_level + 1]
|
sign_info = signtext_info_standing[rotation_level + 1]
|
||||||
|
|
|
@ -82,7 +82,7 @@ minetest.register_node("mcl_sponges:sponge", {
|
||||||
local absorbed, wet_sponge = absorb(pos)
|
local absorbed, wet_sponge = absorb(pos)
|
||||||
if absorbed then
|
if absorbed then
|
||||||
minetest.item_place_node(ItemStack(wet_sponge), placer, pointed_thing)
|
minetest.item_place_node(ItemStack(wet_sponge), placer, pointed_thing)
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -229,7 +229,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local under = minetest.get_node(pointed_thing.under)
|
local under = minetest.get_node(pointed_thing.under)
|
||||||
local wield_item = itemstack:get_name()
|
local wield_item = itemstack:get_name()
|
||||||
local creative_enabled = minetest.settings:get_bool("creative_mode")
|
local creative_enabled = minetest.is_creative_enabled(placer:get_player_name())
|
||||||
|
|
||||||
-- place slab using under node orientation
|
-- place slab using under node orientation
|
||||||
local dir = vector.subtract(pointed_thing.above, pointed_thing.under)
|
local dir = vector.subtract(pointed_thing.above, pointed_thing.under)
|
||||||
|
|
|
@ -48,7 +48,7 @@ local player_throw_function = function(entity_name, velocity)
|
||||||
local playerpos = player:get_pos()
|
local playerpos = player:get_pos()
|
||||||
local dir = player:get_look_dir()
|
local dir = player:get_look_dir()
|
||||||
local obj = mcl_throwing.throw(item, {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, velocity, player:get_player_name())
|
local obj = mcl_throwing.throw(item, {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, velocity, player:get_player_name())
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
end
|
end
|
||||||
return item
|
return item
|
||||||
|
|
|
@ -26,7 +26,7 @@ dig_speed_class group:
|
||||||
|
|
||||||
-- The hand
|
-- The hand
|
||||||
local groupcaps, hand_range, hand_groups
|
local groupcaps, hand_range, hand_groups
|
||||||
if minetest.settings:get_bool("creative_mode") then
|
if minetest.is_creative_enabled("") then
|
||||||
-- Instant breaking in creative mode
|
-- Instant breaking in creative mode
|
||||||
groupcaps = {
|
groupcaps = {
|
||||||
creative_breakable = {times={[1]=0}, uses=0},
|
creative_breakable = {times={[1]=0}, uses=0},
|
||||||
|
@ -213,7 +213,7 @@ local make_grass_path = function(itemstack, placer, pointed_thing)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
-- Add wear, as if digging a level 0 shovely node
|
-- Add wear, as if digging a level 0 shovely node
|
||||||
local toolname = itemstack:get_name()
|
local toolname = itemstack:get_name()
|
||||||
local def = minetest.registered_items[toolname]
|
local def = minetest.registered_items[toolname]
|
||||||
|
@ -247,7 +247,7 @@ if minetest.get_modpath("mcl_farming") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if node.name == "mcl_farming:pumpkin" then
|
if node.name == "mcl_farming:pumpkin" then
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
-- Add wear (as if digging a shearsy node)
|
-- Add wear (as if digging a shearsy node)
|
||||||
local toolname = itemstack:get_name()
|
local toolname = itemstack:get_name()
|
||||||
local def = minetest.registered_items[toolname]
|
local def = minetest.registered_items[toolname]
|
||||||
|
|
|
@ -160,7 +160,7 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
|
||||||
minetest.check_for_falling(pos)
|
minetest.check_for_falling(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (minetest.settings:get_bool("creative_mode")) then
|
if not (minetest.is_creative_enabled(user:get_player_name())) then
|
||||||
itemstack:add_wear(65535 / ((uses or 200) - 1))
|
itemstack:add_wear(65535 / ((uses or 200) - 1))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ minetest.do_item_eat = function(hp_change, replace_with_item, itemstack, user, p
|
||||||
|
|
||||||
local name = user:get_player_name()
|
local name = user:get_player_name()
|
||||||
|
|
||||||
local creative = minetest.settings:get_bool("creative_mode") == true
|
local creative = minetest.is_creative_enabled(name)
|
||||||
|
|
||||||
-- Special foodstuffs like the cake may disable the eating delay
|
-- Special foodstuffs like the cake may disable the eating delay
|
||||||
local no_eat_delay = creative or (minetest.get_item_group(itemstack:get_name(), "no_eat_delay") == 1)
|
local no_eat_delay = creative or (minetest.get_item_group(itemstack:get_name(), "no_eat_delay") == 1)
|
||||||
|
@ -130,7 +130,7 @@ local poisonrandomizer = PseudoRandom(os.time())
|
||||||
function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poison, exhaust, poisonchance, sound)
|
function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poison, exhaust, poisonchance, sound)
|
||||||
return function(itemstack, user, pointed_thing)
|
return function(itemstack, user, pointed_thing)
|
||||||
local itemname = itemstack:get_name()
|
local itemname = itemstack:get_name()
|
||||||
local creative = minetest.settings:get_bool("creative_mode") == true
|
local creative = minetest.is_creative_enabled(user:get_player_name())
|
||||||
if itemstack:peek_item() ~= nil and user ~= nil then
|
if itemstack:peek_item() ~= nil and user ~= nil then
|
||||||
if not creative then
|
if not creative then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
|
|
Loading…
Reference in New Issue