Working on the lava titan to make it less laggus
This commit is contained in:
parent
6a62942713
commit
41b185b8f8
23
darts.lua
23
darts.lua
@ -304,3 +304,26 @@ mobs:register_arrow("nssm:roar_of_the_dragon", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
mobs:register_arrow("nssm:lava_arrow", {
|
||||||
|
visual = "sprite",
|
||||||
|
visual_size = {x = 1, y = 1},
|
||||||
|
textures = {"transparent.png"},
|
||||||
|
velocity = 10,
|
||||||
|
-- direct hit
|
||||||
|
hit_player = function(self, player)
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
for dy=-1, 6, 1 do
|
||||||
|
for dx=-1, 1, 2 do
|
||||||
|
for dz=-1, 1, 2 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~="default:lava_flowing" and not minetest.is_protected(p, "") then
|
||||||
|
minetest.set_node(p, {name="default:lava_flowing"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
@ -2,11 +2,11 @@ mobs:register_mob("nssm:lava_titan", {
|
|||||||
type = "monster",
|
type = "monster",
|
||||||
hp_max = 180,
|
hp_max = 180,
|
||||||
hp_min = 180,
|
hp_min = 180,
|
||||||
collisionbox = {-0.6, -0.05, -0.6, 0.6, 4.0, 0.6},
|
collisionbox = {-0.45, -0.05, -0.45, 0.45, 1.8, 0.45},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "lava_titan.x",
|
mesh = "lava_titan.x",
|
||||||
textures = {{"lava_titan.png"}},
|
textures = {{"lava_titan.png"}},
|
||||||
visual_size = {x=4, y=4},
|
visual_size = {x=2.7, y=2.7},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
view_range = 20,
|
view_range = 20,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
@ -17,7 +17,7 @@ mobs:register_mob("nssm:lava_titan", {
|
|||||||
sounds = {
|
sounds = {
|
||||||
random = "lava_titan",
|
random = "lava_titan",
|
||||||
},
|
},
|
||||||
damage = 10,
|
damage = 8,
|
||||||
jump = false,
|
jump = false,
|
||||||
jump_height=0,
|
jump_height=0,
|
||||||
drops = {
|
drops = {
|
||||||
@ -36,19 +36,17 @@ mobs:register_mob("nssm:lava_titan", {
|
|||||||
},
|
},
|
||||||
armor = 20,
|
armor = 20,
|
||||||
drawtype = "front",
|
drawtype = "front",
|
||||||
water_damage = 4,
|
water_damage = 25,
|
||||||
rotate = 270,
|
rotate = 270,
|
||||||
melter = true,
|
|
||||||
light_damage = 0,
|
light_damage = 0,
|
||||||
lava_damage = 0,
|
lava_damage = 0,
|
||||||
on_rightclick = nil,
|
on_rightclick = nil,
|
||||||
floats = 1,
|
floats = 0,
|
||||||
attack_type = "dogshoot",
|
attack_type = "dogshoot",
|
||||||
dogshoot_stop = true,
|
dogshoot_switch = true,
|
||||||
arrow = "nssm:lava_arrow",
|
arrow = "nssm:lava_arrow",
|
||||||
shoot_interval = 2,
|
shoot_interval = 2,
|
||||||
shoot_offset = -1,
|
shoot_offset = -1,
|
||||||
true_dist_attack = true,
|
|
||||||
--[[
|
--[[
|
||||||
on_dist_attack = function(self, player)
|
on_dist_attack = function(self, player)
|
||||||
local pos = player:getpos()
|
local pos = player:getpos()
|
||||||
@ -80,7 +78,37 @@ mobs:register_mob("nssm:lava_titan", {
|
|||||||
shoot_end=400,
|
shoot_end=400,
|
||||||
},
|
},
|
||||||
do_custom = function (self)
|
do_custom = function (self)
|
||||||
digging_ability(self, nil, self.run_velocity, {x=0, y=5, z=0})
|
digging_attack(self, nil, self.run_velocity, {x=0, y=4, z=0})
|
||||||
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,
|
end,
|
||||||
|
--[[
|
||||||
|
custom_attack = function (self)
|
||||||
|
digging_attack
|
||||||
|
set_animation(self, "punch")
|
||||||
|
local p2 = p
|
||||||
|
local s2 = s
|
||||||
|
|
||||||
|
p2.y = p2.y + 1.5
|
||||||
|
s2.y = s2.y + 1.5
|
||||||
|
|
||||||
|
if line_of_sight_water(self, p2, s2) == true then
|
||||||
|
|
||||||
|
-- play attack sound
|
||||||
|
if self.sounds.attack then
|
||||||
|
|
||||||
|
minetest.sound_play(self.sounds.attack, {
|
||||||
|
object = self.object,
|
||||||
|
max_hear_distance = self.sounds.distance
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- punch player
|
||||||
|
self.attack:punch(self.object, 1.0, {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
damage_groups = {fleshy = self.damage}
|
||||||
|
}, nil)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
]]--
|
||||||
})
|
})
|
||||||
|
52
nssm_api.lua
52
nssm_api.lua
@ -224,7 +224,7 @@ function digging_ability(
|
|||||||
dim --vector representing the dimensions of the mob
|
dim --vector representing the dimensions of the mob
|
||||||
)
|
)
|
||||||
|
|
||||||
if math.random(1,nssm:virulence(self)) ~= 1 then return end
|
--if math.random(1,nssm:virulence(self)) ~= 1 then return end
|
||||||
|
|
||||||
local v = self.object:getvelocity()
|
local v = self.object:getvelocity()
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
@ -270,11 +270,13 @@ function digging_ability(
|
|||||||
if group == nil then
|
if group == nil then
|
||||||
if minetest.get_item_group(n, "unbreakable") == 1 or minetest.is_protected(p, "") or (n == "bones:bones" and not nssm:affectbones(self) ) then
|
if minetest.get_item_group(n, "unbreakable") == 1 or minetest.is_protected(p, "") or (n == "bones:bones" and not nssm:affectbones(self) ) then
|
||||||
else
|
else
|
||||||
minetest.env:set_node(p, {name="air"})
|
--minetest.env:set_node(p, {name="air"})
|
||||||
|
minetest.remove_node(p)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (minetest.get_item_group(n, group)==1) and (minetest.get_item_group(n, "unbreakable") ~= 1) and (n == "bones:bones" and not (minetest.is_protected(p, "")) ) then
|
if (minetest.get_item_group(n, group)==1) and (minetest.get_item_group(n, "unbreakable") ~= 1) and (n == "bones:bones" and not (minetest.is_protected(p, "")) ) then
|
||||||
minetest.env:set_node(p, {name="air"})
|
--minetest.env:set_node(p, {name="air"})
|
||||||
|
minetest.remove_node(p)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -282,13 +284,55 @@ function digging_ability(
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function digging_attack(
|
||||||
|
self, --the entity of the mob
|
||||||
|
group, --group of the blocks the mob can dig: nil=everything
|
||||||
|
max_vel, --max velocity of the mob
|
||||||
|
dim --vector representing the dimensions of the mob
|
||||||
|
)
|
||||||
|
|
||||||
|
--if math.random(1,nssm:virulence(self)) ~= 1 then return end
|
||||||
|
if self.attack and self.attack:is_player() then
|
||||||
|
local s = self.object:getpos()
|
||||||
|
local p = self.attack:getpos()
|
||||||
|
|
||||||
|
local dir = vector.subtract(p,s)
|
||||||
|
dir = vector.normalize(dir)
|
||||||
|
|
||||||
|
pos = vector.add(s,dir)
|
||||||
|
if minetest.is_protected(pos, "") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 0,dim.y do
|
||||||
|
local pos1 = pos
|
||||||
|
pos1.y = pos1.y+i
|
||||||
|
|
||||||
|
local n = minetest.env:get_node(pos1).name
|
||||||
|
--local up = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||||
|
if group == nil then
|
||||||
|
if minetest.get_item_group(n, "unbreakable") == 1 or minetest.is_protected(pos1, "") or (n == "bones:bones" and not nssm:affectbones(self) ) then
|
||||||
|
else
|
||||||
|
--minetest.env:set_node(p, {name="air"})
|
||||||
|
minetest.remove_node(pos1)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if (minetest.get_item_group(n, group)==1) and (minetest.get_item_group(n, "unbreakable") ~= 1) and (n == "bones:bones" and not (minetest.is_protected(pos1, "")) ) then
|
||||||
|
--minetest.env:set_node(p, {name="air"})
|
||||||
|
minetest.remove_node(pos1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function 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
|
self, --the entity of the mob
|
||||||
p_block, --definition of the block to use
|
p_block, --definition of the block to use
|
||||||
max_vel --max velocity of the mob
|
max_vel --max velocity of the mob
|
||||||
)
|
)
|
||||||
if math.random(1,nssm:virulence(self)) ~= 1 then return end
|
--if math.random(1,nssm:virulence(self)) ~= 1 then return end
|
||||||
|
|
||||||
local v = self.object:getvelocity()
|
local v = self.object:getvelocity()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user