code tidy and tweak

This commit is contained in:
tenplus1 2024-07-16 13:12:19 +01:00
parent 89c7812fe5
commit d7a8ff6d9d
21 changed files with 1007 additions and 873 deletions

View File

@ -1,16 +1,14 @@
-- crystalgas arrow
--crystalgas arrow
mobs:register_arrow("nssm:crystal_gas_arrow", { mobs:register_arrow("nssm:crystal_gas_arrow", {
visual = "sprite", visual = "sprite",
visual_size = {x = 1, y = 1}, visual_size = {x = 1, y = 1},
textures = {"crystal_arrow.png"}, textures = {"crystal_arrow.png"},
velocity = 8, velocity = 8,
-- direct hit
hit_player = function(self, player) hit_player = function(self, player)
local p = player:get_pos() crystal_gas_explosion(player:get_pos())
crystal_gas_explosion(p)
end, end,
hit_node = function(self, pos, node) hit_node = function(self, pos, node)
@ -20,67 +18,91 @@ mobs:register_arrow("nssm:crystal_gas_arrow", {
function crystal_gas_explosion(pos) function crystal_gas_explosion(pos)
if minetest.is_protected(pos, "") then if minetest.is_protected(pos, "") then
return return
end end
for dx= 0,0 do
for dy=-1,2 do for dx = 0, 0 do
for dz= 0,0 do for dy = -1, 2 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} for dz = 0, 0 do
local p = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
if minetest.is_protected(p, "") then if minetest.is_protected(p, "") then
return return
end end
local n = minetest.get_node(p).name local n = minetest.get_node(p).name
if n== "air" then
minetest.set_node(p, {name="nssm:crystal_gas"}) if n == "air" then
minetest.set_node(p, {name = "nssm:crystal_gas"})
end end
end end
end end
end end
end end
--Pumpkid bomb -- Pumpkid bomb
mobs:register_arrow("nssm:pumpkid_bomb", { mobs:register_arrow("nssm:pumpkid_bomb", {
visual = "cube", visual = "cube",
visual_size = {x = 1, y = 1}, visual_size = {x = 1, y = 1},
textures = {"pumpbomb_top.png","pumpbomb_bottom.png", "pumpbomb_side.png", "pumpbomb_side.png", "pumpbomb_side.png", "pumpbomb_front.png"}, textures = {
"pumpbomb_top.png", "pumpbomb_bottom.png", "pumpbomb_side.png",
"pumpbomb_side.png", "pumpbomb_side.png", "pumpbomb_front.png"
},
velocity = 8, velocity = 8,
-- direct hit
hit_player = function(self, player) hit_player = function(self, player)
local p = player:get_pos() local p = player:get_pos()
--local pos1 = {x = pos.x, y=pos.y, z=pos.z}
if not minetest.is_protected(p, "") or not minetest.get_item_group(minetest.get_node(p).name, "unbreakable") == 1 then if not minetest.is_protected(p, "")
tnt.boom(p, {damage_radius=3,radius=2,ignore_protection=false}) or not minetest.get_item_group(minetest.get_node(p).name, "unbreakable") == 1 then
tnt.boom(p, {damage_radius = 3,radius = 2,ignore_protection = false})
end end
end, end,
hit_node = function(self, pos, node) hit_node = function(self, pos, node)
--local pos1 = {x = pos.x, y=pos.y, z=pos.z}
if not minetest.is_protected(pos, "") or not minetest.get_item_group(minetest.get_node(pos).name, "unbreakable") == 1 then if not minetest.is_protected(pos, "")
tnt.boom(pos, {damage_radius=3,radius=2,ignore_protection=false}) or not minetest.get_item_group(minetest.get_node(pos).name, "unbreakable") == 1 then
tnt.boom(pos, {damage_radius = 3,radius = 2,ignore_protection = false})
end end
end end
}) })
--Lava_block bomb -- Lava_block bomb
mobs:register_arrow("nssm:lava_block_bomb", { mobs:register_arrow("nssm:lava_block_bomb", {
visual = "cube", visual = "cube",
visual_size = {x = 1, y = 1}, visual_size = {x = 1, y = 1},
textures = {"default_lava.png","default_lava.png", "default_lava.png", "default_lava.png", "default_lava.png", "default_lava.png"}, textures = {
"default_lava.png", "default_lava.png", "default_lava.png",
"default_lava.png", "default_lava.png", "default_lava.png"
},
velocity = 8, velocity = 8,
-- direct hit
hit_player = function(self, player) hit_player = function(self, player)
local p = player:get_pos() local p = player:get_pos()
if not minetest.is_protected(p, "") or not minetest.get_item_group(minetest.get_node(p).name, "unbreakable") == 1 then
minetest.set_node(p, {name="default:lava_source"}) if not minetest.is_protected(p, "")
or not minetest.get_item_group(minetest.get_node(p).name, "unbreakable") == 1 then
minetest.set_node(p, {name = "default:lava_source"})
end end
end, end,
hit_node = function(self, pos, node) hit_node = function(self, pos, node)
if not minetest.is_protected(pos, "") or not minetest.get_item_group(minetest.get_node(pos).name, "unbreakable") == 1 then
minetest.set_node(pos, {name="default:lava_source"}) if not minetest.is_protected(pos, "")
or not minetest.get_item_group(minetest.get_node(pos).name, "unbreakable") == 1 then
minetest.set_node(pos, {name = "default:lava_source"})
end end
end end
}) })

View File

@ -6,64 +6,46 @@ mobs:register_mob("nssm:albino_spider", {
visual = "mesh", visual = "mesh",
mesh = "albino_spider.x", mesh = "albino_spider.x",
textures = {{"albino_spider.png"}}, textures = {{"albino_spider.png"}},
visual_size = {x=4, y=4}, visual_size = {x = 4, y = 4},
makes_footstep_sound = false, makes_footstep_sound = false,
view_range = 22, view_range = 22,
walk_velocity = 0.6, walk_velocity = 0.6,
fear_height = 3, fear_height = 3,
run_velocity = 3, run_velocity = 3,
--[[sounds = { -- sounds = {
random = "albino_spider", -- random = "albino_spider",
},]] -- },
damage = 3, damage = 3,
reach = 2, reach = 2,
jump = true, jump = true,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 1, max = 4},
chance = 1, {name = "nssm:spider_leg", chance = 2, min = 1, max = 8},
min = 1, {name = "nssm:silk_gland", chance = 4, min = 1, max = 3},
max = 4,}, {name = "nssm:spider_meat", chance = 4, min = 1, max = 2},
{name = "nssm:spider_leg",
chance = 2,
min = 1,
max = 8,},
{name = "nssm:silk_gland",
chance = 4,
min = 1,
max = 3,},
{name = "nssm:spider_meat",
chance = 4,
min = 1,
max = 2,},
}, },
armor = 70, armor = 70,
drawtype = "front", drawtype = "front",
water_damage = 2, water_damage = 2,
lava_damage = 14, lava_damage = 14,
light_damage = 0, light_damage = 0,
group_attack=true, group_attack = true,
attack_animals=true, attack_animals = true,
suffocation = 0, suffocation = 0,
knock_back=1, knock_back = 1,
blood_texture="nssm_blood_blue.png", blood_texture = "nssm_blood_blue.png",
stepheight=1.1, stepheight=1.1,
on_rightclick = nil,
attack_type = "dogfight", attack_type = "dogfight",
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 25,
speed_run = 25, stand_start = 1, stand_end = 80,
stand_start = 1, walk_start = 120, walk_end = 160,
stand_end = 80, run_start = 210, run_end = 222,
walk_start = 120, punch_start = 80, punch_end = 110,
walk_end = 160, die_start = 170, die_end = 190,
run_start = 210,
run_end = 222,
punch_start = 80,
punch_end = 110,
die_start = 170,
die_end = 190,
}, },
--[[ do_custom = function(self) -- do_custom = function(self)
webber_ability(self, "nssm:web", 2) -- webber_ability(self, "nssm:web", 2)
end,]] -- end
}) })

View File

@ -6,10 +6,10 @@ mobs:register_mob("nssm:berinhog", {
visual = "mesh", visual = "mesh",
mesh = "berinhog.x", mesh = "berinhog.x",
textures = {{"berinhog.png"}}, textures = {{"berinhog.png"}},
visual_size = {x=5, y=5}, visual_size = {x = 5, y = 5},
makes_footstep_sound = true, makes_footstep_sound = true,
view_range = 18, view_range = 18,
rotate=270, rotate = 270,
walk_velocity = 1, walk_velocity = 1,
fear_height = 4, fear_height = 4,
run_velocity = 3.6, run_velocity = 3.6,
@ -19,61 +19,47 @@ mobs:register_mob("nssm:berinhog", {
damage = 6, damage = 6,
jump = true, jump = true,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 5, max = 7},
chance = 1, -- {name = "nssm:berinhog_steak", chance = 2, min = 1, max = 2},
min = 5, -- {name = "nssm:berinhog_fur", chance = 2, min = 1, max = 1},
max = 7}, -- {name = "nssm:berinhog_horn", chance = 3, min = 1, max = 2},
--[[ {name = "nssm:berinhog_steak",
chance = 2,
min = 1,
max = 2},
{name = "nssm:berinhog_fur",
chance = 2,
min = 1,
max = 1},
{name = "nssm:berinhog_horn",
chance = 3,
min = 1,
max = 2},]]
}, },
armor = 70, armor = 70,
drawtype = "front", drawtype = "front",
water_damage = 0, water_damage = 0,
lava_damage = 15, lava_damage = 15,
suffocation = 4, suffocation = 4,
reach=3, reach = 3,
light_damage = 0, light_damage = 0,
group_attack=true, group_attack = true,
attack_animals=true, attack_animals = true,
knock_back=0, knock_back = 0,
blood_texture="nssm_blood.png", blood_texture = "nssm_blood.png",
stepheight=1.1, stepheight = 1.1,
on_rightclick = nil,
attack_type = "dogfight", attack_type = "dogfight",
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 20,
speed_run = 20, stand_start = 0, stand_end = 40,
stand_start = 0, walk_start = 210, walk_end = 250,
stand_end = 40, run_start = 140, run_end = 160,
walk_start = 210, punch_start = 170, punch_end = 200,
walk_end = 250, die_start = 110, die_end = 130,
run_start = 140,
run_end = 160,
punch_start = 170,
punch_end = 200,
--speed_die = 10,
die_start = 110,
die_end = 130,
}, },
do_custom = function (self)
self.berinhog_timer = (self.berinhog_timer) or os.time() do_custom = function(self)
self.berinhog_timer = self.berinhog_timer or os.time()
if os.time() - self.berinhog_timer > 1 then if os.time() - self.berinhog_timer > 1 then
self.berinhog_timer = os.time() self.berinhog_timer = os.time()
local all_objects = minetest.get_objects_inside_radius(self.object:get_pos(), 1) local all_objects = minetest.get_objects_inside_radius(self.object:get_pos(), 1)
local _,obj
for _,obj in ipairs(all_objects) do for _,obj in ipairs(all_objects) do
if obj:is_player() then if obj:is_player() then
obj:set_hp(obj:get_hp()-1) obj:set_hp(obj:get_hp() - 1)
elseif obj:get_luaentity() and obj:get_luaentity().health elseif obj:get_luaentity() and obj:get_luaentity().health
and obj:get_luaentity().name ~= self.object:get_luaentity().name then and obj:get_luaentity().name ~= self.object:get_luaentity().name then
obj:get_luaentity().health = obj:get_luaentity().health - 1 obj:get_luaentity().health = obj:get_luaentity().health - 1
@ -82,3 +68,4 @@ mobs:register_mob("nssm:berinhog", {
end end
end end
}) })

