Fix sniper crosshairs being active after death (#726)
* Fix bug with crosshairs active after death (hopefully) fixes issue with crosshairs remaining after player death. Requires testing. How to test: - die while scoped Normally I would do this but I am unable to get to a proper platform to test. * Use function Slipped my mind, sorry :P * Fix typo, comment Fixed typo in line 100, also fixed comment for dieplayer function
This commit is contained in:
parent
fbf0126599
commit
2f3b09ff70
1 changed files with 8 additions and 1 deletions
|
@ -63,6 +63,13 @@ local function hide_scope(name)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Be absolutely certain crosshair HUD gets removed on death
|
||||||
|
minetest.register_on_dieplayer(function(player)
|
||||||
|
if scoped_hud_id[player:get_player_name()] then
|
||||||
|
hide_scope(player:get_player_name())
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
local function on_use(stack, user, pointed)
|
local function on_use(stack, user, pointed)
|
||||||
if scoped[user:get_player_name()] then
|
if scoped[user:get_player_name()] then
|
||||||
-- shooter checks for the return value of def.on_use, and executes
|
-- shooter checks for the return value of def.on_use, and executes
|
||||||
|
@ -90,7 +97,7 @@ local function on_rclick(item, placer, pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
||||||
------------------
|
------------------
|
||||||
-- Sccope-check --
|
-- Scope-check --
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
-- Hide scope if currently wielded item is not the same item
|
-- Hide scope if currently wielded item is not the same item
|
||||||
|
|
Loading…
Reference in a new issue