Finish ice zombie and sand zombie
parent
0f2157f5f5
commit
936f897a81
27
api.lua
27
api.lua
|
@ -128,12 +128,15 @@ local function spawn(pos, force)
|
|||
|
||||
minetest.log("Entity count: "..dump(entity_count))
|
||||
minetest.log("Max mob count: "..dump(max_mob_count))
|
||||
--minetest.log("Force: "..dump(force))
|
||||
|
||||
if force or (entity_count <= max_mob_count) then
|
||||
|
||||
-- Spawn
|
||||
local spawn_pos = {x=pos.x + math.random(0, spawner.spawn_radius), y=pos.y+3, z=pos.z + math.random(0, spawner.spawn_radius)}
|
||||
local spawn_pos = {
|
||||
x=pos.x + math.random(0, spawner.spawn_radius),
|
||||
y=pos.y+3,
|
||||
z=pos.z + math.random(0, spawner.spawn_radius)
|
||||
}
|
||||
-- Check spawn position - if not air, then spawn just above the spawner
|
||||
local spawn_node = minetest.get_node_or_nil(spawn_pos)
|
||||
if spawn_node and spawn_node.name ~= "air" then
|
||||
|
@ -301,10 +304,17 @@ natspawner.register_spawner("zombie", {
|
|||
},
|
||||
["default:dirt_with_grass"] = {
|
||||
name = "dirt_with_grass_spawner",
|
||||
tiles = {"default_grass.png^[cracko:1:2", "default_dirt.png", {name = "default_dirt.png^default_grass_side.png"}}},
|
||||
tiles = {"default_grass.png^[cracko:1:2", "default_dirt.png", {name = "default_dirt.png^default_grass_side.png"}},
|
||||
variations = {
|
||||
["natspawner:giant_zombie"] = {
|
||||
max_count = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
["default:dirt_with_dry_grass"] = {
|
||||
name = "dirt_with_dry_grass_spawner",
|
||||
tiles = {"default_dry_grass.png^[cracko:1:2", "default_dirt.png", {name = "default_dirt.png^default_dry_grass_side.png"}}},
|
||||
tiles = {"default_dry_grass.png^[cracko:1:2", "default_dirt.png", {name = "default_dirt.png^default_dry_grass_side.png"}}
|
||||
},
|
||||
["default:dirt_with_snow"] = {
|
||||
name = "dirt_with_snow_spawner",
|
||||
tiles = {"default_snow.png^[cracko:1:2", "default_dirt.png", {name = "default_dirt.png^default_snow_side.png"}},
|
||||
|
@ -318,7 +328,12 @@ natspawner.register_spawner("zombie", {
|
|||
},
|
||||
["default:dirt_with_rainforest_litter"] = {
|
||||
name = "dirt_with_rainforest_litter_spawner",
|
||||
tiles = {"default_rainforest_litter.png^[cracko:1:2", "default_dirt.png", {name = "default_dirt.png^default_rainforest_litter_side.png"}}
|
||||
tiles = {"default_rainforest_litter.png^[cracko:1:2", "default_dirt.png", {name = "default_dirt.png^default_rainforest_litter_side.png"}},
|
||||
variations = {
|
||||
["natspawner:giant_zombie"] = {
|
||||
max_count = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
["default:dirt_with_coniferous_litter"] = {
|
||||
name = "dirt_with_coniferous_litter_spawner",
|
||||
|
@ -406,6 +421,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
"default:dirt_with_grass",
|
||||
"default:dirt_with_snow",
|
||||
"default:dirt_with_coniferous_litter",
|
||||
"default:dirt_with_rainforest_litter",
|
||||
"default:permafrost",
|
||||
"default:permafrost_with_moss",
|
||||
"default:permafrost_with_stones",
|
||||
|
@ -419,6 +435,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
"default:dirt_with_grass",
|
||||
"default:dirt_with_snow",
|
||||
"default:dirt_with_coniferous_litter",
|
||||
"default:dirt_with_rainforest_litter",
|
||||
"default:permafrost",
|
||||
"default:permafrost_with_moss",
|
||||
"default:permafrost_with_stones",
|
||||
|
|
58
mobs.lua
58
mobs.lua
|
@ -1,5 +1,33 @@
|
|||
-- Entity registrations
|
||||
|
||||
local function ice_breaking_effect(pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = math.random(15, 25),
|
||||
|
||||
time = 0.5,
|
||||
-- Lifespan of spawner in seconds.
|
||||
-- If time is 0 spawner has infinite lifespan and spawns the `amount` on
|
||||
-- a per-second basis.
|
||||
minpos = {x=pos.x-1, y=pos.y+1, z=pos.z-1},
|
||||
maxpos = {x=pos.x+1, y=pos.y+1, z=pos.z+1},
|
||||
minvel = {x = -2.5, y = -2.5, z = -2.5},
|
||||
maxvel = {x = 2.5, y = 2.5, z = 2.5},
|
||||
|
||||
|
||||
-- minpos = {x=pos.x-1, y=pos.x-1, z=pos.x-1},
|
||||
-- maxpos = {x=pos.x+1, y=pos.x+1, z=pos.x+1},
|
||||
-- minvel = {x=0, y=0, z=0},
|
||||
-- maxvel = {x=0, y=0, z=0},
|
||||
minacc = {x=0, y=-10, z=0},
|
||||
maxacc = {x=0, y=-10, z=0},
|
||||
minexptime = 0.5,
|
||||
maxexptime = 1,
|
||||
minsize = 0.5,
|
||||
maxsize = 1,
|
||||
texture = "frozen_ice.png"
|
||||
})
|
||||
end
|
||||
|
||||
local function normal_attack(self, to_attack)
|
||||
--set_animation(self, "punch")
|
||||
|
||||
|
@ -146,9 +174,9 @@ mobs:register_mob("natspawner:ice_zombie", {
|
|||
visual_size = {x=1, y=1},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
random = "mobs_zombie.1",
|
||||
random = "mobs_zombie",
|
||||
damage = "mobs_zombie_ice_hit",
|
||||
attack = "mobs_zombie.3",
|
||||
attack = "mobs_zombie",
|
||||
death = "mobs_zombie_death",
|
||||
},
|
||||
walk_velocity = 0.5,
|
||||
|
@ -183,7 +211,7 @@ mobs:register_mob("natspawner:ice_zombie", {
|
|||
|
||||
self.ice_attack_timer = self.ice_attack_timer + 1
|
||||
|
||||
if self.ice_attack_timer >= 5 then
|
||||
if self.ice_attack_timer >= 3 then
|
||||
self.ice_attack_timer = 0
|
||||
local chance = math.random(1, 5)
|
||||
if chance > 3 then
|
||||
|
@ -193,9 +221,12 @@ mobs:register_mob("natspawner:ice_zombie", {
|
|||
minetest.set_node({x=to_attack.x, y=to_attack.y+1, z=to_attack.z}, {name="natspawner:freezing_ice"})
|
||||
-- Remove node
|
||||
minetest.after(math.random(1,2), function(pos)
|
||||
local pos_above = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
minetest.sound_play("default_break_glass")
|
||||
minetest.set_node(to_attack, {name="air"})
|
||||
minetest.set_node({x=to_attack.x, y=to_attack.y+1, z=to_attack.z}, {name="air"})
|
||||
ice_breaking_effect(pos)
|
||||
ice_breaking_effect(pos_above)
|
||||
minetest.set_node(pos, {name="air"})
|
||||
minetest.set_node(pos_above, {name="air"})
|
||||
end, to_attack)
|
||||
end
|
||||
end
|
||||
|
@ -283,8 +314,7 @@ mobs:register_mob("natspawner:sand_zombie", {
|
|||
floats = 0,
|
||||
view_range = 12,
|
||||
drops = {
|
||||
{name = "zombie:rotten_flesh",
|
||||
chance = 2, min = 3, max = 5,},
|
||||
{name = "zombie:rotten_flesh", chance = 2, min = 3, max = 5},
|
||||
},
|
||||
water_damage = 0,
|
||||
lava_damage = 1,
|
||||
|
@ -332,11 +362,18 @@ mobs:register_mob("natspawner:sand_zombie", {
|
|||
})
|
||||
|
||||
-- Nodes
|
||||
|
||||
|
||||
|
||||
minetest.register_node("natspawner:freezing_ice", {
|
||||
description = "Freezing Ice",
|
||||
tiles = {"frozen_ice.png"},
|
||||
groups = {cracky = 3, cools_lava = 1, slippery = 3, flammable = 2, liquid = 1},
|
||||
use_texture_alpha = true,
|
||||
sunlight_propagates = true,
|
||||
drawtype = "glasslike",
|
||||
tiles = {"freezing_ice.png"},
|
||||
paramtype = "light",
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
walkable = false,
|
||||
pointable = true,
|
||||
diggable = true,
|
||||
|
@ -345,13 +382,12 @@ minetest.register_node("natspawner:freezing_ice", {
|
|||
drowning = 1,
|
||||
liquid_renewable = false,
|
||||
liquidtype = "source",
|
||||
use_textrure_alpha = true,
|
||||
liquid_range= 0,
|
||||
liquid_alternative_flowing = "natspawner:freezing_ice",
|
||||
liquid_alternative_source = "natspawner:freezing_ice",
|
||||
liquid_viscosity = 30,
|
||||
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
|
||||
groups = {cracky = 3, cools_lava = 1, slippery = 3, flammable=2, liquid=1, not_in_creative_inventory=1},
|
||||
post_effect_color = {a = 128, r = 30, g = 60, b = 90},
|
||||
--groups = {cracky = 3, cools_lava = 1, slippery = 3, flammable=2, liquid=1, not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_node("natspawner:evil_sand", {
|
||||
|
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
Loading…
Reference in New Issue