Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around missing RandomFloat() #132

Merged
merged 2 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion util/AbilityAbstraction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3228,7 +3228,8 @@ function M:EveryManySeconds(second, oldFunction)
local functionName = tostring(oldFunction)
local callTable = {}
everySecondsCallRegistry[functionName] = callTable
callTable.lastCallTime = DotaTime() + RandomFloat(0, second)
print(RandomInt(0, second*1000) / 1000)
JoshdanG marked this conversation as resolved.
Show resolved Hide resolved
callTable.lastCallTime = DotaTime() + RandomInt(0, second*1000) / 1000
callTable.interval = second
callTable.startup = true
return function(...)
Expand Down
2 changes: 1 addition & 1 deletion util/MiraDota.lua
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ local everySecondsCallRegistry = Linq.NewTable()
function GameLoop.EveryManySeconds(second, registerName, oldFunction, ...)
if everySecondsCallRegistry[registerName] == nil then
local callTable = {}
callTable.lastCallTime = DotaTime() + RandomFloat(0, second) - second
callTable.lastCallTime = DotaTime() + RandomInt(0, second*1000)/1000 - second
callTable.interval = second
everySecondsCallRegistry[registerName] = callTable
end
Expand Down