Skip to content

Commit

Permalink
same loadscreen for everyone connecting (#4281)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruwetuin authored Feb 5, 2025
1 parent 1cc254c commit c2f05e6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 11 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 50 additions & 11 deletions luaintro/Addons/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,12 @@ if addon.InGetInfo then
}
end

local loadscreens = VFS.DirList("bitmaps/loadpictures/")
local backgroundTexture = loadscreens[math.random(#loadscreens)]

local showTips = (Spring.GetConfigInt("loadscreen_tips",1) == 1)
if string.find(backgroundTexture, "guide") then
showTips = false
end

local showTipAboveBar = true
local showTipBackground = false -- false = tips shown below the loading bar

local infolog = VFS.LoadFile("infolog.txt")
local gameID
local usingIntelPotato = false
local infolog = VFS.LoadFile("infolog.txt")
if infolog then
local function lines(str)
local t = {}
Expand Down Expand Up @@ -56,8 +49,54 @@ if infolog then
usingIntelPotato = false
end
end
if string.find(line, '001] GameID: ') then
gameID = string.sub(line, string.find(line, ': ')+2)
end
end
end

-- use gameID so everyone launching the match will see the same loadscreen
if gameID then
local seed = tonumber(string.sub(gameID, 1, 4), 16)
if seed then
math.randomseed(seed)
end
end

local loadscreens = {}
local loadscreenPath = "bitmaps/loadpictures/"

local teamList = Spring.GetTeamList()
for _, teamID in ipairs(teamList) do
local luaAI = Spring.GetTeamLuaAI(teamID)
if luaAI then
if luaAI:find("Raptors") then
loadscreens = VFS.DirList(loadscreenPath.."manual/raptors/")
if loadscreens[1] then
break
end
elseif luaAI:find("Scavengers") then
loadscreens = VFS.DirList(loadscreenPath.."manual/scavengers/")
if loadscreens[1] then
break
end
end
end
end
if not loadscreens[1] then
loadscreens = VFS.DirList(loadscreenPath)
end
local backgroundTexture = loadscreens[math.random(#loadscreens)]

if math.random(1,15) == 1 then
showDonationTip = true
backgroundTexture = "bitmaps/loadpictures/manual/donations.jpg"
end

local showTips = (Spring.GetConfigInt("loadscreen_tips",1) == 1)
if string.find(backgroundTexture, "guide") then
showTips = false
end

local hasLowRam = false
local ram = string.match(Platform.hwConfig, '([0-9]*MB RAM)')
Expand Down Expand Up @@ -134,11 +173,11 @@ if showTips then
randomTip = Spring.I18N('tips.loadscreen.' .. tipKeys[index])
end

if math.random(1,8) == 1 then
backgroundTexture = "bitmaps/loadpictures/manual/donations.jpg"
if showDonationTip then
randomTip = Spring.I18N('tips.loadscreen.donations')
end


-- for guishader
local function CheckHardware()
if not (gl.CopyToTexture ~= nil) then
Expand Down

0 comments on commit c2f05e6

Please sign in to comment.