use the player statistics everywhere
This commit is contained in:
@@ -42,10 +42,12 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var cargo = self.Trait<Cargo>();
|
||||
while (!cargo.IsEmpty(self))
|
||||
{
|
||||
if (chronosphere != null)
|
||||
chronosphere.Owner.Kills++;
|
||||
if (chronosphere != null && chronosphere.HasTrait<UpdatesPlayerStatistics>())
|
||||
chronosphere.Owner.PlayerActor.Trait<PlayerStatistics>().UnitsKilled++;
|
||||
|
||||
var a = cargo.Unload(self);
|
||||
a.Owner.Deaths++;
|
||||
if (a.HasTrait<UpdatesPlayerStatistics>())
|
||||
a.Owner.PlayerActor.Trait<PlayerStatistics>().UnitsDead++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace OpenRA.Mods.RA.Missions
|
||||
|
||||
void UpdateDeaths()
|
||||
{
|
||||
var unitDeaths = allies1.Deaths + allies2.Deaths;
|
||||
var unitDeaths = allies1.PlayerActor.Trait<PlayerStatistics>().UnitsDead + allies2.PlayerActor.Trait<PlayerStatistics>().UnitsDead;
|
||||
fewDeaths.Text = FewDeathsTemplate.F(unitDeaths, DeathsThreshold);
|
||||
OnObjectivesUpdated(false);
|
||||
if (unitDeaths >= DeathsThreshold && fewDeaths.Status == ObjectiveStatus.InProgress)
|
||||
|
||||
@@ -257,11 +257,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
power.GetText = () => powerRes.PowerDrained + "/" + powerRes.PowerProvided;
|
||||
power.GetColor = () => GetPowerColor(powerRes.PowerState);
|
||||
|
||||
template.Get<LabelWidget>("KILLS").GetText = () => player.Kills.ToString();
|
||||
template.Get<LabelWidget>("DEATHS").GetText = () => player.Deaths.ToString();
|
||||
|
||||
var stats = player.PlayerActor.TraitOrDefault<PlayerStatistics>();
|
||||
if (stats == null) return template;
|
||||
template.Get<LabelWidget>("KILLS").GetText = () => (stats.UnitsKilled + stats.BuildingsKilled).ToString();
|
||||
template.Get<LabelWidget>("DEATHS").GetText = () => (stats.UnitsDead + stats.UnitsDead).ToString();
|
||||
template.Get<LabelWidget>("ACTIONS_MIN").GetText = () => AverageOrdersPerMinute(stats.OrderCount);
|
||||
|
||||
return template;
|
||||
|
||||
Reference in New Issue
Block a user