This commit is contained in:
NPXcoot 2017-10-02 22:34:18 +00:00
commit 548b441bdc
5 changed files with 2116 additions and 1848 deletions

View File

@ -1,205 +0,0 @@
mobs:register_mob("nssm:mese_dragon", {
type = "monster",
hp_max = 666,
hp_min = 666,
collisionbox = {-0.8, 0, -0.8, 0.8, 4, 0.8},
visual = "mesh",
mesh = "mese_dragon.x",
textures = {{"mese_dragon.png"}},
visual_size = {x=8, y=8},
makes_footstep_sound = true,
view_range = 45,
rotate = 270,
fear_height = 5,
walk_velocity = 2,
run_velocity = 4,
sounds = {
shoot_attack = "mesed",
attack = "mese_dragon",
distance = 60,
},
damage = 18,
jump = true,
jump_height = 10,
drops = {
{name = "nssm:rainbow_staff",
chance = 1,
min = 1,
max = 1},
{name = "nssm:energy_globe",
chance = 1,
min = 99,
max = 99},
},
armor = 30,
drawtype = "front",
water_damage = 0,
lava_damage = 0,
light_damage = 0,
on_rightclick = nil,
attack_type = "dogfight",
blood_texture="mese_blood.png",
blood_amount=30,
stepheight=3.1,
knock_back=0,
jump_height=12,
dogshoot_count_max = 9,
arrow = "nssm:roar_of_the_dragon",
reach = 25,
shoot_interval = 3,
shoot_offset = -1,
animation = {
speed_normal = 15,
speed_run = 25,
stand_start = 60,
stand_end = 120,
walk_start = 161,
walk_end = 205,
run_start = 206,
run_end = 242,
punch_start = 242,
punch_end = 275,
punch2_start = 330,
punch2_end = 370,
shoot_start = 120,
shoot_end = 160,
},
--[[
do_custom = function(self)
--midas_ability(self, "default:mese_block", self.run_velocity,2, 3)
end,
custom_attack = function(self)
if self.timer > 1 then
self.timer = 0
self.attack_rip = self.attack_rip+1
local s = self.object:getpos()
local p = self.attack:getpos()
p.y = p.y + 1.5
s.y = s.y + 1.5
if minetest.line_of_sight(p, s) == true then
-- play attack sound
if self.sounds.attack then
minetest.sound_play(self.sounds.attack, {
object = self.object,
max_hear_distance = self.sounds.distance
})
end
-- punch player
self.attack:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=self.damage}
}, nil)
end
if self.attack_rip>=8 then
self.attack_rip =0
set_animation("punch1")
for dx = -17,17 do
for dz= -17,17 do
local k = {x = s.x+dx, y=s.y+20, z=s.z+dz}
local n = minetest.env:get_node(k).name
if n=="air" and math.random(1,23)==1 then
minetest.env:set_node(k, {name="nssm:mese_meteor"})
nodeupdate(k)
end
end
end
end
end
end,
]]
custom_attack = function(self)
local p = self.attack:getpos()
local s = self.object:getpos()
s.y = s.y + 5;
local vel = vector.subtract(p,s)
set_animation(self, "shoot")
minetest.add_particlespawner(
125, --amount
0.5, --time
s, --minpos
s, --maxpos
vector.multiply(vel, 0.5), --minvel
vector.multiply(vel, 1.4), --maxvel
{x=0,y=0,z=0}, --minacc
{x=0,y=0,z=0}, --maxacc
2, --minexptime
4, --maxexptime
1, --minsize
2, --maxsize
true, --collisiondetection
"phoenix_fire.png" --texture
)
local obj = minetest.add_entity(s, "nssm:mese_dart")
local ran = math.random(7,14)/10
local vec = vector.multiply(vel, ran)
obj:setvelocity(vec)
minetest.after(0.5, function()
if self.attack then
local p = self.attack:getpos()
local vel = vector.subtract(p,s)
local obj = minetest.add_entity(s, "nssm:mese_dart")
local ran = math.random(7,14)/10
local vec = vector.multiply(vel, ran)
obj:setvelocity(vec)
end
end)
end,
--[[
do_custom = function (self)
--minetest.chat_send_all(s.y.."-"..p.y.."="..(s.y-p.y))
if self.state == "attack" then
if self.attack then
local s = self.object:getpos()
local p = self.attack:getpos()
if (s.y - p.y ) < 10 then
local v = self.object:getvelocity()
v.y = 10
self.object:setvelocity(v)
end
end
end
end,]]
})
minetest.register_entity("nssm:mese_dart", {
textures = {"transparent.png"},
on_step = function(self, dtime)
self.timer = (self.timer) or os.time()
self.attack = (self.attack) or os.time()
if os.time() - self.timer > 4 then
self.object:remove()
end
local p = self.object:getpos()
local all_objects = minetest.get_objects_inside_radius(p, 1)
local players = {}
local _,obj
for _,obj in ipairs(all_objects) do
if obj:is_player() then
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 10}
}, nil)
self.object:remove()
end
end
local n = minetest.get_node(p).name
if n ~= "air" then
minetest.set_node(p, {name="default:mese_block"})
self.object:remove();
end
local node = minetest.get_node(p).name
if node ~= "air" then
self.object:remove()
end
end,
})

View File

