Initial cleanup of BaseBuilder.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
@@ -9,13 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using XRandom = OpenRA.Thirdparty.Random;
|
||||
|
||||
namespace OpenRA.Mods.RA.AI
|
||||
{
|
||||
@@ -39,7 +33,7 @@ namespace OpenRA.Mods.RA.AI
|
||||
public void Tick()
|
||||
{
|
||||
// Pick a free queue
|
||||
var queue = ai.FindQueues( category ).FirstOrDefault();
|
||||
var queue = ai.FindQueues(category).FirstOrDefault();
|
||||
if (queue == null)
|
||||
return;
|
||||
|
||||
@@ -47,7 +41,6 @@ namespace OpenRA.Mods.RA.AI
|
||||
switch (state)
|
||||
{
|
||||
case BuildState.ChooseItem:
|
||||
{
|
||||
var item = chooseItem(queue);
|
||||
if (item == null)
|
||||
{
|
||||
@@ -60,24 +53,24 @@ namespace OpenRA.Mods.RA.AI
|
||||
state = BuildState.WaitForProduction;
|
||||
ai.world.IssueOrder(Order.StartProduction(queue.self, item.Name, 1));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BuildState.WaitForProduction:
|
||||
if (currentBuilding == null) return; /* let it happen.. */
|
||||
if (currentBuilding == null)
|
||||
return;
|
||||
|
||||
else if (currentBuilding.Paused)
|
||||
if (currentBuilding.Paused)
|
||||
ai.world.IssueOrder(Order.PauseProduction(queue.self, currentBuilding.Item, false));
|
||||
else if (currentBuilding.Done)
|
||||
{
|
||||
state = BuildState.WaitForFeedback;
|
||||
lastThinkTick = ai.ticks;
|
||||
|
||||
/* place the building */
|
||||
BuildingType type = BuildingType.Building;
|
||||
if(Rules.Info[currentBuilding.Item].Traits.Contains<AttackBaseInfo>())
|
||||
// Place the building
|
||||
var type = BuildingType.Building;
|
||||
if (Rules.Info[currentBuilding.Item].Traits.Contains<AttackBaseInfo>())
|
||||
type = BuildingType.Defense;
|
||||
else if(Rules.Info[currentBuilding.Item].Traits.Contains<OreRefineryInfo>())
|
||||
else if (Rules.Info[currentBuilding.Item].Traits.Contains<OreRefineryInfo>())
|
||||
type = BuildingType.Refinery;
|
||||
|
||||
var location = ai.ChooseBuildLocation(currentBuilding.Item, type);
|
||||
@@ -95,6 +88,7 @@ namespace OpenRA.Mods.RA.AI
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case BuildState.WaitForFeedback:
|
||||
@@ -105,4 +99,3 @@ namespace OpenRA.Mods.RA.AI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user