Skip to content

Commit

Permalink
handle AutoStyle bug (sort of)
Browse files Browse the repository at this point in the history
This commit does two things:

1. It causes screen branching to ignore AutoStyle when CoinMode is Pay. If CoinMode is Pay, players should always be directed to ScreenSelectStyle to manually choose a style.

This makes sense in the context of a public arcade (that might have accidentally set the AutoStyle setting) while still allowing the setting to exist for private machine owners and keyboard players.

2. If AutoStyle is set to 1 Player, and CoinMode isn't Pay, and both players have already been joined on ScreenTitleJoin, forcibly unjoin PLAYER_2 to prevent possible theme errors like "too many players joined for single" or "no style set" and etc.

Hardcoding the theme to unjoin PLAYER_2 isn't a great fix, but I'm not sure how else to handle the problem at this time.
  • Loading branch information
quietly-turning committed Nov 9, 2018
1 parent 9ad54c2 commit 7e53185
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Scripts/SL-Branches.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,25 @@ end

Branch.AfterScreenSelectColor = function()
local preferred_style = ThemePrefs.Get("AutoStyle")
if preferred_style ~= "none" then

if preferred_style ~= "none"
-- AutoStyle should not be possible in pay mode
-- it's too confusing for machine operators, novice players, and developers alike
and GAMESTATE:GetCoinMode() ~= "CoinMode_Pay" then

-- If "versus" ensure that both players are actually considered joined.
if preferred_style == "versus" then
GAMESTATE:JoinPlayer(PLAYER_1)
GAMESTATE:JoinPlayer(PLAYER_2)

-- if "single" but both players are already joined (for whatever reason),
-- we're in a bit of a pickle, as there is no way to read the player's mind
-- and know which side they really want to play on
-- Unjoin PLAYER_2 for lack of a better solution
elseif preferred_style == "single" then
GAMESTATE:UnjoinPlayer(PLAYER_2)
end

GAMESTATE:SetCurrentStyle( preferred_style )
-- set this here to be used later with the continue system
SL.Global.Gamestate.Style = preferred_style
Expand Down

0 comments on commit 7e53185

Please sign in to comment.