diff --git a/mobs/mese_dragon.lua b/mobs/mese_dragon.lua deleted file mode 100644 index 2a429ef..0000000 --- a/mobs/mese_dragon.lua +++ /dev/null @@ -1,205 +0,0 @@ -mobs:register_mob("nssm:mese_dragon", { - type = "monster", - hp_max = 666, - hp_min = 666, - collisionbox = {-0.8, 0, -0.8, 0.8, 4, 0.8}, - visual = "mesh", - mesh = "mese_dragon.x", - textures = {{"mese_dragon.png"}}, - visual_size = {x=8, y=8}, - makes_footstep_sound = true, - view_range = 45, - rotate = 270, - fear_height = 5, - walk_velocity = 2, - run_velocity = 4, - sounds = { - shoot_attack = "mesed", - attack = "mese_dragon", - distance = 60, - }, - damage = 18, - jump = true, - jump_height = 10, - drops = { - {name = "nssm:rainbow_staff", - chance = 1, - min = 1, - max = 1}, - {name = "nssm:energy_globe", - chance = 1, - min = 99, - max = 99}, - }, - armor = 30, - drawtype = "front", - water_damage = 0, - lava_damage = 0, - light_damage = 0, - on_rightclick = nil, - attack_type = "dogfight", - blood_texture="mese_blood.png", - blood_amount=30, - stepheight=3.1, - knock_back=0, - jump_height=12, - dogshoot_count_max = 9, - arrow = "nssm:roar_of_the_dragon", - reach = 25, - shoot_interval = 3, - shoot_offset = -1, - animation = { - speed_normal = 15, - speed_run = 25, - stand_start = 60, - stand_end = 120, - walk_start = 161, - walk_end = 205, - run_start = 206, - run_end = 242, - punch_start = 242, - punch_end = 275, - punch2_start = 330, - punch2_end = 370, - shoot_start = 120, - shoot_end = 160, - }, - --[[ - do_custom = function(self) - --midas_ability(self, "default:mese_block", self.run_velocity,2, 3) - end, - - - custom_attack = function(self) - if self.timer > 1 then - self.timer = 0 - self.attack_rip = self.attack_rip+1 - - local s = self.object:getpos() - local p = self.attack:getpos() - - p.y = p.y + 1.5 - s.y = s.y + 1.5 - - if minetest.line_of_sight(p, s) == 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 - }) - end - -- punch player - self.attack:punch(self.object, 1.0, { - full_punch_interval=1.0, - damage_groups = {fleshy=self.damage} - }, nil) - end - if self.attack_rip>=8 then - self.attack_rip =0 - set_animation("punch1") - for dx = -17,17 do - for dz= -17,17 do - local k = {x = s.x+dx, y=s.y+20, z=s.z+dz} - local n = minetest.env:get_node(k).name - if n=="air" and math.random(1,23)==1 then - minetest.env:set_node(k, {name="nssm:mese_meteor"}) - nodeupdate(k) - end - end - end - end - end - end, - ]] - custom_attack = function(self) - local p = self.attack:getpos() - local s = self.object:getpos() - s.y = s.y + 5; - local vel = vector.subtract(p,s) - set_animation(self, "shoot") - - minetest.add_particlespawner( - 125, --amount - 0.5, --time - s, --minpos - s, --maxpos - vector.multiply(vel, 0.5), --minvel - vector.multiply(vel, 1.4), --maxvel - {x=0,y=0,z=0}, --minacc - {x=0,y=0,z=0}, --maxacc - 2, --minexptime - 4, --maxexptime - 1, --minsize - 2, --maxsize - true, --collisiondetection - "phoenix_fire.png" --texture - ) - - - local obj = minetest.add_entity(s, "nssm:mese_dart") - local ran = math.random(7,14)/10 - local vec = vector.multiply(vel, ran) - obj:setvelocity(vec) - - minetest.after(0.5, function() - if self.attack then - local p = self.attack:getpos() - local vel = vector.subtract(p,s) - local obj = minetest.add_entity(s, "nssm:mese_dart") - local ran = math.random(7,14)/10 - local vec = vector.multiply(vel, ran) - obj:setvelocity(vec) - end - end) - end, - --[[ - do_custom = function (self) - --minetest.chat_send_all(s.y.."-"..p.y.."="..(s.y-p.y)) - if self.state == "attack" then - if self.attack then - local s = self.object:getpos() - local p = self.attack:getpos() - if (s.y - p.y ) < 10 then - local v = self.object:getvelocity() - v.y = 10 - self.object:setvelocity(v) - end - end - end - end,]] -}) - -minetest.register_entity("nssm:mese_dart", { - textures = {"transparent.png"}, - on_step = function(self, dtime) - self.timer = (self.timer) or os.time() - self.attack = (self.attack) or os.time() - if os.time() - self.timer > 4 then - self.object:remove() - end - local p = self.object:getpos() - local all_objects = minetest.get_objects_inside_radius(p, 1) - local players = {} - local _,obj - for _,obj in ipairs(all_objects) do - if obj:is_player() then - obj:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = 10} - }, nil) - self.object:remove() - end - end - local n = minetest.get_node(p).name - if n ~= "air" then - minetest.set_node(p, {name="default:mese_block"}) - self.object:remove(); - end - - local node = minetest.get_node(p).name - if node ~= "air" then - self.object:remove() - end - end, -}) diff --git a/nssm_api.lua b/nssm_api.lua deleted file mode 100644 index f2207b0..0000000 --- a/nssm_api.lua +++ /dev/null @@ -1,939 +0,0 @@ --- set content id's -local c_air = minetest.get_content_id("air") -local c_ignore = minetest.get_content_id("ignore") -local c_obsidian = minetest.get_content_id("default:obsidian") -local c_brick = minetest.get_content_id("default:obsidianbrick") -local c_chest = minetest.get_content_id("default:chest_locked") - -nssm.lessvirulent = minetest.setting_getbool("nssm.lessvirulent") or false -nssm.safebones = minetest.setting_getbool("nssm.safebones") or false -nssm.cryosave = minetest.setting_getbool("nssm.cryosave") or false - -function nssm:virulence(mobe) - if not nssm.lessvirulent then - return 0 - end - return math.ceil(100 / mobe.hp_max) -end - -function nssm:affectbones(mobe) -- as function for adaptable heuristic - return not nssm.safebones -end - -function drops(drop) - if drop then - drop:setvelocity({ - x = math.random(-10, 10) / 9, - y = 5, - z = math.random(-10, 10) / 9, - }) - end -end - -function perpendicular_vector(vec) --returns a vector rotated of 90° in 2D - local ang = math.pi/2 - local c = math.cos(ang) - local s = math.sin(ang) - - local i = vec.x*c - vec.z*s - local k = vec.x*s + vec.z*c - local j = 0 - - vec = {x=i, y=j, z=k} - return vec -end - -function add_entity_and_particles(entity, pos, particles, multiplier) - minetest.add_particlespawner({ - amount = 100*multiplier, - time = 2, - minpos = {x=pos.x-2, y=pos.y-1, z=pos.z-2}, - maxpos = {x=pos.x+2, y=pos.y+4, z=pos.z+2}, - minvel = {x=0, y=0, z=0}, - maxvel = {x=1, y=2, z=1}, - minacc = {x=-0.5,y=0.6,z=-0.5}, - maxacc = {x=0.5,y=0.7,z=0.5}, - minexptime = 2, - maxexptime = 3, - minsize = 3, - maxsize = 5, - collisiondetection = false, - vertical = false, - texture = particles, - }) - minetest.add_entity(pos, entity) -end - --- get node but use fallback for nil or unknown -function node_ok(pos, fallback) - fallback = fallback or "default:dirt" - local node = minetest.get_node_or_nil(pos) - if not node then - return minetest.registered_nodes[fallback] - end - if minetest.registered_nodes[node.name] then - return node - end - return minetest.registered_nodes[fallback] -end - -function dist_pos(p, s) - local v = {x = math.abs(s.x-p.x), y = math.abs(s.y-p.y), z = math.abs(s.z-p.z)} - local r = math.sqrt(v.x^2+v.y^2+v.z^2) - return r -end - ---check_for_death functions customized for monsters who respawns (Masticone) -function check_for_death_hydra(self) - local hp = self.object:get_hp() - if hp > 0 then - self.health = hp - if self.sounds.damage ~= nil then - minetest.sound_play(self.sounds.damage,{ - object = self.object, - max_hear_distance = self.sounds.distance - }) - end - return false - end - local pos = self.object:getpos() - local obj = nil - if self.sounds.death ~= nil then - minetest.sound_play(self.sounds.death,{ - object = self.object, - max_hear_distance = self.sounds.distance - }) - end - self.object:remove() - return true -end - - -function round(n) - if (n>0) then - return n % 1 >= 0.5 and math.ceil(n) or math.floor(n) - else - n=-n - local t = n % 1 >= 0.5 and math.ceil(n) or math.floor(n) - return -t - end -end - -function explosion_particles(pos, exp_radius) - minetest.add_particlespawner( - 100*exp_radius/2, --amount - 0.1, --time - {x=pos.x-exp_radius, y=pos.y-exp_radius, z=pos.z-exp_radius}, --minpos - {x=pos.x+exp_radius, y=pos.y+exp_radius, z=pos.z+exp_radius}, --maxpos - {x=0, y=0, z=0}, --minvel - {x=0.1, y=0.3, z=0.1}, --maxvel - {x=-0.5,y=1,z=-0.5}, --minacc - {x=0.5,y=1,z=0.5}, --maxacc - 0.1, --minexptime - 4, --maxexptime - 6, --minsize - 12, --maxsize - false, --collisiondetection - "tnt_smoke.png" --texture - ) -end ---[[ -function explosion(pos, exp_radius, fire, kamehameha_bad) - local radius = exp_radius - -- if area protected or near map limits then no blast damage - if minetest.is_protected(pos, "") - or not within_limits(pos, radius) then - return - end - - --sound - minetest.sound_play("boom", { - pos = pos, - max_hear_distance = exp_radius*4, - }) - - --particles: - explosion_particles(pos, exp_radius) - - --Damages entities around (not the player) - local objects = minetest.env:get_objects_inside_radius(pos, exp_radius) - for _,obj in ipairs(objects) do - local obj_p = obj:getpos() - local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z} - local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5 - local damage = (-exp_radius*dist+exp_radius^2)*2 - if not kamehameha_bad then - if obj:is_player() then - obj:set_hp(obj:get_hp()-damage) - elseif obj:get_luaentity().health then - obj:get_luaentity().health = obj:get_luaentity().health - damage - check_for_death(obj:get_luaentity()) - end - else - if (obj:get_luaentity()) then - local name = obj:get_luaentity().name - if (name~="nssm:morvalar0") and (name~="nssm:morvalar5") then - if obj:is_player() then - obj:set_hp(obj:get_hp()-damage) - elseif obj:get_luaentity().health then - obj:get_luaentity().health = obj.get_luaentity().health - damage - check_for_death(obj:get_luaentity()) - end - end - end - end - end - - --damages blocks around and if necessary put some fire - pos = vector.round(pos) -- voxelmanip doesn't work properly unless pos is rounded ?!?! - local vm = VoxelManip() - local minp, maxp = vm:read_from_map(vector.subtract(pos, radius), vector.add(pos, radius)) - local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) - local data = vm:get_data() - local p = {} - local pr = PseudoRandom(os.time()) - - --remove everything near the center of the explosion - for dz=-radius,radius do - for dy=-radius,radius do - local vi = a:index(pos.x + (-radius), pos.y + dy, pos.z + dz) - for dx=-radius,radius do - local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} - - if (dx * dx) + (dy * dy) + (dz * dz) <= (radius * radius) + pr:next(-radius, radius) - and data[vi] ~= c_air - and data[vi] ~= c_ignore - and data[vi] ~= c_obsidian - and data[vi] ~= c_brick - and data[vi] ~= c_chest then - - local n = node_ok(p).name - local on_blast = minetest.registered_nodes[n].on_blast - - if on_blast then - return on_blast(p) - end - - if minetest.get_item_group(n, "unbreakable") ~= 1 then - - -- if chest then drop items inside - if n == "default:chest" - or n == "3dchest:chest" - or n == "bones:bones" then - - local meta = minetest.get_meta(p) - local inv = meta:get_inventory() - - for i = 1, inv:get_size("main") do - - local m_stack = inv:get_stack("main", i) - local obj = minetest.add_item(p, m_stack) - - if obj then - - obj:setvelocity({ - x = math.random(-2, 2), - y = 7, - z = math.random(-2, 2) - }) - end - end - end - - -- after effects - if fire > 0 - and (minetest.registered_nodes[n].groups.flammable - or math.random(1, 100) <= 3) then - minetest.set_node(p, {name = "fire:basic_flame"}) - else - local dist = round(((pos.x-p.x)^2 + (pos.y-p.y)^2 + (pos.z-p.z)^2)^1/2) - local prob = 2/dist - if math.random(1,100)<=prob*100 then - minetest.env:remove_node(p) - end - end - end - end - vi = vi+1 - end - end - end -end -]] - --- SPECIAL ABILITIES OF SOME MOBS ---[[function digging_ability( - self, --the entity of the mob - group, --group of the blocks the mob can dig: nil=everything - max_vel, --max velocity of the mob - dim --vector representing the dimensions of the mob - ) - - --if math.random(1,nssm:virulence(self)) ~= 1 then return end - - local v = self.object:getvelocity() - local pos = self.object:getpos() - - if minetest.is_protected(pos, "") then - return - end - - local h = dim.y - - local max = 0 - --local posmax = 0 -- 1 = x, -1=-x, 2 = z, -2 = -z - local yaw = (self.object:getyaw() + self.rotate) or 0 - local x = math.sin(yaw)*-1 - local z = math.cos(yaw) - - local i = 1 - local i1 = -1 - local k = 1 - local k1 = -1 - - local multiplier = 2 - - if x>0 then - i = round(x*max_vel)*multiplier - else - i1 = round(x*max_vel)*multiplier - end - - if z>0 then - k = round(z*max_vel)*multiplier - else - k1 = round(z*max_vel)*multiplier - end - - for dx = i1, i do - for dy = 0, h do - for dz = k1, k do - local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} - - local n = minetest.env:get_node(p).name - --local up = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} - if group == nil then - if minetest.get_item_group(n, "unbreakable") == 1 or minetest.is_protected(p, "") or (n == "bones:bones" and not nssm:affectbones(self) ) then - else - --minetest.env:set_node(p, {name="air"}) - minetest.remove_node(p) - end - else - if (minetest.get_item_group(n, group)==1) and (minetest.get_item_group(n, "unbreakable") ~= 1) and (n == "bones:bones" and not (minetest.is_protected(p, "")) ) then - --minetest.env:set_node(p, {name="air"}) - minetest.remove_node(p) - end - end - end - end - end -end -]]-- -function digging_attack( - self, --the entity of the mob - group, --group of the blocks the mob can dig: nil=everything - max_vel, --max velocity of the mob - dim --vector representing the dimensions of the mob - ) - - --if math.random(1,nssm:virulence(self)) ~= 1 then return end - if self.attack and self.attack:is_player() then - local s = self.object:getpos() - local p = self.attack:getpos() - - local dir = vector.subtract(p,s) - dir = vector.normalize(dir) - local per = perpendicular_vector(dir) - - - local posp = vector.add(s,dir) - - - --minetest.chat_send_all("La mia posizione:"..minetest.pos_to_string(s)) - --minetest.chat_send_all("La posizione davanti:"..minetest.pos_to_string(posp)) - posp = vector.subtract(posp,per) - - - for j = 1,3 do - --minetest.chat_send_all("pos1:"..minetest.pos_to_string(posp).." per.y= "..dim.y) - if minetest.is_protected(posp, "") then - return - end - local pos1 = posp - - for i = 0,dim.y do - - --minetest.chat_send_all("pos2:"..minetest.pos_to_string(posp).." per.y= "..per.y) - - local n = minetest.env:get_node(pos1).name - --local up = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} - if group == nil then - if minetest.get_item_group(n, "unbreakable") == 1 or minetest.is_protected(pos1, "") or (n == "bones:bones" and not nssm:affectbones(self) ) then - else - --minetest.env:set_node(p, {name="air"}) - minetest.remove_node(pos1) - end - else - if ((minetest.get_item_group(n, group)==1) and (minetest.get_item_group(n, "unbreakable") ~= 1) and (n ~= "bones:bones") and not (minetest.is_protected(pos1, "")) ) then - --minetest.env:set_node(p, {name="air"}) - minetest.remove_node(pos1) - end - end - pos1.y = pos1.y+1 - end - posp.y=s.y - posp=vector.add(posp,per) - --minetest.chat_send_all("pos3:"..minetest.pos_to_string(posp).." per.y= "..per.y) - end - end -end - - -function putting_ability( --puts under the mob the block defined as 'p_block' - self, --the entity of the mob - p_block, --definition of the block to use - max_vel --max velocity of the mob - ) - --if math.random(1,nssm:virulence(self)) ~= 1 then return end - - local v = self.object:getvelocity() - - local dx = 0 - local dz = 0 - - if (math.abs(v.x)>math.abs(v.z)) then - if (v.x)>0 then - dx = 1 - else - dx = -1 - end - else - if (v.z)>0 then - dz = 1 - else - dz = -1 - end - end - - local pos = self.object:getpos() - local pos1 - pos.y=pos.y-1 - pos1 = {x = pos.x+dx, y = pos.y, z = pos.z+dz} - local n = minetest.env:get_node(pos).name - local n1 = minetest.env:get_node(pos1).name - local oldmetainf = {minetest.get_meta(pos):to_table(),minetest.get_meta(pos1):to_table() } - if n~=p_block and not minetest.is_protected(pos, "") and (n == "bones:bones" and nssm:affectbones(self) ) and n~="air" then - minetest.env:set_node(pos, {name=p_block}) - if nssm.cryosave then - local metai = minetest.get_meta(pos) - metai:from_table(oldmetainf[1]) -- this is enough to save the meta - metai:set_string("nssm",n) - end - end - if n1~=p_block and not minetest.is_protected(pos1, "") and (n == "bones:bones" and nssm:affectbones(self) ) and n~="air" then - minetest.env:set_node(pos1, {name=p_block}) - if nssm.cryosave then - local metai = minetest.get_meta(pos1) - metai:from_table(oldmetainf[2]) -- this is enough to save the meta - metai:set_string("nssm",n1) - end - end -end - - -function webber_ability( --puts randomly around the block defined as w_block - self, --the entity of the mob - w_block, --definition of the block to use - radius --max distance the block can be put - ) - - if (nssm:virulence(self)~=0) and (math.random(1,nssm:virulence(self)) ~= 1) then return end - - local pos = self.object:getpos() - - if minetest.is_protected(pos, "") then - return - end - - if (math.random(1,55)==1) then - local dx=math.random(1,radius) - local dz=math.random(1,radius) - local p = {x=pos.x+dx, y=pos.y-1, z=pos.z+dz} - local t = {x=pos.x+dx, y=pos.y, z=pos.z+dz} - local n = minetest.env:get_node(p).name - local k = minetest.env:get_node(t).name - if ((n~="air")and(k=="air")) and not minetest.is_protected(t, "") then - minetest.env:set_node(t, {name=w_block}) - end - end -end - -function midas_ability( --ability to transform every blocks it touches in the m_block block - self, --the entity of the mob - m_block, - max_vel, --max velocity of the mob - mult, --multiplier of the dimensions of the area around that need the transformation - height --height of the mob - ) - --if math.random(1,nssm:virulence(self)) ~= 1 then return end - - local v = self.object:getvelocity() - local pos = self.object:getpos() - - if minetest.is_protected(pos, "") then - return - end - - local max = 0 - local yaw = (self.object:getyaw() + self.rotate) or 0 - local x = math.sin(yaw)*-1 - local z = math.cos(yaw) - - local i = 1 - local i1 = -1 - local k = 1 - local k1 = -1 - - local multiplier = mult - - if x>0 then - i = round(x*max_vel)*multiplier - else - i1 = round(x*max_vel)*multiplier - end - - if z>0 then - k = round(z*max_vel)*multiplier - else - k1 = round(z*max_vel)*multiplier - end - - for dx = i1, i do - for dy = -1, height do - for dz = k1, k do - local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} - local n = minetest.env:get_node(p).name - - if minetest.get_item_group(n, "unbreakable") == 1 or minetest.is_protected(p, "") or n=="air" or (n == "bones:bones" and not nssm:affectbones(self)) then - else - minetest.env:set_node(p, {name=m_block}) - end - end - end - end -end - - - --- NEW EXPLOSION FUNCTION - --- loss probabilities array (one in X will be lost) -local loss_prob = {} - -loss_prob["default:cobble"] = 3 -loss_prob["default:dirt"] = 4 - -local tnt_radius = tonumber(minetest.setting_get("tnt_radius") or 3) - -local cid_data = {} -minetest.after(0, function() - for name, def in pairs(minetest.registered_nodes) do - cid_data[minetest.get_content_id(name)] = { - name = name, - drops = def.drops, - flammable = def.groups.flammable, - on_blast = def.on_blast, - } - end -end) - -local function rand_pos(center, pos, radius) - local def - local reg_nodes = minetest.registered_nodes - local i = 0 - repeat - -- Give up and use the center if this takes too long - if i > 4 then - pos.x, pos.z = center.x, center.z - break - end - pos.x = center.x + math.random(-radius, radius) - pos.z = center.z + math.random(-radius, radius) - def = reg_nodes[minetest.get_node(pos).name] - i = i + 1 - until def and not def.walkable -end - -local function add_effects(pos, radius, drops) - minetest.add_particle({ - pos = pos, - velocity = vector.new(), - acceleration = vector.new(), - expirationtime = 0.4, - size = radius * 10, - collisiondetection = false, - vertical = false, - texture = "tnt_boom.png", - }) - minetest.add_particlespawner({ - amount = 64, - time = 0.5, - minpos = vector.subtract(pos, radius / 2), - maxpos = vector.add(pos, radius / 2), - minvel = {x = -10, y = -10, z = -10}, - maxvel = {x = 10, y = 10, z = 10}, - minacc = vector.new(), - maxacc = vector.new(), - minexptime = 1, - maxexptime = 2.5, - minsize = radius * 3, - maxsize = radius * 5, - texture = "tnt_smoke.png", - }) - - -- we just dropped some items. Look at the items entities and pick - -- one of them to use as texture - local texture = "tnt_blast.png" --fallback texture - local most = 0 - for name, stack in pairs(drops) do - local count = stack:get_count() - if count > most then - most = count - local def = minetest.registered_nodes[name] - if def and def.tiles and def.tiles[1] then - texture = def.tiles[1] - end - end - end - - minetest.add_particlespawner({ - amount = 64, - time = 0.1, - minpos = vector.subtract(pos, radius / 2), - maxpos = vector.add(pos, radius / 2), - minvel = {x = -3, y = 0, z = -3}, - maxvel = {x = 3, y = 5, z = 3}, - minacc = {x = 0, y = -10, z = 0}, - maxacc = {x = 0, y = -10, z = 0}, - minexptime = 0.8, - maxexptime = 2.0, - minsize = radius * 0.66, - maxsize = radius * 2, - texture = texture, - collisiondetection = true, - }) -end - -local function eject_drops(drops, pos, radius) - local drop_pos = vector.new(pos) - for _, item in pairs(drops) do - local count = math.min(item:get_count(), item:get_stack_max()) - while count > 0 do - local take = math.max(1,math.min(radius * radius, - count, - item:get_stack_max())) - rand_pos(pos, drop_pos, radius) - local dropitem = ItemStack(item) - dropitem:set_count(take) - local obj = minetest.add_item(drop_pos, dropitem) - if obj then - obj:get_luaentity().collect = true - obj:setacceleration({x = 0, y = -10, z = 0}) - obj:setvelocity({x = math.random(-3, 3), - y = math.random(0, 10), - z = math.random(-3, 3)}) - end - count = count - take - end - end -end - -local function calc_velocity(pos1, pos2, old_vel, power) - -- Avoid errors caused by a vector of zero length - if vector.equals(pos1, pos2) then - return old_vel - end - - local vel = vector.direction(pos1, pos2) - vel = vector.normalize(vel) - vel = vector.multiply(vel, power) - - -- Divide by distance - local dist = vector.distance(pos1, pos2) - dist = math.max(dist, 1) - vel = vector.divide(vel, dist) - - -- Add old velocity - vel = vector.add(vel, old_vel) - - -- randomize it a bit - vel = vector.add(vel, { - x = math.random() - 0.5, - y = math.random() - 0.5, - z = math.random() - 0.5, - }) - - -- Limit to terminal velocity - dist = vector.length(vel) - if dist > 250 then - vel = vector.divide(vel, dist / 250) - end - return vel -end - -local function entity_physics(pos, radius, drops, damage_all) - local objs = minetest.get_objects_inside_radius(pos, radius) - for _, obj in pairs(objs) do - local obj_pos = obj:getpos() - local dist = math.max(1, vector.distance(pos, obj_pos)) - - local damage = (8 / (dist+1)) * radius - if obj:is_player() then - -- currently the engine has no method to set - -- player velocity. See #2960 - -- instead, we knock the player back 1.0 node, and slightly upwards - local dir = vector.normalize(vector.subtract(obj_pos, pos)) - local moveoff = vector.multiply(dir, dist + 1.0) - local newpos = vector.add(pos, moveoff) - newpos = vector.add(newpos, {x = 0, y = 0.2, z = 0}) - obj:setpos(newpos) - - obj:set_hp(obj:get_hp() - damage) - else - local do_damage = true - local do_knockback = true - local entity_drops = {} - local luaobj = obj:get_luaentity() - local objdef = minetest.registered_entities[luaobj.name] - local name = luaobj.name - - if objdef and objdef.on_blast then - if ((not damage_all) and ((name == "nssm:pumpking") or (name == "nssm:morvalar0") or (name== "nssm:morvalar5"))) then - do_damage = false - do_knockback = false - else - do_damage, do_knockback, entity_drops = objdef.on_blast(luaobj, damage) - end - end - - if do_knockback then - local obj_vel = obj:getvelocity() - obj:setvelocity(calc_velocity(pos, obj_pos, - obj_vel, radius * 10)) - end - if do_damage then - if not obj:get_armor_groups().immortal then - obj:punch(obj, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = damage}, - }, nil) - end - end - for _, item in pairs(entity_drops) do - add_drop(drops, item) - end - end - end -end - -local function add_drop(drops, item) - item = ItemStack(item) - local name = item:get_name() - if loss_prob[name] ~= nil and math.random(1, loss_prob[name]) == 1 then - return - end - - local drop = drops[name] - if drop == nil then - drops[name] = item - else - drop:set_count(drop:get_count() + item:get_count()) - end -end - -local function destroy(drops, npos, cid, c_air, on_blast_queue, ignore_protection, ignore_on_blast) - if not ignore_protection and minetest.is_protected(npos, "") then - return cid - end - - local def = cid_data[cid] - - if not def then - return c_air - elseif not ignore_on_blast and def.on_blast then - on_blast_queue[#on_blast_queue + 1] = {pos = vector.new(npos), on_blast = def.on_blast} - return cid - else - local node_drops = minetest.get_node_drops(def.name, "") - for _, item in pairs(node_drops) do - add_drop(drops, item) - end - return c_air - end -end - -local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, block) - pos = vector.round(pos) - -- scan for adjacent TNT nodes first, and enlarge the explosion - local vm1 = VoxelManip() - local p1 = vector.subtract(pos, 2) - local p2 = vector.add(pos, 2) - local minp, maxp = vm1:read_from_map(p1, p2) - local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) - local data = vm1:get_data() - local count = 0 - local c_tnt = minetest.get_content_id("tnt:tnt") - local c_tnt_burning = minetest.get_content_id("tnt:tnt_burning") - local c_tnt_boom = minetest.get_content_id("tnt:boom") - local c_air - if block then - c_air = minetest.get_content_id(block) - else - c_air = minetest.get_content_id("air") - end - - for z = pos.z - 2, pos.z + 2 do - for y = pos.y - 2, pos.y + 2 do - local vi = a:index(pos.x - 2, y, z) - for x = pos.x - 2, pos.x + 2 do - local cid = data[vi] - if cid == c_tnt or cid == c_tnt_boom or cid == c_tnt_burning then - count = count + 1 - data[vi] = c_air - end - vi = vi + 1 - end - end - end - - vm1:set_data(data) - vm1:write_to_map() - - -- recalculate new radius - radius = math.floor(radius * math.pow(count, 1/3)) - - -- perform the explosion - local vm = VoxelManip() - local pr = PseudoRandom(os.time()) - p1 = vector.subtract(pos, radius) - p2 = vector.add(pos, radius) - minp, maxp = vm:read_from_map(p1, p2) - a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) - data = vm:get_data() - - local drops = {} - local on_blast_queue = {} - - for z = -radius, radius do - for y = -radius, radius do - local vi = a:index(pos.x + (-radius), pos.y + y, pos.z + z) - for x = -radius, radius do - local r = vector.length(vector.new(x, y, z)) - if (radius * radius) / (r * r) >= (pr:next(80, 125) / 100) then - local cid = data[vi] - local p = {x = pos.x + x, y = pos.y + y, z = pos.z + z} - if cid ~= c_air then - data[vi] = destroy(drops, p, cid, c_air, - on_blast_queue, ignore_protection, - ignore_on_blast) - end - end - vi = vi + 1 - end - end - end - - vm:set_data(data) - vm:write_to_map() - vm:update_map() - vm:update_liquids() - - -- call nodeupdate for everything within 1.5x blast radius - for y = -radius * 1.5, radius * 1.5 do - for z = -radius * 1.5, radius * 1.5 do - for x = -radius * 1.5, radius * 1.5 do - local rad = {x = x, y = y, z = z} - local s = vector.add(pos, rad) - local r = vector.length(rad) - if r / radius < 1.4 then - nodeupdate_single(s) - end - end - end - end - - for _, queued_data in pairs(on_blast_queue) do - local dist = math.max(1, vector.distance(queued_data.pos, pos)) - local intensity = (radius * radius) / (dist * dist) - local node_drops = queued_data.on_blast(queued_data.pos, intensity) - if node_drops then - for _, item in pairs(node_drops) do - add_drop(drops, item) - end - end - end - - return drops, radius -end - -function tnt_boom_nssm(pos, def, block, effects) - minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64}) - minetest.set_node(pos, {name = "tnt:boom"}) - local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection, def.ignore_on_blast, block) - -- append entity drops - local damage_radius = (radius / def.radius) * def.damage_radius - if def.damage_all then - entity_physics(pos, damage_radius, drops, def.damage_all) - else - entity_physics(pos, damage_radius, drops) - end - if not def.disable_drops then - eject_drops(drops, pos, radius) - end - if effects then - add_effects(pos, radius, drops) - end -end - -function charge_attack(self) - local s = self.object:getpos() - local p = self.attack:getpos() - 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 - do_charge(self) - else - self.other_state = "charge" - vec.y = -5 - self.charge_vec = vec - self.charge_dir = self.object:getyaw() - self.charge_timer = os.time() - do_charge(self) - minetest.after(3, function(self) - self.other_state = "stand" - self.state = "stand" - end,self) - end -end - -function do_charge(self) - self.state = "" - if self.charge_vec and self.charge_dir then - set_animation(self, "punch2") - self.object:setvelocity(self.charge_vec) - self.object:setyaw(self.charge_dir) - local all_objects = minetest.get_objects_inside_radius(self.object:getpos(), 1.5*self.collisionbox[5]/2) - local _,obj - 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 - end - end - end - if self.charge_timer and os.time() - self.charge_timer > 5 then - self.other_state = "stand" - self.state = "stand" - end -end diff --git a/nssm_materials.lua b/nssm_materials.lua new file mode 100644 index 0000000..6388ed0 --- /dev/null +++ b/nssm_materials.lua @@ -0,0 +1,2116 @@ +--non eatable craftitems + + +function nssm_register_noneatcraftitems (name, descr) + +minetest.register_craftitem("nssm:"..name, { + description = descr, + image = name..".png", +}) + +end + +nssm_register_noneatcraftitems ('sky_feather','Sky Feather') +nssm_register_noneatcraftitems ('snake_scute','Snake Scute') +nssm_register_noneatcraftitems ('eyed_tentacle','Eyed Tentacle') +--nssm_register_noneatcraftitems ('king_duck_crown','King Duck Crown') +nssm_register_noneatcraftitems ('great_energy_globe','Great Energy Globe') +nssm_register_noneatcraftitems ('superior_energy_globe','Superior Energy Globe') +nssm_register_noneatcraftitems ('ant_queen_abdomen','Ant Queen Abdomen') +--nssm_register_noneatcraftitems ('masticone_skull','Masticone Skull') +nssm_register_noneatcraftitems ('masticone_skull_fragments','Masticone Skull Fragments') +--nssm_register_noneatcraftitems ('masticone_skull_crowned','Masticone Skull Crowned') +nssm_register_noneatcraftitems ('tentacle_curly','Kraken Tentacle') +nssm_register_noneatcraftitems ('lava_titan_eye','Lava Titan Eye') +nssm_register_noneatcraftitems ('duck_beak','Duck Beak') +nssm_register_noneatcraftitems ('ice_tooth','Ice Tooth') +nssm_register_noneatcraftitems ('little_ice_tooth','Little Ice Tooth') +nssm_register_noneatcraftitems ('digested_sand',"Digested Sand") +nssm_register_noneatcraftitems ('black_ice_tooth','Black Ice Tooth') +nssm_register_noneatcraftitems ('tarantula_chelicerae','Tarantula Chelicerae') +nssm_register_noneatcraftitems ('crab_chela','Crab Chela') +nssm_register_noneatcraftitems ('cursed_pumpkin_seed','Cursed Pumpkin Seed') +nssm_register_noneatcraftitems ('mantis_claw','Mantis Claw') +nssm_register_noneatcraftitems ('manticore_fur','Manticore Fur') +nssm_register_noneatcraftitems ('ant_hard_skin','Ant Hard Skin') +nssm_register_noneatcraftitems ('bloco_skin','Bloco Skin') +nssm_register_noneatcraftitems ('crab_carapace_fragment','Crab Carapace Fragment') +nssm_register_noneatcraftitems ('crocodile_skin','Crocodile Skin') +nssm_register_noneatcraftitems ('manticore_spine','Manticore Spine') +nssm_register_noneatcraftitems ('night_feather','Night Feather') +nssm_register_noneatcraftitems ('sun_feather','Sun Feather') +nssm_register_noneatcraftitems ('duck_feather','Duck Feather') +nssm_register_noneatcraftitems ('black_duck_feather','Black Duck Feather') +nssm_register_noneatcraftitems ('masticone_fang','Masticone Fang') +nssm_register_noneatcraftitems ('white_wolf_fur','White Wolf Fur') +nssm_register_noneatcraftitems ('stoneater_mandible','Stoneater Mandible') +nssm_register_noneatcraftitems ('ant_mandible','Ant Mandible') +nssm_register_noneatcraftitems ('life_energy','Life Energy') +nssm_register_noneatcraftitems ('wolf_fur','Wolf Fur') +nssm_register_noneatcraftitems ('felucco_fur','Felucco Fur') +nssm_register_noneatcraftitems ('felucco_horn','Felucco Horn') +nssm_register_noneatcraftitems ('energy_globe','Energy Globe') +nssm_register_noneatcraftitems ('greedy_soul_fragment','Greedy Soul Fragment') +nssm_register_noneatcraftitems ('lustful_soul_fragment','Lustful Soul Fragment') +nssm_register_noneatcraftitems ('wrathful_soul_fragment','Wrathful Soul Fragment') +nssm_register_noneatcraftitems ('proud_soul_fragment','Proud Soul Fragment') +nssm_register_noneatcraftitems ('slothful_soul_fragment','Slothful Soul Fragment') +nssm_register_noneatcraftitems ('envious_soul_fragment','Envious Soul Fragment') +nssm_register_noneatcraftitems ('gluttonous_soul_fragment','Gluttonous Soul Fragment') +nssm_register_noneatcraftitems ('gluttonous_moranga','Gluttonous Moranga') +nssm_register_noneatcraftitems ('envious_moranga','Envious Moranga') +nssm_register_noneatcraftitems ('proud_moranga','Proud Moranga') +nssm_register_noneatcraftitems ('slothful_moranga','Slothful Moranga') +nssm_register_noneatcraftitems ('lustful_moranga','Lustful Moranga') +nssm_register_noneatcraftitems ('wrathful_moranga','Wrathful Moranga') +nssm_register_noneatcraftitems ('greedy_moranga','Greedy Moranga') +nssm_register_noneatcraftitems ('mantis_skin','Mantis_skin') +nssm_register_noneatcraftitems ('sand_bloco_skin','Sand Bloco Skin') +nssm_register_noneatcraftitems ('sandworm_skin','Sandworm Skin') +nssm_register_noneatcraftitems ('sky_iron','Sky Iron') +nssm_register_noneatcraftitems ('web_string','Cobweb String') +nssm_register_noneatcraftitems ('dense_web_string','Dense Cobweb String') +nssm_register_noneatcraftitems ('black_powder','Black Powder') +nssm_register_noneatcraftitems ('morelentir_dust','Dark Starred Stone Dust') + +function nssm_register_eatcraftitems (name, descr, gnam) + +minetest.register_craftitem("nssm:"..name, { + description = descr, + image =name..".png", + on_use = minetest.item_eat(gnam), + groups = { meat=1, eatable=1 }, +}) + +end + +nssm_register_eatcraftitems ('werewolf_leg','Werewolf Leg',3) +nssm_register_eatcraftitems ('felucco_steak','Felucco Steak',3) +nssm_register_eatcraftitems ('roasted_felucco_steak','Roasted Felucco Steak',6) +nssm_register_eatcraftitems ('heron_leg','Moonheron Leg',2) +nssm_register_eatcraftitems ('chichibios_heron_leg',"Chichibio's Moonheron Leg",4) +nssm_register_eatcraftitems ('crocodile_tail','Crocodile Tail',3) +nssm_register_eatcraftitems ('roasted_crocodile_tail','Roasted Crocodile Tail',6) +nssm_register_eatcraftitems ('roasted_werewolf_leg','Roasted_Werewolf Leg',6) +nssm_register_eatcraftitems ('duck_legs','Duck Legs',1) +nssm_register_eatcraftitems ('roasted_duck_legs','Roasted Duck Leg',3) +nssm_register_eatcraftitems ('ant_leg','Ant Leg',-1) +nssm_register_eatcraftitems ('roasted_ant_leg','Roasted Ant Leg',4) +nssm_register_eatcraftitems ('spider_leg','Spider Leg',-1) +nssm_register_eatcraftitems ('roasted_spider_leg','Roasted Spider Leg',4) +--nssm_register_eatcraftitems ('brain','Brain',3) +--nssm_register_eatcraftitems ('roasted_brain','Roasted Brain',8) +nssm_register_eatcraftitems ('tentacle','Tentacle',2) +nssm_register_eatcraftitems ('roasted_tentacle','Roasted Tentacle',5) +nssm_register_eatcraftitems ('worm_flesh','Worm Flesh',-2) +nssm_register_eatcraftitems ('roasted_worm_flesh','Roasted Worm Flesh',4) +nssm_register_eatcraftitems ('amphibian_heart','Amphibian Heart',1) +nssm_register_eatcraftitems ('roasted_amphibian_heart','Roasted Amphibian Heart',8) +nssm_register_eatcraftitems ('raw_scrausics_wing','Raw Scrausics Wing',1) +nssm_register_eatcraftitems ('spicy_scrausics_wing','Spicy Scrausics Wing',6) +nssm_register_eatcraftitems ('phoenix_nuggets','Phoenix Nuggets',20) +nssm_register_eatcraftitems ('phoenix_tear','Phoenix Tear',20) +nssm_register_eatcraftitems ('frosted_amphibian_heart','Frosted Amphibian Heart',-1) +nssm_register_eatcraftitems ('surimi','Surimi',4) +nssm_register_eatcraftitems ('amphibian_ribs','Amphibian Ribs',2) +nssm_register_eatcraftitems ('roasted_amphibian_ribs','Roasted Amphibian Ribs',6) +nssm_register_eatcraftitems ('dolidrosaurus_fin','Dolidrosaurus Fin',-2) +nssm_register_eatcraftitems ('roasted_dolidrosaurus_fin','Roasted Dolidrosaurus Fin',4) +nssm_register_eatcraftitems ('larva_meat','Larva Meat',-1) +nssm_register_eatcraftitems ('larva_juice','Larva Juice',-3) +nssm_register_eatcraftitems ('larva_soup','Larva Soup',10) +nssm_register_eatcraftitems ('mantis_meat','Mantis Meat',1) +nssm_register_eatcraftitems ('roasted_mantis_meat','Roasted Mantis Meat',4) +nssm_register_eatcraftitems ('spider_meat','Spider Meat',-1) +nssm_register_eatcraftitems ('roasted_spider_meat','Roasted Spider Meat',3) +nssm_register_eatcraftitems ('silk_gland','Silk Gland',-1) +nssm_register_eatcraftitems ('roasted_silk_gland','Roasted Silk Gland',3) +nssm_register_eatcraftitems ('super_silk_gland','Super Silk Gland',-8) +nssm_register_eatcraftitems ('roasted_super_silk_gland','Roasted Super Silk Gland',2) + +--ore generation + +minetest.register_ore({ + ore_type = "scatter", + ore = "nssm:modders_block", + wherein = "default:stone", + clust_scarcity = 50*50*50, + clust_num_ores = 1, + clust_size = 1, + height_min = -115, + height_max = -95, + }) +for i=1,9 do +minetest.register_ore({ + ore_type = "scatter", + ore = "nssm:ant_dirt", + wherein = "default:cobble", + clust_scarcity = 1, + clust_num_ores = 1, + clust_size = 1, + height_min = -1, + height_max = 40, + }) + +minetest.register_ore({ + ore_type = "scatter", + ore = "nssm:ant_dirt", + wherein = "default:mossycobble", + clust_scarcity = 1, + clust_num_ores = 1, + clust_size = 1, + height_min = -1000, + height_max = 40, + }) + +minetest.register_ore({ + ore_type = "scatter", + ore = "nssm:ant_dirt", + wherein = "default:sandstonebrick", + clust_scarcity = 1, + clust_num_ores = 1, + clust_size = 1, + height_min = -1000, + height_max = 40, + }) + +minetest.register_ore({ + ore_type = "scatter", + ore = "nssm:ant_dirt", + wherein = "stairs:stair_sandstonebrick", + clust_scarcity = 1, + clust_num_ores = 1, + clust_size = 1, + height_min = -1000, + height_max = 40, + }) + +minetest.register_ore({ + ore_type = "scatter", + ore = "nssm:ant_dirt", + wherein = "stairs:stair_cobble", + clust_scarcity = 1, + clust_num_ores = 1, + clust_size = 1, + height_min = -1000, + height_max = 40, + }) +end + +minetest.register_ore({ + ore_type = "scatter", + ore = "nssm:web", + wherein = "default:junglegrass", + clust_scarcity = 2*2*2, + clust_num_ores = 2, + clust_size = 2, + height_min = -20, + height_max = 200, +}) + +minetest.register_ore({ + ore_type = "scatter", + ore = "nssm:web", + wherein = "default:jungleleaves", + clust_scarcity = 4*4*4, + clust_num_ores = 5, + clust_size = 5, + height_min = -20, + height_max = 200, + } +) + +--nodes + +minetest.register_node("nssm:ant_dirt", { + description = "Ant Dirt", + tiles = {"ant_dirt.png"}, + groups = {crumbly=3}, +}) + +minetest.register_node("nssm:dead_leaves", { + description = "Dead leaves", + tiles = {"dead_leaves.png"}, + groups = {snappy=3,leaves=1, not_in_creative_inventory =1}, +}) + +minetest.register_node("nssm:invisible_light", { + description = "Invisible light source", + tiles = {"transparent.png"}, + paramtype = "light", + drawtype = "airlike", + walkable = false, + sunlight_propagates = true, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + groups = {unbreakable=1, not_in_creative_inventory =1}, + drop = "", + light_source = 15, +}) + +minetest.register_node("nssm:venomous_gas", { + description = "Venomous 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, + pointable = false, + diggable = false, + buildable_to = true, + drop = "", + drowning = 9, + damage_per_second = 1, + post_effect_color = {a=100, r=1, g=100, b=1}, + groups = {flammable = 2, not_in_creative_inventory =1}, +}) + +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, + 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}, +}) + +minetest.register_node("nssm:slug_crystal", { + description = "Slug Crystal", + tile_images = {"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}, + light_source = 2, + groups = {cracky=1, not_in_creative_inventory =1}, +}) + +minetest.register_node("nssm:coldest_ice", { + description = "Coldest Ice", + tile_images = {"coldest_ice.png"} , + paramtype = "light", + drowning = 2, + damage_per_second = 1, + drop = "", + light_source = 3, + groups = {cracky=1, not_in_creative_inventory =1}, +}) + +minetest.register_node("nssm:modders_block", { + description = "Modders Block", + tiles = {"modders_block.png"}, + is_ground_content = true, + groups = {crumbly=3, not_in_creative_inventory =1}, +}) + +minetest.register_node("nssm:web", { + description = "Web", + inventory_image = "web.png", + tile_images = {"web.png"} , + drawtype = "plantlike", + paramtype = "light", + walkable = false, + pointable = true, + diggable = true, + buildable_to = false, + drop = "", + drowning = 0, + liquid_renewable = false, + liquidtype = "source", + liquid_range= 0, + liquid_alternative_flowing = "nssm:web", + liquid_alternative_source = "nssm:web", + liquid_viscosity = 20, + groups = {flammable=2, snappy=1, liquid=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}} + }, + walkable = false, + paramtype = "light", + pointable = true, + buildable_to = false, + drop = "", + drowning = 0, + liquid_renewable = false, + liquidtype = "source", + liquid_range= 0, + liquid_alternative_flowing = "nssm:mud", + liquid_alternative_source = "nssm:mud", + liquid_viscosity = 10, + groups = {crumbly=1, liquid=1}, +}) + +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") + if #poslist == 0 then + minetest.set_node(pos, {name="default:dirt"}) + end + end +}) + +minetest.register_node("nssm:thick_web", { + description = "Thick Web", + inventory_image = "thick_web.png", + tile_images = {"thick_web.png"} , + drawtype = "firelike", + paramtype = "light", + walkable = false, + pointable = true, + diggable = true, + buildable_to = false, + drop = "", + drowning = 2, + liquid_renewable = false, + liquidtype = "source", + liquid_range= 0, + liquid_alternative_flowing = "nssm:thick_web", + liquid_alternative_source = "nssm:thick_web", + liquid_viscosity = 30, + groups = {flammable=2, liquid=1}, +}) + +minetest.register_node("nssm:ink", { + description = "Ink", + inventory_image = minetest.inventorycube("ink.png"), + drawtype = "liquid", + tiles = { + { + name = "ink_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + --alpha = 420, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + liquid_range= 0, + drowning = 1, + liquid_renewable = false, + liquidtype = "source", + liquid_alternative_flowing = "nssm:ink", + liquid_alternative_source = "nssm:ink", + liquid_viscosity = 1, + post_effect_color = {a=2000, r=30, g=30, b=30}, + groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory =1}, +}) + +minetest.register_node("nssm:mese_meteor", { + description = "Mese Meteor", + tile_images = {"mese_meteor.png"} , + paramtype = "light", + drop = "", + groups = {crumbly=1, falling_node=1, flammable = 2, not_in_creative_inventory =1}, +}) + +minetest.register_node("nssm:pumpbomb", { + tiles = {"pumpbomb_top.png","pumpbomb_bottom.png", "pumpbomb_side.png", "pumpbomb_side.png", "pumpbomb_side.png", "pumpbomb_front.png"}, + light_source = 5, + groups = {not_in_creative_inventory =1}, + drop = "", + on_timer = function(pos, elapsed) + tnt_boom_nssm(pos, {damage_radius=4,radius=3,ignore_protection=false}) + minetest.env:set_node(pos, {name="air"}) + end, +}) + +--abms + +minetest.register_abm({ + nodenames = {"nssm:mese_meteor"}, + neighbors = {"air"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + --local under = {x=pos.x, y=pos.y-1, z=pos.z} + --local n = minetest.env:get_node(under).name + --if n~= "air" then + minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name = "fire:basic_flame"}) + minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name = "fire:basic_flame"}) + minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name = "fire:basic_flame"}) + minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name = "fire:basic_flame"}) + minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name = "fire:basic_flame"}) + + end +}) + +minetest.register_abm({ + nodenames = {"nssm:web"}, + neighbors = {"default:junglegrass"}, + interval = 20.0, + chance = 20, + action = function(pos, node, active_object_count, active_object_count_wider) + local n = minetest.env:get_node(pos).name + if n== "air" then + minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "nssm:web"}) + end + end +}) + +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"}) + end +}) + +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"}) + end +}) + +minetest.register_abm({ + nodenames = {"nssm:web"}, + neighbors = {"default:junglegrass"}, + interval = 20.0, + chance = 20, + action = function(pos, node, active_object_count, active_object_count_wider) + local n = minetest.env:get_node(pos).name + if n== "air" then + minetest.set_node({x = pos.x + 1, y = pos.y, z = pos.z}, {name = "nssm:web"}) + end + end +}) + +minetest.register_abm({ + nodenames = {"nssm:web"}, + neighbors = {"default:junglegrass"}, + interval = 20.0, + chance = 20, + action = function(pos, node, active_object_count, active_object_count_wider) + local n = minetest.env:get_node(pos).name + if n== "air" then + minetest.set_node({x = pos.x - 1, y = pos.y, z = pos.z}, {name = "nssm:web"}) + end + end +}) + +minetest.register_node("nssm:phoenix_fire", { + description = "Phoenix Fire", + drawtype = "firelike", + tiles = {{ + name = "phoenix_fire_animated.png", + animation = {type = "vertical_frames", + aspect_w = 16, aspect_h = 16, length = 1}, + }}, + inventory_image = "phoenix_fire.png", + light_source = 15, + groups = {igniter = 1, snappy=1}, + drop = '', + walkable = false, + buildable_to = false, + damage_per_second = 4, + }) + +minetest.register_abm({ + nodenames = {"nssm:phoenix_fire"}, + neighbors = {"air"}, + interval = 3, + chance = 2, + action = function(pos, node) + minetest.set_node({x = pos.x, y = pos.y , z = pos.z}, {name = "air"}) + end +}) + +minetest.register_abm({ + nodenames = {"nssm:dead_leaves"}, + neighbors = {"air"}, + interval = 15, + chance = 3, + action = function(pos, node) + minetest.set_node({x = pos.x, y = pos.y , z = pos.z}, {name = "air"}) + end +}) + +--tools + +minetest.register_tool('nssm:sun_sword', { + description = 'Sun Sword', + inventory_image = 'sun_sword.png', + tool_capabilities = { + full_punch_interval = 0.6, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=0.80, [2]=0.40, [3]=0.20}, uses=70, maxlevel=1}, + fleshy={times={[2]=0.6, [3]=0.2}, uses=70, maxlevel=1} + }, + damage_groups = {fleshy=10}, + }, + minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) + if puncher:get_wielded_item():get_name() == 'nssm:sun_sword' then + if node.name ~= "air" then + minetest.add_node(pointed_thing.above, {name = "fire:basic_flame"}) + end + end + end) +}) + +minetest.register_tool("nssm:masticone_fang_sword", { + description = "Masticone Fang Sword", + inventory_image = "masticone_fang_sword.png", + tool_capabilities = { + full_punch_interval =0.7 , + max_drop_level=1, + groupcaps={ + snappy={times={[1]=0.6, [2]=0.5, [3]=0.4}, uses=200, maxlevel=1}, + fleshy={times={[2]=0.8, [3]=0.4}, uses=200, maxlevel=1} + }, + damage_groups = {fleshy=8}, + }, +}) + +minetest.register_tool("nssm:night_sword", { + description = "Night Sword", + inventory_image = "night_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} + }, + damage_groups = {fleshy=12}, + }, +}) + +minetest.register_tool("nssm:crab_light_mace", { + description = "Light Crab Mace", + inventory_image = "crab_light_mace.png", + tool_capabilities = { + full_punch_interval =2 , + max_drop_level=1, + groupcaps={ + fleshy={times={[2]=1.4, [3]=1}, uses=20, maxlevel=1} + }, + damage_groups = {fleshy=8}, + }, +}) + +minetest.register_tool("nssm:crab_heavy_mace", { + description = "Heavy Crab Mace", + inventory_image = "crab_heavy_mace.png", + tool_capabilities = { + full_punch_interval =4 , + max_drop_level=1, + groupcaps={ + fleshy={times={[2]=2, [3]=1.4}, uses=20, maxlevel=1} + }, + damage_groups = {fleshy=12}, + }, +}) + +minetest.register_tool("nssm:mantis_battleaxe", { + description = "Mantis Battleaxe", + inventory_image = "mantis_battleaxe.png", + tool_capabilities = { + full_punch_interval =3 , + max_drop_level=1, + groupcaps={ + fleshy={times={[2]=2, [3]=1.4}, uses=20, maxlevel=1} + }, + damage_groups = {fleshy=10}, + }, +}) + +minetest.register_node("nssm:rope", { + description = "Rope", + paramtype = "light", + walkable = false, + climbable = true, + sunlight_propagates = true, + drawtype = "plantlike", + drops = "nssm:rope", + tile_images = { "rope.png" }, + groups = {snappy=1}, +}) + +minetest.register_tool("nssm:stoneater_pick", { + description = "Stoneater Pickaxe", + inventory_image = "stoneater_pick.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=0, + groupcaps={ + cracky = {times={[3]=0.0}, uses=200, maxlevel=1}, + }, + damage_groups = {fleshy=5}, + }, +}) + +minetest.register_tool("nssm:mantis_sword", { + description = "Mantis Sword", + inventory_image = "mantis_sword.png", + tool_capabilities = { + full_punch_interval =0.7 , + max_drop_level=1, + groupcaps={ + fleshy={times={[2]=1.0, [3]=0.4}, uses=30, maxlevel=1}, + snappy={times={[2]=0.80, [3]=0.3}, uses=40, maxlevel=1}, + }, + damage_groups = {fleshy=7}, + }, +}) + +minetest.register_tool("nssm:little_ice_tooth_knife", { + description = "Little Ice Tooth Knife", + inventory_image = "little_ice_tooth_knife.png", + tool_capabilities = { + full_punch_interval =0.3 , + max_drop_level=1, + groupcaps={ + fleshy={times={[2]=1.0, [3]=0.4}, uses=4, maxlevel=1}, + snappy={times={[2]=0.80, [3]=0.3}, uses=7, maxlevel=1}, + }, + damage_groups = {fleshy=5}, + }, +}) + +minetest.register_tool("nssm:manticore_spine_knife", { + description = "Manticore Spine Knife", + inventory_image = "manticore_spine_knife.png", + tool_capabilities = { + full_punch_interval =0.4 , + max_drop_level=1, + groupcaps={ + fleshy={times={[2]=1.0, [3]=0.4}, uses=6, maxlevel=1}, + snappy={times={[2]=0.80, [3]=0.3}, uses=6, maxlevel=1}, + }, + damage_groups = {fleshy=6}, + }, +}) + +minetest.register_tool("nssm:felucco_knife", { + description = "Felucco Knife", + inventory_image = "felucco_knife.png", + tool_capabilities = { + full_punch_interval =0.4 , + max_drop_level=1, + groupcaps={ + fleshy={times={[2]=1.0, [3]=0.4}, uses=6, maxlevel=1}, + snappy={times={[2]=0.80, [3]=0.3}, uses=6, maxlevel=1}, + }, + damage_groups = {fleshy=6}, + }, +}) + +if minetest.get_modpath("farming") then + +farming.register_hoe(":farming:felucco_hoe", { + description = "Felucco Hoe", + inventory_image = "felucco_hoe.png", + max_uses = 290, + material = "nssm:felucco_horn" +}) + +farming.register_hoe(":farming:ant_hoe", { + description = "Ant Hoe", + inventory_image = "ant_hoe.png", + max_uses = 350, + material = "nssm:ant_mandible" +}) + +minetest.register_craft({ + output = 'nssm:ant_hoe', + recipe = { + {'nssm:ant_mandible', 'nssm:ant_mandible'}, + {'', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:felucco_hoe', + recipe = { + {'nssm:felucco_horn', 'nssm:felucco_horn'}, + {'', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +end + +minetest.register_tool("nssm:ant_sword", { + description = "Ant Sword", + inventory_image = "ant_sword.png", + tool_capabilities = { + full_punch_interval = 0.8, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=1.30, [2]=0.90, [3]=0.40}, uses=40, maxlevel=3}, + }, + damage_groups = {fleshy=8}, + }, +}) + + + +minetest.register_tool("nssm:ant_shovel", { + description = "Ant Shovel", + inventory_image = "ant_shovel.png", + wield_image = "ant_shovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1, + max_drop_level=1, + groupcaps={ + crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=35, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, +}) + +minetest.register_tool("nssm:duck_beak_shovel", { + description = "Duck Beak Shovel", + inventory_image = "duck_beak_shovel.png", + wield_image = "duck_beak_shovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 0.6, + max_drop_level=1, + groupcaps={ + crumbly = {times={[1]=1.10, [2]=0.80, [3]=0.20}, uses=5, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, +}) + +minetest.register_tool("nssm:mantis_axe", { + description = "Mantis Axe", + inventory_image = "mantis_axe.png", + tool_capabilities = { + full_punch_interval = 0.8, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.20, [2]=1.00, [3]=0.60}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=5}, + }, + }) + +minetest.register_tool("nssm:ant_billhook", { + description = "Ant Billhook", + inventory_image = "ant_billhook.png", + tool_capabilities = { + full_punch_interval = 0.8, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=1.40, [2]=1.00, [3]=0.60}, uses=30, maxlevel=3}, + snappy={times={[1]=1.40, [2]=1.00, [3]=0.60}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=6}, + }, + }) + +minetest.register_tool("nssm:duck_beak_pick",{ + description = "Duck Beak Pickaxe", + inventory_image = "duck_beak_pick.png", + tool_capabilities = { + full_punch_interval = 0.6, + max_drop_level=3, + groupcaps={ + cracky = {times={[1]=1.0, [2]=0.8, [3]=0.20}, uses=3, maxlevel=3}, + }, + damage_groups = {fleshy=5}, + }, +}) + +minetest.register_tool("nssm:ant_pick", { + description = "Ant Pickaxe", + inventory_image = "ant_pick.png", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=1, + groupcaps={ + cracky = {times={[1]=2.00, [2]=1.20, [3]=0.80}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, +}) + +minetest.register_tool("nssm:mantis_pick", { + description = "Mantis Pickaxe", + inventory_image = "mantis_pick.png", + tool_capabilities = { + full_punch_interval = 1, + max_drop_level=1, + groupcaps={ + cracky = {times={[1]=1.6, [2]=1.0, [3]=0.60}, uses=20, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, +}) + +minetest.register_tool("nssm:tarantula_warhammer", { + description = "Tarantula Warhammer", + inventory_image = "tarantula_warhammer.png", + wield_scale= {x=2,y=2,z=1.5}, + tool_capabilities = { + full_punch_interval =1, + max_drop_level=1, + groupcaps={ + cracky={times={[1]=0.6, [2]=0.5, [3]=0.4}, uses=80, maxlevel=1}, + fleshy={times={[2]=0.8, [3]=0.4}, uses=200, maxlevel=1} + }, + damage_groups = {fleshy=13}, + }, +}) + +minetest.register_tool("nssm:axe_of_pride", { + description = "Axe of Pride", + inventory_image = "axe_of_pride.png", + wield_scale= {x=2,y=2,z=1.5}, + tool_capabilities = { + full_punch_interval =1.3 , + max_drop_level=1, + groupcaps={ + snappy={times={[1]=0.6, [2]=0.5, [3]=0.4}, uses=100, maxlevel=1}, + fleshy={times={[2]=0.8, [3]=0.4}, uses=400, maxlevel=1} + }, + damage_groups = {fleshy=16}, + }, + on_drop = function(itemstack, dropper, pos) + local objects = minetest.env:get_objects_inside_radius(pos, 10) + local flag = 0 + local part = 0 + for _,obj in ipairs(objects) do + 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 (obj:is_player()) then + --minetest.chat_send_all("Giocatore") + if (obj:get_player_name()~=dropper:get_player_name()) then + obj:set_hp(obj:get_hp()-10) + dropper:set_hp(dropper:get_hp()+10) + --flag = 1 + + local items = player_inv:get_stack('main', found) + items:take_item() + player_inv:set_stack('main', found, items) + part = 1 + end + else + if (obj:get_luaentity().health) then + --minetest.chat_send_all("Entity") + obj:get_luaentity().health = obj:get_luaentity().health -10 + check_for_death(obj:get_luaentity()) + + dropper:set_hp(dropper:get_hp()+10) + --flag = 1 + + local items = player_inv:get_stack('main', found) + items:take_item() + player_inv:set_stack('main', found, items) + part = 1 + end + end + if part == 1 then + local s = dropper:getpos() + local p = obj:getpos() + local m = 2 + + minetest.add_particlespawner( + 3, --amount + 0.1, --time + {x=p.x-0.5, y=p.y-0.5, z=p.z-0.5}, --minpos + {x=p.x+0.5, y=p.y+0.5, z=p.z+0.5}, --maxpos + {x=(s.x-p.x)*m, y=(s.y-p.y)*m, z=(s.z-p.z)*m}, --minvel + {x=(s.x-p.x)*m, y=(s.y-p.y)*m, z=(s.z-p.z)*m}, --maxvel + {x=s.x-p.x, y=s.y-p.y, z=s.z-p.z}, --minacc + {x=s.x-p.x, y=s.y-p.y, z=s.z-p.z}, --maxacc + 0.5, --minexptime + 1, --maxexptime + 3, --minsize + 4, --maxsize + false, --collisiondetection + "heart.png" --texture + ) + end + end + end + end + end + end, +}) + +minetest.register_tool("nssm:gratuitousness_battleaxe", { + description = "Gratuitousness Battleaxe", + inventory_image = "gratuitousness_battleaxe.png", + wield_scale= {x=2.2,y=2.2,z=1.5}, + tool_capabilities = { + full_punch_interval =1.6 , + max_drop_level=1, + groupcaps={ + snappy={times={[1]=0.6, [2]=0.5, [3]=0.4}, uses=100, maxlevel=1}, + fleshy={times={[2]=0.8, [3]=0.4}, uses=400, maxlevel=1} + }, + damage_groups = {fleshy=18}, + }, + on_drop = function(itemstack, dropper, pos) + local objects = minetest.env: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,10 do + pos = vector.add(pos, vec) + end + + local pname = dropper:get_player_name() + 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) + 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) + items:take_item() + player_inv:set_stack('main', found, items) + tnt.boom(pos, {damage_radius=5,radius=4,ignore_protection=false}) + end + end, +}) + +minetest.register_tool("nssm:sword_of_eagerness", { + description = "Sword of Eagerness", + inventory_image = "sword_of_eagerness.png", + wield_scale= {x=2,y=2,z=1}, + tool_capabilities = { + full_punch_interval =0.7 , + max_drop_level=1, + groupcaps={ + snappy={times={[1]=0.6, [2]=0.5, [3]=0.4}, uses=100, maxlevel=1}, + fleshy={times={[2]=0.8, [3]=0.4}, uses=400, maxlevel=1} + }, + damage_groups = {fleshy=14}, + }, + 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 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 + local pos = obj:getpos() + pos.y = pos.y + 15 + 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 + obj:get_luaentity().old_y = pos.y + obj:setpos(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 + if part==1 then + local s = pos + s.y = s.y - 15 + minetest.add_particlespawner( + 25, --amount + 0.3, --time + vector.subtract(s, 0.5), --minpos + vector.add(s, 0.5), --maxpos + {x=0, y=10, z=0}, --minvel + {x=0.1, y=11, z=0.1}, --maxvel + {x=0,y=1,z=0}, --minacc + {x=0,y=1,z=0}, --maxacc + 0.5, --minexptime + 1, --maxexptime + 1, --minsize + 2, --maxsize + false, --collisiondetection + "slothful_soul_fragment.png" --texture + ) + end + end + end + end + end + end, +}) + +minetest.register_tool("nssm:falchion_of_eagerness", { + description = "Falchion of Eagerness", + inventory_image = "falchion_of_eagerness.png", + wield_scale= {x=2,y=2,z=1}, + tool_capabilities = { + full_punch_interval =1 , + max_drop_level=1, + groupcaps={ + snappy={times={[1]=0.6, [2]=0.5, [3]=0.4}, uses=100, maxlevel=1}, + fleshy={times={[2]=0.8, [3]=0.4}, uses=400, maxlevel=1} + }, + damage_groups = {fleshy=16}, + }, + on_drop = function(itemstack, dropper, pos) + local vec = dropper:get_look_dir() + local pos = dropper:getpos() + --vec.y = 0 + + for i=1,16 do + pos = vector.add(pos, vec) + end + + 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:life_energy" then + if items:get_count() >= 5 then + found = i + break + end + end + end + if found == 0 then + minetest.chat_send_player(pname, "You haven't got enough life_energy!") + return + else + local s = dropper:getpos() + minetest.add_particlespawner( + 25, --amount + 0.3, --time + vector.subtract(s, 0.5), --minpos + vector.add(s, 0.5), --maxpos + {x=0, y=10, z=0}, --minvel + {x=0.1, y=11, z=0.1}, --maxvel + {x=0,y=1,z=0}, --minacc + {x=0,y=1,z=0}, --maxacc + 0.5, --minexptime + 1, --maxexptime + 1, --minsize + 2, --maxsize + false, --collisiondetection + "slothful_soul_fragment.png" --texture + ) + minetest.remove_node(pos) + pos.y=pos.y+1 + minetest.remove_node(pos) + pos.y=pos.y-2 + minetest.remove_node(pos) + dropper:setpos(pos) + s = pos + s.y = s.y+10 + minetest.add_particlespawner( + 25, --amount + 0.3, --time + vector.subtract(s, 0.5), --minpos + vector.add(s, 0.5), --maxpos + {x=0, y=-10, z=0}, --minvel + {x=0.1, y=-11, z=0.1}, --maxvel + {x=0,y=-1,z=0}, --minacc + {x=0,y=-1,z=0}, --maxacc + 0.5, --minexptime + 1, --maxexptime + 1, --minsize + 2, --maxsize + false, --collisiondetection + "slothful_soul_fragment.png" --texture + ) + local items = player_inv:get_stack('main', found) + items:set_count(items:get_count()-5) + player_inv:set_stack('main', found, items) + end + end + end, +}) + +minetest.register_tool("nssm:sword_of_envy", { + description = "Sword of Envy", + inventory_image = "sword_of_envy.png", + wield_scale= {x=2,y=2,z=1}, + tool_capabilities = { + full_punch_interval =0.9 , + max_drop_level=1, + groupcaps={ + snappy={times={[1]=0.6, [2]=0.5, [3]=0.4}, uses=100, maxlevel=1}, + fleshy={times={[2]=0.5, [3]=0.2}, uses=400, maxlevel=1} + }, + damage_groups = {fleshy=14}, + }, + 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 + 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 hp_num = nil + if (obj:is_player()) and (obj:get_player_name()~=dropper:get_player_name()) then + hp_num = obj:get_hp() + else + if obj:get_luaentity() and (obj:get_luaentity().health) then + hp_num = obj:get_luaentity().health + end + end + if hp_num ~= nil then + local stack = {name="nssm:life_energy", count=hp_num, wear=0, metadata=""} + if player_inv:contains_item("main", stack) then + --minetest.chat_send_all("trovato!") + + if obj:is_player() and (obj:get_player_name()~=dropper:get_player_name()) then + obj:set_hp(dropper:get_hp()) + dropper:set_hp(hp_num) + else + if obj:get_luaentity() and (obj:get_luaentity().health) then + obj:get_luaentity().health = dropper:get_hp() + if hp_num > 20 then + dropper:set_hp(20) + else + dropper:set_hp(hp_num) + end + end + end + + player_inv:remove_item("main", stack) + else + minetest.chat_send_player(dropper:get_player_name(), "You haven't enough life energy!") + end + end + end + end + end + end, +}) + +minetest.register_tool("nssm:sword_of_gluttony", { + description = "Sword of Gluttony", + inventory_image = "sword_of_gluttony.png", + wield_scale= {x=2,y=2,z=1}, + tool_capabilities = { + full_punch_interval =1 , + max_drop_level=1, + groupcaps={ + snappy={times={[1]=0.9, [2]=0.7, [3]=0.4}, uses=100, maxlevel=1}, + fleshy={times={[2]=0.6, [3]=0.2}, uses=400, maxlevel=1} + }, + damage_groups = {fleshy=14}, + }, + 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 + 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 (obj:is_player()) then + if (obj:get_player_name()~=dropper:get_player_name()) then + obj:set_hp(obj:get_hp()-10) + --flag = 1 + + --take energy globe from inventory: + 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:get_luaentity().health <= 32 then + local pos = obj:getpos() + obj:remove() + + --check_for_death(obj:get_luaentity()) + --flag = 1 + --take energy globe from inventory: + local items = player_inv:get_stack('main', found) + items:take_item() + player_inv:set_stack('main', found, items) + + for i = 1,math.random(1,4) do + drop = minetest.add_item(pos, "nssm:roasted_duck_legs 1") + drops(drop) + end + + local s = obj:getpos() + local p = dropper:getpos() + local m = 3 + + minetest.add_particlespawner( + 10, --amount + 0.1, --time + {x=p.x-0.5, y=p.y-0.5, z=p.z-0.5}, --minpos + {x=p.x+0.5, y=p.y+0.5, z=p.z+0.5}, --maxpos + {x=(s.x-p.x)*m, y=(s.y-p.y)*m, z=(s.z-p.z)*m}, --minvel + {x=(s.x-p.x)*m, y=(s.y-p.y)*m, z=(s.z-p.z)*m}, --maxvel + {x=s.x-p.x, y=s.y-p.y, z=s.z-p.z}, --minacc + {x=s.x-p.x, y=s.y-p.y, z=s.z-p.z}, --maxacc + 0.5, --minexptime + 1, --maxexptime + 1, --minsize + 2, --maxsize + false, --collisiondetection + "gluttonous_soul_fragment.png" --texture + ) + end + end + end + end + end + end + end + end, +}) + +minetest.register_tool("nssm:death_scythe", { + description = "Death Scythe", + wield_scale= {x=3,y=3,z=1.3}, + inventory_image = "death_scythe.png", + tool_capabilities = { + full_punch_interval =0.2 , + max_drop_level=1, + groupcaps={ + snappy={times={[1]=0.1, [2]=0.1, [3]=0.1}, uses=28000, maxlevel=1}, + fleshy={times={[2]=0.1, [3]=0.1}, uses=28000, maxlevel=1} + }, + damage_groups = {fleshy=28}, + }, + groups ={not_in_creative_inventory=1}, + on_drop = function(itemstack, dropper, pos) + local objects = minetest.env:get_objects_inside_radius(pos, 10) + local flag = 0 + dropper:set_hp(dropper:get_hp()-9) + for _,obj in ipairs(objects) do + flag = 0 + if (obj:is_player()) then + if (obj:get_player_name()~=dropper:get_player_name()) then + obj:set_hp(obj:get_hp()-40) + flag = 1 + end + else + if (obj:get_luaentity().health) then + obj:get_luaentity().health = obj:get_luaentity().health -40 + check_for_death(obj:get_luaentity()) + flag = 1 + end + end + if flag == 1 then + for i = 1,math.random(1,2) do + drop = minetest.add_item(pos, "nssm:energy_globe 1") + + if drop then + drop:setvelocity({ + x = math.random(-10, 10) / 9, + y = 5, + z = math.random(-10, 10) / 9, + }) + end + end + end + end + local pos = dropper:getpos() + local vec = {x=5,y=5,z=5} + local poslist = minetest.find_nodes_in_area(vector.subtract(pos, vec), vector.add(pos,vec), "default:dirt_with_grass") + for _,v in pairs(poslist) do + --minetest.chat_send_all(minetest.pos_to_string(v)) + minetest.set_node(v, {name="default:dirt_with_dry_grass"}) + if math.random(1,3)==1 then + v.y = v.y +2 + drop = minetest.add_item(v, "nssm:life_energy 1") + drops(drop) + end + end + + local poslist = minetest.find_nodes_in_area_under_air(vector.subtract(pos, vec), vector.add(pos,vec), "group:flora") + for _,v in pairs(poslist) do + --minetest.chat_send_all(minetest.pos_to_string(v)) + minetest.set_node(v, {name="default:dry_shrub"}) + if math.random(1,3)==1 then + v.y = v.y +2 + drop = minetest.add_item(v, "nssm:life_energy 1") + drops(drop) + end + end + + local poslist = minetest.find_nodes_in_area(vector.subtract(pos, vec), vector.add(pos,vec), "group:leaves") + for _,v in pairs(poslist) do + --minetest.chat_send_all(minetest.pos_to_string(v)) + minetest.set_node(v, {name="nssm:dead_leaves"}) + if math.random(1,3)==1 then + v.y = v.y +2 + drop = minetest.add_item(v, "nssm:life_energy 1") + drops(drop) + end + end + end, +}) + +--recipes + +minetest.register_craft({ + output = 'nssm:web_string', + recipe = { + {'nssm:web', 'nssm:web'}, + {'nssm:web', 'nssm:web'}, + } +}) + +minetest.register_craft({ + output = 'nssm:dense_web_string', + recipe = { + {'nssm:web_string', 'nssm:web_string', 'nssm:web_string'}, + {'nssm:web_string', 'nssm:web_string', 'nssm:web_string'}, + {'nssm:web_string', 'nssm:web_string', 'nssm:web_string'}, + } +}) + +minetest.register_craft({ + output = 'nssm:mantis_sword', + recipe = { + {'nssm:mantis_claw'}, + {'nssm:mantis_claw'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:masticone_fang_sword', + recipe = { + {'nssm:masticone_fang', 'nssm:masticone_fang'}, + {'nssm:masticone_fang', ''}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'nssm:black_ice_tooth', + type = "shapeless", + recipe = {'nssm:digested_sand', 'nssm:ice_tooth'}, +}) + +minetest.register_craft({ + output = 'nssm:web 4', + type = "shapeless", + recipe = {'nssm:silk_gland'}, +}) + +minetest.register_craft({ + output = 'nssm:crab_light_mace', + recipe = { + {'nssm:crab_chela'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:crab_heavy_mace', + recipe = { + {'', 'nssm:crab_chela', ''}, + {'nssm:crab_chela', 'nssm:crab_chela', 'nssm:crab_chela'}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'nssm:energy_globe', + recipe = { + {'nssm:life_energy', 'nssm:life_energy', 'nssm:life_energy'}, + {'nssm:life_energy', 'nssm:life_energy', 'nssm:life_energy'}, + {'nssm:life_energy', 'nssm:life_energy', 'nssm:life_energy'}, + } +}) + +minetest.register_craft({ + output = 'nssm:great_energy_globe', + recipe = { + {'nssm:energy_globe', 'nssm:energy_globe', 'nssm:energy_globe'}, + {'nssm:energy_globe', 'nssm:energy_globe', 'nssm:energy_globe'}, + {'nssm:energy_globe', 'nssm:energy_globe', 'nssm:energy_globe'}, + } +}) + +minetest.register_craft({ + output = 'nssm:superior_energy_globe', + recipe = { + {'nssm:great_energy_globe', 'nssm:great_energy_globe', 'nssm:great_energy_globe'}, + {'nssm:great_energy_globe', 'nssm:great_energy_globe', 'nssm:great_energy_globe'}, + {'nssm:great_energy_globe', 'nssm:great_energy_globe', 'nssm:great_energy_globe'}, + } +}) + +minetest.register_craft({ + output = 'nssm:mese_egg', + type = "shapeless", + recipe = {'nssm:tarantula_chelicerae', 'nssm:helmet_masticone_crowned', 'nssm:eyed_tentacle','nssm:black_ice_tooth', 'nssm:superior_energy_globe', 'nssm:sky_feather','nssm:cursed_pumpkin_seed', 'nssm:ant_queen_abdomen', 'nssm:snake_scute'} +}) + +--[[minetest.register_craft({ + output = 'nssm:masticone_skull_crowned', + recipe = { + {'', 'nssm:king_duck_crown', ''}, + {'', 'nssm:masticone_skull', ''}, + {'', '', ''}, + } +})]] + +minetest.register_craft({ + output = 'nssm:eyed_tentacle', + type = "shapeless", + recipe = {'nssm:lava_titan_eye','nssm:tentacle_curly'} +}) + +minetest.register_craft({ + output = 'nssm:life_energy 9', + type = "shapeless", + recipe = {'nssm:energy_globe'} +}) + +minetest.register_craft({ + output = 'nssm:energy_globe 9', + type = "shapeless", + recipe = {'nssm:great_energy_globe'} +}) + +minetest.register_craft({ + output = 'nssm:great_energy_globe 9', + type = "shapeless", + recipe = {'nssm:superior_energy_globe'} +}) +--[[ +minetest.register_craft({ + output = 'nssm:masticone_skull', + recipe = { + {'nssm:masticone_skull_fragments', 'nssm:masticone_skull_fragments', 'nssm:masticone_skull_fragments'}, + {'nssm:masticone_skull_fragments', 'nssm:masticone_skull_fragments', 'nssm:masticone_skull_fragments'}, + {'nssm:masticone_skull_fragments', 'nssm:masticone_skull_fragments', 'nssm:masticone_skull_fragments'}, + } +})]] + +minetest.register_craft({ + output = 'nssm:rope 12', + recipe = { + {'nssm:web_string'}, + {'nssm:web_string'}, + {'nssm:web_string'}, + } +}) + + +minetest.register_craft({ + output = 'nssm:sky_feather', + type = "shapeless", + recipe = {'nssm:sun_feather','nssm:night_feather'} +}) + +minetest.register_craft({ + output = 'nssm:sun_sword', + recipe = { + {'default:diamond'}, + {'nssm:sun_feather'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:night_sword', + recipe = { + {'default:diamond'}, + {'nssm:night_feather'}, + {'group:stick'}, + } +}) + +function nssm_register_recip (ingredient, dish, tictac) + +minetest.register_craft({ + type = "cooking", + output = "nssm:"..dish, + recipe = "nssm:"..ingredient, + cooktime = tictac, +}) + +end + +nssm_register_recip ('worm_flesh', 'roasted_worm_flesh', 12) +nssm_register_recip ('duck_legs', 'roasted_duck_legs', 6) +nssm_register_recip ('spider_leg', 'roasted_spider_leg', 6) +nssm_register_recip ('felucco_steak', 'roasted_felucco_steak', 10) +nssm_register_recip ('werewolf_leg', 'roasted_werewolf_leg', 10) +nssm_register_recip ('brain', 'roasted_brain', 6) +nssm_register_recip ('amphibian_heart', 'roasted_amphibian_heart', 6) +nssm_register_recip ('tentacle', 'roasted_tentacle', 6) +nssm_register_recip ('frosted_amphibian_heart', 'amphibian_heart', 8) +nssm_register_recip ('heron_leg', 'chichibios_heron_leg', 20) +nssm_register_recip ('raw_scrausics_wing', 'spicy_scrausics_wing', 12) +nssm_register_recip ('ant_leg', 'roasted_ant_leg', 6) +nssm_register_recip ('crocodile_tail', 'roasted_crocodile_tail', 16) +nssm_register_recip ('dolidrosaurus_fin', 'roasted_dolidrosaurus_fin', 8) +nssm_register_recip ('amphibian_ribs', 'roasted_amphibian_ribs', 12) +nssm_register_recip ('mantis_meat', 'roasted_mantis_meat', 6) +nssm_register_recip ('spider_meat', 'roasted_spider_meat', 6) +nssm_register_recip ('silk_gland', 'roasted_silk_gland', 4) +nssm_register_recip ('larva_juice', 'larva_soup', 20) + + + +minetest.register_craft({ + output = 'nssm:larva_juice', + type = "shapeless", + recipe = {'nssm:larva_meat','bucket:bucket_empty'} +}) + +minetest.register_craft({ + output = 'nssm:ant_sword', + recipe = { + {'nssm:ant_mandible'}, + {'nssm:ant_mandible'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:ant_billhook', + recipe = { + {'nssm:ant_mandible', 'nssm:ant_mandible'}, + {'nssm:ant_mandible', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:ant_shovel', + recipe = { + {'nssm:ant_mandible'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:duck_beak_shovel', + recipe = { + {'nssm:duck_beak'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:duck_beak_pick', + recipe = { + {'nssm:duck_beak', 'nssm:duck_beak', 'nssm:duck_beak'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'nssm:sky_iron 30', + recipe = { + {'default:steelblock', 'default:steelblock', 'default:steelblock'}, + {'default:steelblock', 'nssm:sky_feather', 'default:steelblock'}, + {'default:steelblock', 'default:steelblock', 'default:steelblock'}, + } +}) + +minetest.register_craft({ + output = 'nssm:stoneater_pick', + recipe = { + {'nssm:stoneater_mandible', 'nssm:stoneater_mandible', 'nssm:stoneater_mandible'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'nssm:felucco_knife', + recipe = { + {'nssm:felucco_horn'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:little_ice_tooth_knife', + recipe = { + {'nssm:little_ice_tooth'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:manticore_spine_knife', + recipe = { + {'nssm:manticore_spine'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:ant_pick', + recipe = { + {'nssm:ant_mandible', 'nssm:ant_mandible', 'nssm:ant_mandible'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'nssm:mantis_pick', + recipe = { + {'nssm:mantis_claw', 'nssm:mantis_claw', 'nssm:mantis_claw'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'nssm:mantis_axe', + recipe = { + {'nssm:mantis_claw', 'nssm:mantis_claw'}, + {'nssm:mantis_claw', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:tarantula_warhammer', + recipe = { + {'nssm:tarantula_chelicerae'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'nssm:mantis_battleaxe', + recipe = { + {'nssm:mantis_claw', 'nssm:mantis_claw', 'nssm:mantis_claw'}, + {'nssm:mantis_claw', 'group:stick', 'nssm:mantis_claw'}, + {'', 'group:stick', ''}, + } +}) + +if minetest.get_modpath("nssb") then + minetest.register_craft({ + output = 'nssm:axe_of_pride', + recipe = { + {'nssm:proud_moranga', 'nssm:proud_moranga', 'nssm:proud_moranga'}, + {'nssm:proud_moranga', 'nssb:moranga_ingot', ''}, + {'', 'nssb:moranga_ingot', ''}, + } + }) + + minetest.register_craft({ + output = 'nssm:gratuitousness_battleaxe', + recipe = { + {'nssm:greedy_moranga', 'nssm:greedy_moranga', 'nssm:greedy_moranga'}, + {'nssm:greedy_moranga', 'nssb:moranga_ingot', 'nssm:greedy_moranga'}, + {'', 'nssb:moranga_ingot', ''}, + } + }) + + minetest.register_craft({ + output = 'nssm:sword_of_envy', + recipe = { + {'nssm:envious_moranga'}, + {'nssm:envious_moranga'}, + {'nssb:moranga_ingot'}, + } + }) + + minetest.register_craft({ + output = 'nssm:sword_of_eagerness', + recipe = { + {'nssm:slothful_moranga'}, + {'nssm:slothful_moranga'}, + {'nssb:moranga_ingot'}, + } + }) + + minetest.register_craft({ + output = 'nssm:falchion_of_eagerness', + recipe = { + {'nssm:slothful_moranga','nssm:slothful_moranga'}, + {'nssm:slothful_moranga', ''}, + {'nssb:moranga_ingot',''}, + } + }) + + minetest.register_craft({ + output = 'nssm:sword_of_gluttony', + recipe = { + {'nssm:gluttonous_moranga', 'nssm:gluttonous_moranga', 'nssm:gluttonous_moranga'}, + {'', 'nssm:gluttonous_moranga', ''}, + {'', 'nssb:moranga_ingot', ''}, + } + }) + + function nssm_register_moranga (viz) + minetest.register_craft({ + output = 'nssm:'.. viz ..'_moranga', + recipe = { + {'nssm:'.. viz ..'_soul_fragment', 'nssb:moranga_ingot', 'nssm:'.. viz ..'_soul_fragment'}, + {'nssb:moranga_ingot', 'nssm:'.. viz ..'_soul_fragment', 'nssb:moranga_ingot'}, + {'nssm:'.. viz ..'_soul_fragment', 'nssb:moranga_ingot', 'nssm:'.. viz ..'_soul_fragment'}, + } + }) + end + nssm_register_moranga ("lustful") + nssm_register_moranga ("greedy") + nssm_register_moranga ("slothful") + nssm_register_moranga ("wrathful") + nssm_register_moranga ("gluttonous") + nssm_register_moranga ("envious") + nssm_register_moranga ("proud") +end +--Eggs + +function nssm_register_egg (name, descr) + minetest.register_craftitem("nssm:".. name, { + description = descr .. " Egg", + 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 + core.after(0.1, function() + minetest.add_entity(pos1, "nssm:".. name) + end) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + end, + }) +end + +function nssm_register_egg2 (name, descr) --mobs you can't catch + minetest.register_craftitem("nssm:".. name.."_egg", { + description = descr .. " Egg", + 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 + core.after(0.1, function() + minetest.add_entity(pos1, "nssm:".. name) + end) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + end, + }) +end + +nssm_register_egg ('albino_spider', 'Albino Spider') +nssm_register_egg ('flying_duck', 'Flying Duck') +nssm_register_egg ('chog', 'Chog') +nssm_register_egg ('stone_eater', 'Stoneater') +nssm_register_egg ('signosigno', 'Signosigno') +nssm_register_egg ('bloco', 'Bloco') +nssm_register_egg ('sand_bloco', 'Sand Bloco') +nssm_register_egg ('swimming_duck', 'Swimming Duck') +nssm_register_egg ('duck', 'Duck') +nssm_register_egg2 ('duckking', 'Duckking') +nssm_register_egg2 ('tartacacia', 'Tartacacia') +nssm_register_egg2 ('river_lord', 'River Lord') +nssm_register_egg2 ('icelamander', 'Icelamander') +nssm_register_egg ('icesnake', 'Icesnake') +nssm_register_egg ('icelizard', 'Icelizard') +nssm_register_egg2 ('lava_titan', 'Lava Titan') +nssm_register_egg ('kele', 'Kele') +nssm_register_egg ('crystal_slug', 'Crystal Slug') +nssm_register_egg2 ('masticone', 'Masticone') +nssm_register_egg ('mantis', 'Mantis') +nssm_register_egg ('larva', 'Larva') +nssm_register_egg ('berinhog', 'Berinhog') +nssm_register_egg2 ('phoenix', 'Phoenix') +nssm_register_egg2 ('night_master', 'Night Master') +nssm_register_egg ('scrausics', 'Scrausics') +nssm_register_egg ('moonheron', 'Moonheron') +nssm_register_egg ('sandworm', 'Sandworm') +nssm_register_egg ('black_scorpion', 'Black Scorpion') +nssm_register_egg2 ('giant_sandworm', 'Giant Sandworm') +nssm_register_egg2 ('ant_queen', 'Ant Queen') +nssm_register_egg ('ant_soldier', 'Ant Soldier') +nssm_register_egg ('ant_worker', 'Ant Worker') +nssm_register_egg ('crab', 'Crab') +nssm_register_egg ('octopus', 'Octopus') +nssm_register_egg ('xgaloctopus', 'Xgaloctopus') +nssm_register_egg ('black_widow', 'Black Widow') +nssm_register_egg ('uloboros', 'Uloboros') +nssm_register_egg2 ('tarantula', 'Tarantula') +nssm_register_egg ('daddy_long_legs', 'Daddy Long Legs') +nssm_register_egg2 ('kraken', 'Kraken') +nssm_register_egg2 ('pumpking', 'Pumpking') +nssm_register_egg ('manticore', 'Manticore') +nssm_register_egg ('felucco', 'Felucco') +nssm_register_egg ('pumpkid', 'Pumpkid') +nssm_register_egg ('pumpboom_large', 'Large Pumpboom') +nssm_register_egg ('pumpboom_small', 'Small Pumpboom') +nssm_register_egg ('pumpboom_medium', 'Medium Pumpboom') +nssm_register_egg2 ('mordain', 'Mordain') +nssm_register_egg2 ('morgre', 'Morgre') +nssm_register_egg2 ('morvy', 'Morvy') +nssm_register_egg2 ('morgut', 'Morgut') +nssm_register_egg2 ('morde', 'Morde') +nssm_register_egg2 ('morlu', 'Morlu') +nssm_register_egg2 ('morwa', 'Morwa') +nssm_register_egg ('salamander', 'Salamander') +nssm_register_egg ('flust', 'Flust') +--nssm_register_egg ('morvalar', 'Morvalar') + +minetest.register_craftitem("nssm:mese_egg", { + description = "Mese Egg", + image = "mese_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 + minetest.add_particlespawner({ + amount = 1000, + time = 0.2, + minpos = {x=pos1.x-1, y=pos1.y-1, z=pos1.z-1}, + maxpos = {x=pos1.x+1, y=pos1.y+4, z=pos1.z+1}, + minvel = {x=0, y=0, z=0}, + maxvel = {x=1, y=5, z=1}, + minacc = {x=-0.5,y=5,z=-0.5}, + maxacc = {x=0.5,y=5,z=0.5}, + minexptime = 1, + maxexptime = 3, + minsize = 2, + maxsize = 4, + collisiondetection = false, + vertical = false, + texture = "tnt_smoke.png", + }) + core.after(0.4, function() + minetest.add_entity(pos1, "nssm:mese_dragon") + end) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + end, +}) + + +--experimental morwa statue +minetest.register_node("nssm:morwa_statue", { + description = 'Morwa Statue', + drawtype = 'mesh', + mesh = 'morwa_statue.b3d', + tiles = {'morwa_statue.png'}, + inventory_image = 'morwa_statue.png', + groups = {not_in_creative_inventory=1}, + paramtype = 'light', + paramtype2 = 'facedir', + selection_box = { + type = 'fixed', + fixed = {-1, -0.5, -1, 1, 3, 1}, -- Right, Bottom, Back, Left, Top, Front + }, + collision_box = { + type = 'fixed', + fixed = {-1, -0.5, -1, 1, 3, 1}, -- Right, Bottom, Back, Left, Top, Front + }, +}) +--Abm to make the conversion between statue and the entity, caused by light + +minetest.register_abm({ + nodenames = {"nssm:morwa_statue"}, + neighbors = {"air"}, + interval = 1, + chance = 1, + action = + function(pos, node) + local pos1 = {x=pos.x, y=pos.y+1, z=pos.z} + local n = minetest.env:get_node(pos1).name + if n ~= "air" then + return + end + if (minetest.get_node_light(pos1) > 8) + then + minetest.add_entity(pos1, "nssm:morwa") + minetest.remove_node(pos) + end + end +}) +--Eggs recipes + + + +minetest.register_craft({ + output = 'nssm:duck', + recipe = { + {'', 'nssm:duck_beak', ''}, + {'nssm:duck_feather', 'nssm:energy_globe', 'nssm:duck_feather'}, + {'nssm:duck_legs', 'nssm:duck_feather', 'nssm:duck_legs'}, + } +}) + +minetest.register_craft({ + output = 'nssm:flying_duck', + recipe = { + {'nssm:duck_feather', 'nssm:duck_beak', 'nssm:duck_feather'}, + {'nssm:duck_feather', 'nssm:energy_globe', 'nssm:duck_feather'}, + {'nssm:duck_legs', 'nssm:duck_feather', 'nssm:duck_legs'}, + } +}) + +minetest.register_craft({ + output = 'nssm:enderduck', + recipe = { + {'nssm:black_duck_feather', 'nssm:duck_beak', 'nssm:black_duck_feather'}, + {'nssm:duck_legs', 'nssm:energy_globe', 'nssm:duck_legs'}, + {'nssm:duck_legs', '', 'nssm:duck_legs'}, + } +}) + +minetest.register_craft({ + output = 'nssm:swimming_duck', + recipe = { + {'nssm:duck_feather', 'nssm:duck_beak', 'nssm:duck_feather'}, + {'nssm:duck_legs', 'nssm:energy_globe', 'nssm:duck_legs'}, + {'nssm:duck_feather', 'nssm:duck_feather', 'nssm:duck_feather'}, + } +}) + +minetest.register_craft({ + output = 'nssm:spiderduck', + recipe = { + {'nssm:duck_legs', 'nssm:duck_beak', 'nssm:duck_legs'}, + {'nssm:black_duck_feather', 'nssm:energy_globe', 'nssm:black_duck_feather'}, + {'nssm:duck_legs', 'nssm:black_duck_feather', 'nssm:duck_legs'}, + } +}) + +minetest.register_craft({ + output = 'nssm:duckking_egg', + recipe = { + {'', 'nssm:helmet_crown', ''}, + {'nssm:duck_feather', 'nssm:duck_beak', 'nssm:duck_feather'}, + {'nssm:duck_legs', 'nssm:superior_energy_globe', 'nssm:duck_legs'}, + } +}) + +minetest.register_craft({ + output = 'nssm:bloco', + recipe = { + {'nssm:bloco_skin', 'nssm:bloco_skin', 'nssm:bloco_skin'}, + {'nssm:bloco_skin', 'nssm:energy_globe', 'nssm:bloco_skin'}, + {'nssm:bloco_skin', 'nssm:bloco_skin', 'nssm:bloco_skin'}, + } +}) diff --git a/nssm_weapons.lua b/nssm_weapons.lua deleted file mode 100644 index 949a07b..0000000 --- a/nssm_weapons.lua +++ /dev/null @@ -1,669 +0,0 @@ ---Parameters used by some weapons -local default_dir = { - x = 1, - y = 1, - z = 1, -} - ---Function used to shoot: -local function weapons_shot(itemstack, placer, pointed_thing, velocity, name) - local dir = placer:get_look_dir(); - local playerpos = placer:getpos(); - local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+2+dir.y,z=playerpos.z+0+dir.z}, "nssm:"..name) - local vec = {x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity} - obj:setvelocity(vec) - return itemstack -end - -local function hit(pos, self) - local node = node_ok(pos).name - self.hit_node(self, pos, node) - self.object:remove() - return -end - -local function activate_balls(pos) - local radius = 50 - local objects = minetest.env:get_objects_inside_radius(pos, radius) - for _,obj in ipairs(objects) do - if (obj:get_luaentity() and obj:get_luaentity().name == "nssm:hellzone_grenade") then - obj:get_luaentity().move = 1 - end - end -end - -local function search_on_step2( - self, - dtime, --used to count time - max_time, --after this amount of time the entity is removec - radius, --radius in which look for entities to follow - vel) --velocity of the projectile - - local pos = self.object:getpos() - - --Disappear after a certain time - if self.life_time == 0 then - self.life_time = os.time() - end - if os.time() - self.life_time > max_time then - self.object:remove() - return - end - - --Look for an entity to follow - local objects = minetest.env:get_objects_inside_radius(pos, radius) - local min_dist = 100 - local obj_min = nil - local obj_p = nil - local vec_min = nil - for _,obj in ipairs(objects) do - if ((obj:is_player()) or (obj:get_luaentity() and ( - (obj:get_luaentity().name == "mese_dart") or - (obj:get_luaentity().name == "phoenix_dart") or - (obj:get_luaentity().name == "duck_father") or - (obj:get_luaentity().name == "thickwebball") or - (obj:get_luaentity().name == "webball") or - (obj:get_luaentity().name == "super_gas") or - (obj:get_luaentity().name == "lava_arrow") or - (obj:get_luaentity().name == "snow_arrow") or - (obj:get_luaentity().name == "spine") or - (obj:get_luaentity().name == "mese_dart") or - (obj:get_luaentity().name == "morarrow") or - (obj:get_luaentity().name == "lava_block_bomb") or - (obj:get_luaentity().name == "crystal_gas_arrow") or - (obj:get_luaentity().name == "pumpkid_bomb")) - )) then - if (obj:get_luaentity()) then - minetest.chat_send_all(""..obj:get_luaentity().name) - end - elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= self.object:get_luaentity().name) then - obj_p = obj:getpos() - local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z} - local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5 - if (dist max_time then - self.object:remove() - return - end - - - --Look for an entity to follow - local objects = minetest.env:get_objects_inside_radius(pos, radius) - local min_dist = 100 - local obj_min = nil - local obj_p = nil - local vec_min = nil - for _,obj in ipairs(objects) do - if (obj:is_player()) then - elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= self.object:get_luaentity().name) then - obj_p = obj:getpos() - local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z} - local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5 - if (dist max_time then - local node = node_ok(pos).name - self.hit_node(self, pos, node) - self.object:remove() - return - end - - self.timer = self.timer + dtime - --minetest.chat_send_all("Timer: "..self.timer) - - --while going around it damages entities - local objects = minetest.env:get_objects_inside_radius(pos, 2) - if self.timer > 0.1 then - self.timer = 0 - for _,obj in ipairs(objects) do - if obj:get_luaentity() then - if (obj:get_entity_name() ~= self.object:get_luaentity().name) and (obj:get_luaentity().name ~= "__builtin:item") then - if obj:is_player() then - obj:set_hp(obj:get_hp()-damage) - elseif obj:get_luaentity().health then - obj:get_luaentity().health = obj:get_luaentity().health - damage - --minetest.chat_send_all("Danneggiato: "..obj:get_entity_name().." Vita: "..obj:get_luaentity().health) - check_for_death(obj:get_luaentity()) - end - end - end - end - end - - local n = minetest.env:get_node(pos).name - if n==not_transparent or minetest.get_item_group(n, not_transparent)==1 then - local node = node_ok(pos).name - self.hit_node(self, pos, node) - self.object:remove() - return - else - local vec = self.object:getvelocity() - local c=vel/10 - --calculate how many blocks around need to be removed - local max = 0 - local posmax = 0 - if max 60 then - self.object:remove() - return - end - - --Look for an entity to follow - local objects = minetest.env:get_objects_inside_radius(pos, 20) - local min_dist = 100 - local obj_min = nil - local obj_p = nil - local vec_min = nil - for _,obj in ipairs(objects) do - if (obj:is_player()) then - elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= self.object:get_luaentity().name) then - obj_p = obj:getpos() - local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z} - local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5 - if (dist 60 then - self.object:remove() - return - end - - if self.custom_timer == 0 then - self.custom_timer = os.time() - end - - if last_pos == nil or (last_pos ~= nil and last_pos ~= pos) then - minetest.set_node(pos, {name="nssm:invisible_light"}) - if last_pos ~= nil then - minetest.set_node(last_pos, {name="air"}) - end - last_pos = pos - end - - --Look for an entity to follow - local objects = minetest.env:get_objects_inside_radius(pos, 20) - local min_dist = 100 - local obj_min = nil - local obj_p = nil - local vec_min = nil - for _,obj in ipairs(objects) do - if (obj:is_player()) then - elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= self.object:get_luaentity().name) then - obj_p = obj:getpos() - local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z} - local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5 - if (dist Iniziato Fra - - Attacco lanciafango del chog - - Icelamander lagga malissimo (controllare anche i suoi amici) - - Mese Dragon da rifare (lagga, più piccolo, non attacca) - - Mantis beast - - Ahuizotl (?) - - Albino Spider - - Salamander (dogshootta lava (un blocco)) ->semifatto - - Flust mangia le armature di metallo e non viene danneggiato dalle armi di metallo - - Spawn mostri nuovi - - Danno River Lord e Sandonisc - - Silversand Dragon (?) - - togliere le chat (hp_num -> envy sword) - - ascia esplosiva - - -Emmo vorrebbe: - -Nuove armature dei nuovi mostri - -Archi e frecche dei mostri - -Armi fighette difficili da fare e senza la wiki cosicché nessuno possa usarle a parte me, fatte con i drop dei boss di superfichie - - -Modelli: - -Animazioni Ahuizotl - -Animazioni Albino Spider - -Flust - -Animazioni Silversand Dragon (Che fa?) - - Suoni nuovi mostri (Emmo) - -Cose futurose: --Addomesticare e cavalcare