Shift Actor.Health onto a trait.

Known regressions:
 - cnc only
 - health bar colors
 - can't repair buildings
This commit is contained in:
Paul Chote
2010-07-30 00:01:59 +12:00
parent 1e08dc6301
commit 6fba888d45
56 changed files with 530 additions and 303 deletions

View File

@@ -16,7 +16,7 @@ using System.Drawing;
namespace OpenRA.Mods.RA
{
class RepairableNearInfo : TraitInfo<RepairableNear>
class RepairableNearInfo : TraitInfo<RepairableNear>, ITraitPrerequisite<HealthInfo>
{
[ActorReference]
public readonly string[] Buildings = { "spen", "syrd" };
@@ -28,10 +28,10 @@ namespace OpenRA.Mods.RA
{
if (mi.Button != MouseButton.Right) return null;
if (underCursor == null) return null;
if (underCursor.Owner == self.Owner &&
self.Info.Traits.Get<RepairableNearInfo>().Buildings.Contains( underCursor.Info.Name ) &&
self.Health < self.GetMaxHP())
self.traits.Get<Health>().HPFraction < 1f)
return new Order("Enter", self, underCursor);
return null;