mirror of
https://github.com/LoneWolfHT/grenades.git
synced 2024-11-22 06:43:45 +01:00
Flashbangs only flash you if you are looking at the explosion pos. May be buggy
This commit is contained in:
parent
1a16126f63
commit
e67f8cc2f1
@ -39,8 +39,12 @@ if settings:get_bool("enable_flashbang_grenade") then
|
||||
description = "A flashbang grenade (Blinds all who look at the explosion)",
|
||||
image = "grenades_flashbang.png",
|
||||
on_explode = function(pos, player, self)
|
||||
for k, v in ipairs(minetest.get_objects_inside_radius(pos, 6)) do
|
||||
for k, v in ipairs(minetest.get_objects_inside_radius(pos, 15)) do
|
||||
if v:is_player() and v:get_hp() > 0 then
|
||||
local playerdir = vector.floor(vector.normalize(v:get_look_dir()))
|
||||
local grenadedir = vector.floor(vector.normalize(vector.direction(v:get_pos(), pos)))
|
||||
|
||||
if playerdir.x == grenadedir.x and playerdir.z == grenadedir.z then
|
||||
for i = 1, 3, 1 do
|
||||
local key = v:hud_add({
|
||||
hud_elem_type = "image",
|
||||
@ -56,6 +60,7 @@ if settings:get_bool("enable_flashbang_grenade") then
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
timeout = 3
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user