Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
tweak: change version calculation to support betas
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanctech committed Jun 12, 2021
1 parent 3bdbe18 commit ffb1aba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sonorancad/core/configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ end
for k, v in pairs(json.decode(conf)) do
local cvar = GetConvar("sonoran_"..k, "NONE")
if cvar ~= "NONE" then
debugLog("Configuration: Overriding config option %s with convar. New value: %s"):format(k, cvar))
debugLog(("Configuration: Overriding config option %s with convar. New value: %s"):format(k, cvar))
Config[k] = cvar
else
Config[k] = v
Expand Down
1 change: 1 addition & 0 deletions sonorancad/core/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ CreateThread(function()
-- Wait a few seconds for server startup
Wait(5000)
local coreVersion = GetResourceMetadata(GetCurrentResourceName(), "version", 0)
SetConvarServerInfo("SonoranCAD", coreVersion)
local plugins = {}
local playerCount = GetNumPlayerIndices()
for k, v in pairs(Config.plugins) do
Expand Down
9 changes: 7 additions & 2 deletions sonorancad/core/updater.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ function RunAutoUpdater(manualRun)
debugLog(("Raw output for %s: %s"):format(k, data))
else
Config.latestVersion = remote.resource
local latestVersion = string.gsub(remote.resource, "%.","")
local localVersion = string.gsub(myVersion, "%.", "")
_, _, v1, v2, v3 = string.find( myVersion, "(%d+)%.(%d+)%.(%d+)" )
_, _, r1, r2, r3 = string.find( remote.resource, "(%d+)%.(%d+)%.(%d+)" )
if (string.find(myVersion, "-beta")) then
v3 = v3 - 0.5
end
local latestVersion = r3+(r2*2)+(r1*4)
local localVersion = v3+(v2*2)+(v1*4)

assert(localVersion ~= nil, "Failed to parse local version. "..tostring(localVersion))
assert(latestVersion ~= nil, "Failed to parse remote version. "..tostring(latestVersion))
Expand Down

0 comments on commit ffb1aba

Please sign in to comment.