mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-05 15:23:51 +01:00
Stop shadowing upvalues and definitions.
This commit is contained in:
parent
4473627de0
commit
30b0a155fb
@ -59,8 +59,8 @@ function beds.register_bed(name, def)
|
||||
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
|
||||
|
||||
@ -113,8 +113,8 @@ function beds.register_bed(name, def)
|
||||
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
|
||||
|
@ -5,15 +5,16 @@ local player_inventory = {}
|
||||
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
|
||||
@ -45,7 +46,7 @@ creative.init_creative_inventory = function(player)
|
||||
end,
|
||||
})
|
||||
|
||||
creative.update_creative_inventory(player_name)
|
||||
creative.update_creative_inventory(owner_name)
|
||||
--print("creative inventory size: " .. player_inventory[player_name].size)
|
||||
end
|
||||
|
||||
|
@ -344,11 +344,11 @@ function doors.register(name, def)
|
||||
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
|
||||
|
@ -284,8 +284,8 @@ else
|
||||
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
|
||||
|
@ -12,7 +12,7 @@ local loss_prob = {}
|
||||
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 = {}
|
||||
@ -345,10 +345,10 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
||||
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)
|
||||
@ -589,5 +589,5 @@ end
|
||||
tnt.register_tnt({
|
||||
name = "tnt:tnt",
|
||||
description = "TNT",
|
||||
radius = radius,
|
||||
radius = tnt_radius,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user