View File

@ -7,7 +7,7 @@ mobs:register_mob("nssm:black_scorpion", {
visual = "mesh", visual = "mesh",
mesh = "scorpion.x", mesh = "scorpion.x",
textures = {{"scorpion.png"}}, textures = {{"scorpion.png"}},
visual_size = {x=7, y=7}, visual_size = {x = 7, y = 7},
makes_footstep_sound = true, makes_footstep_sound = true,
view_range = 22, view_range = 22,
walk_velocity = 1, walk_velocity = 1,
@ -20,10 +20,7 @@ mobs:register_mob("nssm:black_scorpion", {
reach = 4, reach = 4,
jump = true, jump = true,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 1, max = 8},
chance = 1,
min = 1,
max = 8,},
}, },
armor = 50, armor = 50,
drawtype = "front", drawtype = "front",
@ -32,39 +29,35 @@ mobs:register_mob("nssm:black_scorpion", {
suffocation = 4, suffocation = 4,
lava_damage = 10, lava_damage = 10,
light_damage = 0, light_damage = 0,
group_attack=false, group_attack = false,
attack_animals=true, attack_animals = true,
blood_texture="nssm_blood_blue.png", blood_texture="nssm_blood_blue.png",
stepheight=1.1, stepheight = 1.1,
on_rightclick = nil,
-- double_melee_attack = true, -- double_melee_attack = true,
attack_type = "dogfight", attack_type = "dogfight",
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 30,
speed_run = 30, stand_start = 10, stand_end = 60,
stand_start = 10, walk_start = 70, walk_end = 110,
stand_end = 60, run_start = 70, run_end = 110,
walk_start = 70, punch_start = 160, punch_end = 180,
walk_end = 110, punch2_start = 120, punch2_end = 150,
run_start = 70, die_start = 190, die_end = 210,
run_end = 110,
punch_start = 160,
punch_end = 180,
punch2_start = 120,
punch2_end = 150,
die_start = 190,
die_end = 210,
}, },
custom_attack = function (self) custom_attack = function (self)
if math.random(30) == 1 then if math.random(30) == 1 then
self:set_animation("punch2") self:set_animation("punch2")
self.attack:punch(self.object, 1.0, { self.attack:punch(self.object, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,
damage_groups = {fleshy = self.damage*10} damage_groups = {fleshy = self.damage * 10}
}, nil) }, nil)
else else
self:set_animation("punch") self:set_animation("punch")
self.attack:punch(self.object, 1.0, { self.attack:punch(self.object, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,
damage_groups = {fleshy = self.damage} damage_groups = {fleshy = self.damage}
@ -99,8 +92,7 @@ mobs:register_mob("nssm:black_scorpion", {
on_die = function(self, pos) on_die = function(self, pos)
-- drop saddle when horse is killed while riding -- drop saddle when mob is killed while riding and detach player
-- also detach from horse properly
if self.driver then if self.driver then
minetest.add_item(pos, "mobs:saddle") minetest.add_item(pos, "mobs:saddle")
mobs.detach(self.driver, {x = 1, y = 0, z = 1}) mobs.detach(self.driver, {x = 1, y = 0, z = 1})
@ -115,17 +107,17 @@ mobs:register_mob("nssm:black_scorpion", {
return return
end end
-- feed, tame or heal horse -- feed, tame or heal
if mobs:feed_tame(self, clicker, 10, true, true) then if mobs:feed_tame(self, clicker, 10, true, true) then
return return
end end
-- make sure tamed horse is being clicked by owner only -- make sure tamed mob is being clicked by owner only
if self.tamed and self.owner == clicker:get_player_name() then if self.tamed and self.owner == clicker:get_player_name() then
local inv = clicker:get_inventory() local inv = clicker:get_inventory()
-- detatch player already riding horse -- detatch player already riding mob
if self.driver and clicker == self.driver then if self.driver and clicker == self.driver then
mobs.detach(clicker, {x = 1, y = 0, z = 1}) mobs.detach(clicker, {x = 1, y = 0, z = 1})
@ -137,7 +129,7 @@ mobs:register_mob("nssm:black_scorpion", {
minetest.add_item(clicker.getpos(), "mobs:saddle") minetest.add_item(clicker.getpos(), "mobs:saddle")
end end
-- attach player to horse -- attach player
elseif not self.driver elseif not self.driver
and clicker:get_wielded_item():get_name() == "mobs:saddle" then and clicker:get_wielded_item():get_name() == "mobs:saddle" then
@ -150,6 +142,7 @@ mobs:register_mob("nssm:black_scorpion", {
end end
-- used to capture horse with magic lasso -- used to capture horse with magic lasso
mobs:capture_mob(self, clicker, 0, 0, 80, false, nil) -- mobs:capture_mob(self, clicker, 0, 0, 80, false, nil)
end end
}) })

View File

@ -6,7 +6,7 @@ mobs:register_mob("nssm:chog", {
visual = "mesh", visual = "mesh",
mesh = "chog.x", mesh = "chog.x",
textures = {{"chog.png"}}, textures = {{"chog.png"}},
visual_size = {x=4, y=4}, visual_size = {x = 4, y = 4},
makes_footstep_sound = true, makes_footstep_sound = true,
view_range = 13, view_range = 13,
walk_velocity = 1, walk_velocity = 1,
@ -19,10 +19,7 @@ mobs:register_mob("nssm:chog", {
damage = 4, damage = 4,
jump = true, jump = true,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 3, max = 4},
chance = 1,
min = 3,
max = 4},
}, },
armor = 100, armor = 100,
drawtype = "front", drawtype = "front",
@ -30,28 +27,20 @@ mobs:register_mob("nssm:chog", {
lava_damage = 15, lava_damage = 15,
light_damage = 0, light_damage = 0,
suffocation = 6, suffocation = 6,
--group_attack=true, -- group_attack = true,
--attack_animals=true, -- attack_animals = true,
knock_back=2, knock_back = 2,
blood_texture="nssm_blood.png", blood_texture = "nssm_blood.png",
stepheight=1.1, stepheight = 1.1,
on_rightclick = nil,
attack_type = "dogfight", attack_type = "dogfight",
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 20,
speed_run = 20, stand_start = 0, stand_end = 50,
stand_start = 0, walk_start = 60, walk_end = 100,
stand_end = 50, run_start = 110, run_end = 130,
walk_start = 60, punch_start = 220, punch_end = 240,
walk_end = 100, shoot_start =170, shoot_end = 210,
run_start = 110, die_start = 140, die_end = 160, speed_die = 10,
run_end = 130,
punch_start = 220,
punch_end = 240,
shoot_start =170,
shoot_end=210,
speed_die = 10,
die_start = 140,
die_end = 160,
}, },
}) })

View File

@ -6,56 +6,45 @@ mobs:register_mob("nssm:crystal_slug", {
visual = "mesh", visual = "mesh",
mesh = "crystal_slug.x", mesh = "crystal_slug.x",
textures = {{"crystal_slug.png"}}, textures = {{"crystal_slug.png"}},
visual_size = {x=4, y=4}, visual_size = {x = 4, y = 4},
view_range = 30, view_range = 30,
floats = 1, floats = 1,
rotate = 270, rotate = 270,
group_attack=true, group_attack = true,
attack_animals=false, attack_animals = false,
walk_velocity = 0.4, walk_velocity = 0.4,
run_velocity = 0.4, run_velocity = 0.4,
-- fall_speed = 0, -- fall_speed = 0,
stepheight = 1.1, stepheight = 1.1,
--[[ sounds = { -- sounds = {
random = "crystal_slug", -- random = "crystal_slug",
distance = 45, -- distance = 45,
},]] -- },
damage = 2, damage = 2,
jump = false, jump = false,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 1, max = 3},
chance = 1,
min = 1,
max = 3,},
}, },
armor = 70, armor = 70,
drawtype = "front", drawtype = "front",
water_damage = 5, water_damage = 5,
lava_damage = 10, lava_damage = 10,
light_damage = 0, light_damage = 0,
blood_texture="nssm_blood_blue.png", blood_texture = "nssm_blood_blue.png",
blood_amount=10, blood_amount = 10,
on_rightclick = nil,
attack_type = "shoot", attack_type = "shoot",
shoot_offset = 1, shoot_offset = 1,
arrow = "nssm:crystal_gas_arrow", arrow = "nssm:crystal_gas_arrow",
reach = 1, reach = 1,
shoot_interval = 4, shoot_interval = 4,
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 20,
speed_run = 20, stand_start = 1, stand_end = 60,
stand_start = 1, walk_start = 160, walk_end = 190,
stand_end = 60, run_start = 160, run_end = 190,
walk_start = 160, punch_start = 100, punch_end = 150,
walk_end = 190, shoot_start = 100, shoot_end = 150,
run_start = 160, die_start = 70, die_end = 90, speed_die = 10,
run_end = 190,
punch_start = 100,
punch_end = 150,
shoot_start = 100,
shoot_end = 150,
speed_die = 10,
die_start = 70,
die_end = 90,
} }
}) })

View File

@ -6,23 +6,20 @@ mobs:register_mob("nssm:flust", {
visual = "mesh", visual = "mesh",
mesh = "flust.x", mesh = "flust.x",
textures = {{"flust.png"}}, textures = {{"flust.png"}},
visual_size = {x=6, y=6}, visual_size = {x = 6, y = 6},
makes_footstep_sound = true, makes_footstep_sound = true,
view_range = 16, view_range = 16,
fear_height = 4, fear_height = 4,
walk_velocity = 0.8, walk_velocity = 0.8,
run_velocity = 2.4, run_velocity = 2.4,
--[[sounds = { -- sounds = {
random = "flust", -- random = "flust",
},]] -- },
damage = 4, damage = 4,
reach = 4, reach = 4,
jump = true, jump = true,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 1, max = 1},
chance = 1,
min = 1,
max = 1,},
}, },
armor = 50, armor = 50,
drawtype = "front", drawtype = "front",
@ -30,27 +27,27 @@ mobs:register_mob("nssm:flust", {
lava_damage = 8, lava_damage = 8,
light_damage = 0, light_damage = 0,
suffocation = 4, suffocation = 4,
group_attack=true, group_attack = true,
attack_animals= false, attack_animals = false,
knock_back=1, knock_back = 1,
blood_texture="nssm_blood_blue.png", blood_texture="nssm_blood_blue.png",
--Flust is immune to iron weapons immune_to = {
immune_to={{'default:sword_iron', -6},{'default:iron_lump', -8}, {'default:steel_block', -20}, {'default:axe_iron', -4}, {'default:shovel_iron', -4}, {'default:pick_iron', -6}}, {"default:sword_iron", -6}, --Flust is immune to iron weapons
stepheight=2.1, {"default:iron_lump", -8},
on_rightclick = nil, {"default:steel_block", -20},
{"default:axe_iron", -4},
{"default:shovel_iron", -4},
{"default:pick_iron", -6}
},
stepheight = 2.1,
attack_type = "dogfight", attack_type = "dogfight",
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 40,
speed_run = 40, stand_start = 10, stand_end = 60,
stand_start = 10, walk_start = 140, walk_end = 180,
stand_end = 60, run_start = 140, run_end = 180,
walk_start = 140, punch_start = 100, punch_end = 130,
walk_end = 180, die_start = 70, die_end = 90,
run_start = 140,
run_end = 180,
punch_start = 100,
punch_end = 130,
die_start = 70,
die_end = 90,
} }
}) })

