Fix grenades crash
This commit is contained in:
parent
d9cc457568
commit
31048422c8
1 changed files with 5 additions and 1 deletions
|
@ -95,7 +95,11 @@ grenades.register_grenade("grenades:smoke", {
|
||||||
local player = minetest.get_player_by_name(pname)
|
local player = minetest.get_player_by_name(pname)
|
||||||
if not player or not pos then return end
|
if not player or not pos then return end
|
||||||
|
|
||||||
if vector.distance(pos, ctf_classes.get_flag_pos(player)) <= 15 then
|
local fpos = ctf_classes.get_flag_pos(player)
|
||||||
|
|
||||||
|
if not fpos then return end
|
||||||
|
|
||||||
|
if vector.distance(pos, fpos) <= 15 then
|
||||||
minetest.chat_send_player(pname, "You can't explode smoke grenades so close to your flag!")
|
minetest.chat_send_player(pname, "You can't explode smoke grenades so close to your flag!")
|
||||||
player:get_inventory():add_item("main", "grenades:smoke")
|
player:get_inventory():add_item("main", "grenades:smoke")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue