New lua function CHARMAN:GetCharacterCount.
How the Characters mod won't display by default if there are no characters to play with at all.
This commit is contained in:
@@ -14,6 +14,9 @@ StepMania 5.0 ????????? | 20110???
|
||||
Saving should still work, but this was never tested yet. [Wolfman2000]
|
||||
* [ScreenOptions] Mini is now ITG Mini, and Tiny is now Pump Pro Mini.
|
||||
This will prevent many prior courses from breaking. [sharksoda, Wolfman2000]
|
||||
* [CharacterManager] Add a lua function to check how many characters you have.
|
||||
For an example of how this is used, check the default theme's scripts
|
||||
folder, specifically 03 ThemePrefs.lua. [Wolfman2000]
|
||||
|
||||
2011/07/04
|
||||
----------
|
||||
|
||||
@@ -580,6 +580,7 @@
|
||||
<Function name='GetAllCharacters'/>
|
||||
<Function name='GetCharacter'/>
|
||||
<Function name='GetRandomCharacter'/>
|
||||
<Function name='GetCharacterCount'/>
|
||||
</Class>
|
||||
<Class base='ActorFrame' name='ComboGraph'>
|
||||
<Function name='Load'/>
|
||||
|
||||
@@ -1540,6 +1540,9 @@
|
||||
<Function name='GetRandomCharacter' return='Character' arguments=''>
|
||||
Returns a random character.
|
||||
</Function>
|
||||
<Function name='GetCharacterCount' return='int' arguments=''>
|
||||
Returns the number of characters available.
|
||||
</Function>
|
||||
</Class>
|
||||
<Class name='ComboGraph'>
|
||||
<Function name='Load' return='void' arguments='string sMetricsGroup'>
|
||||
|
||||
@@ -231,9 +231,9 @@ function UserPrefShowLotsaOptions()
|
||||
end
|
||||
|
||||
function GetDefaultOptionLines()
|
||||
local LineSets = {
|
||||
"1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,16,17,18", -- All
|
||||
"1,8,14,2,7,13,16,17,18", -- DDR Essentials ( no turns, fx )
|
||||
local LineSets = { -- none of these include characters yet.
|
||||
"1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,16,17", -- All
|
||||
"1,8,14,2,7,13,16,17", -- DDR Essentials ( no turns, fx )
|
||||
};
|
||||
local function IsExtra()
|
||||
if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then
|
||||
@@ -242,15 +242,22 @@ function GetDefaultOptionLines()
|
||||
return false
|
||||
end
|
||||
end
|
||||
if not IsExtra() then
|
||||
if GetUserPrefB("UserPrefShowLotsaOptions") then
|
||||
return GetUserPrefB("UserPrefShowLotsaOptions") and LineSets[1] or LineSets[2];
|
||||
else
|
||||
return LineSets[2]; -- Just make sure!
|
||||
|
||||
local function CheckCharacters(mods)
|
||||
if CHARMAN:GetCharacterCount() > 0 then
|
||||
return mods .. ",18"; --TODO: Better line name.
|
||||
end
|
||||
else
|
||||
return "1,8,14,2,7,13,16,17,18" -- "failsafe" list
|
||||
return mods;
|
||||
end
|
||||
|
||||
modLines = LineSets[2];
|
||||
|
||||
if not IsExtra() then
|
||||
modLines = GetUserPrefB("UserPrefShowLotsaOptions")
|
||||
and LineSets[1] or LineSets[2];
|
||||
end
|
||||
|
||||
return CheckCharacters(modLines);
|
||||
end;
|
||||
|
||||
function UserPrefAutoSetStyle()
|
||||
|
||||
@@ -152,6 +152,13 @@ public:
|
||||
LuaHelpers::CreateTableFromArray(vChars, L);
|
||||
return 1;
|
||||
}
|
||||
static int GetCharacterCount(T* p, lua_State *L)
|
||||
{
|
||||
vector<Character*> chars;
|
||||
p->GetCharacters(chars);
|
||||
lua_pushnumber(L, chars.size());
|
||||
return 1;
|
||||
}
|
||||
|
||||
LunaCharacterManager()
|
||||
{
|
||||
@@ -159,6 +166,7 @@ public:
|
||||
// sm-ssc adds:
|
||||
ADD_METHOD( GetRandomCharacter );
|
||||
ADD_METHOD( GetAllCharacters );
|
||||
ADD_METHOD( GetCharacterCount );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user