mirror of
https://github.com/LoneWolfHT/grenades.git
synced 2024-11-25 16:23:49 +01:00
Improve flashbang 'is player looing at it' calculations
This commit is contained in:
parent
7d0964950a
commit
b5680b5282
@ -41,8 +41,8 @@ if settings:get_bool("enable_flashbang_grenade") then
|
|||||||
on_explode = function(pos, player, self)
|
on_explode = function(pos, player, self)
|
||||||
for k, v in ipairs(minetest.get_objects_inside_radius(pos, 15)) do
|
for k, v in ipairs(minetest.get_objects_inside_radius(pos, 15)) do
|
||||||
if v:is_player() and v:get_hp() > 0 then
|
if v:is_player() and v:get_hp() > 0 then
|
||||||
local playerdir = vector.round(vector.normalize(v:get_look_dir()))
|
local playerdir = vector.round(v:get_look_dir())
|
||||||
local grenadedir = vector.round(vector.normalize(vector.direction(v:get_pos(), pos)))
|
local grenadedir = vector.round(vector.direction(v:get_pos(), pos))
|
||||||
|
|
||||||
if playerdir.x == grenadedir.x and playerdir.z == grenadedir.z then
|
if playerdir.x == grenadedir.x and playerdir.z == grenadedir.z then
|
||||||
for i = 1, 3, 1 do
|
for i = 1, 3, 1 do
|
||||||
|
Loading…
Reference in New Issue
Block a user