forked from MineClone5/MineClone5
Small mob shoot raycast improvement
This commit is contained in:
parent
bc15c9c22d
commit
52ed7f668e
|
@ -2764,8 +2764,12 @@ local do_states = function(self, dtime)
|
||||||
|
|
||||||
set_velocity(self, 0)
|
set_velocity(self, 0)
|
||||||
|
|
||||||
|
local p = self.object:get_pos()
|
||||||
|
p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2
|
||||||
|
|
||||||
if self.shoot_interval
|
if self.shoot_interval
|
||||||
and self.timer > self.shoot_interval
|
and self.timer > self.shoot_interval
|
||||||
|
and not minetest.raycast(p, self.attack:get_pos(), false, false):next()
|
||||||
and random(1, 100) <= 60 then
|
and random(1, 100) <= 60 then
|
||||||
|
|
||||||
self.timer = 0
|
self.timer = 0
|
||||||
|
@ -2774,12 +2778,8 @@ local do_states = function(self, dtime)
|
||||||
-- play shoot attack sound
|
-- play shoot attack sound
|
||||||
mob_sound(self, "shoot_attack")
|
mob_sound(self, "shoot_attack")
|
||||||
|
|
||||||
local p = self.object:get_pos()
|
|
||||||
|
|
||||||
p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2
|
|
||||||
|
|
||||||
-- Shoot arrow
|
-- Shoot arrow
|
||||||
if not minetest.raycast(self.object:get_pos(), self.attack:get_pos(), false, false):next() and minetest.registered_entities[self.arrow] then
|
if minetest.registered_entities[self.arrow] then
|
||||||
|
|
||||||
local arrow, ent
|
local arrow, ent
|
||||||
local v = 1
|
local v = 1
|
||||||
|
|
Loading…
Reference in New Issue