Custom mods api pretty much complete and usable. Judge skins and playfield mods are...
authorCameron Ball <c.ball1729@gmail.com>
Sat, 21 Dec 2013 16:12:18 +0000 (00:12 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Sat, 21 Dec 2013 16:12:18 +0000 (00:12 +0800)
Themes/GrooveNights/Languages/english.ini
Themes/GrooveNights/Scripts/01 ProfileRows.lua
Themes/GrooveNights/Scripts/05 CustomMods.lua
Themes/GrooveNights/Scripts/Other.lua
Themes/GrooveNights/Scripts/gnSystem.lua

index 096f5c1..fec957d 100644 (file)
@@ -335,6 +335,7 @@ Extra Speed=Extra Speed
 Speed Type=Speed Type
 Accel=Acceleration
 JudgeSkin=Judgement Skin
+Playfield=Playfield Mod
 Effect=Effect
 Appearance=Fade
 Turn=Turn
index 7afed48..378cefd 100644 (file)
@@ -85,7 +85,7 @@ function CreateGenericOptionRow( Params, Choices, Values )
                 if Params.SelectType ~= "SelectMultiple" and list[i] then return end
             end
 
-            if Params.Default then list[Params.Default] = true else if Params.SelectType ~= "SelectMultiple" then list[1] = true end end
+            if Params.Default then list[Params.Default] = true else if (Params.SelectType ~= "SelectMultiple" and Params.SelectType ~= "SelectNone") then list[1] = true end end
         end
 
         local function Save(self, list, pn)
@@ -100,7 +100,7 @@ end
 -- creates a row list given a list of names and values
 function CreateProfileRow( Params, Choices, Values )
         local pref = ProfileTable[Params.Name]
-        if type(pref) ~= "table" and Params.SelectType == "SelectMultiple" then pref = {} end
+        if type(pref) ~= "table" and Params.SelectType == "SelectMultiple" then pref = {} ProfileTable[Params.Name] = {} end
         
         Params.LoadCallback = function(List, Value) if Params.SelectType ~= "SelectMultiple" then return Value == pref else return pref[Value] end end
         Params.SaveCallback = function(List, Value)
index 0f0c5ec..bba0557 100644 (file)
@@ -2,7 +2,7 @@
 local AppliedModsTable = {}
 
 -- For resetting mods
-local WasInOptions = {PLAYER_1 = false, PLAYER_2 = false}
+local WasInOptions = {}
 
 -- Holds the mods
 local ModsTable = {}
@@ -15,15 +15,12 @@ function RegisterCustomMod(Name, fn, Params, Choices)
     if not AppliedModsTable[PLAYER_1] then AppliedModsTable[PLAYER_1] = {} end
     if not AppliedModsTable[PLAYER_2] then AppliedModsTable[PLAYER_2] = {} end
     
-    AppliedModsTable[PLAYER_1][Name] = false
-    AppliedModsTable[PLAYER_2][Name] = false
-
+       WasInOptions[Name] = false
+       
     NullMod(Name)
 end
 
 function NullMod( Name )
-    SCREENMAN:SystemMessage('nulling ' .. Name)
-
     local Choices = ModsTable[Name].Choices 
     local Params = ModsTable[Name].Params
 
@@ -46,7 +43,7 @@ function CustomModOptionRow(Name)
     local Params = ModsTable[Name].Params
 
     Params.LoadCallback = function(List, Value, pn)
-                            WasInOptions[pn] = true
+                           WasInOptions[Name] = true
 
                            -- If this is the first round, reset the skin as it may still be set from earlier
                            if GAMESTATE:StageIndex() == 0 then NullMod(Name) end
@@ -64,8 +61,8 @@ end
 
 function DoCustomMod(Name, pn, Params)
     --if this is the first stage and the user was NOT in the options, reset the mod to default
-    if GAMESTATE:StageIndex() == 0 and not WasInOptions[pn] then NullMod(Name) end
-    WasInOptions[pn] = false
+    if GAMESTATE:StageIndex() == 0 and not WasInOptions[Name] then NullMod(Name) end
+    WasInOptions[Name] = false
 
     Params.Value = AppliedModsTable[pn][Name]
     ModsTable[Name].Callback(Params)
@@ -83,7 +80,18 @@ function CustomModsServiceOptionRow()
 end
 
 function CustomModLines()
-
+       local PrefTable = GetProfilePref("CustomMods")
+       local lines = ''
+       
+       if type(PrefTable) ~= "table" then return nil end
+       
+       for ModName,Enabled in pairs(PrefTable) do
+               if Enabled then
+                       if ModsTable[ModName].Params.LineNumber then lines = lines .. ',' .. ModsTable[ModName].Params.LineNumber end
+               end
+       end
+       
+       if lines ~= '' then return lines else return nil end
 end
 
 
index 432d934..eec072d 100644 (file)
@@ -437,8 +437,14 @@ function oitgACoptions()
 end
 
 function SongModifiers()
+       local CustomModLines = CustomModLines()
+       
     -- this is very basic right now, but it can be modified to take in to account OITG specific stuff
-    return SpeedLines() .. "4,5,25,26,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24"
+       if CustomModLines then 
+               return SpeedLines() .. "4,5" .. CustomModLines .. ",6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24"
+       else
+               return SpeedLines() .. "4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24"
+       end
 end
 
 function SpeedLines()
index e1553f3..d75ebb9 100644 (file)
@@ -418,17 +418,23 @@ RegisterGlobalCallback("TotalTimeSeconds", TotalTimeSeconds)
 
 -- custom mods
 local function LoadJudgeSkin(Params)
-    if Params.Value ~= nil and Params.Value ~= "GrooveNights" then
+    if Params.Value and Params.Value ~= "GrooveNights" then
         Params.Actor:Load( THEME:GetPath( EC_GRAPHICS, '', '_Judgements/' .. Params.Value ))
     end
 end
 
 local function PlayfieldMods(Params)
-   -- if type(Params.Value) == "table" then SCREENMAN:SystemMessage('got a table!') end
+       local a = Params.Actor
+
+       if Params.Value == "Bob" then a:bob() a:effectclock('beat') a:effectmagnitude(0,-30,0) end
+       if Params.Value == "Vibrate" then a:vibrate() a:effectmagnitude(20,20,20) end
+       if Params.Value == "Pulse" then a:pulse() a:effectclock('beat') end
+       if Params.Value == "Wag" then a:wag() a:effectclock('beat') end
+       if Params.Value == "Spin" then a:spin() a:effectclock('beat') a:effectmagnitude(0,0,45) end
 end
 
 RegisterCustomMod( "JudgeSkin", LoadJudgeSkin, { OneChoiceForAllPlayers = false, LineNumber = 25 }, { "GrooveNights", "Love", "Tactics", "Chromatic", "Deco", "FP", "ITG2" } )
-RegisterCustomMod( "Playfield", PlayfieldMods, { OneChoiceForAllPlayers = false, LineNumber = 26, SelectType = "SelectMultiple" }, { "Vibrate", "Wag", "Bob", "Pulse" } )
+RegisterCustomMod( "Playfield", PlayfieldMods, { OneChoiceForAllPlayers = false, LineNumber = 26 }, { "Off", "Vibrate", "Wag", "Bob", "Pulse", "Spin" } )
 
 --actor setters