Updated and fixed the charge attack

This commit is contained in:
npx 2017-03-01 11:13:15 +01:00
parent 8db93b5e65
commit aa4d3a6c41
3 changed files with 9 additions and 8 deletions

View File

@ -8,7 +8,7 @@ mobs:register_mob("nssm:river_lord", {
textures = {{"river_lord.png"}},
visual_size = {x=4, y=4},
makes_footstep_sound = true,
view_range = 10,
view_range = 15,
walk_velocity = 0.6,
rotate = 270,
fear_height = 4,
@ -16,7 +16,7 @@ mobs:register_mob("nssm:river_lord", {
--[[sounds = {
random = "river_lord",
},]]
damage = 1,
damage = 6,
jump = true,
drops = {
{name = "nssm:life_energy",
@ -28,7 +28,7 @@ mobs:register_mob("nssm:river_lord", {
drawtype = "front",
water_damage = 0,
lava_damage = 5,
reach= 4,
reach = 6,
light_damage = 0,
--group_attack=true,
--attack_animals=true,

View File

@ -10,7 +10,7 @@ mobs:register_mob("nssm:silver_sandonisc", {
makes_footstep_sound = false,
view_range = 17,
rotate = 270,
reach = 2,
reach = 5,
fear_height = 3,
walk_velocity = 0.6,
run_velocity = 5,

View File

@ -903,8 +903,8 @@ function charge_attack(self)
vec.y = -5
self.charge_vec = vec
self.charge_dir = self.object:getyaw()
do_charge(self)
self.charge_timer = os.time()
do_charge(self)
minetest.after(3, function(self)
self.other_state = "stand"
self.state = "stand"
@ -918,11 +918,12 @@ function do_charge(self)
set_animation(self, "punch2")
self.object:setvelocity(self.charge_vec)
self.object:setyaw(self.charge_dir)
local all_objects = minetest.get_objects_inside_radius(self.object:getpos(), 0.75)
local all_objects = minetest.get_objects_inside_radius(self.object:getpos(), 1*self.collisionbox[5]/3)
--minetest.chat_send_all("Altezza: "..self.collisionbox[5])
local _,obj
for _,obj in ipairs(all_objects) do
if obj:is_player() then
obj:set_hp(obj:get_hp()-1)
obj:set_hp(obj:get_hp()-self.damage/5)
--[[obj.object:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = self.damage}
@ -932,7 +933,7 @@ function do_charge(self)
end
end
end
if os.time() - self.charge_timer > 5 then
if self.charge_timer and os.time() - self.charge_timer > 5 then
self.other_state = "stand"
self.state = "stand"
end