@ -1,939 +0,0 @@
-- set content id's
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_obsidian = minetest.get_content_id("default:obsidian")
local c_brick = minetest.get_content_id("default:obsidianbrick")
local c_chest = minetest.get_content_id("default:chest_locked")
nssm.lessvirulent = minetest.setting_getbool("nssm.lessvirulent") or false
nssm.safebones = minetest.setting_getbool("nssm.safebones") or false
nssm.cryosave = minetest.setting_getbool("nssm.cryosave") or false
function nssm:virulence(mobe)
if not nssm.lessvirulent then
return 0
end
return math.ceil(100 / mobe.hp_max)
end
function nssm:affectbones(mobe) -- as function for adaptable heuristic
return not nssm.safebones
end
function drops(drop)
if drop then
drop:setvelocity({
x = math.random(-10, 10) / 9,
y = 5,
z = math.random(-10, 10) / 9,
})
end
end
function perpendicular_vector(vec) --returns a vector rotated of 90° in 2D
local ang = math.pi/2
local c = math.cos(ang)
local s = math.sin(ang)
local i = vec.x*c - vec.z*s
local k = vec.x*s + vec.z*c
local j = 0
vec = {x=i, y=j, z=k}
return vec
end
function add_entity_and_particles(entity, pos, particles, multiplier)
minetest.add_particlespawner({
amount = 100*multiplier,
time = 2,
minpos = {x=pos.x-2, y=pos.y-1, z=pos.z-2},
maxpos = {x=pos.x+2, y=pos.y+4, z=pos.z+2},
minvel = {x=0, y=0, z=0},
maxvel = {x=1, y=2, z=1},
minacc = {x=-0.5,y=0.6,z=-0.5},
maxacc = {x=0.5,y=0.7,z=0.5},
minexptime = 2,
maxexptime = 3,
minsize = 3,
maxsize = 5,
collisiondetection = false,
vertical = false,
texture = particles,
})
minetest.add_entity(pos, entity)
end
-- get node but use fallback for nil or unknown
function node_ok(pos, fallback)
fallback = fallback or "default:dirt"
local node = minetest.get_node_or_nil(pos)
if not node then
return minetest.registered_nodes[fallback]
end
if minetest.registered_nodes[node.name] then
return node
end
return minetest.registered_nodes[fallback]
end
function dist_pos(p, s)
local v = {x = math.abs(s.x-p.x), y = math.abs(s.y-p.y), z = math.abs(s.z-p.z)}
local r = math.sqrt(v.x^2+v.y^2+v.z^2)
return r
end
--check_for_death functions customized for monsters who respawns (Masticone)
function check_for_death_hydra(self)
local hp = self.object:get_hp()
if hp > 0 then
self.health = hp
if self.sounds.damage ~= nil then
minetest.sound_play(self.sounds.damage,{
object = self.object,
max_hear_distance = self.sounds.distance
})
end
return false
end
local pos = self.object:getpos()
local obj = nil
if self.sounds.death ~= nil then
minetest.sound_play(self.sounds.death,{
object = self.object,
max_hear_distance = self.sounds.distance
})
end
self.object:remove()
return true
end
function round(n)
if (n>0) then
return n % 1 >= 0.5 and math.ceil(n) or math.floor(n)
else
n=-n
local t = n % 1 >= 0.5 and math.ceil(n) or math.floor(n)
return -t
end
end
function explosion_particles(pos, exp_radius)
minetest.add_particlespawner(
100*exp_radius/2, --amount
0.1, --time
{x=pos.x-exp_radius, y=pos.y-exp_radius, z=pos.z-exp_radius}, --minpos
{x=pos.x+exp_radius, y=pos.y+exp_radius, z=pos.z+exp_radius}, --maxpos
{x=0, y=0, z=0}, --minvel
{x=0.1, y=0.3, z=0.1}, --maxvel
{x=-0.5,y=1,z=-0.5}, --minacc
{x=0.5,y=1,z=0.5}, --maxacc
0.1, --minexptime
4, --maxexptime
6, --minsize
12, --maxsize
false, --collisiondetection
"tnt_smoke.png" --texture
)
end
--[[
function explosion(pos, exp_radius, fire, kamehameha_bad)
local radius = exp_radius
-- if area protected or near map limits then no blast damage
if minetest.is_protected(pos, "")
or not within_limits(pos, radius) then
return
end
--sound
minetest.sound_play("boom", {
pos = pos,
max_hear_distance = exp_radius*4,
})
--particles:
explosion_particles(pos, exp_radius)
--Damages entities around (not the player)
local objects = minetest.env:get_objects_inside_radius(pos, exp_radius)
for _,obj in ipairs(objects) do
local obj_p = obj:getpos()
local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z}
local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5
local damage = (-exp_radius*dist+exp_radius^2)*2
if not kamehameha_bad then
if obj:is_player() then
obj:set_hp(obj:get_hp()-damage)
elseif obj:get_luaentity().health then
obj:get_luaentity().health = obj:get_luaentity().health - damage
check_for_death(obj:get_luaentity())
end
else
if (obj:get_luaentity()) then
local name = obj:get_luaentity().name
if (name~="nssm:morvalar0") and (name~="nssm:morvalar5") then
if obj:is_player() then
obj:set_hp(obj:get_hp()-damage)
elseif obj:get_luaentity().health then
obj:get_luaentity().health = obj.get_luaentity().health - damage
check_for_death(obj:get_luaentity())
end
end
end
end
end
--damages blocks around and if necessary put some fire
pos = vector.round(pos) -- voxelmanip doesn't work properly unless pos is rounded ?!?!
local vm = VoxelManip()
local minp, maxp = vm:read_from_map(vector.subtract(pos, radius), vector.add(pos, radius))
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
local p = {}
local pr = PseudoRandom(os.time())
--remove everything near the center of the explosion
for dz=-radius,radius do
for dy=-radius,radius do
local vi = a:index(pos.x + (-radius), pos.y + dy, pos.z + dz)
for dx=-radius,radius do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
if (dx * dx) + (dy * dy) + (dz * dz) <= (radius * radius) + pr:next(-radius, radius)
and data[vi] ~= c_air
and data[vi] ~= c_ignore
and data[vi] ~= c_obsidian
and data[vi] ~= c_brick
and data[vi] ~= c_chest then
local n = node_ok(p).name
local on_blast = minetest.registered_nodes[n].on_blast
if on_blast then
return on_blast(p)
end
if minetest.get_item_group(n, "unbreakable") ~= 1 then
-- if chest then drop items inside
if n == "default:chest"
or n == "3dchest:chest"
or n == "bones:bones" then
local meta = minetest.get_meta(p)
local inv = meta:get_inventory()
for i = 1, inv:get_size("main") do
local m_stack = inv:get_stack("main", i)
local obj = minetest.add_item(p, m_stack)
if obj then
obj:setvelocity({
x = math.random(-2, 2),
y = 7,
z = math.random(-2, 2)
})
end
end
end
-- after effects
if fire > 0
and (minetest.registered_nodes[n].groups.flammable
or math.random(1, 100) <= 3) then
minetest.set_node(p, {name = "fire:basic_flame"})
else
local dist = round(((pos.x-p.x)^2 + (pos.y-p.y)^2 + (pos.z-p.z)^2)^1/2)
local prob = 2/dist
if math.random(1,100)<=prob*100 then
minetest.env:remove_node(p)
end
end
end
end
vi = vi+1
end
end
end
end
]]
-- SPECIAL ABILITIES OF SOME MOBS
--[[function digging_ability(
self, --the entity of the mob
group, --group of the blocks the mob can dig: nil=everything
max_vel, --max velocity of the mob
dim --vector representing the dimensions of the mob
)
--if math.random(1,nssm:virulence(self)) ~= 1 then return end
local v = self.object:getvelocity()
local pos = self.object:getpos()
if minetest.is_protected(pos, "") then
return
end
local h = dim.y
local max = 0
--local posmax = 0 -- 1 = x, -1=-x, 2 = z, -2 = -z
local yaw = (self.object:getyaw() + self.rotate) or 0
local x = math.sin(yaw)*-1
local z = math.cos(yaw)
local i = 1
local i1 = -1
local k = 1
local k1 = -1
local multiplier = 2
if x>0 then
i = round(x*max_vel)*multiplier
else
i1 = round(x*max_vel)*multiplier
end
if z>0 then
k = round(z*max_vel)*multiplier
else
k1 = round(z*max_vel)*multiplier
end
for dx = i1, i do
for dy = 0, h do
for dz = k1, k do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
--local up = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
if group == nil then
if minetest.get_item_group(n, "unbreakable") == 1 or minetest.is_protected(p, "") or (n == "bones:bones" and not nssm:affectbones(self) ) then
else
--minetest.env:set_node(p, {name="air"})
minetest.remove_node(p)
end
else
if (minetest.get_item_group(n, group)==1) and (minetest.get_item_group(n, "unbreakable") ~= 1) and (n == "bones:bones" and not (minetest.is_protected(p, "")) ) then
--minetest.env:set_node(p, {name="air"})
minetest.remove_node(p)
end
end
end
end
end
end
]]--
function digging_attack(
self, --the entity of the mob
group, --group of the blocks the mob can dig: nil=everything
max_vel, --max velocity of the mob
dim --vector representing the dimensions of the mob
)
--if math.random(1,nssm:virulence(self)) ~= 1 then return end
if self.attack and self.attack:is_player() then
local s = self.object:getpos()
local p = self.attack:getpos()
local dir = vector.subtract(p,s)
dir = vector.normalize(dir)
local per = perpendicular_vector(dir)
local posp = vector.add(s,dir)
--minetest.chat_send_all("La mia posizione:"..minetest.pos_to_string(s))
--minetest.chat_send_all("La posizione davanti:"..minetest.pos_to_string(posp))
posp = vector.subtract(posp,per)
for j = 1,3 do
--minetest.chat_send_all("pos1:"..minetest.pos_to_string(posp).." per.y= "..dim.y)
if minetest.is_protected(posp, "") then
return
end
local pos1 = posp
for i = 0,dim.y do
--minetest.chat_send_all("pos2:"..minetest.pos_to_string(posp).." per.y= "..per.y)
local n = minetest.env:get_node(pos1).name
--local up = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
if group == nil then
if minetest.get_item_group(n, "unbreakable") == 1 or minetest.is_protected(pos1, "") or (n == "bones:bones" and not nssm:affectbones(self) ) then
else
--minetest.env:set_node(p, {name="air"})
minetest.remove_node(pos1)
end
else
if ((minetest.get_item_group(n, group)==1) and (minetest.get_item_group(n, "unbreakable") ~= 1) and (n ~= "bones:bones") and not (minetest.is_protected(pos1, "")) ) then
--minetest.env:set_node(p, {name="air"})
minetest.remove_node(pos1)
end
end
pos1.y = pos1.y+1
end
posp.y=s.y
posp=vector.add(posp,per)
--minetest.chat_send_all("pos3:"..minetest.pos_to_string(posp).." per.y= "..per.y)
end
end
end
function putting_ability( --puts under the mob the block defined as 'p_block'
self, --the entity of the mob
p_block, --definition of the block to use
max_vel --max velocity of the mob
)
--if math.random(1,nssm:virulence(self)) ~= 1 then return end
local v = self.object:getvelocity()
local dx = 0
local dz = 0
if (math.abs(v.x)>math.abs(v.z)) then
if (v.x)>0 then
dx = 1
else
dx = -1
end
else
if (v.z)>0 then
dz = 1
else
dz = -1
end
end
local pos = self.object:getpos()
local pos1
pos.y=pos.y-1
pos1 = {x = pos.x+dx, y = pos.y, z = pos.z+dz}
local n = minetest.env:get_node(pos).name
local n1 = minetest.env:get_node(pos1).name
local oldmetainf = {minetest.get_meta(pos):to_table(),minetest.get_meta(pos1):to_table() }
if n~=p_block and not minetest.is_protected(pos, "") and (n == "bones:bones" and nssm:affectbones(self) ) and n~="air" then
minetest.env:set_node(pos, {name=p_block})
if nssm.cryosave then
local metai = minetest.get_meta(pos)
metai:from_table(oldmetainf[1]) -- this is enough to save the meta
metai:set_string("nssm",n)
end
end
if n1~=p_block and not minetest.is_protected(pos1, "") and (n == "bones:bones" and nssm:affectbones(self) ) and n~="air" then
minetest.env:set_node(pos1, {name=p_block})
if nssm.cryosave then
local metai = minetest.get_meta(pos1)
metai:from_table(oldmetainf[2]) -- this is enough to save the meta
metai:set_string("nssm",n1)
end
end
end
function webber_ability( --puts randomly around the block defined as w_block
self, --the entity of the mob
w_block, --definition of the block to use
radius --max distance the block can be put
)
if (nssm:virulence(self)~=0) and (math.random(1,nssm:virulence(self)) ~= 1) then return end
local pos = self.object:getpos()
if minetest.is_protected(pos, "") then
return
end
if (math.random(1,55)==1) then
local dx=math.random(1,radius)
local dz=math.random(1,radius)
local p = {x=pos.x+dx, y=pos.y-1, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local n = minetest.env:get_node(p).name
local k = minetest.env:get_node(t).name
if ((n~="air")and(k=="air")) and not minetest.is_protected(t, "") then
minetest.env:set_node(t, {name=w_block})
end
end
end
function midas_ability( --ability to transform every blocks it touches in the m_block block
self, --the entity of the mob
m_block,
max_vel, --max velocity of the mob
mult, --multiplier of the dimensions of the area around that need the transformation
height --height of the mob
)
--if math.random(1,nssm:virulence(self)) ~= 1 then return end
local v = self.object:getvelocity()
local pos = self.object:getpos()
if minetest.is_protected(pos, "") then
return
end
local max = 0
local yaw = (self.object:getyaw() + self.rotate) or 0
local x = math.sin(yaw)*-1
local z = math.cos(yaw)
local i = 1
local i1 = -1
local k = 1
local k1 = -1
local multiplier = mult
if x>0 then
i = round(x*max_vel)*multiplier
else
i1 = round(x*max_vel)*multiplier
end
if z>0 then
k = round(z*max_vel)*multiplier
else
k1 = round(z*max_vel)*multiplier
end
for dx = i1, i do
for dy = -1, height do
for dz = k1, k do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if minetest.get_item_group(n, "unbreakable") == 1 or minetest.is_protected(p, "") or n=="air" or (n == "bones:bones" and not nssm:affectbones(self)) then
else
minetest.env:set_node(p, {name=m_block})
end
end
end
end
end
-- NEW EXPLOSION FUNCTION
-- loss probabilities array (one in X will be lost)
local loss_prob = {}
loss_prob["default:cobble"] = 3
loss_prob["default:dirt"] = 4
local tnt_radius = tonumber(minetest.setting_get("tnt_radius") or 3)
local cid_data = {}
minetest.after(0, function()
for name, def in pairs(minetest.registered_nodes) do
cid_data[minetest.get_content_id(name)] = {
name = name,
drops = def.drops,
flammable = def.groups.flammable,
on_blast = def.on_blast,
}
end
end)
local function rand_pos(center, pos, radius)
local def
local reg_nodes = minetest.registered_nodes
local i = 0
repeat
-- Give up and use the center if this takes too long
if i > 4 then
pos.x, pos.z = center.x, center.z
break
end
pos.x = center.x + math.random(-radius, radius)
pos.z = center.z + math.random(-radius, radius)
def = reg_nodes[minetest.get_node(pos).name]
i = i + 1
until def and not def.walkable
end
local function add_effects(pos, radius, drops)
minetest.add_particle({
pos = pos,
velocity = vector.new(),
acceleration = vector.new(),
expirationtime = 0.4,
size = radius * 10,
collisiondetection = false,
vertical = false,
texture = "tnt_boom.png",
})
minetest.add_particlespawner({
amount = 64,
time = 0.5,
minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2),
minvel = {x = -10, y = -10, z = -10},
maxvel = {x = 10, y = 10, z = 10},
minacc = vector.new(),
maxacc = vector.new(),
minexptime = 1,
maxexptime = 2.5,
minsize = radius * 3,
maxsize = radius * 5,
texture = "tnt_smoke.png",
})
-- we just dropped some items. Look at the items entities and pick
-- one of them to use as texture
local texture = "tnt_blast.png" --fallback texture
local most = 0
for name, stack in pairs(drops) do
local count = stack:get_count()
if count > most then
most = count
local def = minetest.registered_nodes[name]
if def and def.tiles and def.tiles[1] then
texture = def.tiles[1]
end
end
end
minetest.add_particlespawner({
amount = 64,
time = 0.1,
minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2),
minvel = {x = -3, y = 0, z = -3},
maxvel = {x = 3, y = 5, z = 3},
minacc = {x = 0, y = -10, z = 0},
maxacc = {x = 0, y = -10, z = 0},
minexptime = 0.8,
maxexptime = 2.0,
minsize = radius * 0.66,
maxsize = radius * 2,
texture = texture,
collisiondetection = true,
})
end
local function eject_drops(drops, pos, radius)
local drop_pos = vector.new(pos)
for _, item in pairs(drops) do
local count = math.min(item:get_count(), item:get_stack_max())
while count > 0 do
local take = math.max(1,math.min(radius * radius,
count,
item:get_stack_max()))
rand_pos(pos, drop_pos, radius)
local dropitem = ItemStack(item)
dropitem:set_count(take)
local obj = minetest.add_item(drop_pos, dropitem)
if obj then
obj:get_luaentity().collect = true
obj:setacceleration({x = 0, y = -10, z = 0})
obj:setvelocity({x = math.random(-3, 3),
y = math.random(0, 10),
z = math.random(-3, 3)})
end
count = count - take
end
end
end
local function calc_velocity(pos1, pos2, old_vel, power)
-- Avoid errors caused by a vector of zero length
if vector.equals(pos1, pos2) then
return old_vel
end
local vel = vector.direction(pos1, pos2)
vel = vector.normalize(vel)
vel = vector.multiply(vel, power)
-- Divide by distance
local dist = vector.distance(pos1, pos2)
dist = math.max(dist, 1)
vel = vector.divide(vel, dist)
-- Add old velocity
vel = vector.add(vel, old_vel)
-- randomize it a bit
vel = vector.add(vel, {
x = math.random() - 0.5,
y = math.random() - 0.5,
z = math.random() - 0.5,
})
-- Limit to terminal velocity
dist = vector.length(vel)
if dist > 250 then
vel = vector.divide(vel, dist / 250)
end
return vel
end
local function entity_physics(pos, radius, drops, damage_all)
local objs = minetest.get_objects_inside_radius(pos, radius)
for _, obj in pairs(objs) do
local obj_pos = obj:getpos()
local dist = math.max(1, vector.distance(pos, obj_pos))
local damage = (8 / (dist+1)) * radius
if obj:is_player() then
-- currently the engine has no method to set
-- player velocity. See #2960
-- instead, we knock the player back 1.0 node, and slightly upwards
local dir = vector.normalize(vector.subtract(obj_pos, pos))
local moveoff = vector.multiply(dir, dist + 1.0)
local newpos = vector.add(pos, moveoff)
newpos = vector.add(newpos, {x = 0, y = 0.2, z = 0})
obj:setpos(newpos)
obj:set_hp(obj:get_hp() - damage)
else
local do_damage = true
local do_knockback = true
local entity_drops = {}
local luaobj = obj:get_luaentity()
local objdef = minetest.registered_entities[luaobj.name]
local name = luaobj.name
if objdef and objdef.on_blast then
if ((not damage_all) and ((name == "nssm:pumpking") or (name == "nssm:morvalar0") or (name== "nssm:morvalar5"))) then
do_damage = false
do_knockback = false
else
do_damage, do_knockback, entity_drops = objdef.on_blast(luaobj, damage)
end
end
if do_knockback then
local obj_vel = obj:getvelocity()
obj:setvelocity(calc_velocity(pos, obj_pos,
obj_vel, radius * 10))
end
if do_damage then
if not obj:get_armor_groups().immortal then
obj:punch(obj, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = damage},
}, nil)
end
end
for _, item in pairs(entity_drops) do
add_drop(drops, item)
end
end
end
end
local function add_drop(drops, item)
item = ItemStack(item)
local name = item:get_name()
if loss_prob[name] ~= nil and math.random(1, loss_prob[name]) == 1 then
return
end
local drop = drops[name]
if drop == nil then
drops[name] = item
else
drop:set_count(drop:get_count() + item:get_count())
end
end
local function destroy(drops, npos, cid, c_air, on_blast_queue, ignore_protection, ignore_on_blast)
if not ignore_protection and minetest.is_protected(npos, "") then
return cid
end
local def = cid_data[cid]
if not def then
return c_air
elseif not ignore_on_blast and def.on_blast then
on_blast_queue[#on_blast_queue + 1] = {pos = vector.new(npos), on_blast = def.on_blast}
return cid
else
local node_drops = minetest.get_node_drops(def.name, "")
for _, item in pairs(node_drops) do
add_drop(drops, item)
end
return c_air
end
end
local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, block)
pos = vector.round(pos)
-- scan for adjacent TNT nodes first, and enlarge the explosion
local vm1 = VoxelManip()
local p1 = vector.subtract(pos, 2)
local p2 = vector.add(pos, 2)
local minp, maxp = vm1:read_from_map(p1, p2)
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm1:get_data()
local count = 0
local c_tnt = minetest.get_content_id("tnt:tnt")
local c_tnt_burning = minetest.get_content_id("tnt:tnt_burning")
local c_tnt_boom = minetest.get_content_id("tnt:boom")
local c_air
if block then
c_air = minetest.get_content_id(block)
else
c_air = minetest.get_content_id("air")
end
for z = pos.z - 2, pos.z + 2 do
for y = pos.y - 2, pos.y + 2 do
local vi = a:index(pos.x - 2, y, z)
for x = pos.x - 2, pos.x + 2 do
local cid = data[vi]
if cid == c_tnt or cid == c_tnt_boom or cid == c_tnt_burning then
count = count + 1
data[vi] = c_air
end
vi = vi + 1
end
end
end
vm1:set_data(data)
vm1:write_to_map()
-- recalculate new radius
radius = math.floor(radius * math.pow(count, 1/3))
-- perform the explosion
local vm = VoxelManip()
local pr = PseudoRandom(os.time())
p1 = vector.subtract(pos, radius)
p2 = vector.add(pos, radius)
minp, maxp = vm:read_from_map(p1, p2)
a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
data = vm:get_data()
local drops = {}
local on_blast_queue = {}
for z = -radius, radius do
for y = -radius, radius do
local vi = a:index(pos.x + (-radius), pos.y + y, pos.z + z)
for x = -radius, radius do
local r = vector.length(vector.new(x, y, z))
if (radius * radius) / (r * r) >= (pr:next(80, 125) / 100) then
local cid = data[vi]
local p = {x = pos.x + x, y = pos.y + y, z = pos.z + z}
if cid ~= c_air then
data[vi] = destroy(drops, p, cid, c_air,
on_blast_queue, ignore_protection,
ignore_on_blast)
end
end
vi = vi + 1
end
end
end
vm:set_data(data)
vm:write_to_map()
vm:update_map()
vm:update_liquids()
-- call nodeupdate for everything within 1.5x blast radius
for y = -radius * 1.5, radius * 1.5 do
for z = -radius * 1.5, radius * 1.5 do
for x = -radius * 1.5, radius * 1.5 do
local rad = {x = x, y = y, z = z}
local s = vector.add(pos, rad)
local r = vector.length(rad)
if r / radius < 1.4 then
nodeupdate_single(s)
end
end
end
end
for _, queued_data in pairs(on_blast_queue) do
local dist = math.max(1, vector.distance(queued_data.pos, pos))
local intensity = (radius * radius) / (dist * dist)
local node_drops = queued_data.on_blast(queued_data.pos, intensity)
if node_drops then
for _, item in pairs(node_drops) do
add_drop(drops, item)
end
end
end
return drops, radius
end
function tnt_boom_nssm(pos, def, block, effects)
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64})
minetest.set_node(pos, {name = "tnt:boom"})
local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection, def.ignore_on_blast, block)
-- append entity drops
local damage_radius = (radius / def.radius) * def.damage_radius
if def.damage_all then
entity_physics(pos, damage_radius, drops, def.damage_all)
else
entity_physics(pos, damage_radius, drops)
end
if not def.disable_drops then
eject_drops(drops, pos, radius)
end
if effects then
add_effects(pos, radius, drops)
end
end
function charge_attack(self)
local s = self.object:getpos()
local p = self.attack:getpos()
local vec = vector.multiply(vector.normalize(vector.subtract(p,s)),self.run_velocity)
if self.other_state and self.other_state == "charge" then --the mob was already charging
do_charge(self)
else
self.other_state = "charge"
vec.y = -5
self.charge_vec = vec
self.charge_dir = self.object:getyaw()
self.charge_timer = os.time()
do_charge(self)
minetest.after(3, function(self)
self.other_state = "stand"
self.state = "stand"
end,self)
end
end
function do_charge(self)
self.state = ""
if self.charge_vec and self.charge_dir then
set_animation(self, "punch2")
self.object:setvelocity(self.charge_vec)
self.object:setyaw(self.charge_dir)
local all_objects = minetest.get_objects_inside_radius(self.object:getpos(), 1.5*self.collisionbox[5]/2)
local _,obj
for _,obj in ipairs(all_objects) do
if obj:is_player() then
obj:set_hp(obj:get_hp()-self.damage/5)
elseif obj:get_luaentity() and obj:get_luaentity().health and obj:get_luaentity().name ~= self.object:get_luaentity().name then
obj:get_luaentity().health = obj:get_luaentity().health - self.damage/5
end
end
end
if self.charge_timer and os.time() - self.charge_timer > 5 then
self.other_state = "stand"
self.state = "stand"
end
end

