return itemstack
end
- local def = minetest.registered_nodes[minetest.get_node(pos).name]
- if not def or not def.buildable_to then
+ local node_def = minetest.registered_nodes[minetest.get_node(pos).name]
+ if not node_def or not node_def.buildable_to then
return itemstack
end
end
local newp = vector.add(pos, minetest.facedir_to_dir(new_param2))
local node3 = minetest.get_node_or_nil(newp)
- local def = node3 and minetest.registered_nodes[node3.name]
- if not def or not def.buildable_to then
+ local node_def = node3 and minetest.registered_nodes[node3.name]
+ if not node_def or not node_def.buildable_to then
return false
end
if minetest.is_protected(newp, user:get_player_name()) then
local creative_mode = minetest.setting_getbool("creative_mode")
-- Create detached creative inventory after loading all mods
-creative.init_creative_inventory = function(player)
- local player_name = player:get_player_name()
- player_inventory[player_name] = {}
- player_inventory[player_name].size = 0
- player_inventory[player_name].filter = ""
- player_inventory[player_name].start_i = 1
- player_inventory[player_name].tab_id = 2
+creative.init_creative_inventory = function(owner)
+ local owner_name = owner:get_player_name()
+ player_inventory[owner_name] = {
+ size = 0,
+ filter = "",
+ start_i = 1,
+ tab_id = 2,
+ }
- minetest.create_detached_inventory("creative_" .. player_name, {
+ minetest.create_detached_inventory("creative_" .. owner_name, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if creative_mode and not to_list == "main" then
return count
end,
})
- creative.update_creative_inventory(player_name)
+ creative.update_creative_inventory(owner_name)
--print("creative inventory size: " .. player_inventory[player_name].size)
end
return true
end
local meta = minetest.get_meta(pos)
- local name
+ local owner_name
if digger then
- name = digger:get_player_name()
+ owner_name = digger:get_player_name()
end
- return meta:get_string("doors_owner") == name
+ return meta:get_string("doors_owner") == owner_name
end
if not def.sounds then
local p = minetest.find_node_near(p0, 1, {"group:flammable"})
if p then
-- remove flammable nodes around flame
- local node = minetest.get_node(p)
- local def = minetest.registered_nodes[node.name]
+ local flammable_node = minetest.get_node(p)
+ local def = minetest.registered_nodes[flammable_node.name]
if def.on_burn then
def.on_burn(p)
else
loss_prob["default:cobble"] = 3
loss_prob["default:dirt"] = 4
-local radius = tonumber(minetest.setting_get("tnt_radius") or 3)
+local tnt_radius = tonumber(minetest.setting_get("tnt_radius") or 3)
-- Fill a list with data for content IDs, after all nodes are registered
local cid_data = {}
end
end
- for _, data in ipairs(on_blast_queue) do
- local dist = math.max(1, vector.distance(data.pos, pos))
+ for _, queued_data in ipairs(on_blast_queue) do
+ local dist = math.max(1, vector.distance(queued_data.pos, pos))
local intensity = (radius * radius) / (dist * dist)
- local node_drops = data.on_blast(data.pos, intensity)
+ local node_drops = queued_data.on_blast(queued_data.pos, intensity)
if node_drops then
for _, item in ipairs(node_drops) do
add_drop(drops, item)
tnt.register_tnt({
name = "tnt:tnt",
description = "TNT",
- radius = radius,
+ radius = tnt_radius,
})