Extra error checking: global variables
This commit is contained in:
parent
bf26b8bee1
commit
1648bc459f
17 changed files with 362 additions and 323 deletions
|
@ -1,7 +1,7 @@
|
|||
local max_depth = 31000
|
||||
|
||||
local function teleporter(user, area, power)
|
||||
if not (user and area and power and type(power) == 'number') then
|
||||
if not (user and area and power and type(power) == 'number' and fun_caves.world and fun_caves.db and fun_caves.db.teleport_data and fun_caves.underzones and fun_caves.is_fortress and fun_caves.cave_noise_1 and fun_caves.cave_noise_2 and fun_caves.cave_width) then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -323,7 +323,7 @@ minetest.register_craft({
|
|||
|
||||
|
||||
local function translocate(pos, node, clicker, itemstack, pointed_thing)
|
||||
if not (pos and clicker) then
|
||||
if not (pos and clicker and fun_caves.db.translocators) then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -394,7 +394,7 @@ local function trans_use(itemstack, user, pointed_thing)
|
|||
end
|
||||
|
||||
local function trans_place(itemstack, placer, pointed_thing)
|
||||
if not (itemstack and placer and pointed_thing) then
|
||||
if not (itemstack and placer and pointed_thing and fun_caves.db.translocators) then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -431,7 +431,7 @@ local function trans_place(itemstack, placer, pointed_thing)
|
|||
end
|
||||
|
||||
local function trans_dig(pos, node, digger)
|
||||
if not (pos and node and digger) then
|
||||
if not (pos and node and digger and fun_caves.db.translocators) then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -485,7 +485,7 @@ local function trans_dig(pos, node, digger)
|
|||
end
|
||||
|
||||
local function trans_dest(pos)
|
||||
if not pos then
|
||||
if not (pos and fun_caves.db.translocators) then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -560,7 +560,7 @@ for _, gem in pairs(gems) do
|
|||
end
|
||||
|
||||
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
|
||||
if not (itemstack and player and itemstack:get_name() == "fun_caves:translocator") then
|
||||
if not (itemstack and player and fun_caves.db.translocators and itemstack:get_name() == "fun_caves:translocator") then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue