234 lines
5.4 KiB
Lua
234 lines
5.4 KiB
Lua
|
|
-- Ice Demon -- creates and moves ice nodes
|
|
|
|
minetest.register_node("fun_caves:freezing_vapor", {
|
|
description = "Freezing Vapor",
|
|
tiles = {'fun_caves_wisp.png'},
|
|
sunlight_propagates = true,
|
|
use_texture_alpha = true,
|
|
drawtype = "glasslike",
|
|
paramtype = 'light',
|
|
walkable = false,
|
|
buildable_to = true,
|
|
pointable = false,
|
|
})
|
|
|
|
local function snow_effect(pos, radius)
|
|
if not (pos and radius and type(radius) == 'number') then
|
|
return
|
|
end
|
|
|
|
minetest.add_particlespawner({
|
|
amount = 30,
|
|
time = 1,
|
|
minpos = vector.subtract(pos, radius / 2),
|
|
maxpos = vector.add(pos, radius / 2),
|
|
minvel = {x=-10, y=-10, z=-10},
|
|
maxvel = {x=10, y=10, z=10},
|
|
minacc = vector.new(),
|
|
maxacc = vector.new(),
|
|
minexptime = 1,
|
|
maxexptime = 3,
|
|
minsize = 16,
|
|
maxsize = 32,
|
|
texture = "fun_caves_snowflakes.png",
|
|
})
|
|
end
|
|
|
|
|
|
mobs:register_mob("fun_caves:ice_demon", {
|
|
description = "Ice Demon",
|
|
type = "monster",
|
|
passive = false,
|
|
damage = 3,
|
|
attack_type = "dogfight",
|
|
attacks_monsters = true,
|
|
hp_min = 10,
|
|
hp_max = 20,
|
|
armor = 50,
|
|
collisionbox = {-0.30,-1.0,-0.30, 0.30,0.8,0.30},
|
|
visual = "mesh",
|
|
mesh = "character.b3d",
|
|
drawtype = "front",
|
|
textures = {
|
|
{"default_ice.png"},
|
|
},
|
|
makes_footstep_sound = true,
|
|
--sounds = {
|
|
-- random = "goblins_goblin_ambient",
|
|
-- warcry = "goblins_goblin_attack",
|
|
-- attack = "goblins_goblin_attack",
|
|
-- damage = "goblins_goblin_damage",
|
|
-- death = "goblins_goblin_death",
|
|
-- distance = 15,
|
|
--},
|
|
walk_velocity = 2,
|
|
run_velocity = 3,
|
|
jump = true,
|
|
drops = {
|
|
{name = "default:ice", chance = 3, min = 1, max = 3},
|
|
{name = "fun_caves:eternal_ice_crystal", chance = 10, min = 1, max = 1},
|
|
},
|
|
water_damage = 0,
|
|
lava_damage = 4,
|
|
light_damage = 2,
|
|
view_range = 15,
|
|
animation = {
|
|
stand_start = 0,
|
|
stand_end = 79,
|
|
sit_start = 81,
|
|
sit_end = 160,
|
|
sleep_start = 162,
|
|
sleep_end = 166,
|
|
walk_start = 168,
|
|
walk_end = 187,
|
|
mine_start = 189,
|
|
mine_end = 198,
|
|
walkmine_start = 200,
|
|
walkmine_end = 219,
|
|
},
|
|
animation_speed = 30,
|
|
fly_in = 'fun_caves:freezing_vapor',
|
|
do_custom = function(self)
|
|
if not (self and fun_caves.surface_damage and fun_caves.search_replace and fun_caves.custom_ready) then
|
|
return
|
|
end
|
|
|
|
-- This has to happen fast.
|
|
if self.attack then
|
|
self.fly = true
|
|
local pos = self.attack:getpos()
|
|
pos.y = pos.y - 0
|
|
fun_caves.search_replace(pos, 1, {'default:ice', 'air'}, 'fun_caves:freezing_vapor')
|
|
end
|
|
|
|
if not fun_caves.custom_ready(self) then
|
|
return
|
|
end
|
|
|
|
if not self.attack then
|
|
self.fly = false
|
|
end
|
|
|
|
fun_caves.surface_damage(self, true)
|
|
end,
|
|
})
|
|
|
|
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
|
|
|
|
local snow_demon = {
|
|
description = "Ice Demon",
|
|
type = "monster",
|
|
passive = false,
|
|
damage = 3,
|
|
-- change to dogshoot?
|
|
attack_type = "dogfight",
|
|
attacks_monsters = true,
|
|
hp_min = 10,
|
|
hp_max = 20,
|
|
armor = 50,
|
|
collisionbox = {-0.30,-1.0,-0.30, 0.30,0.8,0.30},
|
|
visual = "mesh",
|
|
mesh = "character.b3d",
|
|
drawtype = "front",
|
|
textures = {
|
|
{"default_snow.png"},
|
|
},
|
|
makes_footstep_sound = true,
|
|
sounds = {
|
|
random = "wind_howl_2",
|
|
warcry = "wind_howl_2",
|
|
distance = 25,
|
|
},
|
|
walk_velocity = 2,
|
|
run_velocity = 3,
|
|
jump = true,
|
|
drops = {
|
|
{name = "default:snow", chance = 3, min = 1, max = 3},
|
|
{name = "fun_caves:eternal_ice_crystal", chance = 10, min = 1, max = 1},
|
|
},
|
|
water_damage = 0,
|
|
lava_damage = 4,
|
|
light_damage = 2,
|
|
view_range = 15,
|
|
animation = {
|
|
stand_start = 0,
|
|
stand_end = 79,
|
|
sit_start = 81,
|
|
sit_end = 160,
|
|
sleep_start = 162,
|
|
sleep_end = 166,
|
|
walk_start = 168,
|
|
walk_end = 187,
|
|
mine_start = 189,
|
|
mine_end = 198,
|
|
walkmine_start = 200,
|
|
walkmine_end = 219,
|
|
},
|
|
animation_speed = 30,
|
|
do_custom = function(self)
|
|
if not (self and fun_caves.set_status and fun_caves.custom_ready and fun_caves.surface_damage) then
|
|
return
|
|
end
|
|
|
|
if not self.attack then
|
|
self.fly = false
|
|
end
|
|
|
|
local pos = self.object:getpos()
|
|
snow_effect(pos, 20)
|
|
|
|
if self.attack then
|
|
fun_caves.set_status(self.attack:get_player_name(), 'slow_cold', 20)
|
|
end
|
|
|
|
if not fun_caves.custom_ready(self) then
|
|
return
|
|
end
|
|
|
|
fun_caves.surface_damage(self, true)
|
|
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=1})
|
|
end,
|
|
})
|
|
end
|
|
|
|
if minetest.registered_entities["mobs_yeti:yeti"] then
|
|
snow_demon.arrow = "mobs_yeti:snowball"
|
|
snow_demon.attack_type = 'dogshoot'
|
|
snow_demon.shoot_interval = .7
|
|
snow_demon.shoot_offset = 2
|
|
end
|
|
|
|
mobs:register_mob("fun_caves:snow_demon", snow_demon)
|
|
|
|
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 (!)
|
|
|
|
|