public Army(bool Initial = false) { Name = ""; personality = ""; if (MapLuaParser.Current == null || MapLuaParser.Current.ScenarioLuaFile.Data == null) { plans = ""; } else if (MapLuaParser.Current.ScenarioLuaFile.Data.type == "campaign_coop" || MapLuaParser.Current.ScenarioLuaFile.Data.type == "campaign") { plans = "/lua/ai/OpAI/DefaultBlankPlanlist.lua"; } else { plans = ""; } color = 0; faction = 0; Economy = new EconomyTab(); Alliances = new List <Aliance>(); Units = new UnitsGroup(this); nextPlatoonBuilderId = "1"; PlatoonBuilders = new PlatoonBuilder[0]; if (Initial) { Units.AddGroup(new UnitsGroup(this, "INITIAL")); } }
public Army() { Name = ""; personality = ""; plans = ""; color = 0; faction = 0; Economy = new EconomyTab(); Alliances = new Aliance[0]; Units = new UnitsGroup(); nextPlatoonBuilderId = "1"; PlatoonBuilders = new PlatoonBuilder[0]; }
public Army(string name, LuaTable Table) { Name = name; personality = LuaParser.Read.StringFromTable(Table, KEY_PERSONALITY); plans = LuaParser.Read.StringFromTable(Table, KEY_PLANS); color = LuaParser.Read.IntFromTable(Table, KEY_COLOR); faction = LuaParser.Read.IntFromTable(Table, KEY_FACTION); LuaTable EconomyTable = (LuaTable)Table.RawGet(KEY_ECONOMY); Economy = new EconomyTab(); Economy.mass = LuaParser.Read.FloatFromTable(EconomyTable, EconomyTab.KEY_MASS); Economy.energy = LuaParser.Read.FloatFromTable(EconomyTable, EconomyTab.KEY_ENERGY); LuaTable AlliancesTable = (LuaTable)Table.RawGet(KEY_ALLIANCES); string[] AlliancesKeys = LuaParser.Read.GetTableKeys(AlliancesTable); string[] AlliancesValues = LuaParser.Read.GetTableValues(AlliancesTable); Alliances = new List <Aliance>(); for (int a = 0; a < AlliancesKeys.Length; a++) { Aliance ala = new Aliance(); ala.Army = AlliancesKeys[a]; ala.AllianceType = AlliancesValues[a]; Alliances.Add(ala); } LuaTable UnitsTable = (LuaTable)Table.RawGet(KEY_UNITS); Units = new UnitsGroup(KEY_UNITS, UnitsTable, this, true); //TODO Read PlatoonBuilders LuaTable PbTable = (LuaTable)Table.RawGet(KEY_PLATOONBUILDERS); nextPlatoonBuilderId = LuaParser.Read.StringFromTable(PbTable, PlatoonBuilder.KEY_NEXTPLATOONBUILDERID); LuaTable BuildersTable = (LuaTable)PbTable.RawGet(PlatoonBuilder.KEY_BUILDERS); LuaTable[] PbTabs = LuaParser.Read.GetTableTables(BuildersTable); string[] PbNames = LuaParser.Read.GetTableKeys(BuildersTable); PlatoonBuilders = new PlatoonBuilder[PbNames.Length]; for (int c = 0; c < PbNames.Length; c++) { PlatoonBuilders[c] = new PlatoonBuilder(PbNames[c], PbTabs[c]); } MapLuaParser.Current.ScenarioLuaFile.AddDataToArmy(this); }