Add spectate check to stop_follow (#285)

This commit is contained in:
Cooldude2606
2024-02-11 20:22:51 +00:00
committed by GitHub
parent 943adeecbf
commit 65e254ec45

View File

@@ -85,7 +85,9 @@ end
-- @tparam LuaPlayer player The player that will regain control of their camera
function Public.stop_follow(player)
assert(player and player.valid, 'Invalid player given to follower')
if following[player.index] and following[player.index][4] then Public.stop_spectate(player) end
if following[player.index] and following[player.index][4] and Public.is_spectating(player) then
Public.stop_spectate(player)
end
Gui.destroy_if_valid(player.gui.screen[follow_label.name])
following[player.index] = nil