Files
barotrauma-localmods/Real Sonar/Lua/think.lua
2025-03-31 13:19:47 +02:00

22 lines
781 B
Lua

local enemySonarCooldown = 5 * 60
local updateAfflictionCooldown = 2 * 60
Hook.Add("think", "think", function()
if Game.Paused or not Game.RoundStarted then return end
if RealSonar.EnemySub then
if enemySonarCooldown <= 0 then
if RealSonar.Config.EnemySonar and not RealSonar.EnemySub.captain.IsOnPlayerTeam then
enemySonarCooldown = RealSonar.updateEnemySonarMode() * 60
else
enemySonarCooldown = 5 * 60 -- Check again in 5 seconds.
end
end
enemySonarCooldown = enemySonarCooldown - 1
end
if updateAfflictionCooldown <= 0 then
updateAfflictionCooldown = RealSonar.updateAfflictions() * 60
end
updateAfflictionCooldown = updateAfflictionCooldown - 1
end)