[code]if cc_campaign_missions == nil then
cc_campaign_missions = {}
cc_missions = {}
cc_n = 0 else
cc_n = table.getn(cc_campaign_missions)
end
-- Add Campaign to list
cc_campaign_missions[cc_n+1] = {
screen = "the_old_republic", -- cc_missions[screen]
showstr = "The Old Republic",
}
-- Campaign contents
cc_missions[cc_campaign_missions[cc_n+1]["screen"]] = {
[1] = {
preview = "tor_prev1",
desc = "Mountain Defenses - Hoth",
name = "Mountain Defenses",
lua = "SNWt_c",
},
[2] = {
preview = "tor_prev2",
desc = "Revan's Revenge - Endor",
name = "Revan's Revenge",
lua = "FRSt_c",
},
[3] = {
preview = "tor_prev3",
desc = "Rise of Malgus - Coruscant",
name = "Rise of Malgus",
lua = "TMPt_c",
},
[4] = {
preview = "tor_prev4",
desc = "Battle on Korriban - Geonosis",
name = "Battle on Korriban",
lua = "KORt_c",
},
}
cc_n = nil
-- recursively merges the second given table into the first given table
function MergeTables( mission, newFlags )
--for each table entry,
local array = type({})
for key,value in pairs(newFlags) do
--check for nested tables
if type(value) == array then
--mission must have this key as a table too
if type(mission[key]) ~= array then
mission[key] = {}
end
--merge these two tables recursively
MergeTables(mission[key], value)
else
--the key is a simple variable, so simply store it
mission[key] = value
end
end
end
--Search through the missionlist to find a map that matches mapName,
--then insert the new flags into said entry.
--Use this when you know the map already exists, but this content patch is just
--adding new gamemodes (otherwise you should just add whole new entries to the missionlist)
function AddNewGameModes(missionList, mapName, newFlags)
for i, mission in missionList do
if mission.mapluafile == mapName then
MergeTables(mission, newFlags)
end
end
end
--insert totally new maps here:
ReadDataFile("..\\..\\addon\\TOR\\data\\_LVL_PC\\shell.lvl")
local sp_n = 0
local mp_n = 0
sp_n = table.getn(sp_missionselect_listbox_contents)
--add my modes to the singleplayer map selection screen
-- associate this mission name with the current downloadable content directory
-- (this tells the engine which maps are downloaded, so you need to include all new mission lua's here)
-- first arg: mapluafile from above
-- second arg: mission script name
-- third arg: level memory modifier. the arg to LuaScript.cpp: DEFAULT_MODEL_MEMORY_PLUS(x)
AddDownloadableContent("SNW","SNWt_c",4)
AddDownloadableContent("FRS","FRSt_c",4)
AddDownloadableContent("TMP","TMPt_c",4)
AddDownloadableContent("KOR","KORt_c",4)
-- all done
newEntry = nil
n = nil
-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\TOR\\data\\_LVL_PC\\core.lvl")
[/code]