Sentry: start to shoot only if the target is not behind a wall (closes #141)
This commit is contained in:
parent
12273213de
commit
8476a69c36
@ -114,10 +114,14 @@ local sentry_gun = {
|
||||
-- sia entità che giocanti) ma non so perché continua a crashare. Per ora evito le entità
|
||||
--shooting_height = vector.new(0, (collisionbox[5] + math.abs(collisionbox[2])) / 2, 0) -- altezza media
|
||||
shooting_height = vector.new(0, is_player and obj:get_properties().eye_height or 0, 0)
|
||||
to_target_dir = vector.direction(s_pos, vector.add(obj:get_pos(), shooting_height))
|
||||
|
||||
local t_pos = vector.add(obj:get_pos(), shooting_height)
|
||||
local ray = core.raycast(s_pos, t_pos, false) -- non iniziare a sparare se ci son ostacoli nel mezzo
|
||||
|
||||
to_target_dir = vector.direction(s_pos, t_pos)
|
||||
angle = math.deg(vector.angle(to_target_dir, dir))
|
||||
|
||||
if math.abs(angle) <= 60 and obj:get_hp() > 0 then
|
||||
if math.abs(angle) <= 60 and obj:get_hp() > 0 and not ray:next() then
|
||||
local teamID = self._teamID
|
||||
|
||||
if is_player then
|
||||
|
Loading…
x
Reference in New Issue
Block a user