diff --git a/darts.lua b/darts.lua index d75da88..3bbe332 100644 --- a/darts.lua +++ b/darts.lua @@ -1,16 +1,14 @@ - ---crystalgas arrow +-- crystalgas arrow mobs:register_arrow("nssm:crystal_gas_arrow", { visual = "sprite", visual_size = {x = 1, y = 1}, textures = {"crystal_arrow.png"}, velocity = 8, - -- direct hit + hit_player = function(self, player) - local p = player:get_pos() - crystal_gas_explosion(p) + crystal_gas_explosion(player:get_pos()) end, hit_node = function(self, pos, node) @@ -20,68 +18,92 @@ mobs:register_arrow("nssm:crystal_gas_arrow", { function crystal_gas_explosion(pos) + if minetest.is_protected(pos, "") then return end - for dx= 0,0 do - for dy=-1,2 do - for dz= 0,0 do - local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} + + for dx = 0, 0 do + for dy = -1, 2 do + 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 return end + 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 ---Pumpkid bomb +-- Pumpkid bomb mobs:register_arrow("nssm:pumpkid_bomb", { visual = "cube", 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, - -- direct hit + hit_player = function(self, player) + 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 - tnt.boom(p, {damage_radius=3,radius=2,ignore_protection=false}) - end + + if not minetest.is_protected(p, "") + 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, 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 - tnt.boom(pos, {damage_radius=3,radius=2,ignore_protection=false}) - end + + if not minetest.is_protected(pos, "") + 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 }) ---Lava_block bomb +-- Lava_block bomb mobs:register_arrow("nssm:lava_block_bomb", { visual = "cube", 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, - -- direct hit + hit_player = function(self, player) + 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"}) - end + + 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, 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"}) - end + + 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 }) diff --git a/mobs/albino_spider.lua b/mobs/albino_spider.lua index 3c6cf2f..efdbfe6 100644 --- a/mobs/albino_spider.lua +++ b/mobs/albino_spider.lua @@ -6,64 +6,46 @@ mobs:register_mob("nssm:albino_spider", { visual = "mesh", mesh = "albino_spider.x", textures = {{"albino_spider.png"}}, - visual_size = {x=4, y=4}, + visual_size = {x = 4, y = 4}, makes_footstep_sound = false, view_range = 22, walk_velocity = 0.6, fear_height = 3, run_velocity = 3, - --[[sounds = { - random = "albino_spider", - },]] +-- sounds = { +-- random = "albino_spider", +-- }, damage = 3, reach = 2, jump = true, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 1, - max = 4,}, - {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,}, + {name = "nssm:life_energy", chance = 1, min = 1, max = 4}, + {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, drawtype = "front", water_damage = 2, lava_damage = 14, light_damage = 0, - group_attack=true, - attack_animals=true, + group_attack = true, + attack_animals = true, suffocation = 0, - knock_back=1, - blood_texture="nssm_blood_blue.png", + knock_back = 1, + blood_texture = "nssm_blood_blue.png", stepheight=1.1, - on_rightclick = nil, attack_type = "dogfight", animation = { - speed_normal = 20, - speed_run = 25, - stand_start = 1, - stand_end = 80, - walk_start = 120, - walk_end = 160, - run_start = 210, - run_end = 222, - punch_start = 80, - punch_end = 110, - die_start = 170, - die_end = 190, + speed_normal = 20, speed_run = 25, + stand_start = 1, stand_end = 80, + walk_start = 120, walk_end = 160, + run_start = 210, run_end = 222, + punch_start = 80, punch_end = 110, + die_start = 170, die_end = 190, }, ---[[ do_custom = function(self) - webber_ability(self, "nssm:web", 2) - end,]] +-- do_custom = function(self) +-- webber_ability(self, "nssm:web", 2) +-- end }) + diff --git a/mobs/berinhog.lua b/mobs/berinhog.lua index 92a39cd..87435af 100644 --- a/mobs/berinhog.lua +++ b/mobs/berinhog.lua @@ -6,10 +6,10 @@ mobs:register_mob("nssm:berinhog", { visual = "mesh", mesh = "berinhog.x", textures = {{"berinhog.png"}}, - visual_size = {x=5, y=5}, + visual_size = {x = 5, y = 5}, makes_footstep_sound = true, view_range = 18, - rotate=270, + rotate = 270, walk_velocity = 1, fear_height = 4, run_velocity = 3.6, @@ -19,61 +19,47 @@ mobs:register_mob("nssm:berinhog", { damage = 6, jump = true, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 5, - max = 7}, - --[[ {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},]] - }, + {name = "nssm:life_energy", chance = 1, min = 5, max = 7}, +-- {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, drawtype = "front", water_damage = 0, lava_damage = 15, suffocation = 4, - reach=3, + reach = 3, light_damage = 0, - group_attack=true, - attack_animals=true, - knock_back=0, - blood_texture="nssm_blood.png", - stepheight=1.1, - on_rightclick = nil, + group_attack = true, + attack_animals = true, + knock_back = 0, + blood_texture = "nssm_blood.png", + stepheight = 1.1, attack_type = "dogfight", animation = { - speed_normal = 20, - speed_run = 20, - stand_start = 0, - stand_end = 40, - walk_start = 210, - walk_end = 250, - 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() + speed_normal = 20, speed_run = 20, + stand_start = 0, stand_end = 40, + walk_start = 210, walk_end = 250, + run_start = 140, run_end = 160, + punch_start = 170, punch_end = 200, + die_start = 110, die_end = 130, + }, + + do_custom = function(self) + + self.berinhog_timer = self.berinhog_timer or os.time() + if os.time() - self.berinhog_timer > 1 then + self.berinhog_timer = os.time() + local all_objects = minetest.get_objects_inside_radius(self.object:get_pos(), 1) - local _,obj + for _,obj in ipairs(all_objects) do + 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 and obj:get_luaentity().name ~= self.object:get_luaentity().name then obj:get_luaentity().health = obj:get_luaentity().health - 1 @@ -82,3 +68,4 @@ mobs:register_mob("nssm:berinhog", { end end }) + diff --git a/mobs/black_scorpion.lua b/mobs/black_scorpion.lua index ab11052..b506530 100644 --- a/mobs/black_scorpion.lua +++ b/mobs/black_scorpion.lua @@ -7,7 +7,7 @@ mobs:register_mob("nssm:black_scorpion", { visual = "mesh", mesh = "scorpion.x", textures = {{"scorpion.png"}}, - visual_size = {x=7, y=7}, + visual_size = {x = 7, y = 7}, makes_footstep_sound = true, view_range = 22, walk_velocity = 1, @@ -20,10 +20,7 @@ mobs:register_mob("nssm:black_scorpion", { reach = 4, jump = true, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 1, - max = 8,}, + {name = "nssm:life_energy", chance = 1, min = 1, max = 8}, }, armor = 50, drawtype = "front", @@ -32,39 +29,35 @@ mobs:register_mob("nssm:black_scorpion", { suffocation = 4, lava_damage = 10, light_damage = 0, - group_attack=false, - attack_animals=true, + group_attack = false, + attack_animals = true, blood_texture="nssm_blood_blue.png", - stepheight=1.1, - on_rightclick = nil, + stepheight = 1.1, -- double_melee_attack = true, attack_type = "dogfight", animation = { - speed_normal = 20, - speed_run = 30, - stand_start = 10, - stand_end = 60, - walk_start = 70, - walk_end = 110, - run_start = 70, - run_end = 110, - punch_start = 160, - punch_end = 180, - punch2_start = 120, - punch2_end = 150, - die_start = 190, - die_end = 210, + speed_normal = 20, speed_run = 30, + stand_start = 10, stand_end = 60, + walk_start = 70, walk_end = 110, + run_start = 70, 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) if math.random(30) == 1 then + self:set_animation("punch2") + self.attack:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = self.damage*10} + damage_groups = {fleshy = self.damage * 10} }, nil) else self:set_animation("punch") + self.attack:punch(self.object, 1.0, { full_punch_interval = 1.0, damage_groups = {fleshy = self.damage} @@ -99,8 +92,7 @@ mobs:register_mob("nssm:black_scorpion", { on_die = function(self, pos) - -- drop saddle when horse is killed while riding - -- also detach from horse properly + -- drop saddle when mob is killed while riding and detach player if self.driver then minetest.add_item(pos, "mobs:saddle") mobs.detach(self.driver, {x = 1, y = 0, z = 1}) @@ -115,17 +107,17 @@ mobs:register_mob("nssm:black_scorpion", { return end - -- feed, tame or heal horse + -- feed, tame or heal if mobs:feed_tame(self, clicker, 10, true, true) then return 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 local inv = clicker:get_inventory() - -- detatch player already riding horse + -- detatch player already riding mob if self.driver and clicker == self.driver then 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") end - -- attach player to horse + -- attach player elseif not self.driver and clicker:get_wielded_item():get_name() == "mobs:saddle" then @@ -150,6 +142,7 @@ mobs:register_mob("nssm:black_scorpion", { end -- 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 }) + diff --git a/mobs/chog.lua b/mobs/chog.lua index 6b309b7..99714d2 100644 --- a/mobs/chog.lua +++ b/mobs/chog.lua @@ -6,7 +6,7 @@ mobs:register_mob("nssm:chog", { visual = "mesh", mesh = "chog.x", textures = {{"chog.png"}}, - visual_size = {x=4, y=4}, + visual_size = {x = 4, y = 4}, makes_footstep_sound = true, view_range = 13, walk_velocity = 1, @@ -19,39 +19,28 @@ mobs:register_mob("nssm:chog", { damage = 4, jump = true, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 3, - max = 4}, - }, + {name = "nssm:life_energy", chance = 1, min = 3, max = 4}, + }, armor = 100, drawtype = "front", water_damage = 0, lava_damage = 15, light_damage = 0, suffocation = 6, - --group_attack=true, - --attack_animals=true, - knock_back=2, - blood_texture="nssm_blood.png", - stepheight=1.1, - on_rightclick = nil, +-- group_attack = true, +-- attack_animals = true, + knock_back = 2, + blood_texture = "nssm_blood.png", + stepheight = 1.1, attack_type = "dogfight", animation = { - speed_normal = 20, - speed_run = 20, - stand_start = 0, - stand_end = 50, - walk_start = 60, - walk_end = 100, - run_start = 110, - run_end = 130, - punch_start = 220, - punch_end = 240, - shoot_start =170, - shoot_end=210, - speed_die = 10, - die_start = 140, - die_end = 160, - }, + speed_normal = 20, speed_run = 20, + stand_start = 0, stand_end = 50, + walk_start = 60, walk_end = 100, + run_start = 110, run_end = 130, + punch_start = 220, punch_end = 240, + shoot_start =170, shoot_end = 210, + die_start = 140, die_end = 160, speed_die = 10, + }, }) + diff --git a/mobs/crystal_slug.lua b/mobs/crystal_slug.lua index 2246be5..50c2ab0 100644 --- a/mobs/crystal_slug.lua +++ b/mobs/crystal_slug.lua @@ -6,56 +6,45 @@ mobs:register_mob("nssm:crystal_slug", { visual = "mesh", mesh = "crystal_slug.x", textures = {{"crystal_slug.png"}}, - visual_size = {x=4, y=4}, + visual_size = {x = 4, y = 4}, view_range = 30, floats = 1, rotate = 270, - group_attack=true, - attack_animals=false, + group_attack = true, + attack_animals = false, walk_velocity = 0.4, run_velocity = 0.4, -- fall_speed = 0, stepheight = 1.1, ---[[ sounds = { - random = "crystal_slug", - distance = 45, - },]] +-- sounds = { +-- random = "crystal_slug", +-- distance = 45, +-- }, damage = 2, jump = false, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 1, - max = 3,}, + {name = "nssm:life_energy", chance = 1, min = 1, max = 3}, }, armor = 70, drawtype = "front", water_damage = 5, lava_damage = 10, light_damage = 0, - blood_texture="nssm_blood_blue.png", - blood_amount=10, - on_rightclick = nil, + blood_texture = "nssm_blood_blue.png", + blood_amount = 10, attack_type = "shoot", shoot_offset = 1, arrow = "nssm:crystal_gas_arrow", reach = 1, shoot_interval = 4, animation = { - speed_normal = 20, - speed_run = 20, - stand_start = 1, - stand_end = 60, - walk_start = 160, - walk_end = 190, - run_start = 160, - run_end = 190, - punch_start = 100, - punch_end = 150, - shoot_start = 100, - shoot_end = 150, - speed_die = 10, - die_start = 70, - die_end = 90, + speed_normal = 20, speed_run = 20, + stand_start = 1, stand_end = 60, + walk_start = 160, walk_end = 190, + run_start = 160, run_end = 190, + punch_start = 100, punch_end = 150, + shoot_start = 100, shoot_end = 150, + die_start = 70, die_end = 90, speed_die = 10, } }) + diff --git a/mobs/flust.lua b/mobs/flust.lua index 383dc76..3c72a09 100644 --- a/mobs/flust.lua +++ b/mobs/flust.lua @@ -6,23 +6,20 @@ mobs:register_mob("nssm:flust", { visual = "mesh", mesh = "flust.x", textures = {{"flust.png"}}, - visual_size = {x=6, y=6}, + visual_size = {x = 6, y = 6}, makes_footstep_sound = true, view_range = 16, fear_height = 4, walk_velocity = 0.8, run_velocity = 2.4, - --[[sounds = { - random = "flust", - },]] +-- sounds = { +-- random = "flust", +-- }, damage = 4, reach = 4, jump = true, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 1, - max = 1,}, + {name = "nssm:life_energy", chance = 1, min = 1, max = 1}, }, armor = 50, drawtype = "front", @@ -30,27 +27,27 @@ mobs:register_mob("nssm:flust", { lava_damage = 8, light_damage = 0, suffocation = 4, - group_attack=true, - attack_animals= false, - knock_back=1, + group_attack = true, + attack_animals = false, + knock_back = 1, blood_texture="nssm_blood_blue.png", - --Flust is immune to iron weapons - 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}}, - stepheight=2.1, - on_rightclick = nil, + immune_to = { + {"default:sword_iron", -6}, --Flust is immune to iron weapons + {"default:iron_lump", -8}, + {"default:steel_block", -20}, + {"default:axe_iron", -4}, + {"default:shovel_iron", -4}, + {"default:pick_iron", -6} + }, + stepheight = 2.1, attack_type = "dogfight", animation = { - speed_normal = 20, - speed_run = 40, - stand_start = 10, - stand_end = 60, - walk_start = 140, - walk_end = 180, - run_start = 140, - run_end = 180, - punch_start = 100, - punch_end = 130, - die_start = 70, - die_end = 90, + speed_normal = 20, speed_run = 40, + stand_start = 10, stand_end = 60, + walk_start = 140, walk_end = 180, + run_start = 140, run_end = 180, + punch_start = 100, punch_end = 130, + die_start = 70, die_end = 90, } }) + diff --git a/mobs/icelizard.lua b/mobs/icelizard.lua index 57fadf2..dd6aa94 100644 --- a/mobs/icelizard.lua +++ b/mobs/icelizard.lua @@ -6,7 +6,7 @@ mobs:register_mob("nssm:icelizard", { visual = "mesh", mesh = "icelizard.x", textures = {{"snow_biter.png"}}, - visual_size = {x=9, y=9}, + visual_size = {x = 9, y = 9}, makes_footstep_sound = true, view_range = 30, rotate = 270, @@ -15,30 +15,18 @@ mobs:register_mob("nssm:icelizard", { reach = 1.5, walk_velocity = 0.8, run_velocity = 3.5, - sounds = { + sounds = { random = "snow_biter", }, - --pathfinding = true, +-- pathfinding = true, damage = 4, jump = true, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 2, - max = 3}, - {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}, - }, + {name = "nssm:life_energy", chance = 1, min = 2, max = 3}, + {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, drawtype = "front", water_damage = 0, @@ -48,39 +36,40 @@ mobs:register_mob("nssm:icelizard", { group_attack = true, attack_animals = false, knock_back = 2, - blood_texture="nssm_blood.png", - stepheight=1.1, - on_rightclick = nil, + blood_texture = "nssm_blood.png", + stepheight = 1.1, attack_type = "dogfight", - die_anim = true, animation = { - speed_normal = 20, - speed_run = 40, - speed_punch = 5, - stand_start = 0, - stand_end = 80, - walk_start = 110, - walk_end = 150, - run_start = 110, - run_end = 150, - die_start = 80, - die_end = 100, - punch_start = 160, - punch_end = 170, + speed_normal = 20, speed_run = 40, speed_punch = 5, + stand_start = 0, stand_end = 80, + walk_start = 110, 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) + self.icelizard_timer = self.icelizard_timer or os.time() + 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() + nssm:tnt_boom_nssm(pos, { - damage_radius=0, - radius=2, - ignore_protection = false},"nssm:coldest_ice", false) + damage_radius = 0, + radius = 2, + ignore_protection = false + },"nssm:coldest_ice", false) + self.object:remove() end end, + do_custom = function(self) nssm:putting_ability(self, "default:ice", self.run_velocity) end, }) + diff --git a/mobs/kele.lua b/mobs/kele.lua index 73921c2..d8876fe 100644 --- a/mobs/kele.lua +++ b/mobs/kele.lua @@ -6,69 +6,66 @@ mobs:register_mob("nssm:kele", { visual = "mesh", mesh = "kele.x", textures = {{"kele.png"}}, - visual_size = {x=5, y=5}, + visual_size = {x = 5, y = 5}, makes_footstep_sound = true, view_range = 30, walk_velocity = 1, rotate = 270, fear_height = 4, run_velocity = 5, - --[[sounds = { - random = "kele", - },]] +-- sounds = { +-- random = "kele", +-- }, damage = 4, jump = true, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 3, - max = 4}, - }, + {name = "nssm:life_energy", chance = 1, min = 3, max = 4}, + }, armor = 60, drawtype = "front", water_damage = 0, lava_damage = 15, light_damage = 0, suffocation = 4, - --group_attack=true, - --attack_animals=true, +-- group_attack = true, +-- attack_animals = true, knock_back = 1, - blood_texture="nssm_blood.png", - stepheight=2.1, - on_rightclick = nil, + blood_texture = "nssm_blood.png", + stepheight = 2.1, attack_type = "dogfight", specific_attack = {"player", "nssm:felucco"}, animation = { - speed_normal = 20, - speed_run = 25, - stand_start = 200, - stand_end = 250, - walk_start = 40, - walk_end = 80, - run_start = 10, - run_end = 30, - punch_start = 130, - punch_end = 160, - punch2_start = 90, - punch2_end = 120, - die_start = 170, - die_end = 190, - }, + speed_normal = 20, speed_run = 25, + stand_start = 200, stand_end = 250, + walk_start = 40, walk_end = 80, + run_start = 10, 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) + self.kele_timer = (self.kele_timer or os.time()) + if (os.time() - self.kele_timer) > 1 then + self.kele_timer = os.time() local s = self.object: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 self:set_animation("punch") else self:set_animation("punch2") - self.health = self.health + (self.damage*2) + self.health = self.health + (self.damage * 2) end + -- play attack sound if self.sounds.attack then minetest.sound_play(self.sounds.attack, { @@ -77,11 +74,12 @@ mobs:register_mob("nssm:kele", { }, true) end -- punch player - self.attack:punch(self.object, 1.0, { + self.attack:punch(self.object, 1.0, { full_punch_interval=1.0, - damage_groups = {fleshy=self.damage} + damage_groups = {fleshy = self.damage} }, nil) end end end, }) + diff --git a/mobs/pelagia.lua b/mobs/pelagia.lua index 22432b9..4505b74 100644 --- a/mobs/pelagia.lua +++ b/mobs/pelagia.lua @@ -6,8 +6,8 @@ mobs:register_mob("nssm:pelagia", { visual = "mesh", mesh = "pelagia.x", textures = {{"pelagia.png"}}, - visual_size = {x=4, y=4}, - view_range =5, + visual_size = {x = 4, y = 4}, + view_range = 5, fly = true, fly_in = "default:water_source", fall_speed = -20, @@ -20,32 +20,24 @@ mobs:register_mob("nssm:pelagia", { jump_chance = 0, jump_height = 0, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 2, - max = 7,}, + {name = "nssm:life_energy", chance = 1, min = 2, max = 7}, }, armor = 100, drawtype = "front", water_damage = 0, lava_damage = 10, light_damage = 0, - group_attack=true, - attack_animals=false, - knock_back=4, - blood_texture="nssm_blood_blue.png", - on_rightclick = nil, + group_attack = true, + attack_animals = false, + knock_back = 4, + blood_texture = "nssm_blood_blue.png", attack_type = "dogfight", animation = { - speed_normal = 25, - speed_run = 35, - stand_start = 1, - stand_end = 80, - walk_start = 1, - walk_end = 80, - run_start = 100, - run_end = 120, - punch_start = 140, - punch_end = 180, + speed_normal = 25, speed_run = 35, + stand_start = 1, stand_end = 80, + walk_start = 1, walk_end = 80, + run_start = 100, run_end = 120, + punch_start = 140, punch_end = 180, } }) + diff --git a/mobs/pumpkid.lua b/mobs/pumpkid.lua index 27a21db..8cb4d3e 100644 --- a/mobs/pumpkid.lua +++ b/mobs/pumpkid.lua @@ -6,27 +6,24 @@ mobs:register_mob("nssm:pumpkid", { visual = "mesh", mesh = "pumpkid.x", textures = {{"pump.png"}}, - visual_size = {x=3, y=3}, + visual_size = {x = 3, y = 3}, view_range = 30, - floats=0, + floats = 0, rotate = 180, - group_attack=true, - attack_animals=false, + group_attack = true, + attack_animals = false, walk_velocity = 0.6, run_velocity = 0.6, -- fall_speed = 0, stepheight = 1.1, ---[[ sounds = { - random = "pumpkid", - distance = 45, - },]] +-- sounds = { +-- random = "pumpkid", +-- distance = 45, +-- }, damage = 2, jump = true, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 1, - max = 3,}, + {name = "nssm:life_energy", chance = 1, min = 1, max = 3}, }, armor = 50, drawtype = "front", @@ -34,28 +31,21 @@ mobs:register_mob("nssm:pumpkid", { lava_damage = 13, light_damage = 0, suffocation = 4, - blood_texture="nssm_blood.png", - blood_amount=10, - on_rightclick = nil, + blood_texture = "nssm_blood.png", + blood_amount = 10, attack_type = "shoot", shoot_offset = 1, arrow = "nssm:pumpkid_bomb", reach = 1, shoot_interval = 4, animation = { - speed_normal = 20, - speed_run = 20, - stand_start = 0, - stand_end = 40, - walk_start = 60, - walk_end = 100, - run_start = 60, - run_end = 100, - punch_start = 110, - punch_end = 210, - shoot_start = 110, - shoot_end = 210, - die_start = 220, - die_end = 240, + speed_normal = 20, speed_run = 20, + stand_start = 0, stand_end = 40, + walk_start = 60, walk_end = 100, + run_start = 60, run_end = 100, + punch_start = 110, punch_end = 210, + shoot_start = 110, shoot_end = 210, + die_start = 220, die_end = 240, } }) + diff --git a/mobs/river_lord.lua b/mobs/river_lord.lua index df268d4..fc9f3b0 100644 --- a/mobs/river_lord.lua +++ b/mobs/river_lord.lua @@ -1,21 +1,29 @@ local function mud_attack (self) -- replace soil with mud + self.mud_timer = os.time() - local radius = 10 + self:set_animation("shoot") + + local radius = 10 local s = self.object:get_pos() local vec = {x=radius,y=1,z=radius} + 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 - 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 - minetest.set_node(v, {name="nssm:mud"}) + minetest.set_node(v, {name = "nssm:mud"}) end end end, self) end - mobs:register_mob("nssm:river_lord", { type = "monster", hp_max = 210, @@ -24,70 +32,62 @@ mobs:register_mob("nssm:river_lord", { visual = "mesh", mesh = "river_lord.x", textures = {{"river_lord.png"}}, - visual_size = {x=4, y=4}, + visual_size = {x = 4, y = 4}, makes_footstep_sound = true, view_range = 30, walk_velocity = 0.6, rotate = 270, fear_height = 4, run_velocity = 4, - --[[sounds = { - random = "river_lord", - },]] +-- sounds = { +-- random = "river_lord", +-- }, damage = 10, jump = true, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 70, - max = 90}, - }, + {name = "nssm:life_energy", chance = 1, min = 70, max = 90}, + }, armor = 50, drawtype = "front", water_damage = 0, lava_damage = 2, reach = 8, light_damage = 0, - --group_attack=true, - --attack_animals=true, - knock_back=0, - blood_texture="nssm_blood.png", - stepheight=2.1, - on_rightclick = nil, +-- group_attack=true, +-- attack_animals=true, + knock_back = 0, + blood_texture = "nssm_blood.png", + stepheight = 2.1, attack_type = "dogfight", animation = { - speed_normal = 20, - speed_run = 20, - stand_start = 20, - stand_end = 100, - walk_start = 110, - walk_end = 150, - run_start = 160, - run_end = 180, - 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, - }, + speed_normal = 20, speed_run = 20, + stand_start = 20, stand_end = 100, + walk_start = 110, walk_end = 150, + run_start = 160, run_end = 180, + punch_start = 260, punch_end = 280, + punch2_start = 230, punch2_end = 250, -- used for charge + die_start = 290, die_end = 310, speed_die = 10, + shoot_start = 190, shoot_end = 220, speed_shoot = 20, + }, + do_custom = function (self) + if self.other_state and self.other_state == "charge" then nssm:do_charge(self) end end, + custom_attack = function (self) + if self.mud_timer then + if os.time() - self.mud_timer > 15 then mud_attack(self) else local s = self.object:get_pos() local p = self.attack:get_pos() local l = vector.length(vector.subtract(p,s)) + nssm:charge_attack(self) end else diff --git a/mobs/salamander.lua b/mobs/salamander.lua index 540bec9..89a5978 100644 --- a/mobs/salamander.lua +++ b/mobs/salamander.lua @@ -6,7 +6,7 @@ mobs:register_mob("nssm:salamander", { visual = "mesh", mesh = "salamander.x", textures = {{"salamander.png"}}, - visual_size = {x=10, y=10}, + visual_size = {x = 10, y = 10}, fear_height = 4, makes_footstep_sound = true, view_range = 24, @@ -15,10 +15,7 @@ mobs:register_mob("nssm:salamander", { damage = 6, jump = true, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 1, - max = 2,}, + {name = "nssm:life_energy", chance = 1, min = 1, max = 2}, }, armor = 80, drawtype = "front", @@ -26,55 +23,51 @@ mobs:register_mob("nssm:salamander", { lava_damage = 0, light_damage = 0, follow = {"farming:wheat"}, - group_attack=true, - attack_animals=true, - knock_back=2, - blood_texture="nssm_blood.png", - stepheight=1.1, - on_rightclick = nil, + group_attack = true, + attack_animals = true, + knock_back = 2, + blood_texture = "nssm_blood.png", + stepheight = 1.1, dogshoot_switch = true, attack_type = "dogshoot", - arrow = "nssm:lava_block_bomb", - reach = 2, - shoot_interval = 2, - shoot_offset = 2, + arrow = "nssm:lava_block_bomb", + reach = 2, + shoot_interval = 2, + shoot_offset = 2, animation = { - speed_normal = 25, - speed_run = 35, - stand_start = 0, - stand_end = 80, - walk_start = 110, - walk_end = 150, - run_start = 110, - run_end = 150, - punch_start = 160, - punch_end = 180, - shoot_start = 200, - shoot_end = 250, - die_start = 80, - die_end = 100, - --[[ - swim_start = 260, - swim_end = 300, - ]] + speed_normal = 25, speed_run = 35, + stand_start = 0, stand_end = 80, + walk_start = 110, walk_end = 150, + run_start = 110, run_end = 150, + 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) + local p = self.attack:get_pos() local s = self.object:get_pos() 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 vel = vector.subtract(pp,ss) + 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 if self.sounds.attack then + minetest.sound_play(self.sounds.attack, { object = self.object, max_hear_distance = self.sounds.distance }, true) end + -- punch player self.attack:punch(self.object, 1.0, { full_punch_interval=1.0, @@ -83,103 +76,102 @@ mobs:register_mob("nssm:salamander", { end minetest.add_particlespawner({ - amount = 25, --amount - time = 0.5, --time - minpos = ss, --minpos - maxpos = ss, --maxpos - minvel = vector.multiply(vel, 2), --minvel - maxvel = vector.multiply(vel, 4), --maxvel - minacc = {x=0,y=0,z=0}, --minacc - maxacc = {x=0,y=0,z=0}, --maxacc - minexptime = 1, --minexptime - maxexptime = 1.5, --maxexptime - minsize = 5, --minsize - maxsize = 10, --maxsize - collisiondetection = true, --collisiondetection - texture = "phoenix_fire.png" --texture + amount = 25, + time = 0.5, + minpos = ss, + maxpos = ss, + minvel = vector.multiply(vel, 2), + maxvel = vector.multiply(vel, 4), + minacc = {x = 0, y = 0, z = 0}, + maxacc = {x = 0, y = 0, z = 0}, + minexptime = 1, + maxexptime = 1.5, + minsize = 5, + maxsize = 10, + collisiondetection = true, + texture = "phoenix_fire.png" }) -end, + end, + do_custom = function(self, dtime) - do_custom = function(self, dtime) - - -- set needed values if not already present - if not self.v2 then - self.v2 = 0 - self.max_speed_forward = 5 - self.max_speed_reverse = 2 - self.accel = 6 - self.terrain_type = 3 - self.driver_attach_at = {x = 0, y = 0.4, z = -0.8} - self.driver_eye_offset = {x = 0, y = -2, z = 0} - self.driver_scale = {x = 0.09, y = 0.09} - end - - -- if driver present allow control of horse - if self.driver then - - --mobs.fly(self, dtime, 6, true, "nssm:lava_block_bomb", "run", "stand") - mobs.drive(self, "run", "stand", false, dtime) - - return false -- skip rest of mob functions - end - - return true - end, - - on_die = function(self, pos) - - -- drop saddle when horse is killed while riding - -- also detach from horse properly - if self.driver then - minetest.add_item(pos, "mobs:saddle") - mobs.detach(self.driver, {x = 1, y = 0, z = 1}) - end - - end, - - on_rightclick = function(self, clicker) - - -- make sure player is clicking - if not clicker or not clicker:is_player() then - return - end - - -- feed, tame or heal horse - if mobs:feed_tame(self, clicker, 10, true, true) then - return - end - - -- make sure tamed horse is being clicked by owner only - if self.tamed and self.owner == clicker:get_player_name() then - - local inv = clicker:get_inventory() - - -- detatch player already riding horse - if self.driver and clicker == self.driver then - - mobs.detach(clicker, {x = 1, y = 0, z = 1}) - - -- add saddle back to inventory - if inv:room_for_item("main", "mobs:saddle") then - inv:add_item("main", "mobs:saddle") - else - minetest.add_item(clicker.getpos(), "mobs:saddle") - end - - -- attach player to horse - elseif not self.driver - and clicker:get_wielded_item():get_name() == "mobs:saddle" then - - self.object:set_properties({stepheight = 1.1}) - mobs.attach(self, clicker) - - -- take saddle from inventory - inv:remove_item("main", "mobs:saddle") - end - end - - -- used to capture horse with magic lasso - mobs:capture_mob(self, clicker, 0, 0, 80, false, nil) + -- set needed values if not already present + if not self.v2 then + self.v2 = 0 + self.max_speed_forward = 5 + self.max_speed_reverse = 2 + self.accel = 6 + self.terrain_type = 3 + self.driver_attach_at = {x = 0, y = 0.4, z = -0.8} + self.driver_eye_offset = {x = 0, y = -2, z = 0} + self.driver_scale = {x = 0.09, y = 0.09} end + + -- if driver present allow control of mob + if self.driver then + + --mobs.fly(self, dtime, 6, true, "nssm:lava_block_bomb", "run", "stand") + mobs.drive(self, "run", "stand", false, dtime) + + return false -- skip rest of mob functions + end + + return true + end, + + on_die = function(self, pos) + + -- drop saddle when mob is killed while riding and detatch properly + if self.driver then + minetest.add_item(pos, "mobs:saddle") + mobs.detach(self.driver, {x = 1, y = 0, z = 1}) + end + + end, + + on_rightclick = function(self, clicker) + + -- make sure player is clicking + if not clicker or not clicker:is_player() then + return + end + + -- feed, tame or heal + if mobs:feed_tame(self, clicker, 10, true, true) then + return + end + + -- make sure tamed mob is being clicked by owner only + if self.tamed and self.owner == clicker:get_player_name() then + + local inv = clicker:get_inventory() + + -- detatch player already riding horse + if self.driver and clicker == self.driver then + + mobs.detach(clicker, {x = 1, y = 0, z = 1}) + + -- add saddle back to inventory + if inv:room_for_item("main", "mobs:saddle") then + inv:add_item("main", "mobs:saddle") + else + minetest.add_item(clicker.getpos(), "mobs:saddle") + end + + -- attach player + elseif not self.driver + and clicker:get_wielded_item():get_name() == "mobs:saddle" then + + self.object:set_properties({stepheight = 1.1}) + mobs.attach(self, clicker) + + -- take saddle from inventory + inv:remove_item("main", "mobs:saddle") + end + end + + -- used to capture horse with magic lasso +-- mobs:capture_mob(self, clicker, 0, 0, 80, false, nil) + end }) + diff --git a/mobs/silver_sandonisc.lua b/mobs/silver_sandonisc.lua index fd73e78..dbbdfd0 100644 --- a/mobs/silver_sandonisc.lua +++ b/mobs/silver_sandonisc.lua @@ -6,7 +6,7 @@ mobs:register_mob("nssm:silver_sandonisc", { visual = "mesh", mesh = "silver_sandonisc.x", textures = {{"silver_sandonisc.png"}}, - visual_size = {x=8, y=8}, + visual_size = {x = 8, y = 8}, makes_footstep_sound = false, view_range = 24, rotate = 270, @@ -16,51 +16,43 @@ mobs:register_mob("nssm:silver_sandonisc", { run_velocity = 5, damage = 5, -- sounds = { - -- random = "silver_sandonisc", - --distance = 40, - --}, +-- random = "silver_sandonisc", +-- distance = 40, +-- }, jump = false, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 2, - max = 3,}, + {name = "nssm:life_energy", chance = 1, min = 2, max = 3}, }, armor = 30, drawtype = "front", water_damage = 5, lava_damage = 15, light_damage = 0, - group_attack=true, - attack_animals=false, - knock_back=1, - blood_texture="nssm_blood_blue.png", - stepheight=1.1, - on_rightclick = nil, + group_attack = true, + attack_animals = false, + knock_back = 1, + blood_texture = "nssm_blood_blue.png", + stepheight = 1.1, attack_type = "dogfight", animation = { - speed_normal = 20, - speed_run = 30, - stand_start = 170, - stand_end = 230, - walk_start = 80, - walk_end = 120, - run_start = 40, - run_end = 70, - punch_start = 130, - punch_end = 160, - punch2_start = 40, - punch2_end = 70, - speed_punch2 = 40, - die_start = 235, - die_end = 255, + speed_normal = 20, speed_run = 30, + stand_start = 170, stand_end = 230, + walk_start = 80, walk_end = 120, + run_start = 40, 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) + if self.other_state and self.other_state == "charge" then nssm:do_charge(self) end end, + custom_attack = function (self) nssm:charge_attack(self) end, }) + diff --git a/mobs/silversand_dragon.lua b/mobs/silversand_dragon.lua index 107c43b..eb02672 100644 --- a/mobs/silversand_dragon.lua +++ b/mobs/silversand_dragon.lua @@ -6,28 +6,22 @@ mobs:register_mob("nssm:silversand_dragon", { visual = "mesh", mesh = "silversand_dragon.x", textures = {{"silversand_dragon.png"}}, - visual_size = {x=18, y=18}, + visual_size = {x = 18, y = 18}, view_range = 40, lifetimer = 500, rotate = 270, walk_velocity = 1, run_velocity = 3, stepheight = 2.1, - --[[sounds = { - random = "silversand_dragon", - distance = 45, - },]] +-- sounds = { +-- random = "silversand_dragon", +-- distance = 45, +-- }, damage = 1, jump = false, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 70, - max = 80,}, - {name = "nssm:sun_feather", - chance = 1, - min = 1, - max = 1,}, + {name = "nssm:life_energy", chance = 1, min = 70, max = 80}, + {name = "nssm:sun_feather", chance = 1, min = 1, max = 1}, }, armor = 40, drawtype = "front", @@ -35,67 +29,66 @@ mobs:register_mob("nssm:silversand_dragon", { lava_damage = 3, light_damage = 0, blood_texture="silversand_particle.png", - blood_amount=50, - on_rightclick = nil, + blood_amount = 50, attack_type = "dogfight", reach = 15, shoot_interval = 4, animation = { - speed_normal = 25, - speed_run = 50, - speed_die = 20, - stand_start = 0, - stand_end = 60, - walk_start = 70, - walk_end = 110, - run_start = 70, - run_end = 110, - punch_start = 80, - punch_end = 110, - shoot_start = 80, - shoot_end = 110, - die_start = 120, - die_end = 140, + speed_normal = 25, speed_run = 50, + stand_start = 0, stand_end = 60, + walk_start = 70, walk_end = 110, + run_start = 70, run_end = 110, + punch_start = 80, punch_end = 110, + shoot_start = 80, shoot_end = 110, + die_start = 120, die_end = 140, speed_die = 20, }, custom_attack = function(self) + local p = self.attack:get_pos() local s = self.object:get_pos() 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 vel = vector.subtract(pp,ss) + 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 if self.sounds.attack then + minetest.sound_play(self.sounds.attack, { object = self.object, max_hear_distance = self.sounds.distance }, true) end + -- punch player - self.attack:punch(self.object, 1.0, { + self.attack:punch(self.object, 1.0, { full_punch_interval=1.0, - damage_groups = {fleshy=self.damage} + damage_groups = {fleshy = self.damage} }, nil) end minetest.add_particlespawner({ - amount = 225, --amount - time = 0.5, --time - minpos = ss, --minpos - maxpos = ss, --maxpos - minvel = vector.multiply(vel, 2), --minvel - maxvel = vector.multiply(vel, 4), --maxvel - minacc = {x=0,y=0,z=0}, --minacc - maxacc = {x=0,y=0,z=0}, --maxacc - minexptime = 4, --minexptime - maxexptime = 5, --maxexptime - minsize = 5, --minsize - maxsize = 10, --maxsize - collisiondetection = true, --collisiondetection - texture = "silversand_particle.png" --texture + amount = 225, + time = 0.5, + minpos = ss, + maxpos = ss, + minvel = vector.multiply(vel, 2), + maxvel = vector.multiply(vel, 4), + minacc = {x = 0, y = 0, z = 0}, + maxacc = {x = 0, y = 0, z = 0}, + minexptime = 4, + maxexptime = 5, + minsize = 5, + maxsize = 10, + collisiondetection = true, + texture = "silversand_particle.png" }) end }) + diff --git a/mobs/tartacacia.lua b/mobs/tartacacia.lua index c63dd6d..b991bf5 100644 --- a/mobs/tartacacia.lua +++ b/mobs/tartacacia.lua @@ -6,7 +6,7 @@ mobs:register_mob("nssm:tartacacia", { visual = "mesh", mesh = "tartacacia.x", textures = {{"tartacacia.png"}}, - visual_size = {x=10, y=10}, + visual_size = {x = 10, y = 10}, makes_footstep_sound = true, view_range = 15, walk_velocity = 0.6, @@ -14,64 +14,54 @@ mobs:register_mob("nssm:tartacacia", { reach=10, fear_height = 4, run_velocity = 1.2, - --[[sounds = { - random = "tartacacia", - },]] +-- sounds = { +-- random = "tartacacia", +-- }, damage = 1, jump = true, drops = { - {name = "nssm:life_energy", - chance = 1, - min = 33, - max = 43}, - {name = "nssm:earth_sword", - chance = 1, - min = 1, - max = 1}, - }, + {name = "nssm:life_energy", chance = 1, min = 33, max = 43}, + {name = "nssm:earth_sword", chance = 1, min = 1, max = 1}, + }, armor = 50, drawtype = "front", water_damage = 2, lava_damage = 5, light_damage = 0, - --group_attack=true, - --attack_animals=true, - knock_back=0, - blood_texture="nssm_blood.png", - stepheight=2.1, - on_rightclick = nil, +-- group_attack = true, +-- attack_animals = true, + knock_back = 0, + blood_texture = "nssm_blood.png", + stepheight = 2.1, attack_type = "dogfight", animation = { - speed_normal = 20, - speed_run = 40, - stand_start = 10, - stand_end = 60, - walk_start = 70, - walk_end = 150, - run_start = 70, - run_end = 150, - punch_start = 190, - punch_end = 220, - punch2_start = 230, - punch2_end = 250, - speed_die = 10, - die_start = 160, - die_end = 180, - }, + speed_normal = 20, speed_run = 40, + stand_start = 10, stand_end = 60, + walk_start = 70, walk_end = 150, + run_start = 70, run_end = 150, + punch_start = 190, punch_end = 220, + punch2_start = 230, punch2_end = 250, + die_start = 160, die_end = 180, speed_die = 10, + }, + custom_attack = function (self) + local s = self.object:get_pos() local p = self.attack:get_pos() local d = vector.subtract (p,s) local l = vector.length(d) --- minetest.chat_send_all("l="..l) if math.random(5) == 1 then + if l <= 6 then + self:set_animation("punch") + for y = 0,3 do p.y = p.y - y minetest.remove_node(p) end + self.attack:punch(self.object, 1.0, { full_punch_interval = 1.0, damage_groups = {fleshy = self.damage} @@ -79,13 +69,16 @@ mobs:register_mob("nssm:tartacacia", { end else self:set_animation("punch2") + self.attack:punch(self.object, 1.0, { full_punch_interval = 1.0, damage_groups = {fleshy = self.damage} }, nil) + 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, }) + diff --git a/nssm_api.lua b/nssm_api.lua index 1160b9b..9f7be8c 100644 --- a/nssm_api.lua +++ b/nssm_api.lua @@ -1,22 +1,29 @@ - function nssm:do_charge(self) + self.state = "" + if self.charge_vec and self.charge_dir then + self:set_animation("punch2") self.object:set_velocity(self.charge_vec) self.object:set_yaw(self.charge_dir) + 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 _,obj + local all_objects = minetest.get_objects_inside_radius( + self.object:get_pos(), 1.5 * prop.collisionbox[5] / 2) + for _,obj in ipairs(all_objects) do + if obj:is_player() then - 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 - obj:get_luaentity().health = obj:get_luaentity().health - 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 + obj:get_luaentity().health = obj:get_luaentity().health - self.damage / 5 end end end + if self.charge_timer and os.time() - self.charge_timer > 5 then self.other_state = "stand" self.state = "stand" @@ -25,11 +32,13 @@ end function nssm:charge_attack(self) + local s = self.object: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) else self.other_state = "charge" @@ -37,7 +46,9 @@ function nssm:charge_attack(self) self.charge_vec = vec self.charge_dir = self.object:get_yaw() self.charge_timer = os.time() + nssm:do_charge(self) + minetest.after(3, function(self) self.other_state = "stand" self.state = "stand" diff --git a/nssm_bows.lua b/nssm_bows.lua index 37e99d5..be03ef6 100644 --- a/nssm_bows.lua +++ b/nssm_bows.lua @@ -1,30 +1,30 @@ if minetest.get_modpath("bows") then bows.register_bow("bow_berinhog",{ - description="Berinhog Bow", - texture="bow_berinhog.png", - texture_loaded="bow_berinhog_loaded.png", - uses=400, - level=16, - shots=1, - craft={ - {"","nssm:berinhog_horn","nssm:web_string"}, - {"group:stick","","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"}, - {"","",""}, + description = "Berinhog Bow", + texture = "bow_berinhog.png", + texture_loaded = "bow_berinhog_loaded.png", + uses = 400, + level = 16, + shots = 1, + craft = { + {"", "nssm:berinhog_horn", "nssm:web_string"}, + {"group:stick", "", "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"}, + {"", "", ""} + } + }) end + diff --git a/nssm_materials.lua b/nssm_materials.lua index 0cb2f88..3de18de 100644 --- a/nssm_materials.lua +++ b/nssm_materials.lua @@ -1,93 +1,99 @@ ---non eatable craftitems + +-- non eatable craftitems local function nssm_register_noneatcraftitems (name, descr) -minetest.register_craftitem(":nssm:"..name, { - description = descr, - image = name..".png", -}) - + minetest.register_craftitem(":nssm:" .. name, { + description = descr, + image = name .. ".png", + }) end -nssm_register_noneatcraftitems ('masticone_core','Masticone Core') -nssm_register_noneatcraftitems ('berinhog_horn','Berinhog Horn') -nssm_register_noneatcraftitems ('earth_heart','Earth Heart') +nssm_register_noneatcraftitems ("masticone_core","Masticone Core") +nssm_register_noneatcraftitems ("berinhog_horn","Berinhog Horn") +nssm_register_noneatcraftitems ("earth_heart","Earth Heart") minetest.register_craftitem(":nssm:cold_stars", { description = "Cold Stars", image = "cold_stars.png", + 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 dx = math.random(-20,20) - local dy = math.random(-3,20) - local dz = math.random(-20,20) - 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"}) + local dx = math.random(-20, 20) + local dy = math.random(-3, 20) + local dz = math.random(-20, 20) + 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"}) minetest.get_node_timer(pos1):start(400) end end - if not minetest.setting_getbool("creative_mode") then + + if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() end + return itemstack end }) - - ---nodes +-- nodes minetest.register_node(":nssm:crystal_gas", { description = "Crystal Gas", - --inventory_image = minetest.inventorycube("venomous_gas.png"), drawtype = "airlike", - --tiles = { - --{name="venomous_gas_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}} - --}, paramtype = "light", walkable = false, - --sunlight_propagates = true, +-- sunlight_propagates = true, pointable = false, diggable = false, buildable_to = true, drop = "", drowning = 2, - post_effect_color = {a=1000, r=1000, g=1000, b=1000}, - groups = {flammable = 2, not_in_creative_inventory =1}, + post_effect_color = {a = 1000, r = 1000, g = 1000, b = 1000}, + groups = {flammable = 2, not_in_creative_inventory = 1}, }) minetest.register_node(":nssm:slug_crystal", { description = "Slug Crystal", - tiles = {"slug_crystal.png"} , + tiles = {"slug_crystal.png"}, paramtype = "light", drawtype = "glasslike", drowning = 10, damage_per_second = 1, 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, - groups = {cracky=1, not_in_creative_inventory =1}, + groups = {cracky = 1, not_in_creative_inventory = 1}, }) minetest.register_node(":nssm:coldest_ice", { description = "Coldest Ice", - tiles = {"coldest_ice.png"} , + tiles = {"coldest_ice.png"}, paramtype = "light", drowning = 2, damage_per_second = 1, drop = "", light_source = 3, - groups = {cracky=1, not_in_creative_inventory =1}, + groups = {cracky = 1, not_in_creative_inventory = 1}, }) minetest.register_node(":nssm:mud", { description = "Mud", inventory_image = "mude.png", 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, paramtype = "light", @@ -101,32 +107,36 @@ minetest.register_node(":nssm:mud", { liquid_alternative_flowing = "nssm:mud", liquid_alternative_source = "nssm:mud", liquid_viscosity = 10, - groups = {crumbly=1, liquid=1}, + groups = {crumbly = 1, liquid = 1}, }) +-- Abms + minetest.register_abm({ nodenames = {"nssm:mud"}, neighbors = {"air"}, interval = 15, chance = 10, + 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 minetest.set_node(pos, {name="default:dirt"}) end end }) - ---abms - minetest.register_abm({ nodenames = {"nssm:crystal_gas"}, interval = 1, chance = 4, + 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 }) @@ -134,63 +144,76 @@ minetest.register_abm({ nodenames = {"nssm:slug_crystal"}, interval = 20, chance = 3, + 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 }) ---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", - image = name.."_egg.png", + image = name .. "_egg.png", + 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() - minetest.add_entity(pos1, "nssm:".. name) + minetest.add_entity(pos1, "nssm:" .. name) end) + if not mobs.is_creative(placer:get_player_name()) then itemstack:take_item() end + return itemstack 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", - image = name.."_egg.png", + image = name .. "_egg.png", + 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() - minetest.add_entity(pos1, "nssm:".. name) + minetest.add_entity(pos1, "nssm:" .. name) end) + if not mobs.is_creative(placer:get_player_name()) then itemstack:take_item() end + return itemstack end, }) end -nssm_register_egg ('albino_spider', 'Albino Spider') -nssm_register_egg ('chog', 'Chog') -nssm_register_egg2 ('silversand_dragon', 'Silversand Dragon') -nssm_register_egg2 ('tartacacia', 'Tartacacia') -nssm_register_egg2 ('river_lord', 'River Lord') -nssm_register_egg ('icelizard', 'Icelizard') -nssm_register_egg ('kele', 'Kele') -nssm_register_egg ('crystal_slug', 'Crystal Slug') -nssm_register_egg ('berinhog', 'Berinhog') -nssm_register_egg ('black_scorpion', 'Black Scorpion') -nssm_register_egg ('pumpkid', 'Pumpkid') -nssm_register_egg ('salamander', 'Salamander') -nssm_register_egg ('flust', 'Flust') -nssm_register_egg ('pelagia', 'Pelagia') +nssm_register_egg("albino_spider", "Albino Spider") +nssm_register_egg("chog", "Chog") +nssm_register_egg2("silversand_dragon", "Silversand Dragon") +nssm_register_egg2("tartacacia", "Tartacacia") +nssm_register_egg2("river_lord", "River Lord") +nssm_register_egg("icelizard", "Icelizard") +nssm_register_egg("kele", "Kele") +nssm_register_egg("crystal_slug", "Crystal Slug") +nssm_register_egg("berinhog", "Berinhog") +nssm_register_egg("black_scorpion", "Black Scorpion") +nssm_register_egg("pumpkid", "Pumpkid") +nssm_register_egg("salamander", "Salamander") +nssm_register_egg("flust", "Flust") +nssm_register_egg("pelagia", "Pelagia") diff --git a/nssm_tools.lua b/nssm_tools.lua index 66b82c5..2743bff 100644 --- a/nssm_tools.lua +++ b/nssm_tools.lua @@ -1,177 +1,225 @@ ---tools + +-- tools + minetest.register_tool(":nssm:ice_sword", { description = "Ice Sword", inventory_image = "ice_sword.png", tool_capabilities = { - full_punch_interval =0.4 , - max_drop_level=1, - groupcaps={ - 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} + full_punch_interval = 0.4, + max_drop_level = 1, + groupcaps = { + 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} }, - damage_groups = {fleshy=12}, + damage_groups = {fleshy = 12}, }, - on_drop = function(itemstack, dropper, pos) - local objects = minetest.get_objects_inside_radius(pos, 10) - local flag = 0 - local vec = dropper:get_look_dir() - local pos = dropper:getpos() - --vec.y = 0 - for i=1,4 do + on_drop = function(itemstack, dropper, pos) + + local objects = minetest.get_objects_inside_radius(pos, 10) + local flag = 0 + local vec = dropper:get_look_dir() + local pos = dropper:get_pos() + + for i = 1, 4 do pos = vector.add(pos, vec) end 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 - 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() + if n == "nssm:life_energy" then found = i break end end + if found == 0 then minetest.chat_send_player(pname, "You haven't got any Life Energy!") return else - local items = player_inv:get_stack('main', found) + + local items = player_inv:get_stack("main", found) + items:take_item() - player_inv:set_stack('main', found, items) - for dx = -1,1 do - for dz = -1,1 do - 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"}) + + player_inv:set_stack("main", found, items) + + for dx = -1, 1 do + for dz = -1, 1 do + + 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 }) minetest.register_tool(":nssm:earth_warhammer", { description = "Earth Warhammer", inventory_image = "earth_warhammer.png", tool_capabilities = { - full_punch_interval =0.4 , - max_drop_level=1, - groupcaps={ - 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} + full_punch_interval = 0.4, + max_drop_level = 1, + groupcaps = { + 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} }, - damage_groups = {fleshy=12}, + damage_groups = {fleshy = 12}, }, + on_drop = function(itemstack, dropper, pos) - local objects = minetest.env:get_objects_inside_radius(pos, 10) - local flag = 0 - for _,obj in ipairs(objects) do + + local objects = minetest.env:get_objects_inside_radius(pos, 10) + 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 - --minetest.chat_send_all("Inventory empty") - else - local found = 0 - for i = 1,32 do - local items = player_inv:get_stack('main', i) - local n = items:get_name() - if n == "nssm:energy_globe" then - found = i - break - end - end - if found == 0 then - minetest.chat_send_player(pname, "You haven't got any Energy Globe!") - return - else + 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 + local found = 0 + + for i = 1, 32 do + + local items = player_inv:get_stack("main", i) + local n = items:get_name() + + if n == "nssm:energy_globe" then + found = i + break + end + end + + if found == 0 then + minetest.chat_send_player(pname, "You haven't got any Energy Globe!") + return + else 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) - items:take_item() - player_inv:set_stack('main', found, items) - end - else - if (obj:get_luaentity().health) then + 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() + + player_inv:set_stack("main", found, items) + end + else + if obj:get_luaentity().health then obj:get_luaentity().old_y = pos.y - obj:setpos(pos) - part=1 - --flag = 1 + obj:set_pos(pos) + part = 1 +-- flag = 1 - local items = player_inv:get_stack('main', found) - items:take_item() - player_inv:set_stack('main', found, items) - end - end - end - end - end - end - end, + local items = player_inv:get_stack("main", found) + + items:take_item() + + player_inv:set_stack("main", found, items) + end + end + end + end + end + end + end }) minetest.register_tool(":nssm:earth_sword", { description = "Earth Sword", inventory_image = "earth_sword.png", tool_capabilities = { - full_punch_interval =0.4 , - max_drop_level=1, - groupcaps={ - 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} + full_punch_interval = 0.4, + max_drop_level = 1, + groupcaps = { + 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} }, - damage_groups = {fleshy=12}, + damage_groups = {fleshy = 12}, }, + on_drop = function(itemstack, dropper, pos) - local objects = minetest.get_objects_inside_radius(pos, 10) - local flag = 0 + + local objects = minetest.get_objects_inside_radius(pos, 10) + local flag = 0 local vec = dropper:get_look_dir() 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) end 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 - 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() + if n == "nssm:energy_globe" then found = i break end end + if found == 0 then minetest.chat_send_player(pname, "You haven't got any Energy Globe!") return else - local items = player_inv:get_stack('main', found) + local items = player_inv:get_stack("main", found) + items:take_item() - player_inv:set_stack('main', found, items) - for dx = -1,1 do - for dy = -12,3 do - for dz = -1,1 do - 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 + + player_inv:set_stack("main", found, items) + + for dx = -1, 1 do + for dy = -12, 3 do + for dz = -1, 1 do + + 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 }) diff --git a/spawn.lua b/spawn.lua index 72c08b5..489ae2d 100644 --- a/spawn.lua +++ b/spawn.lua @@ -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 -if (mymapgenis~=6) and (mymapgenis~=7) then - mymapgenis = 7 -end -- 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) + -- V6 MAPGEN - -- 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) + if v6 then - -- FOREST - mobs:spawn_specific("nssm:crystal_slug", {"default:leaves", "default:aspen_leaves"}, {"air"}, 0, 20, 40, 4000000/mm, 1, -31000, 140) + -- DIRT - -- 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) + 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 + }) - else + -- ICE - -- 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:icelizard", + nodes = { + "default:snowblock", "default:ice", + "default:dirt_with_snow", "default:snow" + }, + neighbors = { + {"default:snowblock", "default:ice", "default:dirt_with_snow"} + }, + chance = (6000000 / mm) + }) - -- 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) + -- 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 - 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) + -- PINE FOREST - -- 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: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 + + 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 + + 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 + + mobs:spawn({ + name = "nssm:crystal_slug", + nodes = {"default:leaves", "default:aspen_leaves"}, + interval = 40, + chance = (4000000 / mm), + max_height = 140 + }) + + -- PINE FOREST + + mobs:spawn({ + name = "nssm:pumpkid", + nodes = { + "default:dirt_with_grass", "default:dirt_with_snow", + "default:snowblock" + }, + neighbors = {"default:pine_tree"}, + chance = (3300000 / mm) + }) + + -- SAVANNA + + 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 - 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_specific("nssm:silversand_dragon", {"default:silver_sand"}, {"default:silver_sand"}, 0, 20, 180, 2000000000/mm, 1, -200, 31000) + + mobs:spawn({ + 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 - 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 - if minetest.get_modpath("nssb") then - mobs:spawn_specific("nssm:xgaloctopus", {"default:water_source"}, {"nssb:marine_brick"}, 0, 20, 20, 800000/mm, 1, -31000, 0) + mobs:spawn({ + name = "nssm:river_lord", + nodes = {"default:river_water_source"}, + neighbors = {"default:sand", "default:river_water_source"}, + chance = (300000000 / mm), + max_height = 300 + }) end -- 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 - 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 +