Merge pull request #2 from NPXcoot/development

Development
master
NPXcoot 2016-03-22 23:27:15 +01:00
commit 0ab8ead3b4
57 changed files with 57333 additions and 30631 deletions

View File

@ -9,6 +9,7 @@ nssm:register_mob("nssm:ant_queen", {
visual_size = {x=6, y=6},
makes_footstep_sound = true,
view_range = 30,
fear_height = 5,
walk_velocity = 1.5,
run_velocity = 2,
lifetimer = 300,

View File

@ -9,6 +9,7 @@ nssm:register_mob("nssm:ant_soldier", {
visual_size = {x=3, y=3},
makes_footstep_sound = true,
view_range = 20,
fear_height = 4,
walk_velocity = 1.5,
run_velocity = 3,
rotate = 270,

View File

@ -9,6 +9,7 @@ nssm:register_mob("nssm:ant_worker", {
visual_size = {x=2, y=2},
makes_footstep_sound = true,
view_range = 20,
fear_height = 4,
walk_velocity = 1.5,
run_velocity = 2,
rotate = 270,

507
api.lua
View File

@ -1,4 +1,4 @@
-- Mobs Api (17th February 2016) with NSSM modifications
-- nssm Api (19th March 2016) with NSSM modifications
nssm = {}
nssm.mod = "redo"
@ -22,6 +22,16 @@ local stuck_path_timeout = 10 -- how long will mob follow path before giving up
local pi = math.pi
local square = math.sqrt
local atan = function(x)
if x ~= x then
--error("atan bassed NaN")
print ("atan based NaN")
return 0
else
return math.atan(x)
end
end
do_attack = function(self, player)
@ -42,6 +52,7 @@ do_attack = function(self, player)
end
set_velocity = function(self, v)
v = v or 0
local yaw = (self.object:getyaw() + self.rotate) or 0
@ -68,6 +79,8 @@ set_animation = function(self, type)
self.animation.current = self.animation.current or ""
self.animation.speed_normal = self.animation.speed_normal or 15
if type == "stand"
and self.animation.current ~= "stand" then
@ -108,7 +121,7 @@ set_animation = function(self, type)
self.object:set_animation({
x = self.animation.run_start,
y = self.animation.run_end},
self.animation.speed_run, 0)
(self.animation.speed_run or self.animation.speed_normal), 0)
self.animation.current = "run"
end
@ -123,7 +136,7 @@ set_animation = function(self, type)
self.object:set_animation({
x = self.animation.punch_start,
y = self.animation.punch_end},
self.animation.speed_normal, 0)
(self.animation.speed_punch or self.animation.speed_normal), 0)
self.animation.current = "punch"
end
@ -169,22 +182,33 @@ set_animation = function(self, type)
end
end
-- check line of sight for walkers and swimmers alike
function line_of_sight_water(self, pos1, pos2, stepsize)
--NSSM additions: mobs can see through water
function line_of_sight_water(pos1, pos2, stepsize)
if not minetest.line_of_sight(pos1, pos2, stepsize) then
local s, posw
s, posw = minetest.line_of_sight(pos1, pos2, stepsize)
local n = minetest.env:get_node(posw).name
if n=="default:water_source" or n=="default:water_flowing" or n=="nssm:ink" then
local s, pos_w = minetest.line_of_sight(pos1, pos2, stepsize)
-- normal walking and flying nssm can see you through air
if s == true then
return true
end
else
-- swimming nssm can see you through water
if s == false
and self.fly
and self.fly_in == "default:water_source" then
local nod = minetest.get_node(pos_w).name
if nod == "default:water_source"
or nod == "default:water_flowing" then
return true
end
end
return false
end
end
--end of NSSM additions
-- particle effects
function effect(pos, amount, texture, max_size)
@ -234,17 +258,15 @@ end
-- check if mob is dead or only hurt
function check_for_death(self)
-- return if no change
local hp = self.object:get_hp()
if hp == self.health then
return false
-- has health actually changed?
if self.health == self.old_health then
return
end
-- still got some health? play hurt sound
if hp > 0 then
self.old_health = self.health
self.health = hp
-- still got some health? play hurt sound
if self.health > 0 then
if self.sounds.damage then
@ -255,6 +277,11 @@ function check_for_death(self)
})
end
-- make sure health isn't higher than max
if self.health > self.hp_max then
self.health = self.hp_max
end
update_tag(self)
return false
@ -303,34 +330,6 @@ function check_for_death(self)
return true
end
--NSSM addition:
--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
--end of NSSM additions
-- check if within map limits (-30911 to 30927)
function within_limits(pos, radius)
@ -370,6 +369,24 @@ local function is_at_cliff(self)
return false
end
-- get node but use fallback for nil or unknown
local 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
-- environmental damage (water, lava, fire, light)
do_env_damage = function(self)
@ -395,18 +412,20 @@ do_env_damage = function(self)
and self.time_of_day < 0.8
and (minetest.get_node_light(pos) or 0) > 12 then
self.object:set_hp(self.object:get_hp() - self.light_damage)
self.health = self.health - self.light_damage
effect(pos, 5, "tnt_smoke.png")
end
-- what is mob standing in?
pos.y = pos.y + self.collisionbox[2] + 0.1 -- foot level
self.standing_in = node_ok(pos, "air").name
--print ("standing in " .. self.standing_in)
if self.water_damage ~= 0
or self.lava_damage ~= 0 then
pos.y = pos.y + self.collisionbox[2] + 0.1 -- foot level
local nod = node_ok(pos, "air") ; --print ("standing in "..nod.name)
local nodef = minetest.registered_nodes[nod.name]
local nodef = minetest.registered_nodes[self.standing_in]
pos.y = pos.y + 1
@ -414,7 +433,7 @@ do_env_damage = function(self)
if self.water_damage ~= 0
and nodef.groups.water then
self.object:set_hp(self.object:get_hp() - self.water_damage)
self.health = self.health - self.water_damage
effect(pos, 5, "bubble.png")
end
@ -422,10 +441,10 @@ do_env_damage = function(self)
-- lava or fire
if self.lava_damage ~= 0
and (nodef.groups.lava
or nod.name == "fire:basic_flame"
or nod.name == "fire:permanent_flame") then
or self.standing_in == "fire:basic_flame"
or self.standing_in == "fire:permanent_flame") then
self.object:set_hp(self.object:get_hp() - self.lava_damage)
self.health = self.health - self.lava_damage
effect(pos, 5, "fire_basic_flame.png")
end
@ -438,7 +457,7 @@ do_env_damage = function(self)
return
end
else
if check_for_death_hydra(self) then
if nssm:check_for_death_hydra(self) then
return
end
end
@ -488,8 +507,9 @@ do_jump = function(self)
--print ("in front:", nod.name, pos.y + 0.5)
if minetest.registered_items[nod.name].walkable
if (minetest.registered_items[nod.name].walkable
and not nod.name:find("fence")
and not nod.name:find("gate"))
or self.walk_chance == 0 then
local v = self.object:getvelocity()
@ -539,26 +559,20 @@ function entity_physics(pos, radius)
dist = math.max(1, get_distance(pos, obj_pos))
local damage = math.floor((4 / dist) * radius)
local ent = obj:get_luaentity()
if obj:is_player() then
obj:set_hp(obj:get_hp() - damage)
elseif ent.health then
obj:punch(obj, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = damage},
}, nil)
end
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
-- should mob follow what I'm holding ?
@ -763,7 +777,7 @@ function day_docile(self)
end
-- path finding and smart mob routine by rnd
function smart_mobs(self, s, p, dist, dtime)
function smart_nssm(self, s, p, dist, dtime)
local s1 = self.path.lastpos
@ -919,7 +933,6 @@ function smart_mobs(self, s, p, dist, dtime)
end
end
-- register mob function
function nssm:register_mob(name, def)
@ -999,28 +1012,22 @@ minetest.register_entity(name, {
runaway = def.runaway,
runaway_timer = 0,
pathfinding = def.pathfinding,
immune_to = def.immune_to or {},
explosion_radius = def.explosion_radius,
--NSSM parameters
on_dist_attack = def.on_dist_attack,
metamorphosis = def.metamorphosis or false,
metatimer = 30,
putter = def.putter or false,
pump_putter = def.pump_putter or false,
froster = def.froster or false,
big_froster = def.big_froster or false,
digger = def.digger or false,
webber = def.webber or false,
mamma = def.mamma or false,
dogshoot_stop = def.dogshoot_stop or false,
duckking_father = def.duckking_father or false,
maxus = def.maxus or false,
inker = def.inker or false,
melter = def.melter or false,
die_anim = def.die_anim or false,
worm = def.worm or false,
hydra = def.hydra or false,
stone_pooper = def.stone_pooper or false,
mele_number = def.mele_number or 1,
true_dist_attack = def.true_dist_attack or false,
explosion_radius = def.explosion_radius or 0,
@ -1110,7 +1117,8 @@ minetest.register_entity(name, {
if d > 5 then
self.object:set_hp(self.object:get_hp() - math.floor(d - 5))
--self.object:set_hp(self.object:get_hp() - math.floor(d - 5))
self.health = self.health - math.floor(d - 5)
effect(pos, 5, "tnt_smoke.png")
@ -1228,21 +1236,12 @@ minetest.register_entity(name, {
-- field of view check goes here
-- choose closest player to attack
if minetest.line_of_sight(sp, p, 2) == true
--if minetest.line_of_sight(sp, p, 2) == true
if line_of_sight_water(self, sp, p, 2) == true
and dist < min_dist then
min_dist = dist
min_player = player
end
--NSSM additions
if line_of_sight_water(sp,p,2) and dist < min_dist then
min_dist = dist
min_player = player
end
--end of NSSM additions
end
end
end
@ -1366,7 +1365,7 @@ minetest.register_entity(name, {
if vec.x ~= 0
and vec.z ~= 0 then
yaw = (math.atan(vec.z / vec.x) + pi / 2) - self.rotate
yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate
if p.x > s.x then
yaw = yaw + pi
@ -1403,6 +1402,19 @@ minetest.register_entity(name, {
end
end
-- water swimmers flop when on land
if self.fly
and self.fly_in == "default:water_source"
and self.standing_in ~= self.fly_in then
self.state = "flop"
self.object:setvelocity({x = 0, y = -5, z = 0})
set_animation(self, "stand")
return
end
if self.state == "stand" then
if math.random(1, 4) == 1 then
@ -1435,7 +1447,7 @@ minetest.register_entity(name, {
if vec.x ~= 0
and vec.z ~= 0 then
yaw = (math.atan(vec.z / vec.x) + pi / 2) - self.rotate
yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate
if lp.x > s.x then
yaw = yaw + pi
@ -1470,22 +1482,6 @@ minetest.register_entity(name, {
local s = self.object:getpos()
local lp = minetest.find_node_near(s, 1, {"group:water"})
-- water swimmers cannot move out of water
if self.fly
and self.fly_in == "default:water_source"
and not lp then
--print ("out of water")
set_velocity(self, 0)
-- change to undefined state so nothing more happens
self.state = "flop"
set_animation(self, "stand")
return
end
-- if water nearby then turn away
if lp then
@ -1498,7 +1494,7 @@ minetest.register_entity(name, {
if vec.x ~= 0
and vec.z ~= 0 then
yaw = math.atan(vec.z / vec.x) + 3 * pi / 2 - self.rotate
yaw = atan(vec.z / vec.x) + 3 * pi / 2 - self.rotate
if lp.x > s.x then
yaw = yaw + pi
@ -1600,7 +1596,7 @@ minetest.register_entity(name, {
if vec.x ~= 0
and vec.z ~= 0 then
yaw = math.atan(vec.z / vec.x) + pi / 2 - self.rotate
yaw = atan(vec.z / vec.x) + pi / 2 - self.rotate
if p.x > s.x then
yaw = yaw + pi
@ -1659,9 +1655,10 @@ minetest.register_entity(name, {
if self.timer > 3 then
local pos = self.object:getpos()
local radius = self.explosion_radius or 1
-- hurt player/nssm caught in blast area
--entity_physics(pos, 3) --NSSM modification (the damage function is part of the explosion one now)
--entity_physics(pos, radius) --NSSM modification (the damage function is part of the explosion one now)
-- dont damage anything if area protected or next to water
if minetest.find_node_near(pos, 1, {"group:water"})
@ -1701,7 +1698,6 @@ minetest.register_entity(name, {
end
end
elseif self.attack_type == "dogfight"
or (self.attack_type == "dogshoot" and dist <= self.reach)
or (self.attack_type == "dogshoot" and self.dogshoot_stop and self.direct_hit) --NSSM addition
@ -1793,7 +1789,7 @@ minetest.register_entity(name, {
if vec.x ~= 0
and vec.z ~= 0 then
yaw = (math.atan(vec.z / vec.x) + pi / 2) - self.rotate
yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate
if p.x > s.x then
yaw = yaw + pi
@ -1809,7 +1805,7 @@ minetest.register_entity(name, {
if self.pathfinding -- only if mob has pathfinding enabled
and enable_pathfinding then
smart_mobs(self, s, p, dist, dtime)
smart_nssm(self, s, p, dist, dtime)
end
-- jump attack
@ -1827,6 +1823,7 @@ minetest.register_entity(name, {
set_velocity(self, 0)
set_animation(self, "stand")
else
if self.path.stuck then
set_velocity(self, self.walk_velocity)
else
@ -1870,7 +1867,7 @@ minetest.register_entity(name, {
p2.y = p2.y + 1.5
s2.y = s2.y + 1.5
if minetest.line_of_sight(p2, s2) == true or line_of_sight_water(p2,s2,1) then --NSSM modification
if line_of_sight_water(self,p2,s2,1) then
-- play attack sound
if self.sounds.attack then
@ -1887,7 +1884,7 @@ minetest.register_entity(name, {
damage_groups = {fleshy = self.damage}
}, nil)
--NSSM Modifications for dogshoot mobs
--NSSM Modifications for dogshoot nssm
if (self.dogshoot_stop) then
self.num_mele_attacks=self.num_mele_attacks+1
--minetest.chat_send_all("num_mele_attacks= "..self.num_mele_attacks)
@ -1897,7 +1894,7 @@ minetest.register_entity(name, {
self.direct_hit=false
end
end
--end of modifications for dogshoot mobs
--end of modifications for dogshoot nssm
end
end
@ -1911,7 +1908,8 @@ minetest.register_entity(name, {
local s2 = s
p2.y = p2.y + 1.5
s2.y = s2.y + 1.5
if minetest.line_of_sight(p2, s2) == true then
--if minetest.line_of_sight(p2, s2) == true then
if line_of_sight_water(self, p2, s2) == true then
-- play attack sound
if self.sounds.attack then
minetest.sound_play(self.sounds.attack, {
@ -2029,7 +2027,7 @@ minetest.register_entity(name, {
if vec.x ~= 0
and vec.z ~= 0 then
yaw = (math.atan(vec.z / vec.x) + pi / 2) - self.rotate
yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate
if p.x > s.x then
yaw = yaw + pi
@ -2107,7 +2105,6 @@ minetest.register_entity(name, {
end
end
end -- END if self.state == "attack"
--NSSM additions:
@ -2162,137 +2159,6 @@ minetest.register_entity(name, {
end
end
--for the Dahaka and the lava_titan
if self.digger==true then
local pos = self.object:getpos()
for dx=-1,1 do
for dy=0,5 do
for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n~="default:water_source" and n~="default:water_flowing") then
minetest.env:set_node(t, {name="air"})
end
end
end
end
end
--for the spider mobs
if self.webber==true then
local pos = self.object:getpos()
if (math.random(1,50)==1) then
local dx=math.random(1,3)
local dz=math.random(1,3)
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")) then
minetest.env:set_node(t, {name="nssm:web"})
end
end
end
--lava_titan
if self.melter==true then
local pos = self.object:getpos()
pos.y=pos.y-1
local n = minetest.env:get_node(pos).name
if n~="default:lava_source" then
minetest.env:set_node(pos, {name="default:lava_source"})
end
end
--for the mese-dragon
if self.putter==true then
local pos = self.object:getpos()
for dx=-1,1 do
for dy=-1,10 do
for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n~="air" and n~="nssm:mese_meteor" and n~="fire:basic_flame") then
minetest.env:set_node(t, {name="default:mese_block"})
end
end
end
end
end
--Ice mobs
if self.froster==true then
local pos = self.object:getpos()
for dx=-1,1 do
for dy=-1,0 do
for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n=="default:water_source" or n=="default:water_flowing") then
minetest.env:set_node(t, {name="default:ice"})
end
end
end
end
end
--Ice boss
if self.big_froster==true then
local pos = self.object:getpos()
for dx=-1,1 do
for dy=-1,3 do
for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n~="air") then
minetest.env:set_node(t, {name="default:ice"})
end
end
end
end
end
--worms mod
if self.worm==true then
local pos = self.object:getpos()
for dx=-1,1 do
for dy=0,2 do
for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n~="default:water_source" and n~="default:water_flowing") then
if n=="default:sand" or n=="default:desert_sand" then
minetest.env:set_node(t, {name="air"})
end
end
end
end
end
end
if self.stone_pooper==true then
local pos = self.object:getpos()
for dx=-1,1 do
for dy=0,1 do
for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(t).name
if (n~="default:water_source" and n~="default:water_flowing") then
if n=="default:stone" or n=="default:sandstone" or n=="default:cobble" then
minetest.env:set_node(t, {name="air"})
end
end
end
end
end
end
--ens of NSSM additions
end,
@ -2306,6 +2172,37 @@ minetest.register_entity(name, {
local weapon = hitter:get_wielded_item()
local punch_interval = 1.4
-- calculate mob damage
local damage = 0
local armor = self.object:get_armor_groups() or {}
local tmp
for group,_ in pairs(tool_capabilities.damage_groups) do
tmp = tflp / tool_capabilities.full_punch_interval
if tmp < 0 then
tmp = 0.0
elseif tmp > 1 then
tmp = 1.0
end
damage = damage + (tool_capabilities.damage_groups[group] or 0)
* tmp * ((armor[group] or 0) / 100.0)
end
-- check for tool immunity or special damage
for _, no in pairs(self.immune_to) do
if no[1] == weapon:get_name() then
damage = no[2] or 0
break
end
end
-- print ("Mob Damage is", damage)
-- add weapon wear
if tool_capabilities then
punch_interval = tool_capabilities.full_punch_interval or 1.4
end
@ -2333,11 +2230,23 @@ minetest.register_entity(name, {
})
end
-- do damage
self.health = self.health - math.floor(damage)
-- exit here if dead
if check_for_death(self) then
return
end
-- add healthy afterglow when hit
core.after(0.1, function()
self.object:settexturemod("^[colorize:#c9900070")
core.after(0.3, function()
self.object:settexturemod("")
end)
end)
-- blood_particles
if self.blood_amount > 0
and not disable_blood then
@ -2349,8 +2258,9 @@ minetest.register_entity(name, {
effect(pos, self.blood_amount, self.blood_texture)
end
-- knock back effect
if self.knock_back > 0 then
-- knock back effect (only on full punch)
if self.knock_back > 0
and tflp > punch_interval then
local v = self.object:getvelocity()
local r = 1.4 - math.min(punch_interval, 1.4)
@ -2358,7 +2268,8 @@ minetest.register_entity(name, {
local up = 2
-- if already in air then dont go up anymore when hit
if v.y > 0 then
if v.y > 0
or self.fly then
up = 0
end
@ -2386,7 +2297,7 @@ minetest.register_entity(name, {
if vec.x ~= 0
and vec.z ~= 0 then
local yaw = math.atan(vec.z / vec.x) + 3 * pi / 2 - self.rotate
local yaw = atan(vec.z / vec.x) + 3 * pi / 2 - self.rotate
if lp.x > s.x then
yaw = yaw + pi
@ -2400,17 +2311,15 @@ minetest.register_entity(name, {
self.following = nil
end
-- attack puncher and call other nssm for help
if self.passive == false
and self.state ~= "flop"
and self.child == false
and hitter:get_player_name() ~= self.owner then
--if self.state ~= "attack" then
-- attack whoever punched mob
self.state = ""
do_attack(self, hitter)
--end
-- alert others to the attack
local obj = nil
@ -2520,15 +2429,16 @@ minetest.register_entity(name, {
self.path.stuck_timer = 0 -- if stuck for too long search for path
-- end init
self.object:set_hp(self.health)
self.object:set_armor_groups({fleshy = self.armor})
self.object:set_armor_groups({immortal = 1, fleshy = self.armor})
self.old_y = self.object:getpos().y
self.old_health = self.health
self.object:setyaw((math.random(0, 360) - 180) / 180 * pi)
self.sounds.distance = self.sounds.distance or 10
self.textures = textures
self.mesh = mesh
self.collisionbox = colbox
self.visual_size = vis_size
self.standing_in = ""
-- set anything changed above
self.object:set_properties(self)
@ -2711,40 +2621,6 @@ 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 additions:
--pumpbomb explosion
function nssm:pumpbomb_explosion(pos)
minetest.env:remove_node(pos)
for dx=-3,3 do
for dy=-3,3 do
for dz=-3,3 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(pos).name
if math.random(1, 50) <= 35 then
minetest.env:remove_node(p)
end
local objects = minetest.env:get_objects_inside_radius(pos, 3)
for _,obj in ipairs(objects) do
if obj:is_player() or (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= "nssm:pumpking") then
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 = (4 / dist) * 3
local curr_hp=obj:get_hp()
obj:set_hp(curr_hp-damage)
end
end
minetest.sound_play("boom", {
max_hear_distance = 20,
})
end
end
end
end
--end of NSSM additions
-- explosion (cannot break protected or unbreakable nodes)
function nssm:explosion(pos, radius, fire, smoke, sound)
@ -2770,8 +2646,6 @@ function nssm:explosion(pos, radius, fire, smoke, sound)
})
end
entity_physics(pos, radius) --NSSM addition
pos = vector.round(pos) -- voxelmanip doesn't work properly unless pos is rounded ?!?!
local vm = VoxelManip()
@ -2798,6 +2672,11 @@ function nssm:explosion(pos, radius, fire, smoke, sound)
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
@ -2832,26 +2711,11 @@ function nssm:explosion(pos, radius, fire, smoke, sound)
minetest.set_node(p, {name = "fire:basic_flame"})
else
--if (x<2)and(y<2)and(z<2)and(x>-2)and(y>-2)and(z>-2) then --NSSM modification, is it necessary?
minetest.set_node(p, {name = "air"})
if smoke > 0 then
effect(p, 2, "tnt_smoke.png", 5)
end
--NSSM modification is it really useful?
--[[
else if (x<3)and(y<3)and(z<3)and(x>-3)and(y>-3)and(z>-3) then
if (math.random(1,100))>25 then
minetest.remove_node(p)
end
else
if (math.random(1,100))>50 then
minetest.remove_node(p)
end
end
end
]]--
end
end
end
@ -3012,7 +2876,7 @@ function nssm:register_egg(mob, desc, background, addegg)
local invimg = background
if addegg == 1 then
invimg = invimg .. "^nssm_chicken_egg.png"
invimg = "nssm_chicken_egg.png^(" .. invimg .. "^[mask:nssm_chicken_egg_overlay.png)"
end
minetest.register_craftitem(mob, {
@ -3254,7 +3118,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
and fields.name ~= "" then
local name = player:get_player_name()
local ent = mob_obj[name]
if not mob_obj[name]
or not mob_obj[name].object then

View File

@ -9,6 +9,7 @@ nssm:register_mob("nssm:black_widow", {
visual_size = {x=2, y=2},
makes_footstep_sound = true,
view_range = 15,
fear_height = 4,
walk_velocity = 1,
run_velocity = 2.5,
rotate = 270,
@ -34,7 +35,6 @@ nssm:register_mob("nssm:black_widow", {
armor = 100,
drawtype = "front",
water_damage = 1,
webber = true,
lava_damage = 7,
light_damage = 0,
on_rightclick = nil,
@ -50,5 +50,20 @@ nssm:register_mob("nssm:black_widow", {
run_end = 140,
punch_start = 150,
punch_end = 160,
}
},
do_custom = function(self)
--Webber: puts web around himself
local pos = self.object:getpos()
if (math.random(1,75)==1) then
local dx=math.random(1,3)
local dz=math.random(1,3)
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")) then
minetest.env:set_node(t, {name="nssm:web"})
end
end
end,
})

View File

@ -9,6 +9,7 @@ nssm:register_mob("nssm:bloco", {
visual_size = {x=4, y=4},
makes_footstep_sound = true,
view_range = 8,
fear_height = 4,
walk_velocity = 1,
run_velocity = 2.5,
rotate = 270,

View File

@ -13,6 +13,7 @@ nssm:register_mob("nssm:crab", {
makes_footstep_sound = true,
view_range = 7,
rotate = 270,
fear_height = 4,
walk_velocity = 1,
run_velocity = 2,
damage = 3,

View File

@ -10,6 +10,7 @@ nssm:register_mob("nssm:daddy_long_legs", {
makes_footstep_sound = true,
view_range = 12,
walk_velocity = 1.5,
fear_height = 4,
run_velocity = 3.3,
rotate = 90,
sounds = {

View File

@ -1,16 +1,16 @@
nssm:register_mob("nssm:dahaka", {
--[[nssm:register_mob("nssm:dahaka", {
type = "monster",
hp_max = 80,
hp_min = 80,
collisionbox = {-0.85, -0.30, -0.85, 0.85, 4.50, 0.85},
visual = "mesh",
digger = true,
mesh = "dahaka.x",
textures = {{"dahaka.png", "dahaka_sand.png"}},
visual_size = {x=4, y=4},
lifetimer=500,
makes_footstep_sound = true,
view_range = 30,
fear_height = 4,
walk_velocity = 2,
run_velocity = 2,
damage = 8,
@ -52,5 +52,23 @@ nssm:register_mob("nssm:dahaka", {
punch_end = 330,
punch1_start = 120,
punch1_end = 155,
}
})
},
do_custom = function (self)
--Digging ability
local v = self.object:getvelocity()
local pos = self.object:getpos()
local c=3
for dx = -c*(math.abs(v.x))-1 , c*(math.abs(v.x))+1 do
for dy=0,5 do
for dz = -c*(math.abs(v.z))-1 , c*(math.abs(v.z))+1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n~="default:water_source" and n~="default:water_flowing") then
minetest.env:set_node(t, {name="air"})
end
end
end
end
end,
})]]

View File

@ -13,6 +13,7 @@ nssm:register_mob("nssm:duckking", {
rotate = 270,
duck_father = true,
walk_velocity = 1,
fear_height = 4,
run_velocity = 2,
damage = 5,
jump = true,

View File

@ -11,6 +11,7 @@ nssm:register_mob("nssm:echidna", {
view_range = 30,
rotate = 270,
lifetimer = 500,
fear_height = 4,
walk_velocity = 2,
run_velocity = 3.5,
damage = 10,

View File

@ -10,6 +10,7 @@ nssm:register_mob("nssm:enderduck", {
makes_footstep_sound = true,
view_range = 25,
walk_velocity = 3,
fear_height = 4,
run_velocity = 3.9,
rotate = 270,
sounds = {

52
giant_sandworm.lua Normal file
View File

@ -0,0 +1,52 @@
nssm:register_mob("nssm:giant_sandworm", {
type = "monster",
hp_max = 120,
hp_min = 130,
collisionbox = {-1.2, 0, -1.2, 1.2, 4.5, 1.2},
visual = "mesh",
mesh = "giant_sandworm.x",
textures = {{"sandworm.png"}},
visual_size = {x=13, y=13},
makes_footstep_sound = false,
view_range = 9,
rotate = 270,
reach = 8,
walk_velocity = 0,
run_velocity = 0,
damage = 8,
jump = false,
drops = {
{name = "nssm:worm_flesh",
chance = 1,
min = 20,
max = 30,},
{name = "nssm:life_energy",
chance = 1,
min = 7,
max = 8,},
{name = "nssm:black_sand",
chance = 1,
min = 1,
max = 1,},
},
armor = 60,
drawtype = "front",
water_damage = 5,
lava_damage = 3,
light_damage = 0,
on_rightclick = nil,
attack_type = "dogfight",
animation = {
speed_normal = 25,
speed_run = 40,
stand_start = 1,
stand_end = 100,
walk_start = 110,
walk_end = 140,
run_start = 110,
run_end = 140,
punch_start = 150,
punch_end = 180,
},
})

View File

@ -9,8 +9,8 @@ nssm:register_mob("nssm:icelamander", {
visual_size = {x=4, y=4},
makes_footstep_sound = true,
view_range = 35,
big_froster = true,
lifetimer = 500,
fear_height = 4,
walk_velocity = 2,
run_velocity = 4,
sounds = {
@ -60,5 +60,23 @@ nssm:register_mob("nssm:icelamander", {
punch_end = 190,
dattack_start = 190,
dattack_end = 210,
}
},
do_custom = function(self)
--Big_froster
local pos = self.object:getpos()
local c=3
local v = self.object:getvelocity()
for dx = -c*(math.abs(v.x))-1 , c*(math.abs(v.x))+1 do
for dy=-1,3 do
for dz = -c*(math.abs(v.z))-1 , c*(math.abs(v.z))+1 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n~="air") then
minetest.env:set_node(t, {name="default:ice"})
end
end
end
end
end,
})

View File

@ -10,7 +10,7 @@ nssm:register_mob("nssm:icesnake", {
makes_footstep_sound = false,
view_range = 10,
rotate = 270,
froster = true,
fear_height = 3,
walk_velocity = 1.2,
run_velocity = 3,
sounds = {
@ -50,5 +50,23 @@ nssm:register_mob("nssm:icesnake", {
run_end = 120,
punch_start = 130,
punch_end = 160,
}
},
do_custom = function(self)
--Froster
local c=2
local pos = self.object:getpos()
local v = self.object:getvelocity()
for dx = -c*(math.abs(v.x))-1 , c*(math.abs(v.x))+1 do
for dy=-1,0 do
for dz = -c*(math.abs(v.z))-1 , c*(math.abs(v.z))+1 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n=="default:water_source" or n=="default:water_flowing") then
minetest.env:set_node(t, {name="default:ice"})
end
end
end
end
end,
})

View File

@ -11,13 +11,14 @@ dofile(path.."/bloco.lua")
dofile(path.."/crab.lua")
dofile(path.."/crocodile.lua")
dofile(path.."/daddy_long_legs.lua")
dofile(path.."/dahaka.lua")
--dofile(path.."/dahaka.lua")
dofile(path.."/dolidrosaurus.lua")
dofile(path.."/duck.lua")
dofile(path.."/duckking.lua")
dofile(path.."/echidna.lua")
dofile(path.."/enderduck.lua")
dofile(path.."/flying_duck.lua")
dofile(path.."/giant_sandworm.lua")
dofile(path.."/icelamander.lua")
dofile(path.."/icesnake.lua")
dofile(path.."/kraken.lua")
@ -35,6 +36,7 @@ dofile(path.."/pumpboom.lua")
dofile(path.."/pumpking.lua")
dofile(path.."/sandworm.lua")
dofile(path.."/scrausics.lua")
dofile(path.."/sand_bloco.lua")
dofile(path.."/signosigno.lua")
dofile(path.."/snow_biter.lua")
dofile(path.."/spiderduck.lua")
@ -52,6 +54,8 @@ dofile(path.."/mese_dragon.lua")
dofile(path.."/rainbow_staff.lua")
dofile(path.."/darts.lua")
dofile(path.."/nssm_materials.lua")
dofile(path.."/kienzan.lua")
dofile(path.."/kamehameha.lua")
--dofile(path.."/kienzan.lua")
--dofile(path.."/kamehameha.lua")
dofile(path.."/nssm_spears.lua")
dofile(path.."/nssm_api.lua")
dofile(path.."/nssm_weapons.lua")

View File

@ -1,99 +1,150 @@
--Kamehameha!
kame_velocity = 30
exp_radius = 4
minetest.register_entity("nssm:kamehameha", {
textures = {"kamehameha.png"},
velocity = 15,
on_step = function (self, pos, node, dtime)
local pos = self.object:getpos()
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:is_player() then
return
else
--while going around it damages entities
local objects = minetest.env:get_objects_inside_radius(pos, 2)
for _,obj in ipairs(objects) do
if (obj:is_player()) then
elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item") then
obj:set_hp(obj:get_hp()-20)
if obj:get_entity_name() ~= "nssm:kamehameha" then
if obj:get_hp()<=0 then
if (obj:get_hp() <= 0) then
if (not obj:is_player()) and obj:get_entity_name() ~= "nssm:kamehameha" then
obj:remove()
end
end
end
end
for dx=-1,1 do
for dy=-1,1 do
for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if n ~= "kamehameha:kame_entity" and n ~="default:stone" and n ~="default:desert_stone" then
local n = minetest.env:get_node(pos).name
if n ~="default:stone" and n ~="default:desert_stone" then
if minetest.registered_nodes[n].groups.flammable --[[or math.random(1, 100) <= 1]] then
minetest.env:set_node(t, {name="fire:basic_flame"})
minetest.env:set_node(pos, {name="fire:basic_flame"})
else
minetest.env:set_node(t, {name="air"})
minetest.env:set_node(pos, {name="air"})
local vec = self.object:getvelocity()
local c=3
--calculate how many blocks around the kamehameha need to be removed
local i = nssm:round(math.abs(math.abs(vec.x)-kame_velocity)*0.01*c)
local j = nssm:round(math.abs(math.abs(vec.y)-kame_velocity)*0.01*c)
local k = nssm:round(math.abs(math.abs(vec.z)-kame_velocity)*0.01*c)
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}
minetest.env:remove_node(p)
end
elseif n == "default:stone" or n =="default:desert_stone" then
end
end
end
else
self.hit_node(self, pos, node)
self.object:remove()
return
end
end
end
end
end,
hit_node = function(self, pos, node)
--This is the particle spawner, if it slows down your pc then comment this section
minetest.add_particlespawner(
100*exp_radius, --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
2, --maxexptime
6, --minsize
12, --maxsize
false, --collisiondetection
"tnt_smoke.png" --texture
)
--end of the particle spawner
--Damages entities around (not the player)
local objects = minetest.env:get_objects_inside_radius(pos, exp_radius)
for _,obj in ipairs(objects) do
if (obj:is_player()) then
elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item") then
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 = 21-dist*5
obj:set_hp(obj:get_hp()-damage)
if (obj:get_hp() <= 0) then
if (not obj:is_player()) and obj:get_entity_name() ~= "nssm:kamehameha" then
obj:remove()
end
end
end
end
minetest.sound_play("boom", {max_hear_distance = 100})
for dx=-1,1 do
for dy=-1,1 do
for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if n~="air" then
minetest.env:remove_node(p)
end
end
end
end
local i, j, k
local c=1000
for i=2,exp_radius do
local max
local num =4*((i*2)^3)
if c/i<num then
max = c/i
else
max = num
end
for j=1,max do
local p = {x=pos.x+math.random(-i,i), y=pos.y+math.random(-i,i), z=pos.z+math.random(-i,i)}
local n = minetest.env:get_node(p).name
if n~="air" and ( math.abs(p.x-pos.x)==i ) or (math.abs(p.y-pos.y)==i) or (math.abs(p.y-pos.y)==i) then
--if ( math.abs(p.x-pos.x)==i ) or (math.abs(p.y-pos.y)==i) or (math.abs(p.y-pos.y)==i) then
minetest.env:remove_node(p)
elseif math.random(1, 30)==1 then
minetest.env:set_node(p, {name="fire:basic_flame"})
end
end
end
--old explosion function:
--[[
for dx=-4,4 do
for dy=-4,4 do
for dz=-4,4 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(pos).name
local n = minetest.env:get_node(p).name
if math.random(1, 50) <= 35 then
minetest.env:remove_node(p)
end
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <=5 then
minetest.env:set_node(t, {name="fire:basic_flame"})
end
local objects = minetest.env:get_objects_inside_radius(pos, 4)
for _,obj in ipairs(objects) do
if obj:is_player() or (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item") then
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 = (80*0.5^dist)*2
obj:punch(obj, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, vec)
minetest.env:set_node(p, {name="fire:basic_flame"})
end
end
end
end
minetest.sound_play("boom", {
max_hear_distance = 100,
})
--[[
--This is the particle spawner, but it will slow your pc. If you have a powerful pc you can uncomment this section
minetest.add_particlespawner(
1, --amount
0.1, --time
{x=pos.x-3, y=pos.y-3, z=pos.z-3}, --minpos
{x=pos.x+3, y=pos.y+3, z=pos.z+3}, --maxpos
{x=-0, y=-0, z=-0}, --minvel
{x=0, y=0, z=0}, --maxvel
{x=-0.5,y=5,z=-0.5}, --minacc
{x=0.5,y=5,z=0.5}, --maxacc
0.1, --minexptime
1, --maxexptime
8, --minsize
15, --maxsize
false, --collisiondetection
"tnt_smoke.png" --texture
)
]]--
end
end
end
end
})
minetest.register_tool("nssm:kamehameha_hand", {
@ -103,11 +154,10 @@ minetest.register_tool("nssm:kamehameha_hand", {
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:kamehameha")
local vec = {x=dir.x*6,y=dir.y*6,z=dir.z*6}
local vec = {x=dir.x*kame_velocity,y=dir.y*kame_velocity,z=dir.z*kame_velocity}
obj:setvelocity(vec)
return itemstack
end,
light_source = 12,
})
minetest.register_craft({

View File

@ -11,6 +11,7 @@ nssm:register_mob("nssm:larva", {
view_range = 10,
rotate = 90,
jump = false,
fear_height = 4,
jump_height =0,
walk_velocity = 0.4,
run_velocity = 0.4,

View File

@ -9,6 +9,7 @@ nssm:register_mob("nssm:lava_titan", {
visual_size = {x=4, y=4},
makes_footstep_sound = true,
view_range = 20,
fear_height = 4,
lifetimer = 500,
walk_velocity = 1,
run_velocity = 2,
@ -37,7 +38,6 @@ nssm:register_mob("nssm:lava_titan", {
drawtype = "front",
water_damage = 4,
rotate = 270,
digger = true,
melter = true,
light_damage = 0,
lava_damage = 0,
@ -77,5 +77,32 @@ nssm:register_mob("nssm:lava_titan", {
punch_end = 340,
dattack_start =340,
dattack_end=400,
}
},
do_custom = function (self)
--Digging ability:
local v = self.object:getvelocity()
local pos = self.object:getpos()
local c=3
for dx = -c*(math.abs(v.x))-1 , c*(math.abs(v.x))+1 do
for dy=0,5 do
for dz = -c*(math.abs(v.z))-1 , c*(math.abs(v.z))+1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n~="default:water_source" and n~="default:water_flowing") then
minetest.env:set_node(t, {name="air"})
end
end
end
end
--Melting ability (puts lava where he passes)
pos.y=pos.y-1
local n = minetest.env:get_node(pos).name
if n~="default:lava_source" then
minetest.env:set_node(pos, {name="default:lava_source"})
end
end,
})

View File

@ -9,6 +9,7 @@ nssm:register_mob("nssm:manticore", {
visual_size = {x=4, y=4},
makes_footstep_sound = true,
view_range = 25,
fear_height = 4,
walk_velocity = 2,
run_velocity = 4,
sounds = {

View File

@ -9,6 +9,7 @@ nssm:register_mob("nssm:mantis", {
visual_size = {x=4, y=4},
makes_footstep_sound = true,
view_range = 20,
fear_height = 4,
walk_velocity = 2,
run_velocity = 2.5,
sounds = {

View File

@ -9,6 +9,7 @@ nssm:register_mob("nssm:mantis_beast", {
visual_size = {x=6, y=6},
makes_footstep_sound = true,
view_range = 25,
fear_height = 4,
walk_velocity = 2.5,
run_velocity = 3.5,
sounds = {

View File

@ -10,6 +10,7 @@ nssm:register_mob("nssm:masticone", {
makes_footstep_sound = true,
view_range = 15,
lifetimer = 500,
fear_height = 4,
rotate = 270,
walk_velocity = 1.5,
run_velocity = 2.5,

View File

@ -11,6 +11,7 @@ nssm:register_mob("nssm:mese_dragon", {
maxus = true,
view_range = 45,
rotate = 270,
fear_height = 5,
walk_velocity = 2,
run_velocity = 4,
sounds = {
@ -21,7 +22,6 @@ nssm:register_mob("nssm:mese_dragon", {
damage = 16,
jump = true,
jump_height = 10,
putter = true,
drops = {
{name = "nssm:rainbow_staff",
chance = 1,
@ -59,5 +59,23 @@ nssm:register_mob("nssm:mese_dragon", {
punch1_end = 370,
dattack_start = 120,
dattack_end = 160,
}
},
do_custom = function(self)
--transform the blocks he touches in mese_blocks
local pos = self.object:getpos()
local c=2
local v = self.object:getvelocity()
for dx = -c*(math.abs(v.x))-2 , c*(math.abs(v.x))+2 do
for dy=-1,10 do
for dz = -c*(math.abs(v.z))-2 , c*(math.abs(v.z))+2 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n~="air" and n~="nssm:mese_meteor" and n~="fire:basic_flame") then
minetest.env:set_node(t, {name="default:mese_block"})
end
end
end
end
end,
})

17722
models/giant_sandworm.x Normal file

File diff suppressed because it is too large Load Diff

19548
models/sand_bloco.x Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

182
nssm_api.lua Normal file
View File

@ -0,0 +1,182 @@
-- 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")
-- get node but use fallback for nil or unknown
function nssm: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
--check_for_death functions customized for monsters who respawns (Masticone)
function nssm: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 nssm:round(n)
return n % 1 >= 0.5 and math.ceil(n) or math.floor(n)
end
function nssm: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 nssm:explosion(pos, exp_radius, fire)
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:
nssm: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
if (obj:is_player()) then
elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item") then
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
obj:set_hp(obj:get_hp()-damage)
if (obj:get_hp() <= 0) then
if (not obj:is_player()) and obj:get_entity_name() ~= "nssm:kamehameha" then
obj:remove()
end
end
--minetest.chat_send_all("HP: "..obj:get_hp())
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 = nssm: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 = nssm: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

View File

@ -1,401 +1,90 @@
minetest.register_craftitem("nssm:sky_feather", {
description = "Sky Feather",
image = "sky_feather.png",
--non eatable craftitems
function nssm_register_noneatcraftitems (name, descr)
minetest.register_craftitem("nssm:"..name, {
description = descr,
image = name ..".png",
})
minetest.register_craftitem("nssm:snake_scute", {
description = "Snake Scute",
image = "snake_scute.png",
})
end
minetest.register_craftitem("nssm:eyed_tentacle", {
description = "Eyed Tentacle",
image = "eyed_tentacle.png",
})
nssm_register_noneatcraftitems ('sky_feather','Sky Feather')
nssm_register_noneatcraftitems ('snake_scute','Snake Scute')
nssm_register_noneatcraftitems ('eyed_tentacle','Eyed Tentacle')
nssm_register_noneatcraftitems ('king_duck_crown','King Duck Crown')
nssm_register_noneatcraftitems ('great_energy_globe','Great Energy Globe')
nssm_register_noneatcraftitems ('superior_energy_globe','Superior Energy Globe')
nssm_register_noneatcraftitems ('ant_queen_abdomen','Ant Queen Abdomen')
nssm_register_noneatcraftitems ('masticone_skull','Masticone Skull')
nssm_register_noneatcraftitems ('masticone_skull_fragments','Masticone Skull Fragments')
nssm_register_noneatcraftitems ('masticone_skull_crowned','Masticone Skull Crowned')
nssm_register_noneatcraftitems ('tentacle_curly','Kraken Tentacle')
nssm_register_noneatcraftitems ('lava_titan_eye','Lava Titan Eye')
nssm_register_noneatcraftitems ('duck_beak','Duck Beak')
nssm_register_noneatcraftitems ('ice_tooth','Ice Tooth')
nssm_register_noneatcraftitems ('little_ice_tooth','Little Ice Tooth')
nssm_register_noneatcraftitems ('black_sand',"Dahaka's Black Sand")
nssm_register_noneatcraftitems ('black_ice_tooth','Black Ice Tooth')
nssm_register_noneatcraftitems ('tarantula_chelicerae','Tarantula Chelicerae')
nssm_register_noneatcraftitems ('crab_chela','Crab Chela')
nssm_register_noneatcraftitems ('cursed_pumpkin_seed','Cursed Pumpkin Seed')
nssm_register_noneatcraftitems ('mantis_claw','Mantis Claw')
--nssm_register_noneatcraftitems ('manticore_fur','Manticore Fur')
--nssm_register_noneatcraftitems ('ant_hard_skin','Ant Hard Skin')
--nssm_register_noneatcraftitems ('bloco_skin','Bloco Skin')
--nssm_register_noneatcraftitems ('crab_carapace_fragment','Crab Carapace Fragment')
--nssm_register_noneatcraftitems ('crocodile_skin','Crocodile Skin')
nssm_register_noneatcraftitems ('manticore_spine','Manticore Spine')
nssm_register_noneatcraftitems ('night_feather','Moon Feather')
nssm_register_noneatcraftitems ('sun_feather','Sun Feather')
nssm_register_noneatcraftitems ('masticone_fang','Masticone Fang')
nssm_register_noneatcraftitems ('white_wolf_fur','White Wolf Fur')
nssm_register_noneatcraftitems ('stoneater_mandible','Stoneater Mandible')
nssm_register_noneatcraftitems ('ant_mandible','Ant Mandible')
nssm_register_noneatcraftitems ('life_energy','Life Energy')
nssm_register_noneatcraftitems ('wolf_fur','Wolf Fur')
nssm_register_noneatcraftitems ('energy_globe','Energy Globe')
minetest.register_craftitem("nssm:king_duck_crown", {
description = "King Duck Crown",
image = "king_duck_crown.png",
})
function nssm_register_eatcraftitems (name, descr, gnam)
minetest.register_craftitem("nssm:great_energy_globe", {
description = "Great Energy Globe",
image = "great_energy_globe.png",
})
minetest.register_craftitem("nssm:superior_energy_globe", {
description = "Superior Energy Globe",
image = "superior_energy_globe.png",
})
minetest.register_craftitem("nssm:ant_queen_abdomen", {
description = "Ant Queen Abdomen",
image = "ant_queen_abdomen.png",
})
minetest.register_craftitem("nssm:masticone_skull", {
description = "Masticone Skull",
image = "masticone_skull.png",
})
minetest.register_craftitem("nssm:masticone_skull_fragments", {
description = "Masticone Skull fragments",
image = "masticone_skull_fragments.png",
})
minetest.register_craftitem("nssm:masticone_skull_crowned", {
description = "Masticone Skull Crowned",
image = "masticone_skull_crowned.png",
})
minetest.register_craftitem("nssm:kraken_tentacle", {
description = "Kraken Tentacle",
image = "tentacle_curly.png",
})
minetest.register_craftitem("nssm:lava_titan_eye", {
description = "Lava Titan Eye",
image = "lava_titan_eye.png",
})
minetest.register_craftitem("nssm:duck_beak", {
description = "Duck Beak",
image = "duck_beak.png",
})
minetest.register_craftitem("nssm:ice_tooth", {
description = "Ice Tooth",
image = "ice_tooth.png",
})
minetest.register_craftitem("nssm:little_ice_tooth", {
description = "Little Ice Tooth",
image = "little_ice_tooth.png",
})
minetest.register_craftitem("nssm:black_sand", {
description = "Dahaka's black sand",
image = "black_sand.png",
})
minetest.register_craftitem("nssm:black_ice_tooth", {
description = "Black Ice Tooth",
image = "black_ice_tooth.png",
})
minetest.register_craftitem("nssm:tarantula_chelicerae", {
description = "Tarantula Chelicerae",
image = "tarantula_chelicerae.png",
})
minetest.register_craftitem("nssm:crab_chela", {
description = "Crab Chela",
image = "crab_chela.png",
})
minetest.register_craftitem("nssm:cursed_pumpkin_seed", {
description = "Cursed Pumpkin Seed",
image = "cursed_pumpkin_seed.png",
})
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, above)
pos1.y=pos1.y+1.5
minetest.add_particlespawner({
amount = 1000,
time = 0.2,
minpos = {x=pos1.x-1, y=pos1.y-1, z=pos1.z-1},
maxpos = {x=pos1.x+1, y=pos1.y+4, z=pos1.z+1},
minvel = {x=0, y=0, z=0},
maxvel = {x=1, y=5, z=1},
minacc = {x=-0.5,y=5,z=-0.5},
maxacc = {x=0.5,y=5,z=0.5},
minexptime = 1,
maxexptime = 3,
minsize = 2,
maxsize = 4,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
})
core.after(0.4, function()
minetest.add_entity(pos1, "nssm:mese_dragon")
end)
itemstack:take_item()
return itemstack
end,
})
minetest.register_craftitem("nssm:werewolf_leg", {
description = "Werewolf Leg",
image = "werewolf_leg.png",
on_use = minetest.item_eat(3),
minetest.register_craftitem("nssm:"..name, {
description = descr,
image = name..".png",
on_use = minetest.item_eat(gnam),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:heron_leg", {
description = "Moonheron Leg",
image = "heron_leg.png",
on_use = minetest.item_eat(2),
groups = { meat=1, eatable=1 },
})
end
minetest.register_craftitem("nssm:chichibios_heron_leg", {
description = "Chichibio's Moonheron Leg",
image = "chichibios_heron_leg.png",
on_use = minetest.item_eat(4),
groups = { meat=1, eatable=1 },
})
nssm_register_eatcraftitems ('werewolf_leg','Werewolf Leg',3)
nssm_register_eatcraftitems ('heron_leg','Moonheron Leg',2)
nssm_register_eatcraftitems ('chichibios_heron_leg',"Chichibio's Moonheron Leg",4)
nssm_register_eatcraftitems ('crocodile_tail','Crocodile Tail',3)
nssm_register_eatcraftitems ('roasted_crocodile_tail','Roasted Crocodile Tail',6)
nssm_register_eatcraftitems ('roasted_werewolf_leg','Roasted_Werewolf Leg',6)
nssm_register_eatcraftitems ('duck_legs','Duck Legs',1)
nssm_register_eatcraftitems ('roasted_duck_legs','Roasted Duck Leg',3)
nssm_register_eatcraftitems ('ant_leg','Ant Leg',1)
nssm_register_eatcraftitems ('roasted_ant_leg','Roasted Ant Leg',4)
nssm_register_eatcraftitems ('spider_leg','Spider Leg',1)
nssm_register_eatcraftitems ('roasted_spider_leg','Roasted Spider Leg',4)
--nssm_register_eatcraftitems ('brain','Brain',3)
--nssm_register_eatcraftitems ('roasted_brain','Roasted Brain',8)
nssm_register_eatcraftitems ('tentacle','Tentacle',2)
nssm_register_eatcraftitems ('roasted_tentacle','Roasted Tentacle',5)
nssm_register_eatcraftitems ('worm_flesh','Worm Flesh',-1)
nssm_register_eatcraftitems ('roasted_worm_flesh','Roasted Worm Flesh',3)
nssm_register_eatcraftitems ('amphibian_heart','Amphibian Heart',1)
nssm_register_eatcraftitems ('roasted_amphibian_heart','Roasted Amphibian Heart',8)
nssm_register_eatcraftitems ('raw_scrausics_wing','Raw Scrausics Wing',1)
nssm_register_eatcraftitems ('spicy_scrausics_wing','Spicy Scrausics Wing',6)
nssm_register_eatcraftitems ('phoenix_nuggets','Phoenix Nuggets',20)
nssm_register_eatcraftitems ('phoenix_tear','Phoenix Tear',20)
nssm_register_eatcraftitems ('frosted_amphibian_heart','Frosted Amphibian Heart',-1)
nssm_register_eatcraftitems ('surimi','Surimi',4)
minetest.register_craftitem("nssm:croco_tail", {
description = "Crocodile Tail",
image = "crocodile_tail.png",
on_use = minetest.item_eat(3),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:roasted_croco_tail", {
description = "Roasted Crocodile Tail",
image = "roasted_crocodile_tail.png",
on_use = minetest.item_eat(10),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:roasted_werewolf_leg", {
description = "Roasted_Werewolf Leg",
image = "roasted_werewolf_leg.png",
on_use = minetest.item_eat(6),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:duck_legs", {
description = "Duck Legs",
image = "duck_legs.png",
on_use = minetest.item_eat(1),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:roasted_duck_legs", {
description = "Roasted Duck Leg",
image = "roasted_duck_legs.png",
on_use = minetest.item_eat(3),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:ant_leg", {
description = "Ant Leg",
image = "ant_leg.png",
on_use = minetest.item_eat(2),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:roasted_ant_leg", {
description = "Roasted Ant Leg",
image = "roasted_ant_leg.png",
on_use = minetest.item_eat(4),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:spider_leg", {
description = "Spider Leg",
image = "spider_leg.png",
on_use = minetest.item_eat(2),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:roasted_spider_leg", {
description = "Roasted Spider Leg",
image = "roasted_spider_leg.png",
on_use = minetest.item_eat(4),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:brain", {
description = "Brain",
image = "brain.png",
on_use = minetest.item_eat(3),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:roasted_brain", {
description = "Roasted Brain",
image = "roasted_brain.png",
on_use = minetest.item_eat(8),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:tentacle", {
description = "Tentacle",
image = "tentacle.png",
on_use = minetest.item_eat(2),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:roasted_tentacle", {
description = "Roasted Tentacle",
image = "roasted_tentacle.png",
on_use = minetest.item_eat(5),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:worm_flesh", {
description = "Worm Flesh",
image = "worm_flesh.png",
on_use = minetest.item_eat(-1),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:roasted_worm_flesh", {
description = "Roasted Worm Flesh",
image = "roasted_worm_flesh.png",
on_use = minetest.item_eat(3),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:mantis_claw", {
description = "Mantis Claw",
image = "mantis_claw.png",
})
--[[minetest.register_craftitem("nssm:manticore_fur", {
description = "Manticore Fur",
image = "manticore_fur.png",
})]]
minetest.register_craftitem("nssm:manticore_spine", {
description = "Manticore Spine",
image = "manticore_spine.png",
})
minetest.register_craftitem("nssm:moon_feather", {
description = "Moon Feather",
image = "night_feather.png",
})
minetest.register_craftitem("nssm:sun_feather", {
description = "Sun Feather",
image = "sun_feather.png",
})
minetest.register_craftitem("nssm:amphibian_heart", {
description = "Amphibian Heart",
image = "amphibian_heart.png",
on_use = minetest.item_eat(1),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:roasted_amphibian_heart", {
description = "Roasted Amphibian Heart",
image = "roasted_amphibian_heart.png",
on_use = minetest.item_eat(8),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:raw_scrausics_wing", {
description = "Raw Scrausics Wing",
image = "raw_scrausics_wing.png",
on_use = minetest.item_eat(1),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:spicy_scrausics_wing", {
description = "Spicy Scrausics Wing",
image = "spicy_scrausics_wing.png",
on_use = minetest.item_eat(6),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:phoenix_nuggets", {
description = "Phoenix Nuggets",
image = "phoenix_nuggets.png",
on_use = minetest.item_eat(20),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:phoenix_tear", {
description = "Phoenix Tear",
image = "phoenix_tear.png",
on_use = minetest.item_eat(20),
groups = {eatable=1 },
})
minetest.register_craftitem("nssm:frosted_amphibian_heart", {
description = "Frosted Amphibian Heart",
image = "frosted_amphibian_heart.png",
on_use = minetest.item_eat(-1),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:surimi", {
description = "Surimi",
image = "surimi.png",
on_use = minetest.item_eat(4),
groups = { meat=1, eatable=1 },
})
minetest.register_craftitem("nssm:white_wolf_fur", {
description = "White Wolf Fur",
image = "white_wolf_fur.png",
})
minetest.register_craftitem("nssm:masticone_fang", {
description = "Masticone Fang",
image = "masticone_fang.png",
})
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=50, maxlevel=1},
snappy={times={[2]=0.80, [3]=0.3}, uses=100, maxlevel=1},
},
damage_groups = {fleshy=6},
},
})
minetest.register_node("nssm:venomous_gas", {
description = "Venomous Gas",
inventory_image = minetest.inventorycube("venomous_gas.png"),
drawtype = "airlike",
tiles = {
{name="venomous_gas_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
},
paramtype = "light",
walkable = false,
sunlight_propagates = true,
pointable = false,
diggable = false,
buildable_to = true,
drop = "",
drowning = 1,
damage_per_second = 1,
post_effect_color = {a=100, r=1, g=100, b=1},
groups = {flammable = 2},
})
minetest.register_node("nssm:ant_dirt", {
description = "Ant Dirt",
tiles = {"ant_dirt.png"},
groups = {crumbly=3},
})
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},
})
--ore generation
minetest.register_ore({
ore_type = "scatter",
@ -463,19 +152,62 @@ minetest.register_ore({
height_max = 40,
})
minetest.register_craftitem("nssm:life_energy", {
description = "Life Energy",
inventory_image = "life_energy.png",
minetest.register_ore({
ore_type = "scatter",
ore = "nssm:web",
wherein = "default:junglegrass",
clust_scarcity = 2*2*2,
clust_num_ores = 2,
clust_size = 2,
height_min = -20,
height_max = 200,
})
minetest.register_craftitem("nssm:wolf_fur", {
description = "Wolf Fur",
inventory_image = "wolf_fur.png",
minetest.register_ore({
ore_type = "scatter",
ore = "nssm:web",
wherein = "default:jungleleaves",
clust_scarcity = 4*4*4,
clust_num_ores = 5,
clust_size = 5,
height_min = -20,
height_max = 200,
}
)
--nodes
minetest.register_node("nssm:ant_dirt", {
description = "Ant Dirt",
tiles = {"ant_dirt.png"},
groups = {crumbly=3},
})
minetest.register_craftitem("nssm:energy_globe", {
description = "Energy Globe",
inventory_image = "energy_globe.png",
minetest.register_node("nssm:venomous_gas", {
description = "Venomous Gas",
inventory_image = minetest.inventorycube("venomous_gas.png"),
drawtype = "airlike",
tiles = {
{name="venomous_gas_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
},
paramtype = "light",
walkable = false,
sunlight_propagates = true,
pointable = false,
diggable = false,
buildable_to = true,
drop = "",
drowning = 1,
damage_per_second = 1,
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},
})
minetest.register_node("nssm:web", {
@ -499,7 +231,6 @@ minetest.register_node("nssm:web", {
groups = {flammable=2, snappy=1, liquid=1},
})
minetest.register_node("nssm:ink", {
description = "Ink",
inventory_image = minetest.inventorycube("ink.png"),
@ -548,10 +279,12 @@ minetest.register_node("nssm:pumpbomb", {
groups = {not_in_creative_inventory =1},
drop = "",
on_timer = function(pos, elapsed)
nssm:pumpbomb_explosion(pos)
nssm:explosion(pos, 3, 1)
end,
})
--abms
minetest.register_abm({
nodenames = {"nssm:mese_meteor"},
neighbors = {"air"},
@ -610,29 +343,9 @@ minetest.register_abm({
end
})
minetest.register_ore({
ore_type = "scatter",
ore = "nssm:web",
wherein = "default:junglegrass",
clust_scarcity = 2*2*2,
clust_num_ores = 2,
clust_size = 2,
height_min = -20,
height_max = 200,
})
minetest.register_ore({
ore_type = "scatter",
ore = "nssm:web",
wherein = "default:jungleleaves",
clust_scarcity = 4*4*4,
clust_num_ores = 5,
clust_size = 5,
height_min = -20,
height_max = 200,
}
)
--tools
minetest.register_tool('nssm:sun_sword', {
description = 'Sun Sword',
@ -662,7 +375,7 @@ minetest.register_tool("nssm:masticone_fang_sword", {
full_punch_interval =0.7 ,
max_drop_level=1,
groupcaps={
snappy={times={[1]=0.90, [2]=0.8, [3]=0.4}, uses=200, maxlevel=1},
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},
@ -676,7 +389,7 @@ minetest.register_tool("nssm:night_sword", {
full_punch_interval =0.4 ,
max_drop_level=1,
groupcaps={
snappy={times={[1]=0.80, [2]=0.4, [3]=0.2}, uses=300, maxlevel=1},
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},
@ -721,7 +434,6 @@ minetest.register_node("nssm:rope", {
groups = {snappy=1},
})
minetest.register_tool("nssm:stoneater_pick", {
description = "Stoneater Pickaxe",
inventory_image = "stoneater_pick.png",
@ -735,6 +447,19 @@ minetest.register_tool("nssm:stoneater_pick", {
},
})
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=50, maxlevel=1},
snappy={times={[2]=0.80, [3]=0.3}, uses=100, maxlevel=1},
},
damage_groups = {fleshy=6},
},
})
minetest.register_tool("nssm:ant_sword", {
description = "Ant Sword",
@ -749,17 +474,7 @@ minetest.register_tool("nssm:ant_sword", {
},
})
minetest.register_craftitem("nssm:stoneater_mandible", {
description = "Stoneater Mandible",
image = "stoneater_mandible.png",
})
minetest.register_craftitem("nssm:ant_mandible", {
description = "Ant Mandible",
image = "ant_mandible.png",
})
--ricette
--recipes
minetest.register_craft({
output = 'nssm:mantis_sword',
@ -833,7 +548,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'nssm:mese_egg',
recipe = {
@ -1019,9 +733,6 @@ minetest.register_craft({
}
})
--Eggs
function nssm_register_egg (name, descr)
@ -1047,6 +758,7 @@ 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_egg ('duckking', 'Duckking')
@ -1069,6 +781,7 @@ nssm_register_egg ('scrausics', 'Scrausics')
nssm_register_egg ('moonheron', 'Moonheron')
nssm_register_egg ('dahaka', 'Dahaka')
nssm_register_egg ('sandworm', 'Sandworm')
nssm_register_egg ('giant_sandworm', 'Giant Sandworm')
nssm_register_egg ('ant_queen', 'Ant Queen')
nssm_register_egg ('ant_soldier', 'Ant Soldier')
nssm_register_egg ('ant_worker', 'Ant Worker')
@ -1076,6 +789,7 @@ 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_egg ('tarantula', 'Tarantula')
@ -1086,3 +800,35 @@ nssm_register_egg ('manticore', 'Manticore')
nssm_register_egg ('pumpboom_large', 'Large Pumpboom')
nssm_register_egg ('pumpboom_small', 'Small Pumpboom')
nssm_register_egg ('pumpboom_medium', 'Medium Pumpboom')
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, above)
pos1.y=pos1.y+1.5
minetest.add_particlespawner({
amount = 1000,
time = 0.2,
minpos = {x=pos1.x-1, y=pos1.y-1, z=pos1.z-1},
maxpos = {x=pos1.x+1, y=pos1.y+4, z=pos1.z+1},
minvel = {x=0, y=0, z=0},
maxvel = {x=1, y=5, z=1},
minacc = {x=-0.5,y=5,z=-0.5},
maxacc = {x=0.5,y=5,z=0.5},
minexptime = 1,
maxexptime = 3,
minsize = 2,
maxsize = 4,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
})
core.after(0.4, function()
minetest.add_entity(pos1, "nssm:mese_dragon")
end)
itemstack:take_item()
return itemstack
end,
})

271
nssm_weapons.lua Normal file
View File

@ -0,0 +1,271 @@
--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
--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
timer)
local pos = self.object:getpos()
--Disappear after a certain time
minetest.register_globalstep(function(dtime)
timer = timer + dtime
if timer>max_time then
self.object:remove()
end
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 = 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
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
timer)
local pos = self.object:getpos()
minetest.register_globalstep(function(dtime)
timer = timer + dtime
if timer>max_time then
self.object:remove()
end
end)
--while going around it damages entities
local objects = minetest.env:get_objects_inside_radius(pos, 2)
for _,obj in ipairs(objects) do
if (obj:is_player()) then
elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item") then
obj:set_hp(obj:get_hp()-damage)
if (obj:get_hp() <= 0) then
if (not obj:is_player()) and obj:get_entity_name() ~= self.object:get_luaentity().name then
obj:remove()
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 = nssm: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}
minetest.env:remove_node(p)
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,
})
minetest.register_tool("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)
return itemstack
end,
})
minetest.register_craft({
output = 'nssm:'..name.."_hand",
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, 10, 20, default_dir, 1, "stone", 25,0)
end,
hit_node = function(self, pos, node)
nssm:explosion(pos, 6, 1)
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,0)
end,
hit_node = function(self, pos, node)
end,
material = "nssm:king_duck_crown",
description = "Kienzan from DragonBall",
})
nssm_register_weapon("spirit_ball", {
velocity = 25,
on_step = function(self, dtime)
search_on_step(self, dtime, 5, 30, 25, 0)
end,
hit_node = function(self, pos, node)
nssm:explosion(pos, 4, 0)
end,
material = "nssm:cursed_pumpkin_seed",
description = "Spirit Ball from DragonBall",
})

View File

@ -51,3 +51,62 @@ nssm:register_mob("nssm:octopus", {
punch_end = 160,
}
})
nssm:register_mob("nssm:xgaloctopus", {
type = "monster",
hp_max = 30,
hp_min = 27,
collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
visual = "mesh",
mesh = "octopus.x",
textures = {{"xgaloctopus.png"}},
visual_size = {x=1, y=1},
view_range = 25,
fly = true,
fly_in = "default:water_source",
fall_speed = -20,
walk_velocity = 1.5,
run_velocity = 3,
damage = 5,
reach = 1,
rotate = 270,
jump = false,
jump_chance = 0,
jump_height = 0,
sounds = {
random = "octopus",
},
drops = {
{name = "nssm:life_energy",
chance = 1,
min = 2,
max = 3,},
{name = "nssm:tentacle",
chance = 1,
min = 1,
max = 8,},
},
armor = 60,
drawtype = "front",
water_damage = 0,
lava_damage = 10,
light_damage = 0,
on_rightclick = nil,
attack_type = "dogfight",
animation = {
speed_normal = 25,
speed_run = 35,
stand_start = 1,
stand_end = 50,
walk_start = 60,
walk_end = 100,
run_start = 60,
run_end = 100,
punch_start = 120,
punch_end = 160,
},
replace_rate = 1,
replace_what = {"default:torch"},
replace_with = "default:water_source",
replace_offset = 0,
})

View File

@ -11,6 +11,7 @@ nssm:register_mob("nssm:pumpboom_small", {
explosion_radius = 4,
makes_footstep_sound = true,
view_range = 20,
fear_height = 4,
walk_velocity = 2,
run_velocity = 2.5,
sounds = {

View File

@ -10,6 +10,7 @@ nssm:register_mob("nssm:pumpking", {
makes_footstep_sound = true,
lifetimer=500,
rotate=270,
fear_height = 4,
view_range = 35,
walk_velocity = 2,
run_velocity = 4,

50
sand_bloco.lua Normal file
View File

@ -0,0 +1,50 @@
nssm:register_mob("nssm:sand_bloco", {
type = "monster",
hp_max = 23,
hp_min = 17,
collisionbox = {-0.5, -0.2, -0.5, 0.5, 1.3, 0.5},
visual = "mesh",
mesh = "sand_bloco.x",
textures = {{"sand_bloco.png"}},
visual_size = {x=4, y=4},
makes_footstep_sound = true,
view_range = 14,
fear_height = 4,
walk_velocity = 1,
run_velocity = 2,
rotate = 270,
sounds = {
random = "bloco",
},
damage = 3,
jump = true,
drops = {
{name = "nssm:life_energy",
chance = 1,
min = 1,
max = 1,},
{name = "default:sandstone",
chance = 1,
min = 2,
max = 3,},
},
armor = 70,
drawtype = "front",
water_damage = 10,
lava_damage = 1,
light_damage = 0,
on_rightclick = nil,
attack_type = "dogfight",
animation = {
speed_normal = 20,
speed_run = 20,
stand_start = 10,
stand_end = 90,
walk_start = 140,
walk_end = 180,
run_start = 190,
run_end = 200,
punch_start = 100,
punch_end = 130,
}
})

View File

@ -2,15 +2,16 @@ nssm:register_mob("nssm:sandworm", {
type = "monster",
hp_max = 30,
hp_min = 25,
collisionbox = {-0.6, -0.2, -0.6, 0.6, 1.90, 0.6},
collisionbox = {-0.4, -0.2, -0.4, 0.4, 1.90, 0.4},
visual = "mesh",
mesh = "sandworm.x",
textures = {{"sandworm.png"}},
visual_size = {x=10, y=10},
visual_size = {x=4, y=4},
makes_footstep_sound = false,
view_range = 17,
rotate = 270,
worm = true,
reach = 4,
fear_height = 3,
walk_velocity = 2,
run_velocity = 2,
damage = 4,
@ -36,12 +37,32 @@ nssm:register_mob("nssm:sandworm", {
speed_normal = 25,
speed_run = 40,
stand_start = 1,
stand_end = 30,
walk_start = 30,
walk_end = 70,
run_start = 30,
run_end = 70,
punch_start = 70,
punch_end = 90,
}
stand_end = 100,
walk_start = 110,
walk_end = 140,
run_start = 110,
run_end = 140,
punch_start = 150,
punch_end = 180,
},
do_custom = function(self)
--Worm
local c=2
local pos = self.object:getpos()
local v = self.object:getvelocity()
for dx = -c*(math.abs(v.x))-1 , c*(math.abs(v.x))+1 do
for dy=0,2 do
for dz = -c*(math.abs(v.z))-1 , c*(math.abs(v.z))+1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n~="default:water_source" and n~="default:water_flowing") then
if n=="default:sand" or n=="default:desert_sand" then
minetest.env:set_node(t, {name="air"})
end
end
end
end
end
end,
})

View File

@ -10,6 +10,7 @@ nssm:register_mob("nssm:signosigno", {
makes_footstep_sound = false,
view_range = 15,
walk_velocity = 1.5,
fear_height = 4,
run_velocity = 2.5,
rotate = 270,
damage = 3,

View File

@ -10,14 +10,15 @@ nssm:register_mob("nssm:snow_biter", {
makes_footstep_sound = true,
view_range = 18,
rotate = 270,
froster = true,
mele_number = 2,
fear_height = 4,
reach = 1.5,
walk_velocity = 0.8,
run_velocity = 3,
sounds = {
random = "snow_biter",
},
--pathfinding = true,
damage = 5,
jump = true,
drops = {
@ -54,5 +55,23 @@ nssm:register_mob("nssm:snow_biter", {
punch_end = 190,
punch1_start = 200,
punch1_end = 215
}
},
do_custom = function(self)
--Froster
local c=2
local pos = self.object:getpos()
local v = self.object:getvelocity()
for dx = -c*(math.abs(v.x))-1 , c*(math.abs(v.x))+1 do
for dy=-1,0 do
for dz = -c*(math.abs(v.z))-1 , c*(math.abs(v.z))+1 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n=="default:water_source" or n=="default:water_flowing") then
minetest.env:set_node(t, {name="default:ice"})
end
end
end
end
end,
})

View File

@ -13,7 +13,7 @@ nssm:spawn_specific("nssm:uloboros", {"default:jungle_grass", "default:jungletre
-- CAVES
nssm:spawn_specific("nssm:bloco", {"default:stone"}, {"default:stone"}, 0, 20, 30, 500, 3, -31000, -20)
nssm:spawn_specific("nssm:lava_titan", {"default:stone"}, {"air"}, 0, 120, 12, 2000, 1, -31000, -50)
nssm:spawn_specific("nssm:lava_titan", {"default:stone"}, {"air"}, 0, 120, 12, 8000, 1, -31000, -50)
nssm:spawn_specific("nssm:stone_eater", {"default:stone"}, {"default:stone"}, 0, 20, 40, 700, 2, -31000, -20)
nssm:spawn_specific("nssm:signosigno", {"default:stone"}, {"default:stone"}, 0, 10, 20, 400, 2, -31000, -20)
nssm:spawn_specific("nssm:signosigno", {"bones:bones"}, {"air"}, 0, 15, 3, 1, 5, -31000, 31000)
@ -26,8 +26,10 @@ nssm:spawn_specific("nssm:kraken", {"default:water_source"}, {"default:water_sou
nssm:spawn_specific("nssm:octopus", {"default:water_source"}, {"default:water_source"}, 0, 20, 60, 40000, 1, -31000, 0)
-- DESERT
nssm:spawn_specific("nssm:dahaka", {"default:desert_sand", "default:desert_stone"}, {"air"}, 0, 20, 1200, 20000, 1, -31000, 31000)
nssm:spawn_specific("nssm:sandworm", {"default:desert_sand", "default:desert_stone"}, {"default:sand"}, 0, 20, 20, 5000, 1, -31000, 31000)
--nssm:spawn_specific("nssm:dahaka", {"default:desert_sand", "default:desert_stone"}, {"air"}, 0, 20, 1200, 20000, 1, -31000, 31000)
nssm:spawn_specific("nssm:sandworm", {"default:desert_sand", "default:desert_stone"}, {"default:sand"}, 0, 20, 20, 3000, 1, -31000, 31000)
nssm:spawn_specific("nssm:giant_sandworm", {"default:desert_sand", "default:desert_stone"}, {"default:sand"}, 0, 20, 1200, 40000, 1, -31000, 31000)
nssm:spawn_specific("nssm:sand_bloco", {"default:desert_sand", "default:desert_stone"}, {"default:sand"}, 0, 20, 20, 1000, 1, -31000, 31000)
-- DUCKS
nssm:spawn_specific("nssm:duck", {"default:dirt_with_grass"}, {"group:flora"}, 10, 20, 20, 200, 1, -31000, 31000)
@ -64,3 +66,8 @@ nssm:spawn_specific("nssm:pumpboom_small", {"default:dirt_with_grass", "default:
nssm:spawn_specific("nssm:pumpboom_medium", {"default:dirt_with_grass", "default:dirt_with_snow","default:snowblock"}, {"default:pine_tree"}, 0, 20, 30, 400, 1, -31000, 31000)
nssm:spawn_specific("nssm:pumpboom_large", {"default:dirt_with_grass", "default:dirt_with_snow","default:snowblock"}, {"default:pine_tree"}, 0, 20, 30, 500, 1, -31000, 31000)
nssm:spawn_specific("nssm:pumpking", {"default:dirt_with_grass", "default:dirt_with_snow","default:snowblock"}, {"default:pine_needles", "default:pine_tree"}, 0, 12, 120, 10000, 1, -31000, 31000)
-- NSSB SPECIAL
if minetest.get_modpath("nssb") then
nssm:spawn_specific("nssm:xgaloctopus", {"default:water_source"}, {"nssb:marine_brick"}, 0, 20, 20, 800, 1, -31000, 0)
end

View File

@ -8,6 +8,7 @@ nssm:register_mob("nssm:spiderduck", {
mesh = "spiderduck.x",
textures = {{"spiderduck.png"}},
visual_size = {x=2, y=2},
fear_height = 4,
makes_footstep_sound = true,
view_range = 24,
walk_velocity = 2,

View File

@ -8,10 +8,10 @@ nssm:register_mob("nssm:stone_eater", {
textures = {{"stone_eater.png"}},
visual_size = {x=10, y=10},
makes_footstep_sound = false,
stone_pooper = true,
view_range = 16,
rotate = 270,
worm=true,
fear_height = 4,
jump = false,
jump_height =0,
walk_velocity = 1,
@ -49,5 +49,25 @@ nssm:register_mob("nssm:stone_eater", {
run_end = 150,
punch_start = 160,
punch_end = 185,
}
},
do_custom = function(self)
--Remove stone around
local pos = self.object:getpos()
local c=3
local v = self.object:getvelocity()
for dx = -c*(math.abs(v.x))-1 , c*(math.abs(v.x))+1 do
for dy=0,1 do
for dz = -c*(math.abs(v.z))-1 , c*(math.abs(v.z))+1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(t).name
if (n~="default:water_source" and n~="default:water_flowing") then
if n=="default:stone" or n=="default:sandstone" or n=="default:cobble" then
minetest.env:set_node(t, {name="air"})
end
end
end
end
end
end,
})

View File

@ -11,6 +11,7 @@ nssm:register_mob("nssm:tarantula", {
view_range = 20,
lifetimer = 500,
walk_velocity = 1.5,
fear_height = 4,
run_velocity = 3,
rotate = 270,
sounds = {

BIN
textures/ant_hard_skin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

BIN
textures/bloco_skin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

BIN
textures/crocodile_skin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

BIN
textures/sand_bloco.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
textures/sand_bloco_egg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 40 KiB

BIN
textures/spirit_ball.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

BIN
textures/xgaloctopus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

View File

@ -10,6 +10,7 @@ nssm:register_mob("nssm:uloboros", {
makes_footstep_sound = true,
view_range = 22,
walk_velocity = 1.5,
fear_height = 4,
run_velocity = 2.5,
rotate = 270,
sounds = {
@ -34,7 +35,6 @@ nssm:register_mob("nssm:uloboros", {
armor = 100,
drawtype = "front",
water_damage = 1,
webber = true,
lava_damage = 7,
light_damage = 0,
on_rightclick = nil,
@ -50,5 +50,20 @@ nssm:register_mob("nssm:uloboros", {
run_end = 160,
punch_start = 80,
punch_end = 110,
}
},
do_custom = function(self)
--Webber: puts web around himself
local pos = self.object:getpos()
if (math.random(1,75)==1) then
local dx=math.random(1,3)
local dz=math.random(1,3)
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")) then
minetest.env:set_node(t, {name="nssm:web"})
end
end
end,
})

View File

@ -10,6 +10,7 @@ nssm:register_mob("nssm:werewolf", {
makes_footstep_sound = true,
view_range = 30,
walk_velocity = 3,
fear_height = 4,
run_velocity = 5,
sounds = {
random = "werewolf",

View File

@ -10,6 +10,7 @@ nssm:register_mob("nssm:white_werewolf", {
makes_footstep_sound = true,
view_range = 30,
walk_velocity = 3,
fear_height = 4,
run_velocity = 5,
sounds = {
random = "werewolf",