rename ore to the more generic name resources everywhere
This commit is contained in:
@@ -22,8 +22,8 @@ namespace OpenRA.GameRules
|
||||
[FieldLoader.LoadUsing("LoadVersus")]
|
||||
[Desc("Damage vs each armortype. 0% = can't target.")]
|
||||
public readonly Dictionary<string, float> Versus;
|
||||
[Desc("Can this damage ore?")]
|
||||
public readonly bool Ore = false;
|
||||
[Desc("Can this damage resource patches?")]
|
||||
public readonly bool DestroyResources = false;
|
||||
[Desc("Explosion effect to use.")]
|
||||
public readonly string Explosion = null;
|
||||
[Desc("Palette to use for explosion effect.")]
|
||||
|
||||
@@ -37,39 +37,39 @@ namespace OpenRA.Traits
|
||||
|
||||
[Sync] public int Cash;
|
||||
|
||||
[Sync] public int Ore;
|
||||
[Sync] public int OreCapacity;
|
||||
[Sync] public int Resources;
|
||||
[Sync] public int ResourceCapacity;
|
||||
|
||||
public int DisplayCash;
|
||||
public int DisplayOre;
|
||||
public int DisplayResources;
|
||||
public bool AlertSilo;
|
||||
|
||||
public int Earned;
|
||||
public int Spent;
|
||||
|
||||
public bool CanGiveOre(int amount)
|
||||
public bool CanGiveResources(int amount)
|
||||
{
|
||||
return Ore + amount <= OreCapacity;
|
||||
return Resources + amount <= ResourceCapacity;
|
||||
}
|
||||
|
||||
public void GiveOre(int num)
|
||||
public void GiveResources(int num)
|
||||
{
|
||||
Ore += num;
|
||||
Resources += num;
|
||||
Earned += num;
|
||||
|
||||
if (Ore > OreCapacity)
|
||||
if (Resources > ResourceCapacity)
|
||||
{
|
||||
nextSiloAdviceTime = 0;
|
||||
|
||||
Earned -= Ore - OreCapacity;
|
||||
Ore = OreCapacity;
|
||||
Earned -= Resources - ResourceCapacity;
|
||||
Resources = ResourceCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
public bool TakeOre(int num)
|
||||
public bool TakeResources(int num)
|
||||
{
|
||||
if (Ore < num) return false;
|
||||
Ore -= num;
|
||||
if (Resources < num) return false;
|
||||
Resources -= num;
|
||||
Spent += num;
|
||||
|
||||
return true;
|
||||
@@ -83,15 +83,15 @@ namespace OpenRA.Traits
|
||||
|
||||
public bool TakeCash(int num)
|
||||
{
|
||||
if (Cash + Ore < num) return false;
|
||||
if (Cash + Resources < num) return false;
|
||||
|
||||
// Spend ore before cash
|
||||
Ore -= num;
|
||||
Resources -= num;
|
||||
Spent += num;
|
||||
if (Ore < 0)
|
||||
if (Resources < 0)
|
||||
{
|
||||
Cash += Ore;
|
||||
Ore = 0;
|
||||
Cash += Resources;
|
||||
Resources = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -107,16 +107,16 @@ namespace OpenRA.Traits
|
||||
if (nextCashTickTime > 0)
|
||||
nextCashTickTime--;
|
||||
|
||||
OreCapacity = self.World.ActorsWithTrait<IStoreOre>()
|
||||
ResourceCapacity = self.World.ActorsWithTrait<IStoreResources>()
|
||||
.Where(a => a.Actor.Owner == Owner)
|
||||
.Sum(a => a.Trait.Capacity);
|
||||
|
||||
if (Ore > OreCapacity)
|
||||
Ore = OreCapacity;
|
||||
if (Resources > ResourceCapacity)
|
||||
Resources = ResourceCapacity;
|
||||
|
||||
if (--nextSiloAdviceTime <= 0)
|
||||
{
|
||||
if (Ore > 0.8 * OreCapacity)
|
||||
if (Resources > 0.8 * ResourceCapacity)
|
||||
{
|
||||
Sound.PlayNotification(self.World.Map.Rules, Owner, "Speech", "SilosNeeded", Owner.Country.Race);
|
||||
AlertSilo = true;
|
||||
@@ -143,18 +143,18 @@ namespace OpenRA.Traits
|
||||
playCashTickDown(self);
|
||||
}
|
||||
|
||||
diff = Math.Abs(Ore - DisplayOre);
|
||||
diff = Math.Abs(Resources - DisplayResources);
|
||||
move = Math.Min(Math.Max((int)(diff * displayCashFracPerFrame),
|
||||
displayCashDeltaPerFrame), diff);
|
||||
|
||||
if (DisplayOre < Ore)
|
||||
if (DisplayResources < Resources)
|
||||
{
|
||||
DisplayOre += move;
|
||||
DisplayResources += move;
|
||||
playCashTickUp(self);
|
||||
}
|
||||
else if (DisplayOre > Ore)
|
||||
else if (DisplayResources > Resources)
|
||||
{
|
||||
DisplayOre -= move;
|
||||
DisplayResources -= move;
|
||||
playCashTickDown(self);
|
||||
}
|
||||
}
|
||||
|
||||
3
OpenRA.Game/Traits/TraitsInterfaces.cs
Executable file → Normal file
3
OpenRA.Game/Traits/TraitsInterfaces.cs
Executable file → Normal file
@@ -90,8 +90,9 @@ namespace OpenRA.Traits
|
||||
bool IsValidTarget(Actor self, Actor saboteur);
|
||||
}
|
||||
|
||||
public interface IStoreOre { int Capacity { get; } }
|
||||
public interface IStoreResources { int Capacity { get; } }
|
||||
public interface INotifyDocking { void Docked(Actor self, Actor harvester); void Undocked(Actor self, Actor harvester); }
|
||||
|
||||
public interface IEffectiveOwner
|
||||
{
|
||||
bool Disguised { get; }
|
||||
|
||||
Reference in New Issue
Block a user