1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-23 07:10:19 +01:00

Stop shadowing upvalues and definitions.

This commit is contained in:
Tim 2016-06-26 14:46:15 +02:00 committed by paramat
parent 4473627de0
commit 30b0a155fb
5 changed files with 24 additions and 23 deletions

View File

@ -59,8 +59,8 @@ function beds.register_bed(name, def)
return itemstack return itemstack
end end
local def = minetest.registered_nodes[minetest.get_node(pos).name] local node_def = minetest.registered_nodes[minetest.get_node(pos).name]
if not def or not def.buildable_to then if not node_def or not node_def.buildable_to then
return itemstack return itemstack
end end
@ -113,8 +113,8 @@ function beds.register_bed(name, def)
end end
local newp = vector.add(pos, minetest.facedir_to_dir(new_param2)) local newp = vector.add(pos, minetest.facedir_to_dir(new_param2))
local node3 = minetest.get_node_or_nil(newp) local node3 = minetest.get_node_or_nil(newp)
local def = node3 and minetest.registered_nodes[node3.name] local node_def = node3 and minetest.registered_nodes[node3.name]
if not def or not def.buildable_to then if not node_def or not node_def.buildable_to then
return false return false
end end
if minetest.is_protected(newp, user:get_player_name()) then if minetest.is_protected(newp, user:get_player_name()) then

View File

@ -5,15 +5,16 @@ local player_inventory = {}
local creative_mode = minetest.setting_getbool("creative_mode") local creative_mode = minetest.setting_getbool("creative_mode")
-- Create detached creative inventory after loading all mods -- Create detached creative inventory after loading all mods
creative.init_creative_inventory = function(player) creative.init_creative_inventory = function(owner)
local player_name = player:get_player_name() local owner_name = owner:get_player_name()
player_inventory[player_name] = {} player_inventory[owner_name] = {
player_inventory[player_name].size = 0 size = 0,
player_inventory[player_name].filter = "" filter = "",
player_inventory[player_name].start_i = 1 start_i = 1,
player_inventory[player_name].tab_id = 2 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) allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if creative_mode and not to_list == "main" then if creative_mode and not to_list == "main" then
return count return count
@ -45,7 +46,7 @@ creative.init_creative_inventory = function(player)
end, end,
}) })
creative.update_creative_inventory(player_name) creative.update_creative_inventory(owner_name)
--print("creative inventory size: " .. player_inventory[player_name].size) --print("creative inventory size: " .. player_inventory[player_name].size)
end end

View File

@ -344,11 +344,11 @@ function doors.register(name, def)
return true return true
end end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local name local owner_name
if digger then if digger then
name = digger:get_player_name() owner_name = digger:get_player_name()
end end
return meta:get_string("doors_owner") == name return meta:get_string("doors_owner") == owner_name
end end
if not def.sounds then if not def.sounds then

View File

@ -284,8 +284,8 @@ else
local p = minetest.find_node_near(p0, 1, {"group:flammable"}) local p = minetest.find_node_near(p0, 1, {"group:flammable"})
if p then if p then
-- remove flammable nodes around flame -- remove flammable nodes around flame
local node = minetest.get_node(p) local flammable_node = minetest.get_node(p)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[flammable_node.name]
if def.on_burn then if def.on_burn then
def.on_burn(p) def.on_burn(p)
else else

View File

@ -12,7 +12,7 @@ local loss_prob = {}
loss_prob["default:cobble"] = 3 loss_prob["default:cobble"] = 3
loss_prob["default:dirt"] = 4 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 -- Fill a list with data for content IDs, after all nodes are registered
local cid_data = {} local cid_data = {}
@ -345,10 +345,10 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
end end
end end
for _, data in ipairs(on_blast_queue) do for _, queued_data in ipairs(on_blast_queue) do
local dist = math.max(1, vector.distance(data.pos, pos)) local dist = math.max(1, vector.distance(queued_data.pos, pos))
local intensity = (radius * radius) / (dist * dist) 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 if node_drops then
for _, item in ipairs(node_drops) do for _, item in ipairs(node_drops) do
add_drop(drops, item) add_drop(drops, item)
@ -589,5 +589,5 @@ end
tnt.register_tnt({ tnt.register_tnt({
name = "tnt:tnt", name = "tnt:tnt",
description = "TNT", description = "TNT",
radius = radius, radius = tnt_radius,
}) })