From c728e350503dcccd68f1ed30a9b587f002f9e608 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Tue, 27 Sep 2022 19:26:58 +0100 Subject: [PATCH] code tidy (part 1) --- darts.lua | 56 +- init.lua | 125 ++-- nssm_api.lua | 90 +-- nssm_armor.lua | 233 +++--- nssm_materials.lua | 1706 +++++++++++++++++++++++--------------------- nssm_spears.lua | 163 +++-- nssm_weapons.lua | 674 +++++++++-------- rainbow_staff.lua | 25 +- 8 files changed, 1621 insertions(+), 1451 deletions(-) diff --git a/darts.lua b/darts.lua index a1982dc..0c4aa16 100644 --- a/darts.lua +++ b/darts.lua @@ -9,19 +9,19 @@ local function duck_explosion(pos) minetest.add_particlespawner({ amount = 10, time = 0.2, - minpos = {x=pos.x-1, y=pos.y-1, z=pos.z-1}, - maxpos = {x=pos.x+1, y=pos.y+4, z=pos.z+1}, - minvel = {x=0, y=0, z=0}, - maxvel = {x=1, y=1, z=1}, - minacc = {x=-0.5,y=5,z=-0.5}, - maxacc = {x=0.5,y=5,z=0.5}, + minpos = {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1}, + maxpos = {x = pos.x + 1, y = pos.y + 4, z = pos.z + 1}, + minvel = {x = 0, y = 0, z = 0}, + maxvel = {x = 1, y = 1, 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 = 4, maxsize = 6, collisiondetection = false, vertical = false, - texture = "duck_egg_fragments.png", + texture = "duck_egg_fragments.png" }) core.after(0.4, function() @@ -33,19 +33,19 @@ local function duck_explosion(pos) minetest.add_particlespawner({ amount = 100, time = 0.2, - minpos = {x=pos.x-1, y=pos.y-1, z=pos.z-1}, - maxpos = {x=pos.x+1, y=pos.y+4, z=pos.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}, + minpos = {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1}, + maxpos = {x = pos.x + 1, y = pos.y + 4, z = pos.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", + texture = "tnt_smoke.png" }) minetest.add_entity(pos, "nssm:duck") @@ -53,6 +53,7 @@ local function duck_explosion(pos) end) end + -- arrow (duck_arrow) mobs:register_arrow("nssm:duck_father", { visual = "sprite", @@ -73,7 +74,7 @@ mobs:register_arrow("nssm:duck_father", { hit_node = function(self, pos, node) duck_explosion(pos) - end, + end }) @@ -83,7 +84,7 @@ local function ice_explosion(pos) for j = pos.y - 1, pos.y + 4, 1 do - for k = pos.z-math.random(0, 1), pos.z + math.random(0, 1), 1 do + for k = pos.z - math.random(0, 1), pos.z + math.random(0, 1), 1 do local p = {x = i, y = j, z = k} local n = minetest.get_node(p).name @@ -99,6 +100,7 @@ local function ice_explosion(pos) end end + -- snow_arrow mobs:register_arrow("nssm:snow_arrow", { visual = "sprite", @@ -119,7 +121,7 @@ mobs:register_arrow("nssm:snow_arrow", { hit_node = function(self, pos, node) ice_explosion(pos) - end, + end }) @@ -134,14 +136,14 @@ mobs:register_arrow("nssm:spine", { hit_player = function(self, player) player:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = 2}, + damage_groups = {fleshy = 2} }, nil) end, hit_mob = function(self, player) player:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = 2}, + damage_groups = {fleshy = 2} }, nil) end, @@ -153,14 +155,14 @@ mobs:register_arrow("nssm:spine", { --morbat arrow mobs:register_arrow("nssm:morarrow", { visual = "sprite", - visual_size = {x=0.5, y=0.5}, + visual_size = {x = 0.5, y = 0.5}, textures = {"morarrow.png"}, velocity= 13, hit_player = function(self, player) player:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = 3}, + damage_groups = {fleshy = 3} }, nil) end, @@ -215,7 +217,7 @@ mobs:register_arrow("nssm:webball", { hit_mob = function(self, player) player:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = 1}, + damage_groups = {fleshy = 1} }, nil) end, @@ -254,6 +256,7 @@ function explosion_thickweb(pos) end end + -- thick_web arrow mobs:register_arrow("nssm:thickwebball", { visual = "sprite", @@ -270,7 +273,7 @@ mobs:register_arrow("nssm:thickwebball", { hit_mob = function(self, player) player:punch(self.object, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = 6}, + damage_groups = {fleshy = 6} }, nil) end, @@ -310,7 +313,7 @@ mobs:register_arrow("nssm:phoenix_arrow", { self.object:remove() end - if math.random(1, 2) == 2 then + if math.random(2) == 2 then minetest.set_node(pos, {name = "nssm:phoenix_fire"}) end @@ -328,7 +331,7 @@ mobs:register_arrow("nssm:phoenix_arrow", { minetest.set_node(p, {name = "nssm:phoenix_fire"}) end end - end, + end }) @@ -358,6 +361,7 @@ function gas_explosion(pos) end end + mobs:register_arrow("nssm:super_gas", { visual = "sprite", visual_size = {x = 1, y = 1}, @@ -419,7 +423,7 @@ mobs:register_arrow("nssm:roar_of_the_dragon", { minetest.set_node(pos, {name = "air"}) - if math.random(1, 2) == 1 then + if math.random(2) == 1 then local p = { x = pos.x + math.random(-1, 1), diff --git a/init.lua b/init.lua index 6b3b6a8..6c6cc8f 100644 --- a/init.lua +++ b/init.lua @@ -1,82 +1,83 @@ local path = minetest.get_modpath("nssm") nssm = { - mymapgenis = tonumber(minetest.settings:get('mymapgenis')) or 7, - multimobs = tonumber(minetest.settings:get('multimobs')) or 1000 + mymapgenis = tonumber(minetest.settings:get("mymapgenis")) or 7, + multimobs = tonumber(minetest.settings:get("multimobs")) or 1000 } -- Mobs -dofile(path.."/mobs/ant_queen.lua") -dofile(path.."/mobs/ant_soldier.lua") -dofile(path.."/mobs/ant_worker.lua") -dofile(path.."/mobs/black_widow.lua") -dofile(path.."/mobs/bloco.lua") -dofile(path.."/mobs/crab.lua") -dofile(path.."/mobs/crocodile.lua") -dofile(path.."/mobs/daddy_long_legs.lua") -dofile(path.."/mobs/dolidrosaurus.lua") -dofile(path.."/mobs/duck.lua") -dofile(path.."/mobs/duckking.lua") -dofile(path.."/mobs/echidna.lua") -dofile(path.."/mobs/enderduck.lua") -dofile(path.."/mobs/flying_duck.lua") -dofile(path.."/mobs/felucco.lua") -dofile(path.."/mobs/giant_sandworm.lua") -dofile(path.."/mobs/icelamander.lua") -dofile(path.."/mobs/icesnake.lua") -dofile(path.."/mobs/kraken.lua") -dofile(path.."/mobs/larva.lua") -dofile(path.."/mobs/lava_titan.lua") -dofile(path.."/mobs/manticore.lua") -dofile(path.."/mobs/mantis_beast.lua") -dofile(path.."/mobs/mantis.lua") -dofile(path.."/mobs/masticone.lua") -dofile(path.."/mobs/moonheron.lua") -dofile(path.."/mobs/mordain.lua") -dofile(path.."/mobs/morgre.lua") -dofile(path.."/mobs/morde.lua") -dofile(path.."/mobs/morgut.lua") -dofile(path.."/mobs/morlu.lua") -dofile(path.."/mobs/morvalar.lua") -dofile(path.."/mobs/morvy.lua") -dofile(path.."/mobs/morwa.lua") -dofile(path.."/mobs/night_master.lua") -dofile(path.."/mobs/octopus.lua") -dofile(path.."/mobs/phoenix.lua") -dofile(path.."/mobs/pumpboom.lua") -dofile(path.."/mobs/pumpking.lua") -dofile(path.."/mobs/sandworm.lua") -dofile(path.."/mobs/scrausics.lua") -dofile(path.."/mobs/sand_bloco.lua") -dofile(path.."/mobs/signosigno.lua") -dofile(path.."/mobs/snow_biter.lua") -dofile(path.."/mobs/spiderduck.lua") -dofile(path.."/mobs/stone_eater.lua") -dofile(path.."/mobs/swimming_duck.lua") -dofile(path.."/mobs/tarantula.lua") -dofile(path.."/mobs/uloboros.lua") -dofile(path.."/mobs/werewolf.lua") -dofile(path.."/mobs/white_werewolf.lua") +dofile(path .. "/mobs/ant_queen.lua") +dofile(path .. "/mobs/ant_soldier.lua") +dofile(path .. "/mobs/ant_worker.lua") +dofile(path .. "/mobs/black_widow.lua") +dofile(path .. "/mobs/bloco.lua") +dofile(path .. "/mobs/crab.lua") +dofile(path .. "/mobs/crocodile.lua") +dofile(path .. "/mobs/daddy_long_legs.lua") +dofile(path .. "/mobs/dolidrosaurus.lua") +dofile(path .. "/mobs/duck.lua") +dofile(path .. "/mobs/duckking.lua") +dofile(path .. "/mobs/echidna.lua") +dofile(path .. "/mobs/enderduck.lua") +dofile(path .. "/mobs/flying_duck.lua") +dofile(path .. "/mobs/felucco.lua") +dofile(path .. "/mobs/giant_sandworm.lua") +dofile(path .. "/mobs/icelamander.lua") +dofile(path .. "/mobs/icesnake.lua") +dofile(path .. "/mobs/kraken.lua") +dofile(path .. "/mobs/larva.lua") +dofile(path .. "/mobs/lava_titan.lua") +dofile(path .. "/mobs/manticore.lua") +dofile(path .. "/mobs/mantis_beast.lua") +dofile(path .. "/mobs/mantis.lua") +dofile(path .. "/mobs/masticone.lua") +dofile(path .. "/mobs/moonheron.lua") +dofile(path .. "/mobs/mordain.lua") +dofile(path .. "/mobs/morgre.lua") +dofile(path .. "/mobs/morde.lua") +dofile(path .. "/mobs/morgut.lua") +dofile(path .. "/mobs/morlu.lua") +dofile(path .. "/mobs/morvalar.lua") +dofile(path .. "/mobs/morvy.lua") +dofile(path .. "/mobs/morwa.lua") +dofile(path .. "/mobs/night_master.lua") +dofile(path .. "/mobs/octopus.lua") +dofile(path .. "/mobs/phoenix.lua") +dofile(path .. "/mobs/pumpboom.lua") +dofile(path .. "/mobs/pumpking.lua") +dofile(path .. "/mobs/sandworm.lua") +dofile(path .. "/mobs/scrausics.lua") +dofile(path .. "/mobs/sand_bloco.lua") +dofile(path .. "/mobs/signosigno.lua") +dofile(path .. "/mobs/snow_biter.lua") +dofile(path .. "/mobs/spiderduck.lua") +dofile(path .. "/mobs/stone_eater.lua") +dofile(path .. "/mobs/swimming_duck.lua") +dofile(path .. "/mobs/tarantula.lua") +dofile(path .. "/mobs/uloboros.lua") +dofile(path .. "/mobs/werewolf.lua") +dofile(path .. "/mobs/white_werewolf.lua") --Final Boss -dofile(path.."/mobs/mese_dragon.lua") +dofile(path .. "/mobs/mese_dragon.lua") --Others -dofile(path.."/darts.lua") -dofile(path.."/nssm_materials.lua") -dofile(path.."/nssm_spears.lua") -dofile(path.."/nssm_api.lua") -dofile(path.."/nssm_weapons.lua") +dofile(path .. "/darts.lua") +dofile(path .. "/nssm_materials.lua") +dofile(path .. "/nssm_spears.lua") +dofile(path .. "/nssm_api.lua") +dofile(path .. "/nssm_weapons.lua") if minetest.registered_nodes["nyancat:nyancat_rainbow"] then - dofile(path.."/rainbow_staff.lua") ; print ("NYAN!!!!!") + dofile(path .. "/rainbow_staff.lua") ; print ("NYAN!!!!!") end if minetest.get_modpath("3d_armor") then - dofile(path.."/nssm_armor.lua") + dofile(path .. "/nssm_armor.lua") end --Spawn settings -dofile(path.."/spawn.lua") +dofile(path .. "/spawn.lua") + print("[MOD] NSSM loaded") diff --git a/nssm_api.lua b/nssm_api.lua index 2afeb20..78978d9 100644 --- a/nssm_api.lua +++ b/nssm_api.lua @@ -31,7 +31,7 @@ function drops(drop) drop:setvelocity({ x = math.random(-10, 10) / 9, y = 5, - z = math.random(-10, 10) / 9, + z = math.random(-10, 10) / 9 }) end end @@ -53,21 +53,21 @@ end function add_entity_and_particles(entity, pos, particles, multiplier) minetest.add_particlespawner({ - amount = 100*multiplier, + 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}, + 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, + texture = particles }) minetest.add_entity(pos, entity) @@ -114,10 +114,11 @@ function check_for_death_hydra(self) self.health = hp if self.sounds.damage ~= nil then + minetest.sound_play(self.sounds.damage,{ object = self.object, max_hear_distance = self.sounds.distance - }) + }, true) end return false @@ -127,10 +128,11 @@ function check_for_death_hydra(self) local obj = nil if self.sounds.death ~= nil then + minetest.sound_play(self.sounds.death,{ object = self.object, max_hear_distance = self.sounds.distance - }) + }, true) end self.object:remove() @@ -145,7 +147,9 @@ function round(n) 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 @@ -153,22 +157,22 @@ 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 - ) + minetest.add_particlespawner({ + amount = 100 * exp_radius / 2, + time = 0.1, + minpos = {x = pos.x - exp_radius, y = pos.y - exp_radius, z = pos.z - exp_radius}, + maxpos = {x = pos.x + exp_radius, y = pos.y + exp_radius, z = pos.z + exp_radius}, + minvel = {x = 0, y = 0, z = 0}, + maxvel = {x = 0.1, y = 0.3, z = 0.1}, + minacc = {x = -0.5, y = 1, z = -0.5}, + maxacc = {x = 0.5, y = 1, z = 0.5}, + minexptime = 0.1, + maxexptime = 4, + minsize = 6, + maxsize = 12, + collisiondetection = false, + texture = "tnt_smoke.png" + }) end @@ -196,7 +200,7 @@ function digging_attack( --minetest.chat_send_all("La posizione davanti:"..minetest.pos_to_string(posp)) posp = vector.subtract(posp,per) - for j = 1,3 do + 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 @@ -209,7 +213,6 @@ function digging_attack( --minetest.chat_send_all("pos2:"..minetest.pos_to_string(posp).." per.y= "..per.y) local n = minetest.get_node(pos1).name - --local up = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} if group == nil then @@ -217,7 +220,6 @@ function digging_attack( or minetest.is_protected(pos1, "") or (n == "bones:bones" and not nssm:affectbones(self) ) then else - --minetest.set_node(p, {name="air"}) minetest.remove_node(pos1) end else @@ -225,13 +227,13 @@ function digging_attack( and (minetest.get_item_group(n, "unbreakable") ~= 1) and (n ~= "bones:bones") and not (minetest.is_protected(pos1, "")) ) then - --minetest.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) @@ -323,10 +325,10 @@ function webber_ability( --puts randomly around the block defined as w_block local pos = self.object:get_pos() - if (math.random(1, 55) == 1) then + if (math.random(55) == 1) then - local dx = math.random(1, radius) - local dz = math.random(1, radius) + local dx = math.random(radius) + local dz = math.random(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.get_node(p).name @@ -390,7 +392,7 @@ function midas_ability( --ability to transform every blocks it touches in the m 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)) - or n==m_block then + or n == m_block then else minetest.set_node(p, {name = m_block}) end @@ -400,7 +402,6 @@ function midas_ability( --ability to transform every blocks it touches in the m end - -- NEW EXPLOSION FUNCTION -- loss probabilities array (one in X will be lost) @@ -459,7 +460,7 @@ local function add_effects(pos, radius, drops) size = radius * 10, collisiondetection = false, vertical = false, - texture = "tnt_boom.png", + texture = "tnt_boom.png" }) minetest.add_particlespawner({ @@ -475,7 +476,7 @@ local function add_effects(pos, radius, drops) maxexptime = 2.5, minsize = radius * 3, maxsize = radius * 5, - texture = "tnt_smoke.png", + texture = "tnt_smoke.png" }) -- we just dropped some items. Look at the items entities and pick @@ -513,7 +514,7 @@ local function add_effects(pos, radius, drops) minsize = radius * 0.66, maxsize = radius * 2, texture = texture, - collisiondetection = true, + collisiondetection = true }) end @@ -579,7 +580,7 @@ local function calc_velocity(pos1, pos2, old_vel, power) vel = vector.add(vel, { x = math.random() - 0.5, y = math.random() - 0.5, - z = math.random() - 0.5, + z = math.random() - 0.5 }) -- Limit to terminal velocity @@ -650,7 +651,7 @@ local function entity_physics(pos, radius, drops) obj:punch(obj, 1.0, { full_punch_interval = 1.0, - damage_groups = {fleshy = damage}, + damage_groups = {fleshy = damage} }, nil) end end @@ -683,7 +684,8 @@ local function add_drop(drops, item) end -local function destroy(drops, npos, cid, c_air, c_fire, on_blast_queue, ignore_protection, ignore_on_blast) +local function destroy(drops, npos, cid, c_air, c_fire, on_blast_queue, + ignore_protection, ignore_on_blast) if not ignore_protection and minetest.is_protected(npos, "") then return cid @@ -838,7 +840,9 @@ end function tnt_boom_nssm(pos, def) - minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64}) + minetest.sound_play("tnt_explode", { + pos = pos, gain = 1.5, max_hear_distance = 2 * 64}, true) + minetest.set_node(pos, {name = "tnt:boom"}) local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection, diff --git a/nssm_armor.lua b/nssm_armor.lua index c9fe4c0..fa4f167 100644 --- a/nssm_armor.lua +++ b/nssm_armor.lua @@ -1,108 +1,124 @@ --Armors local stats = { - wolf = {name="Werewolf", armor=2.8, heal=0, use=800}, - whitewolf = {name="White Werewolf", armor=2.8, heal=0, use=800}, - bloco = {name="Bloco", armor=3.2, heal=0, use=500}, - croco = {name="Crocodile", armor=3, heal=0, use=450}, - ant = {name="Ant", armor=3, heal=0, use=400}, - ice = {name="Ice Teeth", armor=3.2, heal=0, use=410}, - felucco = {name="Felucco", armor=2.8, heal=0, use=800}, - manticore = {name="Manticore", armor=3.4, heal=0, use=440}, - duck = {name="Duck", armor=1.5, heal=0, use=1000}, - black_duck = {name="Black Duck", armor=1.5, heal=0, use=900}, - mor = {name="Morlu", armor=5.3, heal=0, use=30}, - sky = {name="Sky", armor=4.2, heal=0, use=100}, - sandworm = {name="Sandworm", armor=3.4, heal=0, use=400}, - sandbloco = {name="Sand Bloco", armor=3.2, heal=0, use=500}, - web = {name="Cobweb String", armor=2.4, heal=0, use=900}, - denseweb = {name="Dense Cobweb String", armor=3.5, heal=0, use=400}, + wolf = {name = "Werewolf", armor = 2.8, heal = 0, use = 800}, + whitewolf = {name = "White Werewolf", armor = 2.8, heal = 0, use = 800}, + bloco = {name = "Bloco", armor = 3.2, heal = 0, use = 500}, + croco = {name = "Crocodile", armor = 3, heal = 0, use = 450}, + ant = {name = "Ant", armor = 3, heal = 0, use = 400}, + ice = {name = "Ice Teeth", armor = 3.2, heal = 0, use = 410}, + felucco = {name = "Felucco", armor = 2.8, heal = 0, use = 800}, + manticore = {name = "Manticore", armor = 3.4, heal = 0, use = 440}, + duck = {name = "Duck", armor = 1.5, heal = 0, use = 1000}, + black_duck = {name = "Black Duck", armor = 1.5, heal = 0, use = 900}, + mor = {name = "Morlu", armor = 5.3, heal = 0, use = 30}, + sky = {name = "Sky", armor = 4.2, heal = 0, use = 100}, + sandworm = {name = "Sandworm", armor = 3.4, heal = 0, use = 400}, + sandbloco = {name = "Sand Bloco", armor = 3.2, heal = 0, use = 500}, + web = {name = "Cobweb String", armor = 2.4, heal = 0, use = 900}, + denseweb = {name = "Dense Cobweb String", armor = 3.5, heal = 0, use = 400} } local materials = { - wolf="nssm:wolf_fur", - whitewolf="nssm:white_wolf_fur", - bloco="nssm:bloco_skin", - croco="nssm:crocodile_skin", - ant="nssm:ant_hard_skin", - ice="nssm:little_ice_tooth", - felucco="nssm:felucco_fur", - manticore="nssm:manticore_fur", - duck="nssm:duck_feather", - black_duck="nssm:black_duck_feather", - mor= "nssm:lustful_moranga", - sandbloco= "nssm:sand_bloco_skin", - sandworm="nssm:sandworm_skin", - sky="nssm:sky_iron", - web="nssm:web_string", - denseweb="nssm:dense_web_string", + wolf = "nssm:wolf_fur", + whitewolf = "nssm:white_wolf_fur", + bloco = "nssm:bloco_skin", + croco = "nssm:crocodile_skin", + ant = "nssm:ant_hard_skin", + ice = "nssm:little_ice_tooth", + felucco = "nssm:felucco_fur", + manticore = "nssm:manticore_fur", + duck = "nssm:duck_feather", + black_duck = "nssm:black_duck_feather", + mor = "nssm:lustful_moranga", + sandbloco = "nssm:sand_bloco_skin", + sandworm = "nssm:sandworm_skin", + sky = "nssm:sky_iron", + web = "nssm:web_string", + denseweb = "nssm:dense_web_string" } for k, v in pairs(stats) do - minetest.register_tool("nssm:helmet_"..k, { - description = v.name.." Helmet", - inventory_image ="inv_helmet_"..k..".png", - groups = {armor_head=math.floor(4*v.armor), armor_heal=v.heal, armor_use=v.use}, - wear = 0, + minetest.register_tool("nssm:helmet_" .. k, { + description = v.name .. " Helmet", + inventory_image = "inv_helmet_" .. k .. ".png", + groups = { + armor_head = math.floor(4 * v.armor), + armor_heal = v.heal, + armor_use = v.use + }, + wear = 0 }) - minetest.register_tool("nssm:chestplate_"..k, { - description = v.name.." Chestplate", - inventory_image ="inv_chestplate_"..k..".png", - groups = {armor_torso=math.floor(6*v.armor), armor_heal=v.heal, armor_use=v.use}, - wear = 0, + minetest.register_tool("nssm:chestplate_" .. k, { + description = v.name .. " Chestplate", + inventory_image = "inv_chestplate_" .. k .. ".png", + groups = { + armor_torso = math.floor(6 * v.armor), + armor_heal = v.heal, + armor_use = v.use + }, + wear = 0 }) - minetest.register_tool("nssm:leggings_"..k, { - description = v.name.." Leggings", - inventory_image = "inv_leggings_"..k..".png", - groups = {armor_legs=math.floor(5*v.armor), armor_heal=v.heal, armor_use=v.use}, - wear = 0, + minetest.register_tool("nssm:leggings_" .. k, { + description = v.name .. " Leggings", + inventory_image = "inv_leggings_" .. k .. ".png", + groups = { + armor_legs = math.floor(5 * v.armor), + armor_heal = v.heal, + armor_use = v.use + }, + wear = 0 }) - minetest.register_tool("nssm:boots_"..k, { - description = v.name.." Boots", - inventory_image ="inv_boots_"..k..".png", - groups = {armor_feet=math.floor(3*v.armor), armor_heal=v.heal, armor_use=v.use}, - wear = 0, + minetest.register_tool("nssm:boots_" .. k, { + description = v.name .. " Boots", + inventory_image = "inv_boots_" .. k .. ".png", + groups = { + armor_feet = math.floor(3 * v.armor), + armor_heal = v.heal, + armor_use = v.use + }, + wear = 0 }) end for k, v in pairs(materials) do minetest.register_craft({ - output = "nssm:helmet_"..k, + output = "nssm:helmet_" .. k, recipe = { {v, v, v}, {v, "", v}, - {"", "", ""}, - }, + {"", "", ""} + } }) minetest.register_craft({ - output = "nssm:chestplate_"..k, + output = "nssm:chestplate_" .. k, recipe = { {v, "", v}, {v, v, v}, - {v, v, v}, - }, + {v, v, v} + } }) minetest.register_craft({ - output = "nssm:leggings_"..k, + output = "nssm:leggings_" .. k, recipe = { {v, v, v}, {v, "", v}, - {v, "", v}, - }, + {v, "", v} + } }) minetest.register_craft({ - output = "nssm:boots_"..k, + output = "nssm:boots_" .. k, recipe = { {v, "", v}, - {v, "", v}, - }, + {v, "", v} + } }) end @@ -110,75 +126,84 @@ end if minetest.get_modpath("shields") then local stats = { - crab = {name="Crab", armor=4, heal=0, use=500}, - ice ={name="Ice Teeth", armor=3.5, heal=0, use=600}, - mor ={name="Morlu", armor=5, use=100}, - masticone ={name="Masticone", armor=4.5, use=300}, - mantis ={name="Mantis", armor=3, use=500}, + crab = {name = "Crab", armor = 4, heal = 0, use = 500}, + ice = {name = "Ice Teeth", armor = 3.5, heal = 0, use = 600}, + mor = {name = "Morlu", armor = 5, use = 100}, + masticone = {name = "Masticone", armor = 4.5, use = 300}, + mantis = {name = "Mantis", armor = 3, use = 500} } local materials = { - crab="nssm:crab_carapace_fragment", - ice="nssm:little_ice_tooth", - mor="nssm:lustful_moranga", - masticone="nssm:masticone_skull_fragments", - mantis="nssm:mantis_skin", + crab = "nssm:crab_carapace_fragment", + ice = "nssm:little_ice_tooth", + mor = "nssm:lustful_moranga", + masticone = "nssm:masticone_skull_fragments", + mantis = "nssm:mantis_skin" } for k, v in pairs(stats) do - minetest.register_tool("nssm:shield_"..k, { - description = v.name.." Shield", - inventory_image ="inv_shield_"..k..".png", - groups = {armor_head=math.floor(5*v.armor), armor_heal=v.heal, armor_use=v.use}, - wear = 0, + minetest.register_tool("nssm:shield_" .. k, { + description = v.name .. " Shield", + inventory_image = "inv_shield_" .. k .. ".png", + groups = { + armor_head = math.floor(5 * v.armor), + armor_heal = v.heal, + armor_use = v.use + }, + wear = 0 }) local m = materials[k] minetest.register_craft({ - output = "nssm:shield_"..k, + output = "nssm:shield_" .. k, recipe = { {m, m, m}, {m, m, m}, - {"", m, ""}, - }, + {"", m, ""} + } }) end end + --Special objects (pumpking helmet, masticone helmet, crowned masticone helmet, crown,) local stats = { - pumpking = {name="Pumpking Head", armor=4, heal=0, use=100}, - masticone ={name="Masticone Head", armor=4, heal=0, use=100}, - crown ={name="Dukking Crown", armor=2, heal=0, use=50}, - masticone_crowned ={name="Masticone Crowned Head", armor=6, heal=0, use=20}, + pumpking = {name = "Pumpking Head", armor = 4, heal = 0, use = 100}, + masticone = {name = "Masticone Head", armor = 4, heal = 0, use = 100}, + crown = {name = "Dukking Crown", armor = 2, heal = 0, use = 50}, + masticone_crowned = {name = "Masticone Crowned Head", armor = 6, heal = 0, use = 20}, } for k, v in pairs(stats) do - minetest.register_tool("nssm:helmet_"..k, { - description = v.name.." ", - inventory_image ="inv_helmet_"..k..".png", - groups = {armor_shield=math.floor(5*v.armor), armor_heal=v.heal, armor_use=v.use}, - wear = 0, - }) - - minetest.register_tool("nssm:chestplate_snake", { - description = "Snake Scute Chestplate", - inventory_image ="inv_chestplate_snake.png", - groups = {armor_torso=40, armor_heal=0, armor_use=100}, - wear = 0, + minetest.register_tool("nssm:helmet_" .. k, { + description = v.name .. " ", + inventory_image ="inv_helmet_" .. k .. ".png", + groups = { + armor_shield = math.floor(5 * v.armor), + armor_heal = v.heal, + armor_use = v.use + }, + wear = 0 }) end +minetest.register_tool("nssm:chestplate_snake", { + description = "Snake Scute Chestplate", + inventory_image ="inv_chestplate_snake.png", + groups = {armor_torso = 40, armor_heal = 0, armor_use = 100}, + wear = 0 +}) + minetest.register_craft({ output = "nssm:chestplate_snake", recipe = { {"default:steel_ingot", "", "default:steel_ingot"}, {"default:steel_ingot", "nssm:snake_scute", "default:steel_ingot"}, - {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, - }, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"} + } }) minetest.register_craft({ @@ -186,8 +211,8 @@ minetest.register_craft({ 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"}, - }, + {"nssm:masticone_skull_fragments", "nssm:masticone_skull_fragments", "nssm:masticone_skull_fragments"} + } }) minetest.register_craft({ @@ -195,6 +220,6 @@ minetest.register_craft({ recipe = { {"", "nssm:helmet_crown", ""}, {"", "nssm:helmet_masticone", ""}, - {"", "", ""}, - }, + {"", "", ""} + } }) diff --git a/nssm_materials.lua b/nssm_materials.lua index 33fe203..271407f 100644 --- a/nssm_materials.lua +++ b/nssm_materials.lua @@ -2,223 +2,224 @@ local function nssm_craftitem (name, descr) - minetest.register_craftitem("nssm:"..name, { + minetest.register_craftitem("nssm:" .. name, { description = descr, - image = name..".png", + image = name .. ".png", }) end -nssm_craftitem ('sky_feather','Sky Feather') -nssm_craftitem ('snake_scute','Snake Scute') -nssm_craftitem ('eyed_tentacle','Eyed Tentacle') ---nssm_craftitem ('king_duck_crown','King Duck Crown') -nssm_craftitem ('great_energy_globe','Great Energy Globe') -nssm_craftitem ('superior_energy_globe','Superior Energy Globe') -nssm_craftitem ('ant_queen_abdomen','Ant Queen Abdomen') ---nssm_craftitem ('masticone_skull','Masticone Skull') -nssm_craftitem ('masticone_skull_fragments','Masticone Skull Fragments') ---nssm_craftitem ('masticone_skull_crowned','Masticone Skull Crowned') -nssm_craftitem ('tentacle_curly','Kraken Tentacle') -nssm_craftitem ('lava_titan_eye','Lava Titan Eye') -nssm_craftitem ('duck_beak','Duck Beak') -nssm_craftitem ('ice_tooth','Ice Tooth') -nssm_craftitem ('little_ice_tooth','Little Ice Tooth') -nssm_craftitem ('digested_sand',"Digested Sand") -nssm_craftitem ('black_ice_tooth','Black Ice Tooth') -nssm_craftitem ('tarantula_chelicerae','Tarantula Chelicerae') -nssm_craftitem ('crab_chela','Crab Chela') -nssm_craftitem ('cursed_pumpkin_seed','Cursed Pumpkin Seed') -nssm_craftitem ('mantis_claw','Mantis Claw') -nssm_craftitem ('manticore_fur','Manticore Fur') -nssm_craftitem ('ant_hard_skin','Ant Hard Skin') -nssm_craftitem ('bloco_skin','Bloco Skin') -nssm_craftitem ('crab_carapace_fragment','Crab Carapace Fragment') -nssm_craftitem ('crocodile_skin','Crocodile Skin') -nssm_craftitem ('manticore_spine','Manticore Spine') -nssm_craftitem ('night_feather','Night Feather') -nssm_craftitem ('sun_feather','Sun Feather') -nssm_craftitem ('duck_feather','Duck Feather') -nssm_craftitem ('black_duck_feather','Black Duck Feather') -nssm_craftitem ('masticone_fang','Masticone Fang') -nssm_craftitem ('white_wolf_fur','White Wolf Fur') -nssm_craftitem ('stoneater_mandible','Stoneater Mandible') -nssm_craftitem ('ant_mandible','Ant Mandible') -nssm_craftitem ('life_energy','Life Energy') -nssm_craftitem ('wolf_fur','Wolf Fur') -nssm_craftitem ('felucco_fur','Felucco Fur') -nssm_craftitem ('felucco_horn','Felucco Horn') -nssm_craftitem ('energy_globe','Energy Globe') -nssm_craftitem ('greedy_soul_fragment','Greedy Soul Fragment') -nssm_craftitem ('lustful_soul_fragment','Lustful Soul Fragment') -nssm_craftitem ('wrathful_soul_fragment','Wrathful Soul Fragment') -nssm_craftitem ('proud_soul_fragment','Proud Soul Fragment') -nssm_craftitem ('slothful_soul_fragment','Slothful Soul Fragment') -nssm_craftitem ('envious_soul_fragment','Envious Soul Fragment') -nssm_craftitem ('gluttonous_soul_fragment','Gluttonous Soul Fragment') -nssm_craftitem ('gluttonous_moranga','Gluttonous Moranga') -nssm_craftitem ('envious_moranga','Envious Moranga') -nssm_craftitem ('proud_moranga','Proud Moranga') -nssm_craftitem ('slothful_moranga','Slothful Moranga') -nssm_craftitem ('lustful_moranga','Lustful Moranga') -nssm_craftitem ('wrathful_moranga','Wrathful Moranga') -nssm_craftitem ('greedy_moranga','Greedy Moranga') -nssm_craftitem ('mantis_skin','Mantis_skin') -nssm_craftitem ('sand_bloco_skin','Sand Bloco Skin') -nssm_craftitem ('sandworm_skin','Sandworm Skin') -nssm_craftitem ('sky_iron','Sky Iron') -nssm_craftitem ('web_string','Cobweb String') -nssm_craftitem ('dense_web_string','Dense Cobweb String') -nssm_craftitem ('black_powder','Black Powder') -nssm_craftitem ('morelentir_dust','Dark Starred Stone Dust') -nssm_craftitem ('empty_evocation_bomb','Empty Evocation Bomb') +nssm_craftitem ("sky_feather", "Sky Feather") +nssm_craftitem ("snake_scute", "Snake Scute") +nssm_craftitem ("eyed_tentacle", "Eyed Tentacle") +--nssm_craftitem ("king_duck_crown", "King Duck Crown") +nssm_craftitem ("great_energy_globe", "Great Energy Globe") +nssm_craftitem ("superior_energy_globe", "Superior Energy Globe") +nssm_craftitem ("ant_queen_abdomen", "Ant Queen Abdomen") +--nssm_craftitem ("masticone_skull", "Masticone Skull") +nssm_craftitem ("masticone_skull_fragments", "Masticone Skull Fragments") +--nssm_craftitem ("masticone_skull_crowned", "Masticone Skull Crowned") +nssm_craftitem ("tentacle_curly", "Kraken Tentacle") +nssm_craftitem ("lava_titan_eye", "Lava Titan Eye") +nssm_craftitem ("duck_beak", "Duck Beak") +nssm_craftitem ("ice_tooth", "Ice Tooth") +nssm_craftitem ("little_ice_tooth", "Little Ice Tooth") +nssm_craftitem ("digested_sand", "Digested Sand") +nssm_craftitem ("black_ice_tooth", "Black Ice Tooth") +nssm_craftitem ("tarantula_chelicerae", "Tarantula Chelicerae") +nssm_craftitem ("crab_chela", "Crab Chela") +nssm_craftitem ("cursed_pumpkin_seed", "Cursed Pumpkin Seed") +nssm_craftitem ("mantis_claw", "Mantis Claw") +nssm_craftitem ("manticore_fur", "Manticore Fur") +nssm_craftitem ("ant_hard_skin", "Ant Hard Skin") +nssm_craftitem ("bloco_skin", "Bloco Skin") +nssm_craftitem ("crab_carapace_fragment", "Crab Carapace Fragment") +nssm_craftitem ("crocodile_skin", "Crocodile Skin") +nssm_craftitem ("manticore_spine", "Manticore Spine") +nssm_craftitem ("night_feather", "Night Feather") +nssm_craftitem ("sun_feather", "Sun Feather") +nssm_craftitem ("duck_feather", "Duck Feather") +nssm_craftitem ("black_duck_feather", "Black Duck Feather") +nssm_craftitem ("masticone_fang", "Masticone Fang") +nssm_craftitem ("white_wolf_fur", "White Wolf Fur") +nssm_craftitem ("stoneater_mandible", "Stoneater Mandible") +nssm_craftitem ("ant_mandible", "Ant Mandible") +nssm_craftitem ("life_energy", "Life Energy") +nssm_craftitem ("wolf_fur", "Wolf Fur") +nssm_craftitem ("felucco_fur", "Felucco Fur") +nssm_craftitem ("felucco_horn", "Felucco Horn") +nssm_craftitem ("energy_globe", "Energy Globe") +nssm_craftitem ("greedy_soul_fragment", "Greedy Soul Fragment") +nssm_craftitem ("lustful_soul_fragment", "Lustful Soul Fragment") +nssm_craftitem ("wrathful_soul_fragment", "Wrathful Soul Fragment") +nssm_craftitem ("proud_soul_fragment", "Proud Soul Fragment") +nssm_craftitem ("slothful_soul_fragment", "Slothful Soul Fragment") +nssm_craftitem ("envious_soul_fragment", "Envious Soul Fragment") +nssm_craftitem ("gluttonous_soul_fragment", "Gluttonous Soul Fragment") +nssm_craftitem ("gluttonous_moranga", "Gluttonous Moranga") +nssm_craftitem ("envious_moranga", "Envious Moranga") +nssm_craftitem ("proud_moranga", "Proud Moranga") +nssm_craftitem ("slothful_moranga", "Slothful Moranga") +nssm_craftitem ("lustful_moranga", "Lustful Moranga") +nssm_craftitem ("wrathful_moranga", "Wrathful Moranga") +nssm_craftitem ("greedy_moranga", "Greedy Moranga") +nssm_craftitem ("mantis_skin", "Mantis_skin") +nssm_craftitem ("sand_bloco_skin", "Sand Bloco Skin") +nssm_craftitem ("sandworm_skin", "Sandworm Skin") +nssm_craftitem ("sky_iron", "Sky Iron") +nssm_craftitem ("web_string", "Cobweb String") +nssm_craftitem ("dense_web_string", "Dense Cobweb String") +nssm_craftitem ("black_powder", "Black Powder") +nssm_craftitem ("morelentir_dust", "Dark Starred Stone Dust") +nssm_craftitem ("empty_evocation_bomb", "Empty Evocation Bomb") local function nssm_craftitem_eat (name, descr, gnam) - minetest.register_craftitem("nssm:"..name, { + minetest.register_craftitem("nssm:" .. name, { description = descr, - image =name..".png", + image =name .. ".png", on_use = minetest.item_eat(gnam), - groups = { meat=1, eatable=1 }, + groups = {meat = 1, eatable = 1} }) end -nssm_craftitem_eat ('werewolf_leg','Werewolf Leg',3) -nssm_craftitem_eat ('felucco_steak','Felucco Steak',3) -nssm_craftitem_eat ('roasted_felucco_steak','Roasted Felucco Steak',6) -nssm_craftitem_eat ('heron_leg','Moonheron Leg',2) -nssm_craftitem_eat ('chichibios_heron_leg',"Chichibio's Moonheron Leg",4) -nssm_craftitem_eat ('crocodile_tail','Crocodile Tail',3) -nssm_craftitem_eat ('roasted_crocodile_tail','Roasted Crocodile Tail',6) -nssm_craftitem_eat ('roasted_werewolf_leg','Roasted_Werewolf Leg',6) -nssm_craftitem_eat ('duck_legs','Duck Legs',1) -nssm_craftitem_eat ('roasted_duck_legs','Roasted Duck Leg',3) -nssm_craftitem_eat ('ant_leg','Ant Leg',-1) -nssm_craftitem_eat ('roasted_ant_leg','Roasted Ant Leg',4) -nssm_craftitem_eat ('spider_leg','Spider Leg',-1) -nssm_craftitem_eat ('roasted_spider_leg','Roasted Spider Leg',4) ---nssm_craftitem_eat ('brain','Brain',3) ---nssm_craftitem_eat ('roasted_brain','Roasted Brain',8) -nssm_craftitem_eat ('tentacle','Tentacle',2) -nssm_craftitem_eat ('roasted_tentacle','Roasted Tentacle',5) -nssm_craftitem_eat ('worm_flesh','Worm Flesh',-2) -nssm_craftitem_eat ('roasted_worm_flesh','Roasted Worm Flesh',4) -nssm_craftitem_eat ('amphibian_heart','Amphibian Heart',1) -nssm_craftitem_eat ('roasted_amphibian_heart','Roasted Amphibian Heart',8) -nssm_craftitem_eat ('raw_scrausics_wing','Raw Scrausics Wing',1) -nssm_craftitem_eat ('spicy_scrausics_wing','Spicy Scrausics Wing',6) -nssm_craftitem_eat ('phoenix_nuggets','Phoenix Nuggets',20) -nssm_craftitem_eat ('phoenix_tear','Phoenix Tear',20) -nssm_craftitem_eat ('frosted_amphibian_heart','Frosted Amphibian Heart',-1) -nssm_craftitem_eat ('surimi','Surimi',4) -nssm_craftitem_eat ('amphibian_ribs','Amphibian Ribs',2) -nssm_craftitem_eat ('roasted_amphibian_ribs','Roasted Amphibian Ribs',6) -nssm_craftitem_eat ('dolidrosaurus_fin','Dolidrosaurus Fin',-2) -nssm_craftitem_eat ('roasted_dolidrosaurus_fin','Roasted Dolidrosaurus Fin',4) -nssm_craftitem_eat ('larva_meat','Larva Meat',-1) -nssm_craftitem_eat ('larva_juice','Larva Juice',-3) -nssm_craftitem_eat ('larva_soup','Larva Soup',10) -nssm_craftitem_eat ('mantis_meat','Mantis Meat',1) -nssm_craftitem_eat ('roasted_mantis_meat','Roasted Mantis Meat',4) -nssm_craftitem_eat ('spider_meat','Spider Meat',-1) -nssm_craftitem_eat ('roasted_spider_meat','Roasted Spider Meat',3) -nssm_craftitem_eat ('silk_gland','Silk Gland',-1) -nssm_craftitem_eat ('roasted_silk_gland','Roasted Silk Gland',3) -nssm_craftitem_eat ('super_silk_gland','Super Silk Gland',-8) -nssm_craftitem_eat ('roasted_super_silk_gland','Roasted Super Silk Gland',2) +nssm_craftitem_eat ("werewolf_leg", "Werewolf Leg", 3) +nssm_craftitem_eat ("felucco_steak", "Felucco Steak", 3) +nssm_craftitem_eat ("roasted_felucco_steak", "Roasted Felucco Steak", 6) +nssm_craftitem_eat ("heron_leg", "Moonheron Leg", 2) +nssm_craftitem_eat ("chichibios_heron_leg", "Chichibios Moonheron Leg", 4) +nssm_craftitem_eat ("crocodile_tail", "Crocodile Tail", 3) +nssm_craftitem_eat ("roasted_crocodile_tail", "Roasted Crocodile Tail", 6) +nssm_craftitem_eat ("roasted_werewolf_leg", "Roasted_Werewolf Leg", 6) +nssm_craftitem_eat ("duck_legs", "Duck Legs", 1) +nssm_craftitem_eat ("roasted_duck_legs", "Roasted Duck Leg", 3) +nssm_craftitem_eat ("ant_leg", "Ant Leg", -1) +nssm_craftitem_eat ("roasted_ant_leg", "Roasted Ant Leg", 4) +nssm_craftitem_eat ("spider_leg", "Spider Leg", -1) +nssm_craftitem_eat ("roasted_spider_leg", "Roasted Spider Leg", 4) +--nssm_craftitem_eat ("brain", "Brain", 3) +--nssm_craftitem_eat ("roasted_brain", "Roasted Brain", 8) +nssm_craftitem_eat ("tentacle", "Tentacle", 2) +nssm_craftitem_eat ("roasted_tentacle", "Roasted Tentacle", 5) +nssm_craftitem_eat ("worm_flesh", "Worm Flesh", -2) +nssm_craftitem_eat ("roasted_worm_flesh", "Roasted Worm Flesh", 4) +nssm_craftitem_eat ("amphibian_heart", "Amphibian Heart", 1) +nssm_craftitem_eat ("roasted_amphibian_heart", "Roasted Amphibian Heart", 8) +nssm_craftitem_eat ("raw_scrausics_wing", "Raw Scrausics Wing", 1) +nssm_craftitem_eat ("spicy_scrausics_wing", "Spicy Scrausics Wing", 6) +nssm_craftitem_eat ("phoenix_nuggets", "Phoenix Nuggets", 20) +nssm_craftitem_eat ("phoenix_tear", "Phoenix Tear", 20) +nssm_craftitem_eat ("frosted_amphibian_heart", "Frosted Amphibian Heart", -1) +nssm_craftitem_eat ("surimi", "Surimi", 4) +nssm_craftitem_eat ("amphibian_ribs", "Amphibian Ribs", 2) +nssm_craftitem_eat ("roasted_amphibian_ribs", "Roasted Amphibian Ribs", 6) +nssm_craftitem_eat ("dolidrosaurus_fin", "Dolidrosaurus Fin", -2) +nssm_craftitem_eat ("roasted_dolidrosaurus_fin", "Roasted Dolidrosaurus Fin", 4) +nssm_craftitem_eat ("larva_meat", "Larva Meat", -1) +nssm_craftitem_eat ("larva_juice", "Larva Juice", -3) +nssm_craftitem_eat ("larva_soup", "Larva Soup", 10) +nssm_craftitem_eat ("mantis_meat", "Mantis Meat", 1) +nssm_craftitem_eat ("roasted_mantis_meat", "Roasted Mantis Meat", 4) +nssm_craftitem_eat ("spider_meat", "Spider Meat", -1) +nssm_craftitem_eat ("roasted_spider_meat", "Roasted Spider Meat", 3) +nssm_craftitem_eat ("silk_gland", "Silk Gland", -1) +nssm_craftitem_eat ("roasted_silk_gland", "Roasted Silk Gland", 3) +nssm_craftitem_eat ("super_silk_gland", "Super Silk Gland", -8) +nssm_craftitem_eat ("roasted_super_silk_gland", "Roasted Super Silk Gland", 2) --ore generation minetest.register_ore({ - ore_type = "scatter", - ore = "nssm:modders_block", - wherein = "default:stone", + ore_type = "scatter", + ore = "nssm:modders_block", + wherein = "default:stone", clust_scarcity = 50*50*50, clust_num_ores = 1, clust_size = 1, - y_min = -115, - y_max = -95, + y_min = -115, + y_max = -95 }) for i = 1, 9 do minetest.register_ore({ - ore_type = "scatter", - ore = "nssm:ant_dirt", - wherein = "default:cobble", + ore_type = "scatter", + ore = "nssm:ant_dirt", + wherein = "default:cobble", clust_scarcity = 1, clust_num_ores = 1, clust_size = 1, - y_min = -1, - y_max = 40, + y_min = -1, + y_max = 40 }) minetest.register_ore({ - ore_type = "scatter", - ore = "nssm:ant_dirt", - wherein = "default:mossycobble", + ore_type = "scatter", + ore = "nssm:ant_dirt", + wherein = "default:mossycobble", clust_scarcity = 1, clust_num_ores = 1, clust_size = 1, - y_min = -1000, - y_max = 40, + y_min = -1000, + y_max = 40 }) minetest.register_ore({ - ore_type = "scatter", - ore = "nssm:ant_dirt", - wherein = "default:sandstonebrick", + ore_type = "scatter", + ore = "nssm:ant_dirt", + wherein = "default:sandstonebrick", clust_scarcity = 1, clust_num_ores = 1, clust_size = 1, - y_min = -1000, - y_max = 40, + y_min = -1000, + y_max = 40 }) minetest.register_ore({ - ore_type = "scatter", - ore = "nssm:ant_dirt", - wherein = "stairs:stair_sandstonebrick", + ore_type = "scatter", + ore = "nssm:ant_dirt", + wherein = "stairs:stair_sandstonebrick", clust_scarcity = 1, clust_num_ores = 1, clust_size = 1, - y_min = -1000, - y_max = 40, + y_min = -1000, + y_max = 40 }) minetest.register_ore({ - ore_type = "scatter", - ore = "nssm:ant_dirt", - wherein = "stairs:stair_cobble", + ore_type = "scatter", + ore = "nssm:ant_dirt", + wherein = "stairs:stair_cobble", clust_scarcity = 1, clust_num_ores = 1, clust_size = 1, - y_min = -1000, - y_max = 40, + y_min = -1000, + y_max = 40 }) end -- END for loop + minetest.register_ore({ - ore_type = "scatter", - ore = "nssm:web", - wherein = "default:junglegrass", + ore_type = "scatter", + ore = "nssm:web", + wherein = "default:junglegrass", clust_scarcity = 2*2*2, clust_num_ores = 2, clust_size = 2, - y_min = -20, - y_max = 200, + y_min = -20, + y_max = 200 }) minetest.register_ore({ - ore_type = "scatter", - ore = "nssm:web", - wherein = "default:jungleleaves", + ore_type = "scatter", + ore = "nssm:web", + wherein = "default:jungleleaves", clust_scarcity = 4*4*4, clust_num_ores = 5, clust_size = 5, - y_min = -20, - y_max = 200, + y_min = -20, + y_max = 200 }) --nodes @@ -226,13 +227,13 @@ minetest.register_ore({ minetest.register_node("nssm:ant_dirt", { description = "Ant Dirt", tiles = {"ant_dirt.png"}, - groups = {crumbly=3}, + groups = {crumbly = 3} }) minetest.register_node("nssm:dead_leaves", { description = "Dead leaves", tiles = {"dead_leaves.png"}, - groups = {snappy=3,leaves=1}, + groups = {snappy = 3, leaves = 1} }) minetest.register_node("nssm:invisible_light", { @@ -246,9 +247,9 @@ minetest.register_node("nssm:invisible_light", { diggable = false, buildable_to = true, is_ground_content = false, - groups = {unbreakable=1}, + groups = {unbreakable = 1}, drop = "", - light_source = 14, + light_source = 14 }) minetest.register_node("nssm:venomous_gas", { @@ -256,8 +257,10 @@ minetest.register_node("nssm: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}} + {name = "venomous_gas_animated.png", + animation = { + type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.0} + } }, paramtype = "light", walkable = false, @@ -268,15 +271,15 @@ minetest.register_node("nssm:venomous_gas", { drop = "", drowning = 1, damage_per_second = 1, - post_effect_color = {a=100, r=1, g=100, b=1}, - groups = {flammable = 2}, + post_effect_color = {a = 100, r = 1, g = 100, b = 1}, + groups = {flammable = 2} }) 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}, + groups = {crumbly = 3, not_in_creative_inventory =1} }) minetest.register_node("nssm:web", { @@ -297,13 +300,13 @@ minetest.register_node("nssm:web", { liquid_alternative_flowing = "nssm:web", liquid_alternative_source = "nssm:web", liquid_viscosity = 20, - groups = {flammable=2, snappy=1, liquid=1}, + groups = {flammable = 2, snappy = 1, liquid = 1} }) minetest.register_node("nssm:thick_web", { description = "Thick Web", inventory_image = "thick_web.png", - tiles = {"thick_web.png"} , + tiles = {"thick_web.png"}, drawtype = "firelike", paramtype = "light", walkable = false, @@ -318,7 +321,7 @@ minetest.register_node("nssm:thick_web", { liquid_alternative_flowing = "nssm:thick_web", liquid_alternative_source = "nssm:thick_web", liquid_viscosity = 30, - groups = {flammable=2, liquid=1}, + groups = {flammable = 2, liquid = 1} }) minetest.register_node("nssm:ink", { @@ -332,9 +335,9 @@ minetest.register_node("nssm:ink", { type = "vertical_frames", aspect_w = 16, aspect_h = 16, - length = 2.0, - }, - }, + length = 2.0 + } + } }, --alpha = 420, paramtype = "light", @@ -351,8 +354,8 @@ minetest.register_node("nssm:ink", { 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}, + post_effect_color = {a = 2000, r = 30, g = 30, b = 30}, + groups = {water = 3, liquid = 3, puts_out_fire = 1} }) minetest.register_node("nssm:mese_meteor", { @@ -360,18 +363,21 @@ minetest.register_node("nssm:mese_meteor", { tiles = {"mese_meteor.png"} , paramtype = "light", drop = "", - groups = {crumbly=1, falling_node=1, flammable = 2}, + groups = {crumbly = 1, falling_node = 1, flammable = 2} }) minetest.register_node("nssm:pumpbomb", { - tiles = {"pumpbomb_top.png","pumpbomb_bottom.png", "pumpbomb_side.png", "pumpbomb_side.png", "pumpbomb_side.png", "pumpbomb_front.png"}, + 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}, + groups = {not_in_creative_inventory = 1}, drop = "", on_timer = function(pos, elapsed) - tnt_boom_nssm(pos, {damage_radius=4,radius=3,ignore_protection=false}) + tnt_boom_nssm(pos, {damage_radius = 4, radius = 3, ignore_protection = false}) minetest.set_node(pos, {name="air"}) - end, + end }) --abms @@ -379,7 +385,7 @@ minetest.register_node("nssm:pumpbomb", { minetest.register_abm({ nodenames = {"nssm:mese_meteor"}, neighbors = {"air"}, - interval = 2, -- 1 + interval = 2, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) @@ -387,15 +393,15 @@ minetest.register_abm({ return end - 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"}) + 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 }) ---[[ These don't actually do anything +--[[ These don"t actually do anything minetest.register_abm({ nodenames = {"nssm:web"}, neighbors = {"default:junglegrass"}, @@ -441,16 +447,18 @@ minetest.register_node("nssm:phoenix_fire", { drawtype = "firelike", tiles = {{ name = "phoenix_fire_animated.png", - animation = {type = "vertical_frames", - aspect_w = 16, aspect_h = 16, length = 1}, - }}, + animation = { + type = "vertical_frames", + aspect_w = 16, aspect_h = 16, length = 1} + } + }, inventory_image = "phoenix_fire.png", light_source = 14, - groups = {igniter = 1, snappy=1}, - drop = '', + groups = {igniter = 1, snappy = 1}, + drop = "", walkable = false, buildable_to = false, - damage_per_second = 4, + damage_per_second = 4 }) minetest.register_abm({ @@ -475,21 +483,21 @@ minetest.register_abm({ --tools -minetest.register_tool('nssm:sun_sword', { - description = 'Sun Sword', - inventory_image = 'sun_sword.png', +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} + 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}, + 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 puncher:get_wielded_item():get_name() == "nssm:sun_sword" then if node.name ~= "air" and not minetest.is_protected(pos, "") then minetest.add_node(pointed_thing.above, {name = "fire:basic_flame"}) @@ -502,67 +510,67 @@ 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} + 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}, - }, + 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} + full_punch_interval = 0.4, + max_drop_level = 1, + groupcaps = { + snappy = {times = {[1]=0.4, [2]=0.3, [3]=0.2}, uses = 300, maxlevel = 1}, + fleshy = {times = {[2]=0.7, [3]=0.3}, uses = 300, maxlevel = 1} }, - damage_groups = {fleshy=12}, - }, + damage_groups = {fleshy = 12} + } }) 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} + full_punch_interval = 2, + max_drop_level = 1, + groupcaps = { + fleshy = {times = {[2]=1.4, [3]=1}, uses = 20, maxlevel = 1} }, - damage_groups = {fleshy=8}, - }, + 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, + full_punch_interval = 4, + max_drop_level = 1, groupcaps={ - fleshy={times={[2]=2, [3]=1.4}, uses=20, maxlevel=1} + fleshy = {times = {[2]=2, [3]=1.4}, uses = 20, maxlevel = 1} }, - damage_groups = {fleshy=12}, - }, + 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} + full_punch_interval = 3, + max_drop_level = 1, + groupcaps = { + fleshy = {times = {[2]=2, [3]=1.4}, uses = 20, maxlevel = 1} }, - damage_groups = {fleshy=10}, - }, + damage_groups = {fleshy = 10} + } }) minetest.register_node("nssm:rope", { @@ -573,8 +581,8 @@ minetest.register_node("nssm:rope", { sunlight_propagates = true, drawtype = "plantlike", drops = "nssm:rope", - tiles = { "rope.png" }, - groups = {snappy=1}, + tiles = {"rope.png"}, + groups = {snappy = 1} }) minetest.register_tool("nssm:stoneater_pick", { @@ -582,68 +590,68 @@ minetest.register_tool("nssm:stoneater_pick", { 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}, + max_drop_level = 0, + groupcaps = { + cracky = {times = {[3]=0.0}, uses = 200, maxlevel = 1}, }, - damage_groups = {fleshy=5}, - }, + 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}, + 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}, - }, + 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}, + 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}, - }, + 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}, + 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}, - }, + 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}, + 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}, - }, + damage_groups = {fleshy = 6} + } }) if minetest.get_modpath("farming") then @@ -668,12 +676,12 @@ minetest.register_tool("nssm: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}, + max_drop_level = 1, + groupcaps = { + snappy = {times = {[1]=1.30, [2]=0.90, [3]=0.40}, uses = 40, maxlevel = 3} }, - damage_groups = {fleshy=8}, - }, + damage_groups = {fleshy = 8} + } }) minetest.register_tool("nssm:ant_shovel", { @@ -682,12 +690,12 @@ minetest.register_tool("nssm:ant_shovel", { 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}, + max_drop_level = 1, + groupcaps = { + crumbly = {times = {[1]=1.50, [2]=0.90, [3]=0.40}, uses = 35, maxlevel = 2} }, - damage_groups = {fleshy=4}, - }, + damage_groups = {fleshy = 4} + } }) minetest.register_tool("nssm:duck_beak_shovel", { @@ -696,12 +704,12 @@ minetest.register_tool("nssm:duck_beak_shovel", { 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}, + max_drop_level = 1, + groupcaps = { + crumbly = {times = {[1]=1.10, [2]=0.80, [3]=0.20}, uses = 5, maxlevel = 2} }, - damage_groups = {fleshy=4}, - }, + damage_groups = {fleshy = 4} + } }) minetest.register_tool("nssm:mantis_axe", { @@ -709,12 +717,12 @@ minetest.register_tool("nssm: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}, + max_drop_level = 1, + groupcaps = { + choppy = {times = {[1]=2.20, [2]=1.00, [3]=0.60}, uses = 30, maxlevel = 3} }, - damage_groups = {fleshy=5}, - }, + damage_groups = {fleshy = 5} + } }) minetest.register_tool("nssm:ant_billhook", { @@ -722,13 +730,13 @@ minetest.register_tool("nssm: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}, + 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}, - }, + damage_groups = {fleshy = 6} + } }) minetest.register_tool("nssm:duck_beak_pick",{ @@ -736,12 +744,12 @@ minetest.register_tool("nssm:duck_beak_pick",{ 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}, + max_drop_level = 3, + groupcaps = { + cracky = {times = {[1]=1.0, [2]=0.8, [3]=0.20}, uses = 3, maxlevel = 3} }, - damage_groups = {fleshy=5}, - }, + damage_groups = {fleshy = 5} + } }) minetest.register_tool("nssm:ant_pick", { @@ -749,12 +757,12 @@ minetest.register_tool("nssm:ant_pick", { 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}, + max_drop_level = 1, + groupcaps = { + cracky = {times = {[1]=2.00, [2]=1.20, [3]=0.80}, uses = 30, maxlevel = 2} }, - damage_groups = {fleshy=4}, - }, + damage_groups = {fleshy = 4} + } }) minetest.register_tool("nssm:mantis_pick", { @@ -762,42 +770,43 @@ minetest.register_tool("nssm:mantis_pick", { 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}, + max_drop_level = 1, + groupcaps = { + cracky = {times = {[1]=1.6, [2]=1.0, [3]=0.60}, uses = 20, maxlevel = 2} }, - damage_groups = {fleshy=4}, - }, + 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}, + 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} + 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}, - }, + 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}, + 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} + 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}, + damage_groups = {fleshy = 16} }, + on_drop = function(itemstack, dropper, pos) local objects = minetest.get_objects_inside_radius(pos, 10) @@ -811,16 +820,16 @@ minetest.register_tool("nssm:axe_of_pride", { if flag == 0 then local pname = dropper:get_player_name() - local player_inv = minetest.get_inventory({type='player', name = pname}) + local player_inv = minetest.get_inventory({type="player", name = pname}) - if player_inv:is_empty('main') then + if player_inv:is_empty("main") then --minetest.chat_send_all("Inventory empty") else local found = 0 - for i = 1,32 do + for i = 1, 32 do - local items = player_inv:get_stack('main', i) + local items = player_inv:get_stack("main", i) local n = items:get_name() if n == "nssm:energy_globe" then @@ -831,43 +840,43 @@ minetest.register_tool("nssm:axe_of_pride", { if found == 0 then - minetest.chat_send_player(pname, "You haven't got any Energy Globe!") + minetest.chat_send_player(pname, + "You haven't got any Energy Globe!") return else - if (obj:is_player()) then + if obj:is_player() then --minetest.chat_send_all("Giocatore") - if (obj:get_player_name()~=dropper:get_player_name()) then + 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) + local items = player_inv:get_stack("main", found) items:take_item() - player_inv:set_stack('main', found, items) + player_inv:set_stack("main", found, items) part = 1 end - else - if (obj:get_luaentity().health) then + 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) + local items = player_inv:get_stack("main", found) items:take_item() - player_inv:set_stack('main', found, items) + player_inv:set_stack("main", found, items) part = 1 end @@ -879,43 +888,52 @@ minetest.register_tool("nssm:axe_of_pride", { local p = obj:get_pos() 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 - ) + minetest.add_particlespawner({ + amount = 3, + time = 0.1, + minpos = {x = p.x - 0.5, y = p.y - 0.5, z = p.z - 0.5}, + maxpos = {x = p.x + 0.5, y = p.y + 0.5, z = p.z + 0.5}, + 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) * m, + y = (s.y - p.y) * m, + z = (s.z - p.z) * m + }, + minacc = {x = s.x - p.x, y = s.y - p.y, z = s.z - p.z}, + maxacc = {x = s.x - p.x, y = s.y - p.y, z = s.z - p.z}, + minexptime = 0.5, + maxexptime = 1, + minsize = 3, + maxsize = 4, + collisiondetection = false, + texture = "heart.png" + }) end 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}, + 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} + 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}, + damage_groups = {fleshy = 18} }, + on_drop = function(itemstack, dropper, pos) local objects = minetest.get_objects_inside_radius(pos, 10) @@ -929,11 +947,11 @@ minetest.register_tool("nssm:gratuitousness_battleaxe", { end local pname = dropper:get_player_name() - local player_inv = minetest.get_inventory({type='player', name = pname}) + local player_inv = minetest.get_inventory({type="player", name = pname}) local found = 0 for i = 1, 32 do - local items = player_inv:get_stack('main', i) + local items = player_inv:get_stack("main", i) local n = items:get_name() if n == "nssm:energy_globe" then @@ -946,30 +964,31 @@ minetest.register_tool("nssm:gratuitousness_battleaxe", { minetest.chat_send_player(pname, "You haven't got any Energy Globe!") return else - local items = player_inv:get_stack('main', found) + local items = player_inv:get_stack("main", found) items:take_item() - player_inv:set_stack('main', found, items) + player_inv:set_stack("main", found, items) - tnt.boom(pos, {damage_radius=5,radius=4,ignore_protection=false}) + tnt.boom(pos, {damage_radius = 5, radius = 4, ignore_protection = false}) end - 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}, + 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} + 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}, + damage_groups = {fleshy = 14} }, + on_drop = function(itemstack, dropper, pos) local objects = minetest.get_objects_inside_radius(pos, 10) @@ -982,16 +1001,16 @@ minetest.register_tool("nssm:sword_of_eagerness", { if flag == 0 then local pname = dropper:get_player_name() - local player_inv = minetest.get_inventory({type='player', name = pname}) + local player_inv = minetest.get_inventory({type="player", name = pname}) - if player_inv:is_empty('main') then + if player_inv:is_empty("main") then --minetest.chat_send_all("Inventory empty") else local found = 0 - for i = 1,32 do + for i = 1, 32 do - local items = player_inv:get_stack('main', i) + local items = player_inv:get_stack("main", i) local n = items:get_name() if n == "nssm:energy_globe" then @@ -1001,7 +1020,8 @@ minetest.register_tool("nssm:sword_of_eagerness", { end if found == 0 then - minetest.chat_send_player(pname, "You haven't got any Energy Globe!") + minetest.chat_send_player(pname, + "You haven't got any Energy Globe!") return else local pos = obj:get_pos() @@ -1017,9 +1037,9 @@ minetest.register_tool("nssm:sword_of_eagerness", { obj:set_pos(pos) --flag = 1 - local items = player_inv:get_stack('main', found) + local items = player_inv:get_stack("main", found) items:take_item() - player_inv:set_stack('main', found, items) + player_inv:set_stack("main", found, items) end else if (obj:get_luaentity().health) then @@ -1028,75 +1048,77 @@ minetest.register_tool("nssm:sword_of_eagerness", { part=1 --flag = 1 - local items = player_inv:get_stack('main', found) + local items = player_inv:get_stack("main", found) items:take_item() - player_inv:set_stack('main', found, items) + player_inv:set_stack("main", found, items) end end - if part==1 then + 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 - ) + minetest.add_particlespawner({ + amount = 25, + time = 0.3, + minpos = vector.subtract(s, 0.5), + maxpos = vector.add(s, 0.5), + minvel = {x = 0, y = 10, z = 0}, + maxvel = {x = 0.1, y = 11, z = 0.1}, + minacc = {x = 0, y = 1, z = 0}, + maxacc = {x = 0, y = 1, z = 0}, + minexptime = 0.5, + maxexptime = 1, + minsize = 1, + maxsize = 2, + collisiondetection = false, + texture = "slothful_soul_fragment.png" + }) end 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}, + 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} + 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}, + damage_groups = {fleshy = 16} }, + on_drop = function(itemstack, dropper, pos) + local vec = dropper:get_look_dir() local pos = dropper:get_pos() --vec.y = 0 - for i=1,16 do + 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}) + local player_inv = minetest.get_inventory({type="player", name = pname}) - if player_inv:is_empty('main') then + 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) + 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 @@ -1110,81 +1132,82 @@ minetest.register_tool("nssm:falchion_of_eagerness", { return else local s = dropper:get_pos() - 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.add_particlespawner({ + amount = 25, + time = 0.3, + minpos = vector.subtract(s, 0.5), + maxpos = vector.add(s, 0.5), + minvel = {x = 0, y = 10, z = 0}, + maxvel = {x = 0.1, y = 11, z = 0.1}, + minacc = {x = 0, y = 1, z = 0}, + maxacc = {x = 0, y = 1, z = 0}, + minexptime = 0.5, + maxexptime = 1, + minsize = 1, + maxsize = 2, + collisiondetection = false, + texture = "slothful_soul_fragment.png" + }) minetest.remove_node(pos) - pos.y=pos.y+1 + pos.y=pos.y + 1 minetest.remove_node(pos) - pos.y=pos.y-2 + pos.y=pos.y - 2 minetest.remove_node(pos) dropper:set_pos(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) + s.y = s.y + 10 + minetest.add_particlespawner({ + amount - 25, + time = 0.3, + minpos = vector.subtract(s, 0.5), + maxpos = vector.add(s, 0.5), + minvel = {x = 0, y = -10, z = 0}, + maxvel = {x = 0.1, y = -11, z = 0.1}, + minacc = {x = 0, y = -1, z = 0}, + maxacc = {x = 0, y = -1, z = 0}, + minexptime = 0.5, + maxexptime = 1, + minsize = 1, + maxsize = 2, + collisiondetection = false, + texture = "slothful_soul_fragment.png" + }) + 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, + 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}, + 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} + 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}, + damage_groups = {fleshy = 14} }, + on_drop = function(itemstack, dropper, pos) local objects = minetest.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}) + local player_inv = minetest.get_inventory({type="player", name = pname}) - if player_inv:is_empty('main') then + 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) + 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 @@ -1203,9 +1226,9 @@ minetest.register_tool("nssm:sword_of_envy", { dropper:set_hp(hpp) flag = 1 - local items = player_inv:get_stack('main', found) + local items = player_inv:get_stack("main", found) items:take_item() - player_inv:set_stack('main', found, items) + player_inv:set_stack("main", found, items) end else if (obj:get_luaentity().health) then @@ -1216,48 +1239,48 @@ minetest.register_tool("nssm:sword_of_envy", { else dropper:set_hp(hpp) end --- check_for_death(obj:get_luaentity()) flag = 1 - local items = player_inv:get_stack('main', found) + local items = player_inv:get_stack("main", found) items:take_item() - player_inv:set_stack('main', found, items) + player_inv:set_stack("main", found, items) end end 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}, + 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} + 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}, + damage_groups = {fleshy = 14} }, + on_drop = function(itemstack, dropper, pos) local objects = minetest.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}) + local player_inv = minetest.get_inventory({type="player", name = pname}) - if player_inv:is_empty('main') then + 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) + 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 @@ -1270,13 +1293,13 @@ minetest.register_tool("nssm:sword_of_gluttony", { else if (obj:is_player()) then if (obj:get_player_name()~=dropper:get_player_name()) then - obj:set_hp(obj:get_hp()-10) + obj:set_hp(obj:get_hp() - 10) --flag = 1 --take energy globe from inventory: - local items = player_inv:get_stack('main', found) + local items = player_inv:get_stack("main", found) items:take_item() - player_inv:set_stack('main', found, items) + player_inv:set_stack("main", found, items) end else if (obj:get_luaentity().health) then @@ -1287,11 +1310,11 @@ minetest.register_tool("nssm:sword_of_gluttony", { --check_for_death(obj:get_luaentity()) --flag = 1 --take energy globe from inventory: - local items = player_inv:get_stack('main', found) + local items = player_inv:get_stack("main", found) items:take_item() - player_inv:set_stack('main', found, items) + player_inv:set_stack("main", found, items) - for i = 1,math.random(1,4) do + for i = 1, math.random(4) do drop = minetest.add_item(pos, "nssm:roasted_duck_legs 1") drops(drop) end @@ -1300,22 +1323,30 @@ minetest.register_tool("nssm:sword_of_gluttony", { local p = dropper:get_pos() 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 - ) + minetest.add_particlespawner({ + amount = 10, + time = 0.1, + minpos = {x = p.x - 0.5, y = p.y - 0.5, z = p.z - 0.5}, + maxpos = {x = p.x + 0.5, y = p.y + 0.5, z = p.z + 0.5}, + 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) * m, + y = (s.y - p.y) * m, + z = (s.z - p.z) * m + }, + {x = s.x - p.x, y = s.y - p.y, z = s.z - p.z}, + {x = s.x - p.x, y = s.y - p.y, z = s.z - p.z}, + minexptime = 0.5, + maxexptime = 1, + minsize = 1, + maxsize = 2, + collisiondetection = false, + texture = "gluttonous_soul_fragment.png" + }) end end end @@ -1323,85 +1354,88 @@ minetest.register_tool("nssm:sword_of_gluttony", { end end end - end, + end }) minetest.register_tool("nssm:death_scythe", { description = "Death Scythe", - wield_scale= {x=3,y=3,z=1.3}, + 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} + 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}, + damage_groups = {fleshy = 28} }, - groups ={not_in_creative_inventory=1}, + groups ={not_in_creative_inventory = 1}, + on_drop = function(itemstack, dropper, pos) local objects = minetest.get_objects_inside_radius(pos, 10) local flag = 0 - dropper:set_hp(dropper:get_hp()-9) + 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) + 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()) + obj:get_luaentity().health = obj:get_luaentity().health - 40 flag = 1 end end if flag == 1 then - for i = 1,math.random(1,2) do + for i = 1, math.random(2) do drop = minetest.add_item(pos, "nssm:energy_globe 1") if drop then drop:set_velocity({ x = math.random(-10, 10) / 9, y = 5, - z = math.random(-10, 10) / 9, + z = math.random(-10, 10) / 9 }) end end end end local pos = dropper:get_pos() - 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") + 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 + if math.random(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") + 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 + if math.random(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") + 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 + if math.random(3) == 1 then + v.y = v.y + 2 drop = minetest.add_item(v, "nssm:life_energy 1") drops(drop) end @@ -1412,414 +1446,423 @@ minetest.register_tool("nssm:death_scythe", { --recipes minetest.register_craft({ - output = 'nssm:web_string', + output = "nssm:web_string", recipe = { - {'nssm:web', 'nssm:web'}, - {'nssm:web', 'nssm:web'}, + {"nssm:web", "nssm:web"}, + {"nssm:web", "nssm:web"} } }) minetest.register_craft({ - output = 'nssm:dense_web_string', + 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'}, + {"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', + output = "nssm:mantis_sword", recipe = { - {'nssm:mantis_claw'}, - {'nssm:mantis_claw'}, - {'group:stick'}, + {"nssm:mantis_claw"}, + {"nssm:mantis_claw"}, + {"group:stick"} } }) minetest.register_craft({ - output = 'nssm:masticone_fang_sword', + output = "nssm:masticone_fang_sword", recipe = { - {'nssm:masticone_fang', 'nssm:masticone_fang'}, - {'nssm:masticone_fang', ''}, - {'group:stick', ''}, + {"nssm:masticone_fang", "nssm:masticone_fang"}, + {"nssm:masticone_fang", ""}, + {"group:stick", ""} } }) minetest.register_craft({ - output = 'nssm:black_ice_tooth', + output = "nssm:black_ice_tooth", type = "shapeless", - recipe = {'nssm:digested_sand', 'nssm:ice_tooth'}, + recipe = {"nssm:digested_sand", "nssm:ice_tooth"} }) minetest.register_craft({ - output = 'nssm:web 4', + output = "nssm:web 4", type = "shapeless", - recipe = {'nssm:silk_gland'}, + recipe = {"nssm:silk_gland"} }) minetest.register_craft({ - output = 'nssm:crab_light_mace', + output = "nssm:crab_light_mace", recipe = { - {'nssm:crab_chela'}, - {'group:stick'}, - {'group:stick'}, + {"nssm:crab_chela"}, + {"group:stick"}, + {"group:stick"} } }) minetest.register_craft({ - output = 'nssm:crab_heavy_mace', + output = "nssm:crab_heavy_mace", recipe = { - {'', 'nssm:crab_chela', ''}, - {'nssm:crab_chela', 'nssm:crab_chela', 'nssm:crab_chela'}, - {'', 'group:stick', ''}, + {"", "nssm:crab_chela", ""}, + {"nssm:crab_chela", "nssm:crab_chela", "nssm:crab_chela"}, + {"", "group:stick", ""} } }) minetest.register_craft({ - output = 'nssm:energy_globe', + 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'}, + {"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', + 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'}, + {"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', + 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'}, + {"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', + 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'} + 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', + output = "nssm:masticone_skull_crowned", recipe = { - {'', 'nssm:king_duck_crown', ''}, - {'', 'nssm:masticone_skull', ''}, - {'', '', ''}, + {"", "nssm:king_duck_crown", ""}, + {"", "nssm:masticone_skull", ""}, + {"", "", ""}, } })]] minetest.register_craft({ - output = 'nssm:eyed_tentacle', + output = "nssm:eyed_tentacle", type = "shapeless", - recipe = {'nssm:lava_titan_eye','nssm:tentacle_curly'} + recipe = {"nssm:lava_titan_eye", "nssm:tentacle_curly"} }) minetest.register_craft({ - output = 'nssm:life_energy 9', + output = "nssm:life_energy 9", type = "shapeless", - recipe = {'nssm:energy_globe'} + recipe = {"nssm:energy_globe"} }) minetest.register_craft({ - output = 'nssm:energy_globe 9', + output = "nssm:energy_globe 9", type = "shapeless", - recipe = {'nssm:great_energy_globe'} + recipe = {"nssm:great_energy_globe"} }) minetest.register_craft({ - output = 'nssm:great_energy_globe 9', + output = "nssm:great_energy_globe 9", type = "shapeless", - recipe = {'nssm:superior_energy_globe'} + recipe = {"nssm:superior_energy_globe"} }) --[[ minetest.register_craft({ - output = 'nssm:masticone_skull', + 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'}, + {"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', + output = "nssm:rope 12", recipe = { - {'nssm:web_string'}, - {'nssm:web_string'}, - {'nssm:web_string'}, + {"nssm:web_string"}, + {"nssm:web_string"}, + {"nssm:web_string"} } }) minetest.register_craft({ - output = 'nssm:sky_feather', + output = "nssm:sky_feather", type = "shapeless", - recipe = {'nssm:sun_feather','nssm:night_feather'} + recipe = {"nssm:sun_feather", "nssm:night_feather"} }) minetest.register_craft({ - output = 'nssm:sun_sword', + output = "nssm:sun_sword", recipe = { - {'default:diamond'}, - {'nssm:sun_feather'}, - {'group:stick'}, + {"default:diamond"}, + {"nssm:sun_feather"}, + {"group:stick"} } }) minetest.register_craft({ - output = 'nssm:night_sword', + output = "nssm:night_sword", recipe = { - {'default:diamond'}, - {'nssm:night_feather'}, - {'group:stick'}, + {"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, -}) - + 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) +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', + output = "nssm:larva_juice", type = "shapeless", - recipe = {'nssm:larva_meat','bucket:bucket_empty'} + recipe = {"nssm:larva_meat", "bucket:bucket_empty"} }) minetest.register_craft({ - output = 'nssm:ant_sword', + output = "nssm:ant_sword", recipe = { - {'nssm:ant_mandible'}, - {'nssm:ant_mandible'}, - {'group:stick'}, + {"nssm:ant_mandible"}, + {"nssm:ant_mandible"}, + {"group:stick"} } }) minetest.register_craft({ - output = 'nssm:ant_billhook', + output = "nssm:ant_billhook", recipe = { - {'nssm:ant_mandible', 'nssm:ant_mandible'}, - {'nssm:ant_mandible', 'group:stick'}, - {'', 'group:stick'}, + {"nssm:ant_mandible", "nssm:ant_mandible"}, + {"nssm:ant_mandible", "group:stick"}, + {"", "group:stick"} } }) minetest.register_craft({ - output = 'nssm:ant_shovel', + output = "nssm:ant_shovel", recipe = { - {'nssm:ant_mandible'}, - {'group:stick'}, - {'group:stick'}, + {"nssm:ant_mandible"}, + {"group:stick"}, + {"group:stick"} } }) minetest.register_craft({ - output = 'nssm:duck_beak_shovel', + output = "nssm:duck_beak_shovel", recipe = { - {'nssm:duck_beak'}, - {'group:stick'}, - {'group:stick'}, + {"nssm:duck_beak"}, + {"group:stick"}, + {"group:stick"} } }) minetest.register_craft({ - output = 'nssm:duck_beak_pick', + output = "nssm:duck_beak_pick", recipe = { - {'nssm:duck_beak', 'nssm:duck_beak', 'nssm:duck_beak'}, - {'', 'group:stick', ''}, - {'', 'group:stick', ''}, + {"nssm:duck_beak", "nssm:duck_beak", "nssm:duck_beak"}, + {"", "group:stick", ""}, + {"", "group:stick", ""} } }) minetest.register_craft({ - output = 'nssm:sky_iron 30', + 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'}, + {"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', + output = "nssm:stoneater_pick", recipe = { - {'nssm:stoneater_mandible', 'nssm:stoneater_mandible', 'nssm:stoneater_mandible'}, - {'', 'group:stick', ''}, - {'', 'group:stick', ''}, + {"nssm:stoneater_mandible", "nssm:stoneater_mandible", "nssm:stoneater_mandible"}, + {"", "group:stick", ""}, + {"", "group:stick", ""} } }) minetest.register_craft({ - output = 'nssm:felucco_knife', + output = "nssm:felucco_knife", recipe = { - {'nssm:felucco_horn'}, - {'group:stick'}, + {"nssm:felucco_horn"}, + {"group:stick"} } }) minetest.register_craft({ - output = 'nssm:little_ice_tooth_knife', + output = "nssm:little_ice_tooth_knife", recipe = { - {'nssm:little_ice_tooth'}, - {'group:stick'}, + {"nssm:little_ice_tooth"}, + {"group:stick"} } }) minetest.register_craft({ - output = 'nssm:manticore_spine_knife', + output = "nssm:manticore_spine_knife", recipe = { - {'nssm:manticore_spine'}, - {'group:stick'}, + {"nssm:manticore_spine"}, + {"group:stick"} } }) minetest.register_craft({ - output = 'nssm:ant_pick', + output = "nssm:ant_pick", recipe = { - {'nssm:ant_mandible', 'nssm:ant_mandible', 'nssm:ant_mandible'}, - {'', 'group:stick', ''}, - {'', 'group:stick', ''}, + {"nssm:ant_mandible", "nssm:ant_mandible", "nssm:ant_mandible"}, + {"", "group:stick", ""}, + {"", "group:stick", ""} } }) minetest.register_craft({ - output = 'nssm:mantis_pick', + output = "nssm:mantis_pick", recipe = { - {'nssm:mantis_claw', 'nssm:mantis_claw', 'nssm:mantis_claw'}, - {'', 'group:stick', ''}, - {'', 'group:stick', ''}, + {"nssm:mantis_claw", "nssm:mantis_claw", "nssm:mantis_claw"}, + {"", "group:stick", ""}, + {"", "group:stick", ""} } }) minetest.register_craft({ - output = 'nssm:mantis_axe', + output = "nssm:mantis_axe", recipe = { - {'nssm:mantis_claw', 'nssm:mantis_claw'}, - {'nssm:mantis_claw', 'group:stick'}, - {'', 'group:stick'}, + {"nssm:mantis_claw", "nssm:mantis_claw"}, + {"nssm:mantis_claw", "group:stick"}, + {"", "group:stick"} } }) minetest.register_craft({ - output = 'nssm:tarantula_warhammer', + output = "nssm:tarantula_warhammer", recipe = { - {'nssm:tarantula_chelicerae'}, - {'group:stick'}, - {'group:stick'}, + {"nssm:tarantula_chelicerae"}, + {"group:stick"}, + {"group:stick"} } }) minetest.register_craft({ - output = 'nssm:mantis_battleaxe', + output = "nssm:mantis_battleaxe", recipe = { - {'nssm:mantis_claw', 'nssm:mantis_claw', 'nssm:mantis_claw'}, - {'nssm:mantis_claw', 'group:stick', 'nssm:mantis_claw'}, - {'', 'group:stick', ''}, + {"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', + output = "nssm:axe_of_pride", recipe = { - {'nssm:proud_moranga', 'nssm:proud_moranga', 'nssm:proud_moranga'}, - {'nssm:proud_moranga', 'nssb:moranga_ingot', ''}, - {'', 'nssb:moranga_ingot', ''}, + {"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', + 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', ''}, + {"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', + output = "nssm:sword_of_envy", recipe = { - {'nssm:envious_moranga'}, - {'nssm:envious_moranga'}, - {'nssb:moranga_ingot'}, + {"nssm:envious_moranga"}, + {"nssm:envious_moranga"}, + {"nssb:moranga_ingot"} } }) minetest.register_craft({ - output = 'nssm:sword_of_eagerness', + output = "nssm:sword_of_eagerness", recipe = { - {'nssm:slothful_moranga'}, - {'nssm:slothful_moranga'}, - {'nssb:moranga_ingot'}, + {"nssm:slothful_moranga"}, + {"nssm:slothful_moranga"}, + {"nssb:moranga_ingot"} } }) minetest.register_craft({ - output = 'nssm:falchion_of_eagerness', + output = "nssm:falchion_of_eagerness", recipe = { - {'nssm:slothful_moranga','nssm:slothful_moranga'}, - {'nssm:slothful_moranga', ''}, - {'nssb:moranga_ingot',''}, + {"nssm:slothful_moranga", "nssm:slothful_moranga"}, + {"nssm:slothful_moranga", ""}, + {"nssb:moranga_ingot", ""} } }) minetest.register_craft({ - output = 'nssm:sword_of_gluttony', + output = "nssm:sword_of_gluttony", recipe = { - {'nssm:gluttonous_moranga', 'nssm:gluttonous_moranga', 'nssm:gluttonous_moranga'}, - {'', 'nssm:gluttonous_moranga', ''}, - {'', 'nssb:moranga_ingot', ''}, + {"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'}, - } - }) + + 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") @@ -1833,142 +1876,142 @@ end --Eggs local function nssm_register_egg (name, descr) - minetest.register_craftitem("nssm:".. name, { + 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 + local pos1 = minetest.get_pointed_thing_position(pointed_thing, true) + pos1.y = pos1.y + 1.5 core.after(0.1, function() - minetest.add_entity(pos1, "nssm:".. name) + minetest.add_entity(pos1, "nssm:" .. name) end) itemstack:take_item() return itemstack - end, + end }) end -local function nssm_register_egg2 (name, descr) --mobs you can't catch - minetest.register_craftitem("nssm:".. name.."_egg", { +local function nssm_register_egg2 (name, descr) --mobs you can"t catch + minetest.register_craftitem("nssm:" .. name .. "_egg", { description = descr .. " Egg", - image = name.."_egg.png", + image = name .. "_egg.png", on_place = function(itemstack, placer, pointed_thing) - local pos1=minetest.get_pointed_thing_position(pointed_thing, true) - pos1.y=pos1.y+1.5 + local pos1 = minetest.get_pointed_thing_position(pointed_thing, true) + pos1.y = pos1.y + 1.5 core.after(0.1, function() - minetest.add_entity(pos1, "nssm:".. name) + minetest.add_entity(pos1, "nssm:" .. name) end) itemstack:take_item() return itemstack - end, + end }) end -nssm_register_egg ('flying_duck', 'Flying Duck') -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_egg ('enderduck', 'Enderduck') -nssm_register_egg ('spiderduck', 'Spiderduck') -nssm_register_egg2 ('echidna', 'Echidna') -nssm_register_egg ('werewolf', 'Werewolf') -nssm_register_egg ('white_werewolf', 'White Werewolf') -nssm_register_egg ('snow_biter', 'Snow Biter') -nssm_register_egg2 ('icelamander', 'Icelamander') -nssm_register_egg ('icesnake', 'Icesnake') -nssm_register_egg2 ('lava_titan', 'Lava Titan') -nssm_register_egg ('masticone', 'Masticone') -nssm_register_egg ('mantis_beast', 'Mantis Beast') -nssm_register_egg ('mantis', 'Mantis') -nssm_register_egg ('larva', 'Larva') -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_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 ('crocodile', 'Crocodile') -nssm_register_egg ('dolidrosaurus', 'Dolidrosaurus') -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 ('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 ('morvalar', 'Morvalar') +nssm_register_egg ("flying_duck", "Flying Duck") +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_egg ("enderduck", "Enderduck") +nssm_register_egg ("spiderduck", "Spiderduck") +nssm_register_egg2 ("echidna", "Echidna") +nssm_register_egg ("werewolf", "Werewolf") +nssm_register_egg ("white_werewolf", "White Werewolf") +nssm_register_egg ("snow_biter", "Snow Biter") +nssm_register_egg2 ("icelamander", "Icelamander") +nssm_register_egg ("icesnake", "Icesnake") +nssm_register_egg2 ("lava_titan", "Lava Titan") +nssm_register_egg ("masticone", "Masticone") +nssm_register_egg ("mantis_beast", "Mantis Beast") +nssm_register_egg ("mantis", "Mantis") +nssm_register_egg ("larva", "Larva") +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_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 ("crocodile", "Crocodile") +nssm_register_egg ("dolidrosaurus", "Dolidrosaurus") +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 ("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 ("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 + 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}, + 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", + texture = "tnt_smoke.png" }) core.after(0.4, function() minetest.add_entity(pos1, "nssm:mese_dragon") end) itemstack:take_item() return itemstack - end, + 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', + 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 + 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 @@ -1979,15 +2022,14 @@ minetest.register_abm({ interval = 2, chance = 1, action = function(pos, node) - local pos1 = {x=pos.x, y=pos.y+1, z=pos.z} + local pos1 = {x = pos.x, y = pos.y + 1, z = pos.z} local n = minetest.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) + if (minetest.get_node_light(pos1) > 8) then + minetest.add_entity(pos1, "nssm:morwa") + minetest.remove_node(pos) end end }) @@ -1995,64 +2037,64 @@ minetest.register_abm({ --Eggs recipes minetest.register_craft({ - output = 'nssm:duck', + 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'}, + {"", "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', + 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'}, + {"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', + 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'}, + {"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', + 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'}, + {"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', + 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'}, + {"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', + 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'}, + {"", "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', + 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'}, + {"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_spears.lua b/nssm_spears.lua index b67e5e0..5417501 100644 --- a/nssm_spears.lua +++ b/nssm_spears.lua @@ -4,7 +4,11 @@ local function spears_shot (itemstack, player) local spear = itemstack:get_name() .. '_entity' local playerpos = player:get_pos() - local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, spear) + local obj = minetest.add_entity({ + x = playerpos.x, + y = playerpos.y + 1.5, + z = playerpos.z + }, spear) local dir = player:get_look_dir() if spear == "nssm:spear_of_peace_entity" then sp = 32 @@ -14,10 +18,10 @@ local function spears_shot (itemstack, player) gravity = 9.8 end local dr = .3 - obj:set_velocity({x=dir.x*sp, y=dir.y*sp, z=dir.z*sp}) - obj:set_acceleration({x=-dir.x*dr, y=-gravity, z=-dir.z*dr}) - obj:set_yaw(player:get_look_yaw()+math.pi) - minetest.sound_play("spears_sound", {pos=playerpos}) + obj:set_velocity({x = dir.x * sp, y = dir.y * sp, z = dir.z * sp}) + obj:set_acceleration({x = -dir.x * dr, y = -gravity, z = -dir.z * dr}) + obj:set_yaw(player:get_look_yaw() + math.pi) + minetest.sound_play("spears_sound", {pos = playerpos}, true) obj:get_luaentity().wear = itemstack:get_wear() return true end @@ -26,16 +30,19 @@ end local function spears_set_entity(kind, eq, toughness) local SPEAR_ENTITY={ physical = false, - timer=0, + timer = 0, visual = "wielditem", - visual_size = {x=0.15, y=0.1}, + visual_size = {x = 0.15, y = 0.1}, textures = {"nssm:spear_" .. kind}, lastpos={}, collisionbox = {0,0,0,0,0,0}, on_punch = function(self, puncher) if puncher then if puncher:is_player() then - local stack = {name='nssm:spear_' .. kind, wear=self.wear+65535/toughness} + local stack = { + name = "nssm:spear_" .. kind, + wear = self.wear + 65535 / toughness + } local inv = puncher:get_inventory() if inv:room_for_item("main", stack) then inv:add_item("main", stack) @@ -43,11 +50,11 @@ local function spears_set_entity(kind, eq, toughness) end end end - end, + end } - + SPEAR_ENTITY.on_step = function(self, dtime) - self.timer=self.timer+dtime + self.timer=self.timer + dtime local pos = self.object:get_pos() local node = minetest.get_node(pos) if not self.wear then @@ -55,32 +62,44 @@ local function spears_set_entity(kind, eq, toughness) return end if self.lastpos.x~=nil then - if node.name ~= "air" and not (string.find(node.name, 'grass') and not string.find(node.name, 'dirt')) and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then + if node.name ~= "air" + and not (string.find(node.name, "grass") + and not string.find(node.name, "dirt")) + and not string.find(node.name, "flowers:") + and not string.find(node.name, "farming:") then self.object:remove() - if self.wear+65535/toughness < 65535 then - minetest.add_item(self.lastpos, {name='nssm:spear_' .. kind, wear=self.wear+65535/toughness}) + if self.wear + 65535 / toughness < 65535 then + minetest.add_item(self.lastpos, { + name = "nssm:spear_" .. kind, + wear = self.wear + 65535 / toughness + }) end - elseif self.timer>0.2 then - local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) + elseif self.timer > 0.2 then + local objs = minetest.get_objects_inside_radius({ + x = pos.x, y = pos.y, z = pos.z}, 1) for k, obj in pairs(objs) do if obj:get_luaentity() ~= nil then - if obj:get_luaentity().name ~= "nssm:spear_" .. kind .. "_entity" and obj:get_luaentity().name ~= "__builtin:item" then + if obj:get_luaentity().name ~= "nssm:spear_" .. kind .. "_entity" + and obj:get_luaentity().name ~= "__builtin:item" then local speed = vector.length(self.object:get_velocity()) - local damage = (speed + eq)^1.12-20 + local damage = (speed + eq) ^ 1.12 - 20 obj:punch(self.object, 1.0, { - full_punch_interval=1.0, - damage_groups={fleshy=damage}, + full_punch_interval = 1.0, + damage_groups={fleshy = damage} }, nil) self.object:remove() - if self.wear+65535/toughness < 65535 then - minetest.add_item(self.lastpos, {name='nssm:spear_' .. kind, wear=self.wear+65535/toughness}) + if self.wear + 65535 / toughness < 65535 then + minetest.add_item(self.lastpos, { + name = "nssm:spear_" .. kind, + wear = self.wear + 65535 / toughness + }) end end end end end end - self.lastpos={x=pos.x, y=pos.y, z=pos.z} + self.lastpos={x = pos.x, y = pos.y, z = pos.z} end return SPEAR_ENTITY end @@ -93,7 +112,7 @@ local function spears_register_spear(kind, desc, eq, toughness, material) description = desc .. " Spear", wield_image = "spear_" .. kind .. ".png", inventory_image = "spear_" .. kind .. ".png^[transform4", - wield_scale= {x=2,y=1,z=1}, + wield_scale= {x = 2, y = 1, z = 1}, on_drop = function(itemstack, user, pointed_thing) spears_shot(itemstack, user) if not minetest.setting_getbool("creative_mode") then @@ -110,11 +129,12 @@ local function spears_register_spear(kind, desc, eq, toughness, material) end, tool_capabilities = { full_punch_interval = 1.3, - max_drop_level=1, - groupcaps={ - snappy = {times={[3]=0.2, [2]=0.2, [1]=0.2}, uses=toughness, maxlevel=1}, + max_drop_level = 1, + groupcaps = { + snappy = {times = {[3]=0.2, [2]=0.2, [1]=0.2}, + uses = toughness, maxlevel = 1}, }, - damage_groups = {fleshy=eq}, + damage_groups = {fleshy = eq} } }) @@ -123,34 +143,34 @@ local function spears_register_spear(kind, desc, eq, toughness, material) minetest.register_entity("nssm:spear_" .. kind .. "_entity", SPEAR_ENTITY) minetest.register_craft({ - output = 'nssm:spear_' .. kind, + output = "nssm:spear_" .. kind, recipe = { - {'group:wood', 'group:wood', material}, + {"group:wood", "group:wood", material} } }) minetest.register_craft({ - output = 'nssm:spear_' .. kind, + output = "nssm:spear_" .. kind, recipe = { - {material, 'group:wood', 'group:wood'}, + {material, "group:wood", "group:wood"} } }) end -spears_register_spear('ant', 'Ant', 6, 25, 'nssm:ant_mandible') +spears_register_spear("ant", "Ant", 6, 25, "nssm:ant_mandible") -spears_register_spear('mantis', 'Mantis', 6, 10, 'nssm:mantis_claw') +spears_register_spear("mantis", "Mantis", 6, 10, "nssm:mantis_claw") -spears_register_spear('manticore', 'Manticore', 8, 8, 'nssm:manticore_spine') +spears_register_spear("manticore", "Manticore", 8, 8, "nssm:manticore_spine") -spears_register_spear('ice_tooth', 'Ice Tooth', 16, 200, 'nssm:ice_tooth') +spears_register_spear("ice_tooth", "Ice Tooth", 16, 200, "nssm:ice_tooth") -spears_register_spear('little_ice_tooth', 'Little Ice Tooth', 7, 10, 'nssm:little_ice_tooth') +spears_register_spear("little_ice_tooth", "Little Ice Tooth", 7, 10, "nssm:little_ice_tooth") -spears_register_spear('duck_beak', 'Duck Beak', 5, 6, 'nssm:duck_beak') +spears_register_spear("duck_beak", "Duck Beak", 5, 6, "nssm:duck_beak") -spears_register_spear('felucco_horn', 'Felucco Horn', 7, 9, 'nssm:felucco_horn') +spears_register_spear("felucco_horn", "Felucco Horn", 7, 9, "nssm:felucco_horn") --Spear of peace @@ -158,7 +178,7 @@ minetest.register_tool("nssm:spear_of_peace", { description = "Spear of Peace", wield_image = "spear_of_peace.png", inventory_image = "spear_of_peace.png^[transform4", - wield_scale= {x=4,y=2,z=2}, + wield_scale= {x = 4, y = 2, z = 2}, on_drop = function(itemstack, user, pointed_thing) spears_shot(itemstack, user) if not minetest.setting_getbool("creative_mode") then @@ -175,27 +195,30 @@ minetest.register_tool("nssm:spear_of_peace", { end, tool_capabilities = { full_punch_interval = 0.7, - max_drop_level=1, - groupcaps={ - snappy = {times={[3]=0.2, [2]=0.2, [1]=0.2}, uses=500, maxlevel=1}, - }, - damage_groups = {fleshy=18}, + max_drop_level = 1, + groupcaps = { + snappy = {times = {[3]=0.2, [2]=0.2, [1]=0.2}, uses = 500, maxlevel = 1} + }, + damage_groups = {fleshy = 18} } }) local function spears_set_sentity(kind, eq, toughness) local SUPERSPEAR_ENTITY={ physical = false, - timer=0, + timer = 0, visual = "wielditem", - visual_size = {x=0.15, y=0.1}, + visual_size = {x = 0.15, y = 0.1}, textures = {"nssm:spear_" .. kind}, lastpos={}, collisionbox = {0,0,0,0,0,0}, on_punch = function(self, puncher) if puncher then if puncher:is_player() then - local stack = {name='nssm:spear_' .. kind, wear=self.wear+65535/toughness} + local stack = { + name = "nssm:spear_" .. kind, + wear = self.wear + 65535 / toughness + } local inv = puncher:get_inventory() if inv:room_for_item("main", stack) then inv:add_item("main", stack) @@ -203,7 +226,7 @@ local function spears_set_sentity(kind, eq, toughness) end end end - end, + end } SUPERSPEAR_ENTITY.on_step = function(self, dtime) @@ -214,34 +237,46 @@ local function spears_set_sentity(kind, eq, toughness) self.object:remove() return end - if self.lastpos.x~=nil then - if node.name ~= "air" and not (string.find(node.name, 'grass') and not string.find(node.name, 'dirt')) and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then + if self.lastpos.x ~= nil then + if node.name ~= "air" + and not (string.find(node.name, "grass") + and not string.find(node.name, "dirt")) + and not string.find(node.name, "flowers:") + and not string.find(node.name, "farming:") then self.object:remove() - if self.wear+65535/toughness < 65535 then - minetest.add_item(self.lastpos, {name='nssm:spear_' .. kind, wear=self.wear+65535/toughness}) + if self.wear + 65535 / toughness < 65535 then + minetest.add_item(self.lastpos, { + name = "nssm:spear_" .. kind, + wear = self.wear + 65535 / toughness + }) end - elseif self.timer>0.2 then - local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) + elseif self.timer > 0.2 then + local objs = minetest.get_objects_inside_radius({ + x = pos.x, y = pos.y, z = pos.z}, 1) for k, obj in pairs(objs) do if obj:get_luaentity() ~= nil then - if obj:get_luaentity().name ~= "nssm:spear_" .. kind .. "_entity" and obj:get_luaentity().name ~= "__builtin:item" then + if obj:get_luaentity().name ~= "nssm:spear_" .. kind .. "_entity" + and obj:get_luaentity().name ~= "__builtin:item" then local speed = vector.length(self.object:get_velocity()) --minetest.chat_send_all(speed) - local damage = (speed + eq)^1.12-20 + local damage = (speed + eq) ^ 1.12 - 20 obj:punch(self.object, 1.0, { - full_punch_interval=1.0, - damage_groups={fleshy=damage}, + full_punch_interval = 1.0, + damage_groups={fleshy = damage} }, nil) self.object:remove() - if self.wear+65535/toughness < 65535 then - minetest.add_item(self.lastpos, {name='nssm:spear_' .. kind, wear=self.wear+65535/toughness}) + if self.wear + 65535 / toughness < 65535 then + minetest.add_item(self.lastpos, { + name = "nssm:spear_" .. kind, + wear = self.wear + 65535 / toughness + }) end end end end end end - self.lastpos={x=pos.x, y=pos.y, z=pos.z} + self.lastpos = {x = pos.x, y = pos.y, z = pos.z} end return SUPERSPEAR_ENTITY end @@ -251,8 +286,8 @@ SUPERSPEAR_ENTITY=spears_set_sentity("of_peace", 30, 300) minetest.register_entity("nssm:spear_of_peace_entity", SUPERSPEAR_ENTITY) minetest.register_craft({ - output = 'nssm:spear_of_peace', + output = "nssm:spear_of_peace", recipe = { - {'nssm:wrathful_moranga', 'group:wood', 'group:wood'}, + {"nssm:wrathful_moranga", "group:wood", "group:wood"} } }) diff --git a/nssm_weapons.lua b/nssm_weapons.lua index 6abda5e..c40df88 100644 --- a/nssm_weapons.lua +++ b/nssm_weapons.lua @@ -5,8 +5,12 @@ local default_dir = {x = 1, y = 1, z = 1} local function weapons_shot(itemstack, placer, pointed_thing, velocity, name) local dir = placer:get_look_dir(); local playerpos = placer:get_pos(); - local obj = minetest.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} + local obj = minetest.add_entity({ + x = playerpos.x + dir.x, + y = playerpos.y + 2 + dir.y, + z = playerpos.z + dir.z + }, "nssm:" .. name) + local vec = {x = dir.x * velocity, y = dir.y * velocity, z = dir.z * velocity} obj:set_velocity(vec) return itemstack end @@ -22,7 +26,8 @@ local function activate_balls(pos) local radius = 50 local objects = minetest.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 + if obj:get_luaentity() + and obj:get_luaentity().name == "nssm:hellzone_grenade" then obj:get_luaentity().move = 1 end end @@ -54,11 +59,13 @@ local function search_on_step2( 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 + 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:get_pos() - 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 10 then - minetest.set_node(pos, {name="nyancat:nyancat"}) + minetest.set_node(pos, {name = "nyancat:nyancat"}) self.object:remove() end if minetest.get_node(pos) then local n = minetest.get_node(pos).name if n ~= "nyancat:nyancat_rainbow" then - if n=="air" then - minetest.set_node(pos, {name="nyancat:nyancat_rainbow"}) + if n == "air" then + minetest.set_node(pos, {name = "nyancat:nyancat_rainbow"}) else - minetest.chat_send_all("Nome:"..n) - minetest.set_node(pos, {name="nyancat:nyancat"}) + minetest.chat_send_all("Nome:" .. n) + minetest.set_node(pos, {name = "nyancat:nyancat"}) self.object:remove() end end @@ -37,12 +36,16 @@ minetest.register_tool("nssm:rainbow_staff", { description = "Rainbow Staff", inventory_image = "rainbow_staff.png", on_use = function(itemstack, placer, pointed_thing) - local dir = placer:get_look_dir(); - local playerpos = placer:get_pos(); - local obj = minetest.add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+2+dir.y,z=playerpos.z+0+dir.z}, "nssm:rainbow") - local vec = {x=dir.x*6,y=dir.y*6,z=dir.z*6} + local dir = placer:get_look_dir() + local playerpos = placer:get_pos() + local obj = minetest.add_entity({ + x = playerpos.x + dir.x, + y = playerpos.y + 2 + dir.y, + z = playerpos.z + dir.z + }, "nssm:rainbow") + local vec = {x = dir.x * 6, y = dir.y * 6, z = dir.z * 6} obj:set_velocity(vec) return itemstack end, - groups = {not_in_creative_inventory=1,} + groups = {not_in_creative_inventory = 1} })