Merge pull request #81 from DS-Minetest/patch-1

make variables x5 and z5 local
This commit is contained in:
D00Med 2017-04-21 18:59:10 +10:00 committed by GitHub
commit 1505d2ebc9

View File

@ -1,16 +1,7 @@
local MINE_DEEP_MIN = tonumber(minetest.setting_get("mines_deep_min")) local MINE_DEEP_MIN = tonumber(minetest.setting_get("mines_deep_min")) or -64
local MINE_DEEP_MAX = tonumber(minetest.setting_get("mines_deep_max")) local MINE_DEEP_MAX = tonumber(minetest.setting_get("mines_deep_max")) or -380
local MINE_FACTOR = tonumber(minetest.setting_get("mines_spawnfactor")) local MINE_FACTOR = tonumber(minetest.setting_get("mines_spawnfactor")) or 1.5
if not MINE_DEEP_MIN then
MINE_DEEP_MIN = -64
end
if not MINE_DEEP_MAX then
MINE_DEEP_MAX = -380
end
if not MINE_FACTOR then
MINE_FACTOR = 1.5
end
minetest.register_node("mines:dummy", { minetest.register_node("mines:dummy", {
description = "Air (you hacker you!)", description = "Air (you hacker you!)",
@ -25,7 +16,7 @@ minetest.register_node("mines:dummy", {
buildable_to = true, buildable_to = true,
air_equivalent = true, air_equivalent = true,
drop = "", drop = "",
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory = 1},
}) })
@ -69,7 +60,7 @@ local function fill_chest(pos)
--meta:set_string("infotext", "Chest") --meta:set_string("infotext", "Chest")
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("main", 8*4) inv:set_size("main", 8*4)
for i=0,2,1 do for i = 0, 2, 1 do
local stuff = chest_stuff[math.random(1,#chest_stuff)] local stuff = chest_stuff[math.random(1,#chest_stuff)]
local stack = {name=stuff.name, count = math.random(1,stuff.max)} local stack = {name=stuff.name, count = math.random(1,stuff.max)}
if not inv:contains_item("main", stack) then if not inv:contains_item("main", stack) then
@ -81,7 +72,7 @@ local function fill_chest(pos)
end) end)
end end
local function check_dir(dir,old_dir) local function check_dir(dir, old_dir)
if old_dir == 1 and dir == 3 then if old_dir == 1 and dir == 3 then
--n_switch = 2 --n_switch = 2
return true return true
@ -97,13 +88,13 @@ local function check_dir(dir,old_dir)
end end
return false return false
end end
local function make_mine(mpos,p2,p3, vm_data, vx_area,cnt) local function make_mine(mpos, p2, p3, vm_data, vx_area,cnt)
local pos = {x=mpos.x,y=mpos.y,z=mpos.z} local pos = {x = mpos.x, y = mpos.y, z = mpos.z}
for j=0,12,1 do for j = 0, 12, 1 do
local switch = cnt+1 local switch = cnt+1
n_switch = math.random(1,4) n_switch = math.random(1, 4)
while check_dir(n_switch,switch) == true do while check_dir(n_switch, switch) == true do
n_switch = math.random(1,4) n_switch = math.random(1, 4)
end end
switch = n_switch switch = n_switch
@ -118,10 +109,12 @@ local function make_mine(mpos,p2,p3, vm_data, vx_area,cnt)
local x2 local x2
local x3 local x3
local x4 local x4
local x5
local z1 local z1
local z2 local z2
local z3 local z3
local z4 local z4
local z5
if switch == 1 then if switch == 1 then
x1 = pos.x+1 x1 = pos.x+1
x2 = pos.x x2 = pos.x