code tidy (part 1)
This commit is contained in:
parent
bfcf64ba24
commit
c728e35050
56
darts.lua
56
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),
|
||||
|
125
init.lua
125
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")
|
||||
|
90
nssm_api.lua
90
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,
|
||||
|
233
nssm_armor.lua
233
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", ""},
|
||||
{"", "", ""},
|
||||
},
|
||||
{"", "", ""}
|
||||
}
|
||||
})
|
||||
|
1706
nssm_materials.lua
1706
nssm_materials.lua
File diff suppressed because it is too large
Load Diff
161
nssm_spears.lua
161
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"}
|
||||
}
|
||||
})
|
||||
|
674
nssm_weapons.lua
674
nssm_weapons.lua
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,3 @@
|
||||
|
||||
--rainbow!
|
||||
|
||||
minetest.register_entity("nssm:rainbow", {
|
||||
@ -14,18 +13,18 @@ minetest.register_entity("nssm:rainbow", {
|
||||
end
|
||||
|
||||
if os.time() - self.timer > 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}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user