2116
nssm_materials.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,669 +0,0 @@
--Parameters used by some weapons
local default_dir = {
x = 1,
y = 1,
z = 1,
}
--Function used to shoot:
local function weapons_shot(itemstack, placer, pointed_thing, velocity, name)
local dir = placer:get_look_dir();
local playerpos = placer:getpos();
local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+2+dir.y,z=playerpos.z+0+dir.z}, "nssm:"..name)
local vec = {x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity}
obj:setvelocity(vec)
return itemstack
end
local function hit(pos, self)
local node = node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
end
local function activate_balls(pos)
local radius = 50
local objects = minetest.env:get_objects_inside_radius(pos, radius)
for _,obj in ipairs(objects) do
if (obj:get_luaentity() and obj:get_luaentity().name == "nssm:hellzone_grenade") then
obj:get_luaentity().move = 1
end
end
end
local function search_on_step2(
self,
dtime, --used to count time
max_time, --after this amount of time the entity is removec
radius, --radius in which look for entities to follow
vel) --velocity of the projectile
local pos = self.object:getpos()
--Disappear after a certain time
if self.life_time == 0 then
self.life_time = os.time()
end
if os.time() - self.life_time > max_time then
self.object:remove()
return
end
--Look for an entity to follow
local objects = minetest.env:get_objects_inside_radius(pos, radius)
local min_dist = 100
local obj_min = nil
local obj_p = nil
local vec_min = nil
for _,obj in ipairs(objects) do
if ((obj:is_player()) or (obj:get_luaentity() and (
(obj:get_luaentity().name == "mese_dart") or
(obj:get_luaentity().name == "phoenix_dart") or
(obj:get_luaentity().name == "duck_father") or
(obj:get_luaentity().name == "thickwebball") or
(obj:get_luaentity().name == "webball") or
(obj:get_luaentity().name == "super_gas") or
(obj:get_luaentity().name == "lava_arrow") or
(obj:get_luaentity().name == "snow_arrow") or
(obj:get_luaentity().name == "spine") or
(obj:get_luaentity().name == "mese_dart") or
(obj:get_luaentity().name == "morarrow") or
(obj:get_luaentity().name == "lava_block_bomb") or
(obj:get_luaentity().name == "crystal_gas_arrow") or
(obj:get_luaentity().name == "pumpkid_bomb"))
)) then
if (obj:get_luaentity()) then
minetest.chat_send_all(""..obj:get_luaentity().name)
end
elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= self.object:get_luaentity().name) then
obj_p = obj:getpos()
local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z}
local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5
if (dist<min_dist) then
min_dist = dist
obj_min = obj
vec_min = vec
end
end
end
--Found an entity to follow:
if obj_min ~= nil then
local new_vel = {x=0, y=0, z=0}
local dir = 0
local max_diff = 0
if (max_diff<math.abs(vec_min.x)) then
dir = 1
max_diff = math.abs(vec_min.x)
end
if (max_diff<math.abs(vec_min.y)) then
dir = 2
max_diff = math.abs(vec_min.y)
end
if (max_diff<math.abs(vec_min.z)) then
dir = 3
max_diff = math.abs(vec_min.z)
end
vec_min.x = (vec_min.x/max_diff)*vel
vec_min.y = (vec_min.y/max_diff)*vel
vec_min.z = (vec_min.z/max_diff)*vel
obj_p = obj_min:getpos()
if min_dist <=8 and self.move==0 then
self.object:setvelocity({x=0, y=0, z=0})
--hit(pos,self)
elseif min_dist<=1 and self.move==1 then
obj_min:punch(obj_min, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 20},
}, nil)
hit(pos,self)
else
self.object:setvelocity(vec_min)
end
end
local n = minetest.env:get_node(pos).name
if n ~= "air" and n ~= "default:water_source" and n ~= "default:water_flowing" then
hit(pos,self)
end
end
--on_step function able to follow the mobs
local function search_on_step(
self,
dtime, --used to count time
max_time, --after this amount of time the entity is removec
radius, --radius in which look for entities to follow
vel) --velocity of the projectile
local pos = self.object:getpos()
--Disappear after a certain time
if self.life_time == 0 then
self.life_time = os.time()
end
if os.time() - self.life_time > max_time then
self.object:remove()
return
end
--Look for an entity to follow
local objects = minetest.env:get_objects_inside_radius(pos, radius)
local min_dist = 100
local obj_min = nil
local obj_p = nil
local vec_min = nil
for _,obj in ipairs(objects) do
if (obj:is_player()) then
elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= self.object:get_luaentity().name) then
obj_p = obj:getpos()
local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z}
local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5
if (dist<min_dist) then
min_dist = dist
obj_min = obj
vec_min = vec
end
end
end
--Found an entity to follow:
if obj_min ~= nil then
local new_vel = {x=0, y=0, z=0}
local dir = 0
local max_diff = 0
if (max_diff<math.abs(vec_min.x)) then
dir = 1
max_diff = math.abs(vec_min.x)
end
if (max_diff<math.abs(vec_min.y)) then
dir = 2
max_diff = math.abs(vec_min.y)
end
if (max_diff<math.abs(vec_min.z)) then
dir = 3
max_diff = math.abs(vec_min.z)
end
vec_min.x = (vec_min.x/max_diff)*vel
vec_min.y = (vec_min.y/max_diff)*vel
vec_min.z = (vec_min.z/max_diff)*vel
obj_p = obj_min:getpos()
if min_dist < 1 then
local node = node_ok(pos).name
obj_min:punch(obj_min, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 30},
}, nil)
self.hit_node(self, pos, node)
self.object:remove()
return
else
self.object:setvelocity(vec_min)
end
end
local n = minetest.env:get_node(pos).name
if n ~= "air" and n ~= "default:water_source" and n ~= "default:water_flowing" then
local node = node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
end
end
local function default_on_step(
self,
dtime, --used to count time
max_time, --after this amount of time the entity is removec
damage, --damage dealt to the entity around
dir, --vector to specify directions in which remove blocks
radius, --radius of blocks removed aroind the projectile
not_transparent, --name of a block or of a group: when the projectile hit one of these blocks the function hit_node is called
vel) --velocity of the projectile
local pos = self.object:getpos()
if self.life_time == 0 then
self.life_time = os.time()
end
if os.time() - self.life_time > max_time then
local node = node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
end
self.timer = self.timer + dtime
--minetest.chat_send_all("Timer: "..self.timer)
--while going around it damages entities
local objects = minetest.env:get_objects_inside_radius(pos, 2)
if self.timer > 0.1 then
self.timer = 0
for _,obj in ipairs(objects) do
if obj:get_luaentity() then
if (obj:get_entity_name() ~= self.object:get_luaentity().name) and (obj:get_luaentity().name ~= "__builtin:item") then
if obj:is_player() then
obj:set_hp(obj:get_hp()-damage)
elseif obj:get_luaentity().health then
obj:get_luaentity().health = obj:get_luaentity().health - damage
--minetest.chat_send_all("Danneggiato: "..obj:get_entity_name().." Vita: "..obj:get_luaentity().health)
check_for_death(obj:get_luaentity())
end
end
end
end
end
local n = minetest.env:get_node(pos).name
if n==not_transparent or minetest.get_item_group(n, not_transparent)==1 then
local node = node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
else
local vec = self.object:getvelocity()
local c=vel/10
--calculate how many blocks around need to be removed
local max = 0
local posmax = 0
if max<math.abs(vec.x) then
max = math.abs(vec.x)
posmax = 1
end
if max<math.abs(vec.y) then
max = math.abs(vec.y)
posmax = 2
end
if max<math.abs(vec.z) then
max = math.abs(vec.z)
posmax = 3
end
local i = radius
local j = radius
local k = radius
if dir.x == 0 then
i = 0
end
if dir.y == 0 then
j = 0
end
if dir.z == 0 then
k = 0
end
if posmax==1 then
i = 0
end
if posmax==2 then
j = 0
end
if posmax==3 then
k = 0
end
for dx = -i,i do
for dy= -j,j do
for dz = -k,k do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
if not minetest.is_protected(p, "") or not minetest.get_item_group(n, "unbreakable") == 1 then
minetest.env:remove_node(p)
end
end
end
end
end
end
--[[
Function to register new weapons: parameters:
- name of the weapon
- on_step function (written by you or taken from the standard one above)
- hit_node function
- description of the weapon
- the velocity of the projectile
- one material to be used in the receipt
]]
local function nssm_register_weapon(name, def)
minetest.register_entity("nssm:"..name, {
textures = {name..".png"},
on_step = function(self, dtime)
def.on_step(self, dtime)
end,
hit_node = function(self, pos, node)
def.hit_node(self, pos, node)
end,
move = def.move,
life_time = 0,
timer = 0,
custom_timer = 0,
})
minetest.register_craftitem("nssm:"..name.."_hand", {
description = def.description,
inventory_image = name.."_hand.png",
on_use = function(itemstack, placer, pointed_thing)
weapons_shot(itemstack, placer, pointed_thing, def.velocity, name)
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
on_drop = def.on_drop or function(itemstack, user, pointed_thing)
end,
})
minetest.register_craft({
output = 'nssm:'..name.."_hand 23",
recipe = {
{'nssm:great_energy_globe', 'nssm:great_energy_globe', 'nssm:great_energy_globe'},
{'nssm:great_energy_globe', def.material, 'nssm:great_energy_globe'},
{'nssm:great_energy_globe', 'nssm:great_energy_globe', 'nssm:great_energy_globe'}
}
})
end
--Registered weapons:
nssm_register_weapon("kamehameha", {
velocity = 25,
on_step = function(self, dtime)
default_on_step(self, dtime, 4, 20, default_dir, 1, "stone", 25)
end,
hit_node = function(self, pos, node)
tnt.boom(pos, {damage_radius=10,radius=6,ignore_protection=false})
end,
material = "default:diamondblock",
description = "Kamehameha from DragonBall",
})
nssm_register_weapon("kienzan", {
velocity = 25,
on_step = function(self, dtime)
default_on_step(self, dtime, 5, 20, {x=1, y=0, z=1}, 1, nil, 25)
end,
hit_node = function(self, pos, node)
end,
material = "default:bronzeblock",
description = "Kienzan from DragonBall",
})
nssm_register_weapon("spirit_ball", {
velocity = 25,
move = 0,
on_step = function(self, dtime)
search_on_step(self, dtime, 5, 30, 25)
end,
hit_node = function(self, pos, node)
--tnt.boom(pos, {damage_radius=8,radius=4,ignore_protection=false})
tnt_boom_nssm(pos, {damage_radius=4,radius=3,ignore_protection=false, damage_all = true})
end,
material = "default:goldblock",
description = "Spirit Ball from DragonBall",
})
nssm_register_weapon("hellzone_grenade", {
velocity = 25,
move = 0,
on_step = function(self, dtime)
search_on_step2(self, dtime, 30, 30, 25)
end,
hit_node = function(self, pos, node)
tnt.boom(pos, {damage_radius=8,radius=4,ignore_protection=false})
end,
on_drop = function(itemstack, user, pointed_thing)
local pos = user:getpos()
activate_balls(pos)
end,
material = "default:mese",
description = "Hellzone grenade (Press q to activate)",
})
--[[nssm_register_weapon("particles_ball", {
velocity = 25,
move = 0,
on_step = function(self, dtime)
local pos = self.object:getpos()
local vel = 1
minetest.add_particlespawner({
amount = 2,
time = 0.01,
minpos = pos,
maxpos = pos,
minvel = {x=3, y=3, z=3},
maxvel = {x=-3, y=-3, z=-3},
minacc = {x=0, y=0, z=0},
maxacc = {x=0, y=0, z=0},
minexptime = 0.5,
maxexptime = 0.5,
minsize = 3,
maxsize = 3,
collisiondetection = false,
vertical = false,
texture = "morparticle.png"
})
--Disappear after a certain time
if self.life_time == 0 then
self.life_time = os.time()
end
if os.time() - self.life_time > 60 then
self.object:remove()
return
end
--Look for an entity to follow
local objects = minetest.env:get_objects_inside_radius(pos, 20)
local min_dist = 100
local obj_min = nil
local obj_p = nil
local vec_min = nil
for _,obj in ipairs(objects) do
if (obj:is_player()) then
elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= self.object:get_luaentity().name) then
obj_p = obj:getpos()
local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z}
local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5
if (dist<min_dist) then
min_dist = dist
obj_min = obj
vec_min = vec
end
end
end
--Found an entity to follow:
if obj_min ~= nil then
local new_vel = {x=0, y=0, z=0}
local dir = 0
local max_diff = 0
if (max_diff<math.abs(vec_min.x)) then
dir = 1
max_diff = math.abs(vec_min.x)
end
if (max_diff<math.abs(vec_min.y)) then
dir = 2
max_diff = math.abs(vec_min.y)
end
if (max_diff<math.abs(vec_min.z)) then
dir = 3
max_diff = math.abs(vec_min.z)
end
vec_min.x = (vec_min.x/max_diff)*vel
vec_min.y = (vec_min.y/max_diff)*vel
vec_min.z = (vec_min.z/max_diff)*vel
obj_p = obj_min:getpos()
self.object:setvelocity(vec_min)
if min_dist < 1 then
local node = nssm:node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
else
self.object:setvelocity(vec_min)
end
end
local n = minetest.env:get_node(pos).name
if n ~= "air" and n ~= "default:water_source" and n ~= "default:water_flowing" then
local node = nssm:node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
end
end,
hit_node = function(self, pos, node)
--nssm:explosion(pos, 4, 0)
end,
on_drop = function(itemstack, user, pointed_thing)
local pos = user:getpos()
--activate_balls(pos)
end,
material = "group:wood",
description = "Particles ball",
})]]
--[[
nssm_register_weapon("light_ball", {
velocity = 25,
move = 0,
on_step = function(self, dtime, last_pos)
local pos = self.object:getpos()
local vel = 1
--Disappear after a certain time
if self.life_time == 0 then
self.life_time = os.time()
end
if os.time() - self.life_time > 60 then
self.object:remove()
return
end
if self.custom_timer == 0 then
self.custom_timer = os.time()
end
if last_pos == nil or (last_pos ~= nil and last_pos ~= pos) then
minetest.set_node(pos, {name="nssm:invisible_light"})
if last_pos ~= nil then
minetest.set_node(last_pos, {name="air"})
end
last_pos = pos
end
--Look for an entity to follow
local objects = minetest.env:get_objects_inside_radius(pos, 20)
local min_dist = 100
local obj_min = nil
local obj_p = nil
local vec_min = nil
for _,obj in ipairs(objects) do
if (obj:is_player()) then
elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= self.object:get_luaentity().name) then
obj_p = obj:getpos()
local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z}
local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5
if (dist<min_dist) then
min_dist = dist
obj_min = obj
vec_min = vec
end
end
end
--Found an entity to follow:
if obj_min ~= nil then
local new_vel = {x=0, y=0, z=0}
local dir = 0
local max_diff = 0
if (max_diff<math.abs(vec_min.x)) then
dir = 1
max_diff = math.abs(vec_min.x)
end
if (max_diff<math.abs(vec_min.y)) then
dir = 2
max_diff = math.abs(vec_min.y)
end
if (max_diff<math.abs(vec_min.z)) then
dir = 3
max_diff = math.abs(vec_min.z)
end
vec_min.x = (vec_min.x/max_diff)*vel
vec_min.y = (vec_min.y/max_diff)*vel
vec_min.z = (vec_min.z/max_diff)*vel
obj_p = obj_min:getpos()
self.object:setvelocity(vec_min)
if min_dist < 1 then
local node = nssm:node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
else
self.object:setvelocity(vec_min)
end
end
local n = minetest.env:get_node(pos).name
if n ~= "air" and n ~= "default:water_source" and n ~= "default:water_flowing" then
local node = nssm:node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
end
end,
hit_node = function(self, pos, node)
--nssm:explosion(pos, 4, 0)
end,
on_drop = function(itemstack, user, pointed_thing)
local pos = user:getpos()
--activate_balls(pos)
end,
material = "group:sand",
description = "Light Ball",
})
]]

