Skip to content

Commit

Permalink
Merge pull request #919 from AntlerForce/master
Browse files Browse the repository at this point in the history
Gate Random to Singleplayer only too
  • Loading branch information
AntlerForce authored Feb 18, 2025
2 parents 818b314 + c1d9cfe commit e2f55bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions LuaMenu/configs/gameConfig/byar/sidedata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ return {
name = "Legion",
logo = SIDEPICS_DIR .. "legion.png",
requiresModoption = "experimentallegionfaction",
singleplayerOnly = true,
},
{
name = "Random",
logo = SIDEPICS_DIR .. "random.png",
singleplayerOnly = true,
},
}
8 changes: 5 additions & 3 deletions LuaMenu/widgets/gui_side_change_window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ local function CreateSideChangeWindow(opts)
local modoptions = battleLobby.modoptions

for index, data in ipairs(sidedata) do
if not data.requiresModoption or (modoptions and modoptions[data.requiresModoption] == "1" and battleLobby.name == "singleplayer") then
factionMap[data.name] = index - 1
table.insert(factionNames, data.name)
if not data.requiresModoption or (modoptions and modoptions[data.requiresModoption] == "1") then
if not data.singleplayerOnly or battleLobby.name == "singleplayer" then
factionMap[data.name] = index - 1
table.insert(factionNames, data.name)
end
end
end

Expand Down
7 changes: 2 additions & 5 deletions libs/liblobby/lobby/lobby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1238,11 +1238,8 @@ function Lobby:_OnJoinedBattle(battleID, userName, scriptPassword)
end
if userName == self:GetMyUserName() then
local lastFaction = WG.Chobby.Configuration.lastFactionChoice
if lastFaction then
local sideData = WG.Chobby.Configuration:GetSideById(lastFaction)
if sideData and sideData.requiresModoption and (not self.modoptions or self.modoptions[sideData.requiresModoption] ~= "1") then
WG.Chobby.Configuration.lastFactionChoice = 0
end
if lastFaction and lastFaction > 1 then
WG.Chobby.Configuration.lastFactionChoice = 0
end
end
local found = false
Expand Down

0 comments on commit e2f55bd

Please sign in to comment.