View File

@ -6,7 +6,7 @@ mobs:register_mob("nssm:icelizard", {
visual = "mesh", visual = "mesh",
mesh = "icelizard.x", mesh = "icelizard.x",
textures = {{"snow_biter.png"}}, textures = {{"snow_biter.png"}},
visual_size = {x=9, y=9}, visual_size = {x = 9, y = 9},
makes_footstep_sound = true, makes_footstep_sound = true,
view_range = 30, view_range = 30,
rotate = 270, rotate = 270,
@ -18,26 +18,14 @@ mobs:register_mob("nssm:icelizard", {
sounds = { sounds = {
random = "snow_biter", random = "snow_biter",
}, },
--pathfinding = true, -- pathfinding = true,
damage = 4, damage = 4,
jump = true, jump = true,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 2, max = 3},
chance = 1, {name = "nssm:frosted_amphibian_heart", chance = 2, min = 1, max = 1},
min = 2, {name = "nssm:amphibian_ribs", chance = 2, min = 1, max = 1},
max = 3}, {name = "nssm:little_ice_tooth", chance = 2, min = 0, max = 4},
{name = "nssm:frosted_amphibian_heart",
chance = 2,
min = 1,
max = 1},
{name = "nssm:amphibian_ribs",
chance = 2,
min = 1,
max = 1},
{name = "nssm:little_ice_tooth",
chance = 2,
min = 0,
max = 4},
}, },
armor = 80, armor = 80,
drawtype = "front", drawtype = "front",
@ -48,39 +36,40 @@ mobs:register_mob("nssm:icelizard", {
group_attack = true, group_attack = true,
attack_animals = false, attack_animals = false,
knock_back = 2, knock_back = 2,
blood_texture="nssm_blood.png", blood_texture = "nssm_blood.png",
stepheight=1.1, stepheight = 1.1,
on_rightclick = nil,
attack_type = "dogfight", attack_type = "dogfight",
die_anim = true,
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 40, speed_punch = 5,
speed_run = 40, stand_start = 0, stand_end = 80,
speed_punch = 5, walk_start = 110, walk_end = 150,
stand_start = 0, run_start = 110, run_end = 150,
stand_end = 80, die_start = 80, die_end = 100,
walk_start = 110, punch_start = 160, punch_end = 170,
walk_end = 150,
run_start = 110,
run_end = 150,
die_start = 80,
die_end = 100,
punch_start = 160,
punch_end = 170,
}, },
custom_attack = function(self) custom_attack = function(self)
self.icelizard_timer = self.icelizard_timer or os.time() self.icelizard_timer = self.icelizard_timer or os.time()
self:set_animation("punch") self:set_animation("punch")
if (os.time()-self.icelizard_timer) > 0.9 then
if (os.time() - self.icelizard_timer) > 0.9 then
local pos = self.object:get_pos() local pos = self.object:get_pos()
nssm:tnt_boom_nssm(pos, { nssm:tnt_boom_nssm(pos, {
damage_radius=0, damage_radius = 0,
radius=2, radius = 2,
ignore_protection = false},"nssm:coldest_ice", false) ignore_protection = false
},"nssm:coldest_ice", false)
self.object:remove() self.object:remove()
end end
end, end,
do_custom = function(self) do_custom = function(self)
nssm:putting_ability(self, "default:ice", self.run_velocity) nssm:putting_ability(self, "default:ice", self.run_velocity)
end, end,
}) })

View File

@ -6,23 +6,20 @@ mobs:register_mob("nssm:kele", {
visual = "mesh", visual = "mesh",
mesh = "kele.x", mesh = "kele.x",
textures = {{"kele.png"}}, textures = {{"kele.png"}},
visual_size = {x=5, y=5}, visual_size = {x = 5, y = 5},
makes_footstep_sound = true, makes_footstep_sound = true,
view_range = 30, view_range = 30,
walk_velocity = 1, walk_velocity = 1,
rotate = 270, rotate = 270,
fear_height = 4, fear_height = 4,
run_velocity = 5, run_velocity = 5,
--[[sounds = { -- sounds = {
random = "kele", -- random = "kele",
},]] -- },
damage = 4, damage = 4,
jump = true, jump = true,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 3, max = 4},
chance = 1,
min = 3,
max = 4},
}, },
armor = 60, armor = 60,
drawtype = "front", drawtype = "front",
@ -30,45 +27,45 @@ mobs:register_mob("nssm:kele", {
lava_damage = 15, lava_damage = 15,
light_damage = 0, light_damage = 0,
suffocation = 4, suffocation = 4,
--group_attack=true, -- group_attack = true,
--attack_animals=true, -- attack_animals = true,
knock_back = 1, knock_back = 1,
blood_texture="nssm_blood.png", blood_texture = "nssm_blood.png",
stepheight=2.1, stepheight = 2.1,
on_rightclick = nil,
attack_type = "dogfight", attack_type = "dogfight",
specific_attack = {"player", "nssm:felucco"}, specific_attack = {"player", "nssm:felucco"},
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 25,
speed_run = 25, stand_start = 200, stand_end = 250,
stand_start = 200, walk_start = 40, walk_end = 80,
stand_end = 250, run_start = 10, run_end = 30,
walk_start = 40, punch_start = 130, punch_end = 160,
walk_end = 80, punch2_start = 90, punch2_end = 120,
run_start = 10, die_start = 170, die_end = 190,
run_end = 30,
punch_start = 130,
punch_end = 160,
punch2_start = 90,
punch2_end = 120,
die_start = 170,
die_end = 190,
}, },
custom_attack = function (self) custom_attack = function (self)
self.kele_timer = (self.kele_timer or os.time()) self.kele_timer = (self.kele_timer or os.time())
if (os.time() - self.kele_timer) > 1 then if (os.time() - self.kele_timer) > 1 then
self.kele_timer = os.time() self.kele_timer = os.time()
local s = self.object:get_pos() local s = self.object:get_pos()
local p = self.attack:get_pos() local p = self.attack:get_pos()
if minetest.line_of_sight({x = p.x, y = p.y +1.5, z = p.z}, {x = s.x, y = s.y +1.5, z = s.z}) == true then if minetest.line_of_sight(
{x = p.x, y = p.y +1.5, z = p.z},
{x = s.x, y = s.y +1.5, z = s.z}) == true then
if self.health > 10 then if self.health > 10 then
self:set_animation("punch") self:set_animation("punch")
else else
self:set_animation("punch2") self:set_animation("punch2")
self.health = self.health + (self.damage*2) self.health = self.health + (self.damage * 2)
end end
-- play attack sound -- play attack sound
if self.sounds.attack then if self.sounds.attack then
minetest.sound_play(self.sounds.attack, { minetest.sound_play(self.sounds.attack, {
@ -79,9 +76,10 @@ mobs:register_mob("nssm:kele", {
-- punch player -- punch player
self.attack:punch(self.object, 1.0, { self.attack:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval=1.0,
damage_groups = {fleshy=self.damage} damage_groups = {fleshy = self.damage}
}, nil) }, nil)
end end
end end
end, end,
}) })

View File

@ -6,8 +6,8 @@ mobs:register_mob("nssm:pelagia", {
visual = "mesh", visual = "mesh",
mesh = "pelagia.x", mesh = "pelagia.x",
textures = {{"pelagia.png"}}, textures = {{"pelagia.png"}},
visual_size = {x=4, y=4}, visual_size = {x = 4, y = 4},
view_range =5, view_range = 5,
fly = true, fly = true,
fly_in = "default:water_source", fly_in = "default:water_source",
fall_speed = -20, fall_speed = -20,
@ -20,32 +20,24 @@ mobs:register_mob("nssm:pelagia", {
jump_chance = 0, jump_chance = 0,
jump_height = 0, jump_height = 0,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 2, max = 7},
chance = 1,
min = 2,
max = 7,},
}, },
armor = 100, armor = 100,
drawtype = "front", drawtype = "front",
water_damage = 0, water_damage = 0,
lava_damage = 10, lava_damage = 10,
light_damage = 0, light_damage = 0,
group_attack=true, group_attack = true,
attack_animals=false, attack_animals = false,
knock_back=4, knock_back = 4,
blood_texture="nssm_blood_blue.png", blood_texture = "nssm_blood_blue.png",
on_rightclick = nil,
attack_type = "dogfight", attack_type = "dogfight",
animation = { animation = {
speed_normal = 25, speed_normal = 25, speed_run = 35,
speed_run = 35, stand_start = 1, stand_end = 80,
stand_start = 1, walk_start = 1, walk_end = 80,
stand_end = 80, run_start = 100, run_end = 120,
walk_start = 1, punch_start = 140, punch_end = 180,
walk_end = 80,
run_start = 100,
run_end = 120,
punch_start = 140,
punch_end = 180,
} }
}) })

View File

@ -6,27 +6,24 @@ mobs:register_mob("nssm:pumpkid", {
visual = "mesh", visual = "mesh",
mesh = "pumpkid.x", mesh = "pumpkid.x",
textures = {{"pump.png"}}, textures = {{"pump.png"}},
visual_size = {x=3, y=3}, visual_size = {x = 3, y = 3},
view_range = 30, view_range = 30,
floats=0, floats = 0,
rotate = 180, rotate = 180,
group_attack=true, group_attack = true,
attack_animals=false, attack_animals = false,
walk_velocity = 0.6, walk_velocity = 0.6,
run_velocity = 0.6, run_velocity = 0.6,
-- fall_speed = 0, -- fall_speed = 0,
stepheight = 1.1, stepheight = 1.1,
--[[ sounds = { -- sounds = {
random = "pumpkid", -- random = "pumpkid",
distance = 45, -- distance = 45,
},]] -- },
damage = 2, damage = 2,
jump = true, jump = true,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 1, max = 3},
chance = 1,
min = 1,
max = 3,},
}, },
armor = 50, armor = 50,
drawtype = "front", drawtype = "front",
@ -34,28 +31,21 @@ mobs:register_mob("nssm:pumpkid", {
lava_damage = 13, lava_damage = 13,
light_damage = 0, light_damage = 0,
suffocation = 4, suffocation = 4,
blood_texture="nssm_blood.png", blood_texture = "nssm_blood.png",
blood_amount=10, blood_amount = 10,
on_rightclick = nil,
attack_type = "shoot", attack_type = "shoot",
shoot_offset = 1, shoot_offset = 1,
arrow = "nssm:pumpkid_bomb", arrow = "nssm:pumpkid_bomb",
reach = 1, reach = 1,
shoot_interval = 4, shoot_interval = 4,
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 20,
speed_run = 20, stand_start = 0, stand_end = 40,
stand_start = 0, walk_start = 60, walk_end = 100,
stand_end = 40, run_start = 60, run_end = 100,
walk_start = 60, punch_start = 110, punch_end = 210,
walk_end = 100, shoot_start = 110, shoot_end = 210,
run_start = 60, die_start = 220, die_end = 240,
run_end = 100,
punch_start = 110,
punch_end = 210,
shoot_start = 110,
shoot_end = 210,
die_start = 220,
die_end = 240,
} }
}) })