View File

@ -1,35 +0,0 @@
Codice:
- Mantis problema animazioni (fra)
- I Pumboom droppano gli oggetti quando esplodono! (Controllare se anche quelli di tenplus, Fra)
- Attacco tartacacia: ti pianta nel terreno facendo danno o apre una voragine sotto di te. -> Iniziato Fra
- Attacco lanciafango del chog
- Icelamander lagga malissimo (controllare anche i suoi amici)
- Mese Dragon da rifare (lagga, più piccolo, non attacca)
- Mantis beast
- Ahuizotl (?)
- Albino Spider
- Salamander (dogshootta lava (un blocco)) ->semifatto
- Flust mangia le armature di metallo e non viene danneggiato dalle armi di metallo
- Spawn mostri nuovi
- Danno River Lord e Sandonisc
- Silversand Dragon (?)
- togliere le chat (hp_num -> envy sword)
- ascia esplosiva
Emmo vorrebbe:
-Nuove armature dei nuovi mostri
-Archi e frecche dei mostri
-Armi fighette difficili da fare e senza la wiki cosicché nessuno possa usarle a parte me, fatte con i drop dei boss di superfichie
Modelli:
-Animazioni Ahuizotl
-Animazioni Albino Spider
-Flust
-Animazioni Silversand Dragon (Che fa?)
Suoni nuovi mostri (Emmo)
Cose futurose:
-Addomesticare e cavalcare