un-FP Building.cs power stuff
This commit is contained in:
@@ -64,19 +64,14 @@ namespace OpenRA.Traits
|
|||||||
return Info.Power;
|
return Info.Power;
|
||||||
|
|
||||||
var health = self.TraitOrDefault<Health>();
|
var health = self.TraitOrDefault<Health>();
|
||||||
var healthFraction = (health == null) ? 1f : health.HPFraction;
|
return health != null ? (Info.Power * health.HP / health.MaxHP) : Info.Power;
|
||||||
return (int)(healthFraction * Info.Power);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Damaged(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
// Power plants lose power with damage
|
// Power plants lose power with damage
|
||||||
if (Info.Power > 0)
|
if (Info.Power > 0)
|
||||||
{
|
PlayerPower.UpdateActor(self, GetPowerUsage());
|
||||||
var health = self.TraitOrDefault<Health>();
|
|
||||||
var healthFraction = (health == null) ? 1f : health.HPFraction;
|
|
||||||
PlayerPower.UpdateActor(self, (int)(healthFraction * Info.Power));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.DamageState == DamageState.Dead)
|
if (e.DamageState == DamageState.Dead)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user