View File

@ -1,21 +1,29 @@
local function mud_attack (self) -- replace soil with mud local function mud_attack (self) -- replace soil with mud
self.mud_timer = os.time() self.mud_timer = os.time()
local radius = 10
self:set_animation("shoot") self:set_animation("shoot")
local radius = 10
local s = self.object:get_pos() local s = self.object:get_pos()
local vec = {x=radius,y=1,z=radius} local vec = {x=radius,y=1,z=radius}
minetest.after(0.5, function (self) minetest.after(0.5, function (self)
local poslist = minetest.find_nodes_in_area(vector.subtract(s, vec), vector.add(s,vec), "group:crumbly")
local poslist = minetest.find_nodes_in_area(
vector.subtract(s, vec), vector.add(s,vec), "group:crumbly")
for _,v in pairs(poslist) do for _,v in pairs(poslist) do
local l = vector.length(vector.subtract(v,s))
local l = vector.length(vector.subtract(v, s))
if l <= radius and not minetest.is_protected(v, "") then if l <= radius and not minetest.is_protected(v, "") then
minetest.set_node(v, {name="nssm:mud"}) minetest.set_node(v, {name = "nssm:mud"})
end end
end end
end, self) end, self)
end end
mobs:register_mob("nssm:river_lord", { mobs:register_mob("nssm:river_lord", {
type = "monster", type = "monster",
hp_max = 210, hp_max = 210,
@ -24,23 +32,20 @@ mobs:register_mob("nssm:river_lord", {
visual = "mesh", visual = "mesh",
mesh = "river_lord.x", mesh = "river_lord.x",
textures = {{"river_lord.png"}}, textures = {{"river_lord.png"}},
visual_size = {x=4, y=4}, visual_size = {x = 4, y = 4},
makes_footstep_sound = true, makes_footstep_sound = true,
view_range = 30, view_range = 30,
walk_velocity = 0.6, walk_velocity = 0.6,
rotate = 270, rotate = 270,
fear_height = 4, fear_height = 4,
run_velocity = 4, run_velocity = 4,
--[[sounds = { -- sounds = {
random = "river_lord", -- random = "river_lord",
},]] -- },
damage = 10, damage = 10,
jump = true, jump = true,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 70, max = 90},
chance = 1,
min = 70,
max = 90},
}, },
armor = 50, armor = 50,
drawtype = "front", drawtype = "front",
@ -48,46 +53,41 @@ mobs:register_mob("nssm:river_lord", {
lava_damage = 2, lava_damage = 2,
reach = 8, reach = 8,
light_damage = 0, light_damage = 0,
--group_attack=true, -- group_attack=true,
--attack_animals=true, -- attack_animals=true,
knock_back=0, knock_back = 0,
blood_texture="nssm_blood.png", blood_texture = "nssm_blood.png",
stepheight=2.1, stepheight = 2.1,
on_rightclick = nil,
attack_type = "dogfight", attack_type = "dogfight",
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 20,
speed_run = 20, stand_start = 20, stand_end = 100,
stand_start = 20, walk_start = 110, walk_end = 150,
stand_end = 100, run_start = 160, run_end = 180,
walk_start = 110, punch_start = 260, punch_end = 280,
walk_end = 150, punch2_start = 230, punch2_end = 250, -- used for charge
run_start = 160, die_start = 290, die_end = 310, speed_die = 10,
run_end = 180, shoot_start = 190, shoot_end = 220, speed_shoot = 20,
punch_start = 260,
punch_end = 280,
punch2_start = 230, --charge_start
punch2_end = 250, --charge_end
die_start = 290,
die_end = 310,
speed_die = 10,
shoot_start = 190, --Arena di fango inizio: 190
shoot_end = 220, --Arena di fango fine: 220
speed_shoot = 20,
}, },
do_custom = function (self) do_custom = function (self)
if self.other_state and self.other_state == "charge" then if self.other_state and self.other_state == "charge" then
nssm:do_charge(self) nssm:do_charge(self)
end end
end, end,
custom_attack = function (self) custom_attack = function (self)
if self.mud_timer then if self.mud_timer then
if os.time() - self.mud_timer > 15 then if os.time() - self.mud_timer > 15 then
mud_attack(self) mud_attack(self)
else else
local s = self.object:get_pos() local s = self.object:get_pos()
local p = self.attack:get_pos() local p = self.attack:get_pos()
local l = vector.length(vector.subtract(p,s)) local l = vector.length(vector.subtract(p,s))
nssm:charge_attack(self) nssm:charge_attack(self)
end end
else else

View File

@ -6,7 +6,7 @@ mobs:register_mob("nssm:salamander", {
visual = "mesh", visual = "mesh",
mesh = "salamander.x", mesh = "salamander.x",
textures = {{"salamander.png"}}, textures = {{"salamander.png"}},
visual_size = {x=10, y=10}, visual_size = {x = 10, y = 10},
fear_height = 4, fear_height = 4,
makes_footstep_sound = true, makes_footstep_sound = true,
view_range = 24, view_range = 24,
@ -15,10 +15,7 @@ mobs:register_mob("nssm:salamander", {
damage = 6, damage = 6,
jump = true, jump = true,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 1, max = 2},
chance = 1,
min = 1,
max = 2,},
}, },
armor = 80, armor = 80,
drawtype = "front", drawtype = "front",
@ -26,12 +23,11 @@ mobs:register_mob("nssm:salamander", {
lava_damage = 0, lava_damage = 0,
light_damage = 0, light_damage = 0,
follow = {"farming:wheat"}, follow = {"farming:wheat"},
group_attack=true, group_attack = true,
attack_animals=true, attack_animals = true,
knock_back=2, knock_back = 2,
blood_texture="nssm_blood.png", blood_texture = "nssm_blood.png",
stepheight=1.1, stepheight = 1.1,
on_rightclick = nil,
dogshoot_switch = true, dogshoot_switch = true,
attack_type = "dogshoot", attack_type = "dogshoot",
arrow = "nssm:lava_block_bomb", arrow = "nssm:lava_block_bomb",
@ -39,42 +35,39 @@ mobs:register_mob("nssm:salamander", {
shoot_interval = 2, shoot_interval = 2,
shoot_offset = 2, shoot_offset = 2,
animation = { animation = {
speed_normal = 25, speed_normal = 25, speed_run = 35,
speed_run = 35, stand_start = 0, stand_end = 80,
stand_start = 0, walk_start = 110, walk_end = 150,
stand_end = 80, run_start = 110, run_end = 150,
walk_start = 110, punch_start = 160, punch_end = 180,
walk_end = 150, shoot_start = 200, shoot_end = 250,
run_start = 110, die_start = 80, die_end = 100,
run_end = 150, -- swim_start = 260, swim_end = 300,
punch_start = 160,
punch_end = 180,
shoot_start = 200,
shoot_end = 250,
die_start = 80,
die_end = 100,
--[[
swim_start = 260,
swim_end = 300,
]]
}, },
custom_attack = function(self) custom_attack = function(self)
local p = self.attack:get_pos() local p = self.attack:get_pos()
local s = self.object:get_pos() local s = self.object:get_pos()
local ss = {x = s.x, y = s.y +0.5, z = s.z} local ss = {x = s.x, y = s.y +0.5, z = s.z}
local pp = {x = p.x, y = p.y +1.5, z = p.z} local pp = {x = p.x, y = p.y +1.5, z = p.z}
local vel = vector.subtract(pp,ss) local vel = vector.subtract(pp,ss)
self:set_animation("punch") self:set_animation("punch")
if minetest.line_of_sight({x = p.x, y = p.y +1.5, z = p.z}, {x = s.x, y = s.y +1.5, z = s.z}) == true then if minetest.line_of_sight(
{x = p.x, y = p.y +1.5, z = p.z},
{x = s.x, y = s.y +1.5, z = s.z}) == true then
-- play attack sound -- play attack sound
if self.sounds.attack then if self.sounds.attack then
minetest.sound_play(self.sounds.attack, { minetest.sound_play(self.sounds.attack, {
object = self.object, object = self.object,
max_hear_distance = self.sounds.distance max_hear_distance = self.sounds.distance
}, true) }, true)
end end
-- punch player -- punch player
self.attack:punch(self.object, 1.0, { self.attack:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval=1.0,
@ -83,23 +76,22 @@ mobs:register_mob("nssm:salamander", {
end end
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 25, --amount amount = 25,
time = 0.5, --time time = 0.5,
minpos = ss, --minpos minpos = ss,
maxpos = ss, --maxpos maxpos = ss,
minvel = vector.multiply(vel, 2), --minvel minvel = vector.multiply(vel, 2),
maxvel = vector.multiply(vel, 4), --maxvel maxvel = vector.multiply(vel, 4),
minacc = {x=0,y=0,z=0}, --minacc minacc = {x = 0, y = 0, z = 0},
maxacc = {x=0,y=0,z=0}, --maxacc maxacc = {x = 0, y = 0, z = 0},
minexptime = 1, --minexptime minexptime = 1,
maxexptime = 1.5, --maxexptime maxexptime = 1.5,
minsize = 5, --minsize minsize = 5,
maxsize = 10, --maxsize maxsize = 10,
collisiondetection = true, --collisiondetection collisiondetection = true,
texture = "phoenix_fire.png" --texture texture = "phoenix_fire.png"
}) })
end, end,
do_custom = function(self, dtime) do_custom = function(self, dtime)
@ -115,7 +107,7 @@ end,
self.driver_scale = {x = 0.09, y = 0.09} self.driver_scale = {x = 0.09, y = 0.09}
end end
-- if driver present allow control of horse -- if driver present allow control of mob
if self.driver then if self.driver then
--mobs.fly(self, dtime, 6, true, "nssm:lava_block_bomb", "run", "stand") --mobs.fly(self, dtime, 6, true, "nssm:lava_block_bomb", "run", "stand")
@ -129,8 +121,7 @@ end,
on_die = function(self, pos) on_die = function(self, pos)
-- drop saddle when horse is killed while riding -- drop saddle when mob is killed while riding and detatch properly
-- also detach from horse properly
if self.driver then if self.driver then
minetest.add_item(pos, "mobs:saddle") minetest.add_item(pos, "mobs:saddle")
mobs.detach(self.driver, {x = 1, y = 0, z = 1}) mobs.detach(self.driver, {x = 1, y = 0, z = 1})
@ -145,12 +136,12 @@ end,
return return
end end
-- feed, tame or heal horse -- feed, tame or heal
if mobs:feed_tame(self, clicker, 10, true, true) then if mobs:feed_tame(self, clicker, 10, true, true) then
return return
end end
-- make sure tamed horse is being clicked by owner only -- make sure tamed mob is being clicked by owner only
if self.tamed and self.owner == clicker:get_player_name() then if self.tamed and self.owner == clicker:get_player_name() then
local inv = clicker:get_inventory() local inv = clicker:get_inventory()
@ -167,7 +158,7 @@ end,
minetest.add_item(clicker.getpos(), "mobs:saddle") minetest.add_item(clicker.getpos(), "mobs:saddle")
end end
-- attach player to horse -- attach player
elseif not self.driver elseif not self.driver
and clicker:get_wielded_item():get_name() == "mobs:saddle" then and clicker:get_wielded_item():get_name() == "mobs:saddle" then
@ -180,6 +171,7 @@ end,
end end
-- used to capture horse with magic lasso -- used to capture horse with magic lasso
mobs:capture_mob(self, clicker, 0, 0, 80, false, nil) -- mobs:capture_mob(self, clicker, 0, 0, 80, false, nil)
end end
}) })

View File

@ -6,7 +6,7 @@ mobs:register_mob("nssm:silver_sandonisc", {
visual = "mesh", visual = "mesh",
mesh = "silver_sandonisc.x", mesh = "silver_sandonisc.x",
textures = {{"silver_sandonisc.png"}}, textures = {{"silver_sandonisc.png"}},
visual_size = {x=8, y=8}, visual_size = {x = 8, y = 8},
makes_footstep_sound = false, makes_footstep_sound = false,
view_range = 24, view_range = 24,
rotate = 270, rotate = 270,
@ -16,51 +16,43 @@ mobs:register_mob("nssm:silver_sandonisc", {
run_velocity = 5, run_velocity = 5,
damage = 5, damage = 5,
-- sounds = { -- sounds = {
-- random = "silver_sandonisc", -- random = "silver_sandonisc",
--distance = 40, -- distance = 40,
--}, -- },
jump = false, jump = false,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 2, max = 3},
chance = 1,
min = 2,
max = 3,},
}, },
armor = 30, armor = 30,
drawtype = "front", drawtype = "front",
water_damage = 5, water_damage = 5,
lava_damage = 15, lava_damage = 15,
light_damage = 0, light_damage = 0,
group_attack=true, group_attack = true,
attack_animals=false, attack_animals = false,
knock_back=1, knock_back = 1,
blood_texture="nssm_blood_blue.png", blood_texture = "nssm_blood_blue.png",
stepheight=1.1, stepheight = 1.1,
on_rightclick = nil,
attack_type = "dogfight", attack_type = "dogfight",
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 30,
speed_run = 30, stand_start = 170, stand_end = 230,
stand_start = 170, walk_start = 80, walk_end = 120,
stand_end = 230, run_start = 40, run_end = 70,
walk_start = 80, punch_start = 130, punch_end = 160,
walk_end = 120, punch2_start = 40, punch2_end = 70, speed_punch2 = 40,
run_start = 40, die_start = 235, die_end = 255,
run_end = 70,
punch_start = 130,
punch_end = 160,
punch2_start = 40,
punch2_end = 70,
speed_punch2 = 40,
die_start = 235,
die_end = 255,
}, },
do_custom = function (self) do_custom = function (self)
if self.other_state and self.other_state == "charge" then if self.other_state and self.other_state == "charge" then
nssm:do_charge(self) nssm:do_charge(self)
end end
end, end,
custom_attack = function (self) custom_attack = function (self)
nssm:charge_attack(self) nssm:charge_attack(self)
end, end,
}) })

