2015-04-06 22:19:25 +02:00
|
|
|
-- Pyramid mummy
|
|
|
|
|
|
|
|
mobs:register_mob("tsm_pyramids:mummy", {
|
|
|
|
-- animal, monster, npc, barbarian
|
|
|
|
type = "monster",
|
|
|
|
-- aggressive, deals 5 damage to player when hit
|
|
|
|
passive = false,
|
|
|
|
attack_type = "dogfight",
|
|
|
|
damage = 5,
|
|
|
|
-- health & armor
|
2015-04-07 00:29:19 +02:00
|
|
|
hp_min = 15, hp_max = 20, armor = 80,
|
2015-04-06 22:19:25 +02:00
|
|
|
-- textures and model
|
2015-03-13 19:06:32 +01:00
|
|
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
|
|
|
visual = "mesh",
|
2015-04-06 22:19:25 +02:00
|
|
|
mesh = "tsm_pyramids_mummy.x",
|
|
|
|
drawtype = "front",
|
|
|
|
textures = {
|
|
|
|
{"tsm_pyramids_mummy.png"},
|
|
|
|
},
|
2015-03-13 19:06:32 +01:00
|
|
|
visual_size = {x=8,y=8},
|
2015-04-06 22:19:25 +02:00
|
|
|
blood_texture = "default_sand.png",
|
|
|
|
-- sounds
|
2015-03-13 19:06:32 +01:00
|
|
|
makes_footstep_sound = true,
|
2015-04-06 22:19:25 +02:00
|
|
|
sounds = {
|
|
|
|
random = "mummy",
|
|
|
|
},
|
|
|
|
-- speed and jump, sinks in water
|
2015-04-18 23:29:56 +02:00
|
|
|
walk_velocity = 0.5, -- A tester si assez lent / trop lent, valeur actuel = moitié moins que les Tree Monster
|
|
|
|
run_velocity = 1,
|
2015-04-06 22:19:25 +02:00
|
|
|
view_range = 16,
|
2015-04-18 23:34:00 +02:00
|
|
|
jump = false,
|
2015-04-06 22:19:25 +02:00
|
|
|
floats = 0,
|
|
|
|
-- drops papyrus when dead
|
|
|
|
drops = {
|
|
|
|
{name = "default:papyrus",
|
|
|
|
chance = 1, min = 3, max = 5,},
|
2015-05-16 22:30:02 +02:00
|
|
|
{name = "maptools:silver_coin",
|
|
|
|
chance = 10, min = 1, max = 1,},
|
2015-04-06 22:19:25 +02:00
|
|
|
},
|
|
|
|
-- damaged by
|
2015-04-07 00:29:19 +02:00
|
|
|
water_damage = 0,
|
2015-04-18 23:29:56 +02:00
|
|
|
lava_damage = 5,
|
|
|
|
light_damage = 10,
|
2015-04-06 22:19:25 +02:00
|
|
|
-- model animation
|
|
|
|
animation = {
|
|
|
|
speed_normal = 15, speed_run = 15,
|
|
|
|
stand_start = 74, stand_end = 74,
|
|
|
|
walk_start = 74, walk_end = 105,
|
|
|
|
run_start = 74, run_end = 105,
|
|
|
|
punch_start = 74, punch_end = 105,
|
|
|
|
sit_start = 81, sit_end = 160,
|
|
|
|
lay_start = 162, lay_end = 166,
|
|
|
|
mine_start = 74, mine_end = 105,
|
2015-04-07 00:29:19 +02:00
|
|
|
walk_mine_start = 74, walk_mine_end = 105,
|
2015-04-06 22:19:25 +02:00
|
|
|
},
|
|
|
|
})
|
2015-03-13 19:06:32 +01:00
|
|
|
|
2015-04-07 00:29:19 +02:00
|
|
|
-- spawner (spawn in pyramids, near the spawner)
|
2015-04-06 22:19:25 +02:00
|
|
|
if not minetest.setting_getbool("only_peaceful_mobs") then
|
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"tsm_pyramids:spawner_mummy"},
|
|
|
|
interval = 2.0,
|
|
|
|
chance = 20,
|
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
|
|
local player_near = false
|
|
|
|
local mobs = 0
|
|
|
|
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, 17)) do
|
|
|
|
if obj then
|
|
|
|
if obj:is_player() then
|
|
|
|
player_near = true
|
|
|
|
else
|
|
|
|
if obj:get_luaentity() and obj:get_luaentity().mob_name == "mummy" then mobs = mobs + 1 end
|
2015-03-13 19:06:32 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-04-06 22:19:25 +02:00
|
|
|
if player_near then
|
|
|
|
if mobs < 6 then
|
|
|
|
pos.x = pos.x+1
|
2015-06-10 17:14:58 +02:00
|
|
|
local p = minetest.find_node_near(pos, 5, {"air"})
|
2015-04-06 22:19:25 +02:00
|
|
|
minetest.add_entity(p,"tsm_pyramids:mummy")
|
2015-03-13 19:06:32 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-04-06 22:19:25 +02:00
|
|
|
})
|
2015-03-13 19:06:32 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function pyramids.spawn_mummy (pos, number)
|
|
|
|
for i=0,number do
|
2015-04-06 22:19:25 +02:00
|
|
|
minetest.add_entity(pos,"tsm_pyramids:mummy")
|
2015-03-13 19:06:32 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_node("tsm_pyramids:spawner_mummy", {
|
|
|
|
description = "Mummy spawner",
|
|
|
|
paramtype = "light",
|
|
|
|
tiles = {"tsm_pyramids_spawner.png"},
|
|
|
|
is_ground_content = true,
|
|
|
|
drawtype = "allfaces",--_optional",
|
2015-03-14 17:30:42 +01:00
|
|
|
groups = {unbreakable=1},
|
2015-03-13 19:06:32 +01:00
|
|
|
drop = "",
|
|
|
|
on_construct = function(pos)
|
|
|
|
pos.y = pos.y - 0.28
|
|
|
|
minetest.env:add_entity(pos,"tsm_pyramids:mummy_spawner")
|
|
|
|
end,
|
|
|
|
on_destruct = function(pos)
|
|
|
|
for _,obj in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do
|
2015-06-10 17:14:58 +02:00
|
|
|
if not obj:is_player() then
|
2015-03-13 19:06:32 +01:00
|
|
|
if obj ~= nil and obj:get_luaentity().m_name == "dummy" then
|
2015-06-10 17:14:58 +02:00
|
|
|
obj:remove()
|
2015-03-13 19:06:32 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
2015-04-06 22:19:25 +02:00
|
|
|
|
2015-04-07 00:29:19 +02:00
|
|
|
-- register spawn egg
|
2015-04-06 22:19:25 +02:00
|
|
|
minetest.register_craftitem("tsm_pyramids:spawn_egg", {
|
|
|
|
description = "Mummy spawn-egg",
|
|
|
|
inventory_image = "tsm_pyramids_mummy_egg.png",
|
|
|
|
liquids_pointable = false,
|
|
|
|
stack_max = 99,
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
if pointed_thing.type == "node" then
|
|
|
|
minetest.env:add_entity(pointed_thing.above,"tsm_pyramids:mummy")
|
|
|
|
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
|
|
|
return itemstack
|
2015-03-13 19:06:32 +01:00
|
|
|
end
|
2015-04-06 22:19:25 +02:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Spawner entity
|
|
|
|
|
|
|
|
spawner_DEF = {
|
|
|
|
hp_max = 1,
|
|
|
|
physical = true,
|
|
|
|
collisionbox = {0,0,0,0,0,0},
|
|
|
|
visual = "mesh",
|
|
|
|
visual_size = {x=3.3,y=3.3},
|
|
|
|
mesh = "tsm_pyramids_mummy.x",
|
|
|
|
textures = {"tsm_pyramids_mummy.png"},
|
|
|
|
makes_footstep_sound = false,
|
|
|
|
timer = 0,
|
|
|
|
automatic_rotate = math.pi * 2.9,
|
|
|
|
m_name = "dummy"
|
|
|
|
}
|
|
|
|
|
|
|
|
spawner_DEF.on_activate = function(self)
|
|
|
|
mummy_update_visuals_def(self)
|
|
|
|
self.object:setvelocity({x=0, y=0, z=0})
|
|
|
|
self.object:setacceleration({x=0, y=0, z=0})
|
|
|
|
self.object:set_armor_groups({immortal=1})
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
spawner_DEF.on_step = function(self, dtime)
|
|
|
|
self.timer = self.timer + 0.01
|
|
|
|
local n = minetest.get_node_or_nil(self.object:getpos())
|
|
|
|
if self.timer > 1 then
|
|
|
|
if n and n.name and n.name ~= "tsm_pyramids:spawner_mummy" then
|
|
|
|
self.object:remove()
|
2015-03-13 19:06:32 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-04-06 22:19:25 +02:00
|
|
|
|
|
|
|
spawner_DEF.on_punch = function(self, hitter)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_entity("tsm_pyramids:mummy_spawner", spawner_DEF)
|
|
|
|
|
|
|
|
function mummy_update_visuals_def(self)
|
|
|
|
--local name = get_player_name()
|
|
|
|
-- visual = default_model_def
|
|
|
|
npc_anim = 0 -- Animation will be set further below immediately
|
|
|
|
--npc_sneak[name] = false
|
|
|
|
local prop = {
|
|
|
|
mesh = mummy_mesh,
|
|
|
|
textures = mummy_texture,
|
|
|
|
--visual_size = {x=1, y=1, z=1},
|
|
|
|
}
|
|
|
|
self.object:set_properties(prop)
|
|
|
|
end
|