Extra error checking: global variables

This commit is contained in:
Duane 2016-07-15 04:18:54 -05:00
parent bf26b8bee1
commit 1648bc459f
17 changed files with 362 additions and 323 deletions

View file

@ -90,7 +90,7 @@ mobs:register_mob("fun_caves:ice_demon", {
animation_speed = 30,
fly_in = 'fun_caves:freezing_vapor',
do_custom = function(self)
if not self then
if not (self and fun_caves.surface_damage and fun_caves.search_replace and fun_caves.custom_ready) then
return
end
@ -114,8 +114,10 @@ mobs:register_mob("fun_caves:ice_demon", {
end,
})
mobs:spawn_specific("fun_caves:ice_demon", {"default:ice"}, nil, -1, 10, 300, 3000, 2, fun_caves.underzones['Caina'].lower_bound, fun_caves.underzones['Caina'].upper_bound)
mobs:spawn_specific("fun_caves:ice_demon", {"default:ice"}, {'default:torch'}, -1, 20, 100, 300, 2, fun_caves.underzones['Caina'].lower_bound, fun_caves.underzones['Caina'].upper_bound)
if fun_caves.underzones then
mobs:spawn_specific("fun_caves:ice_demon", {"default:ice"}, nil, -1, 10, 300, 3000, 2, fun_caves.underzones['Caina'].lower_bound, fun_caves.underzones['Caina'].upper_bound)
mobs:spawn_specific("fun_caves:ice_demon", {"default:ice"}, {'default:torch'}, -1, 20, 100, 300, 2, fun_caves.underzones['Caina'].lower_bound, fun_caves.underzones['Caina'].upper_bound)
end
-- Blizzard Demon -- storm that slows players
@ -171,7 +173,7 @@ local snow_demon = {
},
animation_speed = 30,
do_custom = function(self)
if not self then
if not (self and fun_caves.set_status and fun_caves.custom_ready and fun_caves.surface_damage) then
return
end
@ -194,23 +196,25 @@ local snow_demon = {
end,
}
fun_caves.register_status({
name = 'slow_cold',
start = function(player)
if not player then
return
end
if fun_caves.register_status then
fun_caves.register_status({
name = 'slow_cold',
start = function(player)
if not player then
return
end
player:set_physics_override({speed=0.3})
end,
terminate = function(player)
if not player then
return
end
player:set_physics_override({speed=0.3})
end,
terminate = function(player)
if not player then
return
end
player:set_physics_override({speed=1})
end,
})
player:set_physics_override({speed=1})
end,
})
end
if minetest.registered_entities["mobs_yeti:yeti"] then
snow_demon.arrow = "mobs_yeti:snowball"
@ -221,7 +225,9 @@ end
mobs:register_mob("fun_caves:snow_demon", snow_demon)
mobs:spawn_specific("fun_caves:snow_demon", {"default:ice"}, nil, -1, 10, 300, 3000, 2, fun_caves.underzones['Caina'].lower_bound, fun_caves.underzones['Caina'].upper_bound)
if fun_caves.underzones then
mobs:spawn_specific("fun_caves:snow_demon", {"default:ice"}, nil, -1, 10, 300, 3000, 2, fun_caves.underzones['Caina'].lower_bound, fun_caves.underzones['Caina'].upper_bound)
end
-- Magma Demon -- creates lava under player (!)