View File

@ -6,28 +6,22 @@ mobs:register_mob("nssm:silversand_dragon", {
visual = "mesh", visual = "mesh",
mesh = "silversand_dragon.x", mesh = "silversand_dragon.x",
textures = {{"silversand_dragon.png"}}, textures = {{"silversand_dragon.png"}},
visual_size = {x=18, y=18}, visual_size = {x = 18, y = 18},
view_range = 40, view_range = 40,
lifetimer = 500, lifetimer = 500,
rotate = 270, rotate = 270,
walk_velocity = 1, walk_velocity = 1,
run_velocity = 3, run_velocity = 3,
stepheight = 2.1, stepheight = 2.1,
--[[sounds = { -- sounds = {
random = "silversand_dragon", -- random = "silversand_dragon",
distance = 45, -- distance = 45,
},]] -- },
damage = 1, damage = 1,
jump = false, jump = false,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 70, max = 80},
chance = 1, {name = "nssm:sun_feather", chance = 1, min = 1, max = 1},
min = 70,
max = 80,},
{name = "nssm:sun_feather",
chance = 1,
min = 1,
max = 1,},
}, },
armor = 40, armor = 40,
drawtype = "front", drawtype = "front",
@ -35,67 +29,66 @@ mobs:register_mob("nssm:silversand_dragon", {
lava_damage = 3, lava_damage = 3,
light_damage = 0, light_damage = 0,
blood_texture="silversand_particle.png", blood_texture="silversand_particle.png",
blood_amount=50, blood_amount = 50,
on_rightclick = nil,
attack_type = "dogfight", attack_type = "dogfight",
reach = 15, reach = 15,
shoot_interval = 4, shoot_interval = 4,
animation = { animation = {
speed_normal = 25, speed_normal = 25, speed_run = 50,
speed_run = 50, stand_start = 0, stand_end = 60,
speed_die = 20, walk_start = 70, walk_end = 110,
stand_start = 0, run_start = 70, run_end = 110,
stand_end = 60, punch_start = 80, punch_end = 110,
walk_start = 70, shoot_start = 80, shoot_end = 110,
walk_end = 110, die_start = 120, die_end = 140, speed_die = 20,
run_start = 70,
run_end = 110,
punch_start = 80,
punch_end = 110,
shoot_start = 80,
shoot_end = 110,
die_start = 120,
die_end = 140,
}, },
custom_attack = function(self) custom_attack = function(self)
local p = self.attack:get_pos() local p = self.attack:get_pos()
local s = self.object:get_pos() local s = self.object:get_pos()
local ss = {x = s.x, y = s.y +0.5, z = s.z} local ss = {x = s.x, y = s.y +0.5, z = s.z}
local pp = {x = p.x, y = p.y +1.5, z = p.z} local pp = {x = p.x, y = p.y +1.5, z = p.z}
local vel = vector.subtract(pp,ss) local vel = vector.subtract(pp,ss)
self:set_animation("punch") self:set_animation("punch")
if minetest.line_of_sight({x = p.x, y = p.y +1.5, z = p.z}, {x = s.x, y = s.y +1.5, z = s.z}) == true then if minetest.line_of_sight(
{x = p.x, y = p.y +1.5, z = p.z},
{x = s.x, y = s.y +1.5, z = s.z}) == true then
-- play attack sound -- play attack sound
if self.sounds.attack then if self.sounds.attack then
minetest.sound_play(self.sounds.attack, { minetest.sound_play(self.sounds.attack, {
object = self.object, object = self.object,
max_hear_distance = self.sounds.distance max_hear_distance = self.sounds.distance
}, true) }, true)
end end
-- punch player -- punch player
self.attack:punch(self.object, 1.0, { self.attack:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval=1.0,
damage_groups = {fleshy=self.damage} damage_groups = {fleshy = self.damage}
}, nil) }, nil)
end end
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 225, --amount amount = 225,
time = 0.5, --time time = 0.5,
minpos = ss, --minpos minpos = ss,
maxpos = ss, --maxpos maxpos = ss,
minvel = vector.multiply(vel, 2), --minvel minvel = vector.multiply(vel, 2),
maxvel = vector.multiply(vel, 4), --maxvel maxvel = vector.multiply(vel, 4),
minacc = {x=0,y=0,z=0}, --minacc minacc = {x = 0, y = 0, z = 0},
maxacc = {x=0,y=0,z=0}, --maxacc maxacc = {x = 0, y = 0, z = 0},
minexptime = 4, --minexptime minexptime = 4,
maxexptime = 5, --maxexptime maxexptime = 5,
minsize = 5, --minsize minsize = 5,
maxsize = 10, --maxsize maxsize = 10,
collisiondetection = true, --collisiondetection collisiondetection = true,
texture = "silversand_particle.png" --texture texture = "silversand_particle.png"
}) })
end end
}) })

View File

