Compare commits

...

5 Commits

Author SHA1 Message Date
Juraj Vajda 6676b6a3f8 new animated booom cloud particle 2018-11-24 20:00:21 -05:00
Juraj Vajda 01f7914ec8 deep orange balrog chat message color 2018-11-22 18:13:38 -05:00
Juraj Vajda 7e4bed95b6 mummy view range 16 2018-11-18 22:49:18 -05:00
Juraj Vajda 344ebe972b adjust teleport y axis 2018-11-18 19:17:17 -05:00
Juraj Vajda 7d8d7e7f96 mobs longer reach, mummy teleports to attacker 2018-11-18 15:08:53 -05:00
7 changed files with 105 additions and 45 deletions

View File

@ -1,12 +1,12 @@
--
--
-- * CREATE ALL SPAWNERS NODES *
--
--
function spawners_env.create(mob_name, mod_prefix, size, offset, mesh, texture, night_only, sound_custom, env, boss)
--
--
-- DUMMY INSIDE THE SPAWNER
--
--
local dummy_definition = {
hp_max = 1,
@ -41,9 +41,9 @@ function spawners_env.create(mob_name, mod_prefix, size, offset, mesh, texture,
minetest.register_entity("spawners_env:dummy_"..mod_prefix.."_"..mob_name, dummy_definition)
--
--
-- ACTIVE SPAWNER ENV
--
--
minetest.register_node("spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active", {
description = mod_prefix.."_"..mob_name.." spawner active env",
@ -84,9 +84,9 @@ function spawners_env.create(mob_name, mod_prefix, size, offset, mesh, texture,
end,
})
--
--
-- WAITING SPAWNER ENV
--
--
-- waiting for light - everything is ok but too much light or not enough light
minetest.register_node("spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting", {
@ -123,9 +123,9 @@ function spawners_env.create(mob_name, mod_prefix, size, offset, mesh, texture,
},
})
--
--
-- INACTIVE SPAWNER (DEFAULT) ENV
--
--
minetest.register_node("spawners_env:"..mod_prefix.."_"..mob_name.."_spawner", {
description = mod_prefix.."_"..mob_name.." spawner env",
@ -150,9 +150,9 @@ function spawners_env.create(mob_name, mod_prefix, size, offset, mesh, texture,
end,
})
--
--
-- * LBM *
--
--
minetest.register_lbm({
name = "spawners_env:check_for_spawning_timer",
@ -167,9 +167,9 @@ function spawners_env.create(mob_name, mod_prefix, size, offset, mesh, texture,
})
end
--
--
-- * check for spawning *
--
--
function spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_prefix, sound_custom, env, boss)
local random_pos, waiting = spawners_env.check_node_status(pos, mob_name, night_only, boss)
@ -185,7 +185,7 @@ function spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_pr
local mobs_check_radius
local mobs_max
mobs_counter_table[mob_name] = 0
if boss then
mobs_max = 1
mobs_check_radius = 35
@ -196,10 +196,10 @@ function spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_pr
-- collect all spawned mobs around area
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, mobs_check_radius)) do
if obj:get_luaentity() ~= nil then
-- get entity name
-- get entity name
local name_split = string.split(obj:get_luaentity().name, ":")
if name_split[2] == mob_name then
@ -222,7 +222,8 @@ function spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_pr
end
if boss then
minetest.chat_send_all('!Balrog has spawned to this World!')
-- color: deep orange
minetest.chat_send_all(minetest.colorize("#FF5722", "Balrog has spawned to this World!"))
end
spawners_env.start_spawning(random_pos, 1, "spawners_env:"..mob_name, mod_prefix, sound_custom)
@ -251,9 +252,9 @@ function spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_pr
end
end
--
--
-- CALL 'CREATE' FOR ALL SPAWNERS
--
--
for i, mob_table in ipairs(spawners_env.mob_tables) do
if mob_table then

View File

@ -69,9 +69,18 @@ function spawners_mobs.cloud_booom(pos)
maxacc = vector.new({x=0.1, y=0.6, z=0.1}),
minexptime = 2,
maxexptime = 3,
minsize = 4,
maxsize = 12,
texture = "spawners_mobs_smoke_particle_2.png^[transform"..math.random(0,3),
minsize = 16,
maxsize = 24,
texture = "spawners_mobs_smoke_particle_2.png",
animation = {
type = "vertical_frames",
-- Width of a frame in pixels
aspect_w = 16,
-- Height of a frame in pixels
aspect_h = 16,
-- Full loop length
length = 2.0,
},
})
end
@ -187,12 +196,11 @@ function spawners_mobs.start_spawning(spawn_area_random_pos, mob_name, mod_prefi
minetest.after(1, function()
-- minetest.set_node(spawn_area_random_pos[i], {name = "default:apple"})
local obj = minetest.add_entity(spawn_area_random_pos[i], mod_prefix..":"..mob_name)
if obj then
if sound_name then
minetest.sound_play(sound_name, {
pos = spawn_area_random_pos[i],
max_hear_distance = 8,
max_hear_distance = 16,
gain = 0.5
})
end

View File

@ -6,7 +6,7 @@ local bunny_evil_def = {
attack_type = "dogfight",
group_attack = true,
pathfinding = false,
reach = 2,
reach = 3,
damage = 3,
hp_min = 35,
hp_max = 65,

View File

@ -33,7 +33,7 @@ local mummy_def = {
},
walk_velocity = .75,
run_velocity = 1.5,
view_range = 10,
view_range = 16,
jump = true,
floats = 1,
drops = {
@ -70,6 +70,57 @@ local mummy_def = {
max_hear_distance = 8
})
end,
_timer = 0,
_random_trigger = 5,
do_custom = function(self, dtime)
if not self._timer then
self._timer = 0
end
if not self._random_trigger then
self._random_trigger = math.random(5, 20)
end
self._timer = self._timer + dtime
if self._timer > self._random_trigger then
self._timer = 0
self._random_trigger = math.random(5, 20)
if not self.attack then
return
end
local mob_pos = self.object:get_pos()
local player_pos = self.attack:get_pos()
local distance = vector.distance(mob_pos, player_pos)
-- don't teleport when closer than 'reach' distance in mod def
if distance <= 3 then
return
end
if self.attack:is_player() then
-- health check
if self.attack:get_hp() > 0 then
-- play sound
minetest.sound_play("spawners_mobs_teleport", {
object = self.object,
gain = 1.0,
max_hear_distance = 20
})
local player_look_dir = self.attack:get_look_dir()
player_look_dir.y = 1
local to_pos = vector.add(player_pos, player_look_dir)
-- teleport player
self.object:set_pos(to_pos)
end
end
end
end,
-- on_rightclick = function(self, clicker)
-- if mobs:feed_tame(self, clicker, 8, true, true) then

View File

@ -9,7 +9,7 @@ local uruk_hai_def = {
pathfinding = false,
attack_type = "dogfight",
group_attack = true,
reach = 2,
reach = 3,
damage = 6,
armor = 100,
collisionbox = {-0.3,-1.0,-0.3, 0.3,0.8,0.3},

View File

@ -1,6 +1,6 @@
--
--
-- CREATE ALL SPAWNERS NODES
--
--
function spawners_mobs.create(mob_table, idx)
local mob_name = mob_table.name
local mod_prefix = mob_table.mod_prefix
@ -8,9 +8,9 @@ function spawners_mobs.create(mob_table, idx)
local mesh = mob_table.dummy_mesh
local texture = mob_table.dummy_texture
--
--
-- DUMMY INSIDE THE SPAWNER
--
--
minetest.register_entity("spawners_mobs:dummy_"..mod_prefix.."_"..mob_name, {
hp_max = 1,
visual = "mesh",
@ -30,9 +30,9 @@ function spawners_mobs.create(mob_table, idx)
end
})
--
--
-- DEFAULT SPAWNER
--
--
minetest.register_node("spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner", {
description = mod_prefix.."_"..mob_name.." spawner",
paramtype = "light",
@ -73,9 +73,9 @@ function spawners_mobs.create(mob_table, idx)
end
})
--
--
-- WAITING SPAWNER
--
--
minetest.register_node("spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner_waiting", {
description = mod_prefix.."_"..mob_name.." spawner waiting",
paramtype = "light",
@ -103,9 +103,9 @@ function spawners_mobs.create(mob_table, idx)
on_timer = spawners_mobs.on_timer
})
--
--
-- RUSTY SPAWNER
--
--
minetest.register_node("spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner_rusty", {
description = mod_prefix.."_"..mob_name.." spawner rusty",
paramtype = "light",
@ -120,9 +120,9 @@ function spawners_mobs.create(mob_table, idx)
drop = "spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner"
})
--
--
-- replacement LBM for pre-nodetimer spawners
--
--
minetest.register_lbm({
name = "spawners_mobs:start_nodetimer_"..mod_prefix.."_"..mob_name.."_spawner",
nodenames = "spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner",
@ -131,15 +131,15 @@ function spawners_mobs.create(mob_table, idx)
end,
})
--
--
-- COMPATIBILITY
--
--
minetest.register_alias("spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner_active", "spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner")
end
--
--
-- INIT 'CREATE' FOR ALL SPAWNERS
--
--
for i, mob_table in ipairs(spawners_mobs.mob_tables) do
spawners_mobs.create(mob_table, i)
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 217 B