Removed references to the old APIS

master
npx 2016-05-19 15:30:07 +02:00
parent 0f1610be11
commit 1121f6cbc7
18 changed files with 69 additions and 69 deletions

View File

@ -91,7 +91,7 @@ mobs:register_mob("nssm:ant_queen", {
and (minetest.env:get_node(pos1).name == "air")
and (counter < 4)
then
nssm:explosion_particles(pos1, 1)
explosion_particles(pos1, 1)
minetest.add_entity(pos1, "nssm:ant_soldier")
end
end

View File

@ -53,6 +53,6 @@ mobs:register_mob("nssm:black_widow", {
punch_end = 160,
},
do_custom = function(self)
nssm:webber_ability(self, "nssm:web", 2)
webber_ability(self, "nssm:web", 2)
end,
})

View File

@ -1,5 +1,5 @@
-- arrow (duck_arrow)
nssm:register_arrow("nssm:duck_father", {
mobs:register_arrow("nssm:duck_father", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"duck_egg.png"},
@ -7,21 +7,21 @@ nssm:register_arrow("nssm:duck_father", {
-- direct hit
hit_player = function(self, player)
local pos = self.object:getpos()
nssm:duck_explosion(pos)
duck_explosion(pos)
end,
hit_mob = function(self, player)
local pos = self.object:getpos()
nssm:duck_explosion(pos)
duck_explosion(pos)
end,
hit_node = function(self, pos, node)
nssm:duck_explosion(pos)
duck_explosion(pos)
end,
})
function nssm:duck_explosion(pos)
function duck_explosion(pos)
pos.y = pos.y+1;
minetest.add_particlespawner({
amount = 10,
@ -66,7 +66,7 @@ function nssm:duck_explosion(pos)
end
-- snow_arrow
nssm:register_arrow("nssm:snow_arrow", {
mobs:register_arrow("nssm:snow_arrow", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"transparent.png"},
@ -74,19 +74,19 @@ nssm:register_arrow("nssm:snow_arrow", {
-- direct hit
hit_player = function(self, player)
local pos = self.object:getpos()
nssm:ice_explosion(pos)
ice_explosion(pos)
end,
hit_mob = function(self, player)
local pos = self.object:getpos()
nssm:ice_explosion(pos)
ice_explosion(pos)
end,
hit_node = function(self, pos, node)
nssm:ice_explosion(pos)
ice_explosion(pos)
end,
})
function nssm:ice_explosion(pos)
function ice_explosion(pos)
for i=pos.x-math.random(0, 1), pos.x+math.random(0, 1), 1 do
for j=pos.y-1, pos.y+4, 1 do
for k=pos.z-math.random(0, 1), pos.z+math.random(0, 1), 1 do
@ -97,7 +97,7 @@ function nssm:ice_explosion(pos)
end
-- arrow manticore
nssm:register_arrow("nssm:spine", {
mobs:register_arrow("nssm:spine", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"manticore_spine_flying.png"},
@ -119,12 +119,12 @@ nssm:register_arrow("nssm:spine", {
})
--morbat arrow
nssm:register_arrow("nssm:morarrow", {
mobs:register_arrow("nssm:morarrow", {
visual = "sprite",
visual_size = {x=0.5, y=0.5},
textures = {"morarrow.png"},
velocity= 13,
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
@ -134,7 +134,7 @@ nssm:register_arrow("nssm:morarrow", {
})
-- web arrow
nssm:register_arrow("nssm:webball", {
mobs:register_arrow("nssm:webball", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"web_ball.png"},
@ -142,7 +142,7 @@ nssm:register_arrow("nssm:webball", {
-- direct hit
hit_player = function(self, player)
local p = player:getpos()
nssm:explosion_web(p)
explosion_web(p)
end,
hit_mob = function(self, player)
@ -153,11 +153,11 @@ nssm:register_arrow("nssm:webball", {
end,
hit_node = function(self, pos, node)
nssm:explosion_web(pos)
explosion_web(pos)
end
})
function nssm:explosion_web(pos)
function explosion_web(pos)
if minetest.is_protected(pos, "") then
return
end
@ -182,7 +182,7 @@ function nssm:explosion_web(pos)
end
-- arrow=>phoenix arrow
nssm:register_arrow("nssm:phoenix_arrow", {
mobs:register_arrow("nssm:phoenix_arrow", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"transparent.png"},
@ -223,7 +223,7 @@ nssm:register_arrow("nssm:phoenix_arrow", {
end,
})
nssm:register_arrow("nssm:super_gas", {
mobs:register_arrow("nssm:super_gas", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"transparent.png"},
@ -231,16 +231,16 @@ nssm:register_arrow("nssm:super_gas", {
-- direct hit
hit_player = function(self, player)
local p = player:getpos()
nssm:gas_explosion(p)
gas_explosion(p)
end,
hit_node = function(self, pos, node)
nssm:gas_explosion(pos)
gas_explosion(pos)
end
})
function nssm:gas_explosion(pos)
function gas_explosion(pos)
if minetest.is_protected(pos, "") then
return
end
@ -261,7 +261,7 @@ function nssm:gas_explosion(pos)
end
--
nssm:register_arrow("nssm:roar_of_the_dragon", {
mobs:register_arrow("nssm:roar_of_the_dragon", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"transparent.png"},

View File

@ -62,6 +62,6 @@ mobs:register_mob("nssm:icelamander", {
shoot_end = 210,
},
do_custom = function(self)
nssm:midas_ability(self, "default:ice", self.run_velocity,1, 3)
midas_ability(self, "default:ice", self.run_velocity,1, 3)
end,
})

View File

@ -53,6 +53,6 @@ mobs:register_mob("nssm:icesnake", {
punch_end = 160,
},
do_custom = function(self)
nssm:putting_ability(self, "default:ice", self.run_velocity)
putting_ability(self, "default:ice", self.run_velocity)
end,
})

View File

@ -1,5 +1,5 @@
local path = minetest.get_modpath("nssm")
dofile(path.."/api.lua")
--dofile(path.."/api.lua")
--dofile(path.."/spawn.lua")
--Mobs
@ -8,7 +8,7 @@ dofile(path.."/ant_soldier.lua")
dofile(path.."/ant_worker.lua")
dofile(path.."/black_widow.lua")
dofile(path.."/bloco.lua")
dofile(path.."/pupumolle.lua")
--dofile(path.."/pupumolle.lua")
dofile(path.."/crab.lua")
dofile(path.."/crocodile.lua")
dofile(path.."/daddy_long_legs.lua")

View File

@ -80,7 +80,7 @@ mobs:register_mob("nssm:lava_titan", {
shoot_end=400,
},
do_custom = function (self)
nssm:digging_ability(self, nil, self.run_velocity, {x=0, y=5, z=0})
nssm:putting_ability(self, "default:lava_source", self.run_velocity)
digging_ability(self, nil, self.run_velocity, {x=0, y=5, z=0})
putting_ability(self, "default:lava_source", self.run_velocity)
end,
})

View File

@ -61,7 +61,7 @@ mobs:register_mob("nssm:mese_dragon", {
dattack_end = 160,
},
do_custom = function(self)
nssm:midas_ability(self, "default:mese_block", self.run_velocity,2, 3)
midas_ability(self, "default:mese_block", self.run_velocity,2, 3)
end,
custom_attack = function(self)

View File

@ -92,7 +92,7 @@ mobs:register_mob("nssm:mordain", {
d.x = p.x + math.random(-m,m)
d.z = p.z + math.random(-m,m)
d.y = p.y
local dist = nssm:dist_pos(d, p)
local dist = dist_pos(d, p)
if dist>=2 then
for j = -3,3 do
ty = d.y + j

View File

@ -6,7 +6,7 @@ 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)
function node_ok(pos, fallback)
fallback = fallback or "default:dirt"
local node = minetest.get_node_or_nil(pos)
if not node then
@ -18,14 +18,14 @@ function nssm:node_ok(pos, fallback)
return minetest.registered_nodes[fallback]
end
function nssm:dist_pos(p, s)
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 nssm:check_for_death_hydra(self)
function check_for_death_hydra(self)
local hp = self.object:get_hp()
if hp > 0 then
self.health = hp
@ -50,7 +50,7 @@ function nssm:check_for_death_hydra(self)
end
function nssm:round(n)
function round(n)
if (n>0) then
return n % 1 >= 0.5 and math.ceil(n) or math.floor(n)
else
@ -60,7 +60,7 @@ function nssm:round(n)
end
end
function nssm:explosion_particles(pos, exp_radius)
function explosion_particles(pos, exp_radius)
minetest.add_particlespawner(
100*exp_radius/2, --amount
0.1, --time
@ -79,7 +79,7 @@ function nssm:explosion_particles(pos, exp_radius)
)
end
function nssm:explosion(pos, exp_radius, fire)
function 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, "")
@ -94,7 +94,7 @@ function nssm:explosion(pos, exp_radius, fire)
})
--particles:
nssm:explosion_particles(pos, exp_radius)
explosion_particles(pos, exp_radius)
--Damages entities around (not the player)
local objects = minetest.env:get_objects_inside_radius(pos, exp_radius)
@ -134,7 +134,7 @@ function nssm:explosion(pos, exp_radius, fire)
and data[vi] ~= c_brick
and data[vi] ~= c_chest then
local n = nssm:node_ok(p).name
local n = node_ok(p).name
local on_blast = minetest.registered_nodes[n].on_blast
if on_blast then
@ -173,7 +173,7 @@ function nssm:explosion(pos, exp_radius, fire)
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 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)
@ -188,7 +188,7 @@ function nssm:explosion(pos, exp_radius, fire)
end
-- SPECIAL ABILITIES OF SOME MOBS
function nssm:digging_ability(
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
@ -218,15 +218,15 @@ function nssm:digging_ability(
local multiplier = 2
if x>0 then
i = nssm:round(x*max_vel)*multiplier
i = round(x*max_vel)*multiplier
else
i1 = nssm:round(x*max_vel)*multiplier
i1 = round(x*max_vel)*multiplier
end
if z>0 then
k = nssm:round(z*max_vel)*multiplier
k = round(z*max_vel)*multiplier
else
k1 = nssm:round(z*max_vel)*multiplier
k1 = round(z*max_vel)*multiplier
end
for dx = i1, i do
@ -252,7 +252,7 @@ function nssm:digging_ability(
end
function nssm:putting_ability( --puts under the mob the block defined as 'p_block'
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
@ -292,7 +292,7 @@ function nssm:putting_ability( --puts under the mob the block defined as 'p_blo
end
function nssm:webber_ability( --puts randomly around the block defined as w_block
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
@ -312,7 +312,7 @@ function nssm:webber_ability( --puts randomly around the block defined as w_blo
end
end
function nssm:midas_ability( --ability to transform every blocks it touches in the m_block block
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
@ -340,15 +340,15 @@ function nssm:midas_ability( --ability to transform every blocks it touches in
local multiplier = mult
if x>0 then
i = nssm:round(x*max_vel)*multiplier
i = round(x*max_vel)*multiplier
else
i1 = nssm:round(x*max_vel)*multiplier
i1 = round(x*max_vel)*multiplier
end
if z>0 then
k = nssm:round(z*max_vel)*multiplier
k = round(z*max_vel)*multiplier
else
k1 = nssm:round(z*max_vel)*multiplier
k1 = round(z*max_vel)*multiplier
end
for dx = i1, i do

View File

@ -279,7 +279,7 @@ minetest.register_node("nssm:pumpbomb", {
groups = {not_in_creative_inventory =1},
drop = "",
on_timer = function(pos, elapsed)
nssm:explosion(pos, 3, 1)
explosion(pos, 3, 1)
minetest.env:set_node(pos, {name="air"})
end,
})

View File

@ -16,7 +16,7 @@ local function weapons_shot(itemstack, placer, pointed_thing, velocity, name)
end
local function hit(pos, self)
local node = nssm:node_ok(pos).name
local node = node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
@ -177,7 +177,7 @@ local function search_on_step(
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
local node = node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
@ -187,7 +187,7 @@ local function search_on_step(
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
local node = node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
@ -213,7 +213,7 @@ local function default_on_step(
if os.time() - self.life_time > max_time then
local node = nssm:node_ok(pos).name
local node = node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
@ -236,7 +236,7 @@ local function default_on_step(
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
local node = node_ok(pos).name
self.hit_node(self, pos, node)
self.object:remove()
return
@ -351,7 +351,7 @@ nssm_register_weapon("kamehameha", {
default_on_step(self, dtime, 4, 20, default_dir, 1, "stone", 25)
end,
hit_node = function(self, pos, node)
nssm:explosion(pos, 6, 1)
explosion(pos, 6, 1)
end,
material = "default:diamondblock",
description = "Kamehameha from DragonBall",
@ -376,7 +376,7 @@ nssm_register_weapon("spirit_ball", {
search_on_step(self, dtime, 5, 30, 25)
end,
hit_node = function(self, pos, node)
nssm:explosion(pos, 4, 0)
explosion(pos, 4, 0)
end,
material = "nssm:cursed_pumpkin_seed",
@ -390,7 +390,7 @@ nssm_register_weapon("hellzone_grenade", {
search_on_step2(self, dtime, 30, 30, 25)
end,
hit_node = function(self, pos, node)
nssm:explosion(pos, 4, 0)
explosion(pos, 4, 0)
end,
on_drop = function(itemstack, user, pointed_thing)

View File

@ -45,7 +45,7 @@ mobs:register_mob("nssm:pumpking", {
speed_normal = 15, speed_run = 15,
},
on_die=function(self,pos)
nssm:explosion(pos, 3, 0, 1, self.sounds.explode)
explosion(pos, 3, 0, 1, self.sounds.explode)
end,
custom_attack = function(self)
if self.timer >3 then

View File

@ -1,4 +1,4 @@
nssm:register_mob("nssm:pupumolle", {
mobs:register_mob("nssm:pupumolle", {
type = "animal",
hp_max = 15,
hp_min = 14,

View File

@ -46,6 +46,6 @@ mobs:register_mob("nssm:sandworm", {
punch_end = 180,
},
do_custom = function(self)
nssm:digging_ability(self, "sand", self.run_velocity, {x=0, y=2, z=0})
digging_ability(self, "sand", self.run_velocity, {x=0, y=2, z=0})
end,
})

View File

@ -58,6 +58,6 @@ mobs:register_mob("nssm:snow_biter", {
punch2_end = 215
},
do_custom = function(self)
nssm:putting_ability(self, "default:ice", self.run_velocity)
putting_ability(self, "default:ice", self.run_velocity)
end,
})

View File

@ -51,6 +51,6 @@ mobs:register_mob("nssm:stone_eater", {
punch_end = 185,
},
do_custom = function(self)
nssm:digging_ability(self, "stone", self.run_velocity, {x=0, y=2, z=0})
digging_ability(self, "stone", self.run_velocity, {x=0, y=2, z=0})
end,
})

View File

@ -53,6 +53,6 @@ mobs:register_mob("nssm:uloboros", {
punch_end = 110,
},
do_custom = function(self)
nssm:webber_ability(self, "nssm:web", 2)
webber_ability(self, "nssm:web", 2)
end,
})