@ -6,7 +6,7 @@ mobs:register_mob("nssm:tartacacia", {
visual = "mesh", visual = "mesh",
mesh = "tartacacia.x", mesh = "tartacacia.x",
textures = {{"tartacacia.png"}}, textures = {{"tartacacia.png"}},
visual_size = {x=10, y=10}, visual_size = {x = 10, y = 10},
makes_footstep_sound = true, makes_footstep_sound = true,
view_range = 15, view_range = 15,
walk_velocity = 0.6, walk_velocity = 0.6,
@ -14,64 +14,54 @@ mobs:register_mob("nssm:tartacacia", {
reach=10, reach=10,
fear_height = 4, fear_height = 4,
run_velocity = 1.2, run_velocity = 1.2,
--[[sounds = { -- sounds = {
random = "tartacacia", -- random = "tartacacia",
},]] -- },
damage = 1, damage = 1,
jump = true, jump = true,
drops = { drops = {
{name = "nssm:life_energy", {name = "nssm:life_energy", chance = 1, min = 33, max = 43},
chance = 1, {name = "nssm:earth_sword", chance = 1, min = 1, max = 1},
min = 33,
max = 43},
{name = "nssm:earth_sword",
chance = 1,
min = 1,
max = 1},
}, },
armor = 50, armor = 50,
drawtype = "front", drawtype = "front",
water_damage = 2, water_damage = 2,
lava_damage = 5, lava_damage = 5,
light_damage = 0, light_damage = 0,
--group_attack=true, -- group_attack = true,
--attack_animals=true, -- attack_animals = true,
knock_back=0, knock_back = 0,
blood_texture="nssm_blood.png", blood_texture = "nssm_blood.png",
stepheight=2.1, stepheight = 2.1,
on_rightclick = nil,
attack_type = "dogfight", attack_type = "dogfight",
animation = { animation = {
speed_normal = 20, speed_normal = 20, speed_run = 40,
speed_run = 40, stand_start = 10, stand_end = 60,
stand_start = 10, walk_start = 70, walk_end = 150,
stand_end = 60, run_start = 70, run_end = 150,
walk_start = 70, punch_start = 190, punch_end = 220,
walk_end = 150, punch2_start = 230, punch2_end = 250,
run_start = 70, die_start = 160, die_end = 180, speed_die = 10,
run_end = 150,
punch_start = 190,
punch_end = 220,
punch2_start = 230,
punch2_end = 250,
speed_die = 10,
die_start = 160,
die_end = 180,
}, },
custom_attack = function (self) custom_attack = function (self)
local s = self.object:get_pos() local s = self.object:get_pos()
local p = self.attack:get_pos() local p = self.attack:get_pos()
local d = vector.subtract (p,s) local d = vector.subtract (p,s)
local l = vector.length(d) local l = vector.length(d)
-- minetest.chat_send_all("l="..l)
if math.random(5) == 1 then if math.random(5) == 1 then
if l <= 6 then if l <= 6 then
self:set_animation("punch") self:set_animation("punch")
for y = 0,3 do for y = 0,3 do
p.y = p.y - y p.y = p.y - y
minetest.remove_node(p) minetest.remove_node(p)
end end
self.attack:punch(self.object, 1.0, { self.attack:punch(self.object, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,
damage_groups = {fleshy = self.damage} damage_groups = {fleshy = self.damage}
@ -79,13 +69,16 @@ mobs:register_mob("nssm:tartacacia", {
end end
else else
self:set_animation("punch2") self:set_animation("punch2")
self.attack:punch(self.object, 1.0, { self.attack:punch(self.object, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,
damage_groups = {fleshy = self.damage} damage_groups = {fleshy = self.damage}
}, nil) }, nil)
if l < 4 then if l < 4 then
self.attack:setpos(vector.subtract(p, {x=0, y=2, z=0})) self.attack:set_pos(vector.subtract(p, {x = 0, y = 2, z = 0}))
end end
end end
end, end,
}) })

View File

@ -1,22 +1,29 @@
function nssm:do_charge(self) function nssm:do_charge(self)
self.state = "" self.state = ""
if self.charge_vec and self.charge_dir then if self.charge_vec and self.charge_dir then
self:set_animation("punch2") self:set_animation("punch2")
self.object:set_velocity(self.charge_vec) self.object:set_velocity(self.charge_vec)
self.object:set_yaw(self.charge_dir) self.object:set_yaw(self.charge_dir)
local prop = self.object:get_properties() local prop = self.object:get_properties()
local all_objects = minetest.get_objects_inside_radius(self.object:get_pos(), 1.5*prop.collisionbox[5]/2) local all_objects = minetest.get_objects_inside_radius(
local _,obj self.object:get_pos(), 1.5 * prop.collisionbox[5] / 2)
for _,obj in ipairs(all_objects) do for _,obj in ipairs(all_objects) do
if obj:is_player() then if obj:is_player() then
obj:set_hp(obj:get_hp()-self.damage/5) obj:set_hp(obj:get_hp() - self.damage / 5)
elseif obj:get_luaentity() and obj:get_luaentity().health and obj:get_luaentity().name ~= self.object:get_luaentity().name then elseif obj:get_luaentity() and obj:get_luaentity().health
obj:get_luaentity().health = obj:get_luaentity().health - self.damage/5 and obj:get_luaentity().name ~= self.object:get_luaentity().name then
obj:get_luaentity().health = obj:get_luaentity().health - self.damage / 5
end end
end end
end end
if self.charge_timer and os.time() - self.charge_timer > 5 then if self.charge_timer and os.time() - self.charge_timer > 5 then
self.other_state = "stand" self.other_state = "stand"
self.state = "stand" self.state = "stand"
@ -25,11 +32,13 @@ end
function nssm:charge_attack(self) function nssm:charge_attack(self)
local s = self.object:get_pos() local s = self.object:get_pos()
local p = self.attack:get_pos() local p = self.attack:get_pos()
local vec = vector.multiply(vector.normalize(vector.subtract(p,s)),self.run_velocity) local vec = vector.multiply(vector.normalize(
vector.subtract(p, s)), self.run_velocity)
if self.other_state and self.other_state == "charge" then --the mob was already charging if self.other_state and self.other_state == "charge" then -- mob was already charging
nssm:do_charge(self) nssm:do_charge(self)
else else
self.other_state = "charge" self.other_state = "charge"
@ -37,7 +46,9 @@ function nssm:charge_attack(self)
self.charge_vec = vec self.charge_vec = vec
self.charge_dir = self.object:get_yaw() self.charge_dir = self.object:get_yaw()
self.charge_timer = os.time() self.charge_timer = os.time()
nssm:do_charge(self) nssm:do_charge(self)
minetest.after(3, function(self) minetest.after(3, function(self)
self.other_state = "stand" self.other_state = "stand"
self.state = "stand" self.state = "stand"

View File

@ -1,30 +1,30 @@
if minetest.get_modpath("bows") then if minetest.get_modpath("bows") then
bows.register_bow("bow_berinhog",{ bows.register_bow("bow_berinhog",{
description="Berinhog Bow", description = "Berinhog Bow",
texture="bow_berinhog.png", texture = "bow_berinhog.png",
texture_loaded="bow_berinhog_loaded.png", texture_loaded = "bow_berinhog_loaded.png",
uses=400, uses = 400,
level=16, level = 16,
shots=1, shots = 1,
craft={ craft = {
{"","nssm:berinhog_horn","nssm:web_string"}, {"", "nssm:berinhog_horn", "nssm:web_string"},
{"group:stick","","nssm:web_string"}, {"group:stick", "", "nssm:web_string"},
{"","nssm:berinhog_horn","nssm:web_string"} {"", "nssm:berinhog_horn", "nssm:web_string"}
},
})
bows.register_arrow("arrow_ice",{
description="Ice Arrow",
texture="arrow_ice.png",
damage=12,
craft_count=4,
drop_chance = 10,
craft={
{"","",""},
{"nssm:little_ice_tooth","group:stick","nssm:duck_feather"},
{"","",""},
} }
}) })
bows.register_arrow("arrow_ice",{
description = "Ice Arrow",
texture = "arrow_ice.png",
damage = 12,
craft_count = 4,
drop_chance = 10,
craft = {
{"", "", ""},
{"nssm:little_ice_tooth", "group:stick", "nssm:duck_feather"},
{"", "", ""}
}
})
end end

View File

@ -1,93 +1,99 @@
--non eatable craftitems
-- non eatable craftitems
local function nssm_register_noneatcraftitems (name, descr) local function nssm_register_noneatcraftitems (name, descr)
minetest.register_craftitem(":nssm:"..name, { minetest.register_craftitem(":nssm:" .. name, {
description = descr, description = descr,
image = name..".png", image = name .. ".png",
}) })
end end
nssm_register_noneatcraftitems ('masticone_core','Masticone Core') nssm_register_noneatcraftitems ("masticone_core","Masticone Core")
nssm_register_noneatcraftitems ('berinhog_horn','Berinhog Horn') nssm_register_noneatcraftitems ("berinhog_horn","Berinhog Horn")
nssm_register_noneatcraftitems ('earth_heart','Earth Heart') nssm_register_noneatcraftitems ("earth_heart","Earth Heart")
minetest.register_craftitem(":nssm:cold_stars", { minetest.register_craftitem(":nssm:cold_stars", {
description = "Cold Stars", description = "Cold Stars",
image = "cold_stars.png", image = "cold_stars.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
for i=1,33 do
for i = 1, 33 do
local pos1 = minetest.get_pointed_thing_position(pointed_thing, true) local pos1 = minetest.get_pointed_thing_position(pointed_thing, true)
local dx = math.random(-20,20) local dx = math.random(-20, 20)
local dy = math.random(-3,20) local dy = math.random(-3, 20)
local dz = math.random(-20,20) local dz = math.random(-20, 20)
local pos1 = {x = pos1.x+dx, y=pos1.y+dy, z=pos1.z+dz} local pos1 = {x = pos1.x + dx, y = pos1.y + dy, z = pos1.z + dz}
if not minetest.is_protected(pos, "") or not minetest.get_item_group(minetest.get_node(pos).name, "unbreakable") == 1 then
minetest.set_node(pos1, {name="nssm:cold_star"}) if not minetest.is_protected(pos, "")
or not minetest.get_item_group(minetest.get_node(pos).name, "unbreakable") == 1 then
minetest.set_node(pos1, {name = "nssm:cold_star"})
minetest.get_node_timer(pos1):start(400) minetest.get_node_timer(pos1):start(400)
end end
end end
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack
end end
}) })
-- nodes
--nodes
minetest.register_node(":nssm:crystal_gas", { minetest.register_node(":nssm:crystal_gas", {
description = "Crystal Gas", description = "Crystal Gas",
--inventory_image = minetest.inventorycube("venomous_gas.png"),
drawtype = "airlike", drawtype = "airlike",
--tiles = {
--{name="venomous_gas_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
--},
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
--sunlight_propagates = true, -- sunlight_propagates = true,
pointable = false, pointable = false,
diggable = false, diggable = false,
buildable_to = true, buildable_to = true,
drop = "", drop = "",
drowning = 2, drowning = 2,
post_effect_color = {a=1000, r=1000, g=1000, b=1000}, post_effect_color = {a = 1000, r = 1000, g = 1000, b = 1000},
groups = {flammable = 2, not_in_creative_inventory =1}, groups = {flammable = 2, not_in_creative_inventory = 1},
}) })
minetest.register_node(":nssm:slug_crystal", { minetest.register_node(":nssm:slug_crystal", {
description = "Slug Crystal", description = "Slug Crystal",
tiles = {"slug_crystal.png"} , tiles = {"slug_crystal.png"},
paramtype = "light", paramtype = "light",
drawtype = "glasslike", drawtype = "glasslike",
drowning = 10, drowning = 10,
damage_per_second = 1, damage_per_second = 1,
drop = "", drop = "",
post_effect_color = {a=1000, r=1000, g=1000, b=1000}, post_effect_color = {a = 1000, r = 1000, g = 1000, b = 1000},
light_source = 2, light_source = 2,
groups = {cracky=1, not_in_creative_inventory =1}, groups = {cracky = 1, not_in_creative_inventory = 1},
}) })
minetest.register_node(":nssm:coldest_ice", { minetest.register_node(":nssm:coldest_ice", {
description = "Coldest Ice", description = "Coldest Ice",
tiles = {"coldest_ice.png"} , tiles = {"coldest_ice.png"},
paramtype = "light", paramtype = "light",
drowning = 2, drowning = 2,
damage_per_second = 1, damage_per_second = 1,
drop = "", drop = "",
light_source = 3, light_source = 3,
groups = {cracky=1, not_in_creative_inventory =1}, groups = {cracky = 1, not_in_creative_inventory = 1},
}) })
minetest.register_node(":nssm:mud", { minetest.register_node(":nssm:mud", {
description = "Mud", description = "Mud",
inventory_image = "mude.png", inventory_image = "mude.png",
tiles = { tiles = {
{name="mud_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=16.0}} {
name="mud_animated.png",
animation={
type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 16.0
}
}
}, },
walkable = false, walkable = false,
paramtype = "light", paramtype = "light",
@ -101,32 +107,36 @@ minetest.register_node(":nssm:mud", {
liquid_alternative_flowing = "nssm:mud", liquid_alternative_flowing = "nssm:mud",
liquid_alternative_source = "nssm:mud", liquid_alternative_source = "nssm:mud",
liquid_viscosity = 10, liquid_viscosity = 10,
groups = {crumbly=1, liquid=1}, groups = {crumbly = 1, liquid = 1},
}) })
-- Abms
minetest.register_abm({ minetest.register_abm({
nodenames = {"nssm:mud"}, nodenames = {"nssm:mud"},
neighbors = {"air"}, neighbors = {"air"},
interval = 15, interval = 15,
chance = 10, chance = 10,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local vec={x=1, y=1, z=1}
local poslist = minetest.find_nodes_in_area(vector.subtract(pos, vec), vector.add(pos,vec), "group:water") local vec={x = 1, y = 1, z = 1}
local poslist = minetest.find_nodes_in_area(
vector.subtract(pos, vec), vector.add(pos,vec), "group:water")
if #poslist == 0 then if #poslist == 0 then
minetest.set_node(pos, {name="default:dirt"}) minetest.set_node(pos, {name="default:dirt"})
end end
end end
}) })
--abms
minetest.register_abm({ minetest.register_abm({
nodenames = {"nssm:crystal_gas"}, nodenames = {"nssm:crystal_gas"},
interval = 1, interval = 1,
chance = 4, chance = 4,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "nssm:slug_crystal"}) minetest.set_node(pos, {name = "nssm:slug_crystal"})
end end
}) })
@ -134,63 +144,76 @@ minetest.register_abm({
nodenames = {"nssm:slug_crystal"}, nodenames = {"nssm:slug_crystal"},
interval = 20, interval = 20,
chance = 3, chance = 3,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "air"}) minetest.set_node(pos, {name = "air"})
end end
}) })
--Eggs -- Eggs
function nssm_register_egg (name, descr) local function nssm_register_egg(name, descr)
minetest.register_craftitem(":nssm:".. name, { minetest.register_craftitem(":nssm:" .. name, {
description = descr .. " Egg", description = descr .. " Egg",
image = name.."_egg.png", image = name .. "_egg.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos1=minetest.get_pointed_thing_position(pointed_thing, true)
pos1.y=pos1.y+1.5 local pos1 = minetest.get_pointed_thing_position(pointed_thing, true)
pos1.y=pos1.y + 1.5
core.after(0.1, function() core.after(0.1, function()
minetest.add_entity(pos1, "nssm:".. name) minetest.add_entity(pos1, "nssm:" .. name)
end) end)
if not mobs.is_creative(placer:get_player_name()) then if not mobs.is_creative(placer:get_player_name()) then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack
end, end,
}) })
end end
function nssm_register_egg2 (name, descr) --mobs you can't catch function nssm_register_egg2 (name, descr) -- mobs you can"t catch
minetest.register_craftitem(":nssm:".. name.."_egg", { minetest.register_craftitem(":nssm:" .. name .. "_egg", {
description = descr .. " Egg", description = descr .. " Egg",
image = name.."_egg.png", image = name .. "_egg.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos1=minetest.get_pointed_thing_position(pointed_thing, true)
pos1.y=pos1.y+1.5 local pos1 = minetest.get_pointed_thing_position(pointed_thing, true)
pos1.y = pos1.y + 1.5
core.after(0.1, function() core.after(0.1, function()
minetest.add_entity(pos1, "nssm:".. name) minetest.add_entity(pos1, "nssm:" .. name)
end) end)
if not mobs.is_creative(placer:get_player_name()) then if not mobs.is_creative(placer:get_player_name()) then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack
end, end,
}) })
end end
nssm_register_egg ('albino_spider', 'Albino Spider') nssm_register_egg("albino_spider", "Albino Spider")
nssm_register_egg ('chog', 'Chog') nssm_register_egg("chog", "Chog")
nssm_register_egg2 ('silversand_dragon', 'Silversand Dragon') nssm_register_egg2("silversand_dragon", "Silversand Dragon")
nssm_register_egg2 ('tartacacia', 'Tartacacia') nssm_register_egg2("tartacacia", "Tartacacia")
nssm_register_egg2 ('river_lord', 'River Lord') nssm_register_egg2("river_lord", "River Lord")
nssm_register_egg ('icelizard', 'Icelizard') nssm_register_egg("icelizard", "Icelizard")
nssm_register_egg ('kele', 'Kele') nssm_register_egg("kele", "Kele")
nssm_register_egg ('crystal_slug', 'Crystal Slug') nssm_register_egg("crystal_slug", "Crystal Slug")
nssm_register_egg ('berinhog', 'Berinhog') nssm_register_egg("berinhog", "Berinhog")
nssm_register_egg ('black_scorpion', 'Black Scorpion') nssm_register_egg("black_scorpion", "Black Scorpion")
nssm_register_egg ('pumpkid', 'Pumpkid') nssm_register_egg("pumpkid", "Pumpkid")
nssm_register_egg ('salamander', 'Salamander') nssm_register_egg("salamander", "Salamander")
nssm_register_egg ('flust', 'Flust') nssm_register_egg("flust", "Flust")
nssm_register_egg ('pelagia', 'Pelagia') nssm_register_egg("pelagia", "Pelagia")

View File

@ -1,177 +1,225 @@
--tools
-- tools
minetest.register_tool(":nssm:ice_sword", { minetest.register_tool(":nssm:ice_sword", {
description = "Ice Sword", description = "Ice Sword",
inventory_image = "ice_sword.png", inventory_image = "ice_sword.png",
tool_capabilities = { tool_capabilities = {
full_punch_interval =0.4 , full_punch_interval = 0.4,
max_drop_level=1, max_drop_level = 1,
groupcaps={ groupcaps = {
snappy={times={[1]=0.4, [2]=0.3, [3]=0.2}, uses=300, maxlevel=1}, snappy = {times = {[1] = 0.4, [2] = 0.3, [3] = 0.2}, uses = 300, maxlevel = 1},
fleshy={times={[2]=0.7, [3]=0.3}, uses=300, maxlevel=1} fleshy = {times = {[2] = 0.7, [3] = 0.3}, uses = 300, maxlevel = 1}
}, },
damage_groups = {fleshy=12}, damage_groups = {fleshy = 12},
}, },
on_drop = function(itemstack, dropper, pos) on_drop = function(itemstack, dropper, pos)
local objects = minetest.get_objects_inside_radius(pos, 10) local objects = minetest.get_objects_inside_radius(pos, 10)
local flag = 0 local flag = 0
local vec = dropper:get_look_dir() local vec = dropper:get_look_dir()
local pos = dropper:getpos() local pos = dropper:get_pos()
--vec.y = 0
for i=1,4 do for i = 1, 4 do
pos = vector.add(pos, vec) pos = vector.add(pos, vec)
end end
local pname = dropper:get_player_name() local pname = dropper:get_player_name()
local player_inv = minetest.get_inventory({type='player', name = pname}) local player_inv = minetest.get_inventory({type = "player", name = pname})
local found = 0 local found = 0
for i = 1,32 do
local items = player_inv:get_stack('main', i) for i = 1, 32 do
local items = player_inv:get_stack("main", i)
local n = items:get_name() local n = items:get_name()
if n == "nssm:life_energy" then if n == "nssm:life_energy" then
found = i found = i
break break
end end
end end
if found == 0 then if found == 0 then
minetest.chat_send_player(pname, "You haven't got any Life Energy!") minetest.chat_send_player(pname, "You haven't got any Life Energy!")
return return
else else
local items = player_inv:get_stack('main', found)
local items = player_inv:get_stack("main", found)
items:take_item() items:take_item()
player_inv:set_stack('main', found, items)
for dx = -1,1 do player_inv:set_stack("main", found, items)
for dz = -1,1 do
local pos = {x = pos.x+dx, y=pos.y-1, z=pos.z+dz} for dx = -1, 1 do
if not minetest.is_protected(pos, "") or not minetest.get_item_group(minetest.get_node(pos).name, "unbreakable") == 1 then for dz = -1, 1 do
minetest.set_node(pos, {name="default:ice"})
local pos = {x = pos.x + dx, y = pos.y - 1, z = pos.z + dz}
if not minetest.is_protected(pos, "")
or not minetest.get_item_group(
minetest.get_node(pos).name, "unbreakable") == 1 then
minetest.set_node(pos, {name = "default:ice"})
end
end end
end end
end end
end end
end,
}) })
minetest.register_tool(":nssm:earth_warhammer", { minetest.register_tool(":nssm:earth_warhammer", {
description = "Earth Warhammer", description = "Earth Warhammer",
inventory_image = "earth_warhammer.png", inventory_image = "earth_warhammer.png",
tool_capabilities = { tool_capabilities = {
full_punch_interval =0.4 , full_punch_interval = 0.4,
max_drop_level=1, max_drop_level = 1,
groupcaps={ groupcaps = {
snappy={times={[1]=0.4, [2]=0.3, [3]=0.2}, uses=300, maxlevel=1}, snappy = {times = {[1] = 0.4, [2] = 0.3, [3] = 0.2}, uses = 300, maxlevel = 1},
fleshy={times={[2]=0.7, [3]=0.3}, uses=300, maxlevel=1} fleshy = {times = {[2] = 0.7, [3] = 0.3}, uses = 300, maxlevel = 1}
}, },
damage_groups = {fleshy=12}, damage_groups = {fleshy = 12},
}, },
on_drop = function(itemstack, dropper, pos) on_drop = function(itemstack, dropper, pos)
local objects = minetest.env:get_objects_inside_radius(pos, 10) local objects = minetest.env:get_objects_inside_radius(pos, 10)
local flag = 0 local flag = 0
for _,obj in ipairs(objects) do
local part = 0
if flag == 0 then
local pname = dropper:get_player_name()
local player_inv = minetest.get_inventory({type='player', name = pname})
if player_inv:is_empty('main') then for _,obj in ipairs(objects) do
--minetest.chat_send_all("Inventory empty")
local part = 0
if flag == 0 then
local pname = dropper:get_player_name()
local player_inv = minetest.get_inventory({type = "player", name = pname})
if player_inv:is_empty("main") then
-- minetest.chat_send_all("Inventory empty")
else else
local found = 0 local found = 0
for i = 1,32 do
local items = player_inv:get_stack('main', i) for i = 1, 32 do
local items = player_inv:get_stack("main", i)
local n = items:get_name() local n = items:get_name()
if n == "nssm:energy_globe" then if n == "nssm:energy_globe" then
found = i found = i
break break
end end
end end
if found == 0 then if found == 0 then
minetest.chat_send_player(pname, "You haven't got any Energy Globe!") minetest.chat_send_player(pname, "You haven't got any Energy Globe!")
return return
else else
local pos = obj:get_pos() local pos = obj:get_pos()
pos.y = pos.y - 3
if (obj:is_player()) then
if (obj:get_player_name()~=dropper:get_player_name()) then
part=1
obj:setpos(pos)
--flag = 1
local items = player_inv:get_stack('main', found) pos.y = pos.y - 3
if obj:is_player() then
if obj:get_player_name() ~= dropper:get_player_name() then
part = 1
obj:set_pos(pos)
-- flag = 1
local items = player_inv:get_stack("main", found)
items:take_item() items:take_item()
player_inv:set_stack('main', found, items)
player_inv:set_stack("main", found, items)
end end
else else
if (obj:get_luaentity().health) then if obj:get_luaentity().health then
obj:get_luaentity().old_y = pos.y obj:get_luaentity().old_y = pos.y
obj:setpos(pos) obj:set_pos(pos)
part=1 part = 1
--flag = 1 -- flag = 1
local items = player_inv:get_stack("main", found)
local items = player_inv:get_stack('main', found)
items:take_item() items:take_item()
player_inv:set_stack('main', found, items)
player_inv:set_stack("main", found, items)
end
end end
end end
end end
end end
end end
end end
end,
}) })
minetest.register_tool(":nssm:earth_sword", { minetest.register_tool(":nssm:earth_sword", {
description = "Earth Sword", description = "Earth Sword",
inventory_image = "earth_sword.png", inventory_image = "earth_sword.png",
tool_capabilities = { tool_capabilities = {
full_punch_interval =0.4 , full_punch_interval = 0.4,
max_drop_level=1, max_drop_level = 1,
groupcaps={ groupcaps = {
snappy={times={[1]=0.4, [2]=0.3, [3]=0.2}, uses=300, maxlevel=1}, snappy = {times = {[1] = 0.4, [2] = 0.3, [3] = 0.2}, uses = 300, maxlevel = 1},
fleshy={times={[2]=0.7, [3]=0.3}, uses=300, maxlevel=1} fleshy = {times = {[2] = 0.7, [3] = 0.3}, uses = 300, maxlevel = 1}
}, },
damage_groups = {fleshy=12}, damage_groups = {fleshy = 12},
}, },
on_drop = function(itemstack, dropper, pos) on_drop = function(itemstack, dropper, pos)
local objects = minetest.get_objects_inside_radius(pos, 10) local objects = minetest.get_objects_inside_radius(pos, 10)
local flag = 0 local flag = 0
local vec = dropper:get_look_dir() local vec = dropper:get_look_dir()
local pos = dropper:get_pos() local pos = dropper:get_pos()
--vec.y = 0 -- vec.y = 0
for i=1,6 do for i = 1, 6 do
pos = vector.add(pos, vec) pos = vector.add(pos, vec)
end end
local pname = dropper:get_player_name() local pname = dropper:get_player_name()
local player_inv = minetest.get_inventory({type='player', name = pname}) local player_inv = minetest.get_inventory({type = "player", name = pname})
local found = 0 local found = 0
for i = 1,32 do
local items = player_inv:get_stack('main', i) for i = 1, 32 do
local items = player_inv:get_stack("main", i)
local n = items:get_name() local n = items:get_name()
if n == "nssm:energy_globe" then if n == "nssm:energy_globe" then
found = i found = i
break break
end end
end end
if found == 0 then if found == 0 then
minetest.chat_send_player(pname, "You haven't got any Energy Globe!") minetest.chat_send_player(pname, "You haven't got any Energy Globe!")
return return
else else
local items = player_inv:get_stack('main', found) local items = player_inv:get_stack("main", found)
items:take_item() items:take_item()
player_inv:set_stack('main', found, items)
for dx = -1,1 do player_inv:set_stack("main", found, items)
for dy = -12,3 do
for dz = -1,1 do for dx = -1, 1 do
local pos = {x = pos.x+dx, y=pos.y+dy, z=pos.z+dz} for dy = -12, 3 do
if not minetest.is_protected(pos, "") or not minetest.get_item_group(minetest.get_node(pos).name, "unbreakable") == 1 then for dz = -1, 1 do
minetest.set_node(pos, {name="air"})
local pos = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
if not minetest.is_protected(pos, "")
or not minetest.get_item_group(
minetest.get_node(pos).name, "unbreakable") == 1 then
minetest.set_node(pos, {name = "air"})
end
end end
end end
end end
end end
end end
end,
}) })

216
spawn.lua
View File

@ -1,68 +1,222 @@
--Before starting a new game write 6 or 7 in order to regulate the spawns (7 works also with flat and fractal).
local mymapgenis = nssm.mymapgenis local v6 = nssm.mymapgenis == 6 -- true if set to 6
local mm = nssm.multimobs local mm = nssm.multimobs
if (mymapgenis~=6) and (mymapgenis~=7) then
mymapgenis = 7
end
-- Spawning parameters -- Spawning parameters
if mm ~= 0 then
if mymapgenis == 6 then
mobs:spawn_specific("nssm:berinhog", {"default:dirt_with_grass"}, {"default:dirt_with_grass"}, 10, 20, 60, 12000000/mm, 1, 20, 31000) if mm ~= 0 then
-- V6 MAPGEN
if v6 then
-- DIRT
mobs:spawn({
name = "nssm:berinhog",
nodes = {"default:dirt_with_grass"},
neighbors = {"default:dirt_with_grass"},
interval = 60,
chance = (12000000 / mm),
min_light = 10,
min_height = 20
})
-- ICE -- ICE
mobs:spawn_specific("nssm:icelizard", {"default:snowblock", "default:ice", "default:dirt_with_snow", "default:snow"}, {"default:snowblock", "default:ice", "default:dirt_with_snow"}, 0, 20, 30, 6000000/mm, 1, -31000, 31000)
mobs:spawn({
name == "nssm:icelizard",
nodes = {
"default:snowblock", "default:ice",
"default:dirt_with_snow", "default:snow"
},
neighbors = {
{"default:snowblock", "default:ice", "default:dirt_with_snow"}
},
chance = (6000000 / mm)
})
-- FOREST -- FOREST
mobs:spawn_specific("nssm:crystal_slug", {"default:leaves", "default:aspen_leaves"}, {"air"}, 0, 20, 40, 4000000/mm, 1, -31000, 140)
mobs:spawn({
name = "nssm:crystal_slug",
nodes = {"default:leaves", "default:aspen_leaves"},
interval = 40,
chance = (4000000 / mm),
max_height = 140
})
-- PINE FOREST -- PINE FOREST
mobs:spawn_specific("nssm:pumpkid", {"default:dirt_with_grass", "default:dirt_with_snow","default:snowblock", "default:snow"}, {"default:pine_tree"}, 0, 20, 60, 3000000/mm, 1, -31000, 31000)
else mobs:spawn({
name = "nssm:pumpkid",
nodes = {
"default:dirt_with_grass", "default:dirt_with_snow",
"default:snowblock", "default:snow"
},
neighbors = {"default:pine_tree"},
chance = (3000000 / mm)
})
else -- ALL OTHER MAPGENS
-- MOUNTAINS -- MOUNTAINS
mobs:spawn_specific("nssm:berinhog", {"default:dirt_with_grass"}, {"default:dirt_with_grass"}, 10, 20, 60, 13000000/mm, 1, 20, 31000)
mobs:spawn({
name = "nssm:berinhog",
nodes = {"default:dirt_with_grass"},
neighbors = {"default:dirt_with_grass"},
interval = 60,
chance = (13000000 / mm),
min_light = 10,
min_height = 20
})
-- ICE -- ICE
mobs:spawn_specific("nssm:icelizard", {"default:snowblock", "default:ice", "default:dirt_with_snow", "default:snow"}, {"default:snowblock", "default:ice", "default:dirt_with_snow"}, 0, 20, 40, 20000000/mm, 1, -31000, 31000)
mobs:spawn({
name = "nssm:icelizard",
nodes = {
"default:snowblock", "default:ice",
"default:dirt_with_snow", "default:snow"
},
neighbors = {
"default:snowblock", "default:ice", "default:dirt_with_snow"
},
interval = 40,
chance = (20000000 / mm)
})
-- FOREST -- FOREST
mobs:spawn_specific("nssm:crystal_slug", {"default:leaves", "default:aspen_leaves"}, {"air"}, 0, 20, 40, 4000000/mm, 1, -31000, 140)
mobs:spawn({
name = "nssm:crystal_slug",
nodes = {"default:leaves", "default:aspen_leaves"},
interval = 40,
chance = (4000000 / mm),
max_height = 140
})
-- PINE FOREST -- PINE FOREST
mobs:spawn_specific("nssm:pumpkid", {"default:dirt_with_grass", "default:dirt_with_snow","default:snowblock"}, {"default:pine_tree"}, 0, 20, 60, 3300000/mm, 1, -31000, 31000)
mobs:spawn({
name = "nssm:pumpkid",
nodes = {
"default:dirt_with_grass", "default:dirt_with_snow",
"default:snowblock"
},
neighbors = {"default:pine_tree"},
chance = (3300000 / mm)
})
-- SAVANNA -- SAVANNA
mobs:spawn_specific("nssm:kele", {"default:dirt_with_dry_grass"}, {"default:dirt_with_dry_grass"}, 0, 20, 80, 30000000/mm, 1, -200, 31000)
mobs:spawn_specific("nssm:tartacacia", {"default:dirt_with_dry_grass"}, {"default:dirt_with_dry_grass"}, 0, 20, 180, 2000000000/mm, 1, -200, 31000) mobs:spawn({
name = "nssm:kele",
nodes = {"default:dirt_with_dry_grass"},
neighbors = {"default:dirt_with_dry_grass"},
interval = 80,
chance = (30000000 / mm),
min_height = -200
})
mobs:spawn({
name = "nssm:tartacacia",
nodes = {"default:dirt_with_dry_grass"},
neighbors = {"default:dirt_with_dry_grass"},
interval = 180,
chance = (2000000000 / mm),
min_height = -200
})
--COLD DESERT --COLD DESERT
mobs:spawn_specific("nssm:silver_sandonisc", {"default:silver_sand"}, {"default:silver_sand"}, 0, 20, 80, 300000000/mm, 1, -200, 31000)
mobs:spawn_specific("nssm:black_scorpion", {"default:silver_sand"}, {"default:silver_sand"}, 0, 20, 80, 300000000/mm, 1, -200, 31000) mobs:spawn({
mobs:spawn_specific("nssm:silversand_dragon", {"default:silver_sand"}, {"default:silver_sand"}, 0, 20, 180, 2000000000/mm, 1, -200, 31000) name = "nssm:silver_sandonisc",
nodes = {"default:silver_sand"},
neighbors = {"default:silver_sand"},
interval = 80,
chance = (300000000 / mm),
min_height = -200
})
mobs:spawn({
name = "nssm:black_scoprion",
nodes = {"default:silver_sand"},
neighbors = {"default:silver_sand"},
interval = 80,
chance = (300000000 / mm),
min_height = -200
})
mobs:spawn({
name = "nssm:silversand_dragon",
nodes = {"default:silver_sand"},
neighbors = {"default:silver_sand"},
interval = 180,
chance = (2000000000 / mm),
min_height = -200
})
--RIVER --RIVER
mobs:spawn_specific("nssm:chog", {"default:river_water_source"}, {"default:sand","default:river_water_source"}, 0, 20, 60, 3000000/mm, 1, -31000, 300)
mobs:spawn_specific("nssm:river_lord", {"default:river_water_source"}, {"default:sand","default:river_water_source"}, 0, 20, 60, 300000000/mm, 1, -31000, 300)
end mobs:spawn({
name = "nssm:chog",
nodes = {"default:river_water_source"},
neighbors = {"default:sand", "default:river_water_source"},
chance = (3000000 / mm),
max_height = 300
})
-- NSSB SPECIAL mobs:spawn({
if minetest.get_modpath("nssb") then name = "nssm:river_lord",
mobs:spawn_specific("nssm:xgaloctopus", {"default:water_source"}, {"nssb:marine_brick"}, 0, 20, 20, 800000/mm, 1, -31000, 0) nodes = {"default:river_water_source"},
neighbors = {"default:sand", "default:river_water_source"},
chance = (300000000 / mm),
max_height = 300
})
end end
-- CAVES -- CAVES
mobs:spawn_specific("nssm:albino_spider", {"default:stone"}, {"default:stone"}, 0, 20, 30, 500000/mm, 3, -31000, -150)
mobs:spawn_specific("nssm:salamander", {"default:lava_source"}, {"default:stone", "default:lava_flowing", "default:lava_source", "air"}, 0, 20, 30, 500000/mm, 3, -31000, -200)
mobs:spawn_specific("nssm:flust", {"default:stone", "default:desert_stone"}, {"default:stone", "default:desert_stone"}, 0, 20, 30, 500000/mm, 3, -31000, -164)
mobs:spawn({
name = "nssm:albino_spider",
nodes = {"default:stone"},
neighbors = {"default:stone"},
chance = (500000 / mm),
active_object_count = 3,
max_height = -150
})
mobs:spawn({
name = "nssm:salamander",
nodes = {"default:lava_source"},
neighbors = {
"default:stone", "default:lava_flowing", "default:lava_source", "air"
},
chance = (500000 / mm),
active_object_count = 3,
max_height = -200
})
mobs:spawn({
name = "nssm:flust",
nodes = {"default:stone", "default:desert_stone"},
neighbors = {"default:stone", "default:desert_stone"},
chance = (500000/mm),
active_object_count = 3,
max_height = -164
})
-- SEA -- SEA
mobs:spawn_specific("nssm:pelagia", {"default:water_source"}, {"default:water_source"}, 0, 20, 80, 40000000/mm, 1, -31000, 0)
mobs:spawn({
name = "nssm:pelagia",
nodes = {"default:water_source"},
neighbors = {"default:water_source"},
interval = 80,
chance = (40000000 / mm),
max_height = 0
})
end end