Merge branch 'master' of git://github.com/chrisforbes/OpenRA

This commit is contained in:
Paul Chote
2010-01-09 16:06:35 +13:00
41 changed files with 201 additions and 24 deletions

View File

@@ -8,10 +8,12 @@ namespace OpenRa.Game.Traits
{
class AttackBase : IIssueOrder, IResolveOrder, ITick
{
public Actor target;
[Sync] public Actor target;
// time (in frames) until each weapon can fire again.
[Sync]
protected int primaryFireDelay = 0;
[Sync]
protected int secondaryFireDelay = 0;
int primaryBurst;

View File

@@ -7,7 +7,7 @@ namespace OpenRa.Game.Traits
public AttackFrontal(Actor self, int facingTolerance)
: base(self) { FacingTolerance = facingTolerance; }
int FacingTolerance;
readonly int FacingTolerance;
public override void Tick(Actor self)
{

View File

@@ -13,7 +13,9 @@ namespace OpenRa.Game.Traits
{
readonly Actor self;
public readonly BuildingInfo unitInfo;
[Sync]
bool isRepairing = false;
[Sync]
bool manuallyDisabled = false;
public bool ManuallyDisabled { get { return manuallyDisabled; } }
public bool Disabled { get { return (manuallyDisabled || (unitInfo.Powered && self.Owner.GetPowerState() != PowerState.Normal)); } }

View File

@@ -7,8 +7,9 @@ namespace OpenRa.Game.Traits
class ChronoshiftDeploy : IIssueOrder, IResolveOrder, ISpeedModifier, ITick, IPips
{
// Recharge logic
[Sync]
int chargeTick = 0; // How long until we can chronoshift again?
int chargeLength = (int)(Rules.Aftermath.ChronoTankDuration * 60 * 25); // How long between shifts?
readonly int chargeLength = (int)(Rules.Aftermath.ChronoTankDuration * 60 * 25); // How long between shifts?
public ChronoshiftDeploy(Actor self) { }

View File

@@ -8,9 +8,11 @@ namespace OpenRa.Game.Traits
class Chronoshiftable : IResolveOrder, ISpeedModifier, ITick
{
// Return-to-sender logic
[Sync]
int2 chronoshiftOrigin;
[Sync]
int chronoshiftReturnTicks = 0;
public Chronoshiftable(Actor self) { }
public void Tick(Actor self)
@@ -65,7 +67,7 @@ namespace OpenRa.Game.Traits
self.QueueActivity(new Activities.Teleport(order.TargetLocation));
var power = self.Owner.SupportPowers[order.TargetString].Impl;
power.OnFireNotification(self, self.Location);
power.OnFireNotification(self, self.Location);
}
}

View File

@@ -6,6 +6,7 @@ namespace OpenRa.Game.Traits
{
class Cloak : IRenderModifier, INotifyAttack, ITick
{
[Sync]
int remainingUncloakTime = 2; /* setup for initial cloak */
public Cloak(Actor self) {}

View File

@@ -5,7 +5,9 @@ namespace OpenRa.Game.Traits
{
class Harvester : IIssueOrder, IResolveOrder, IPips
{
[Sync]
public int oreCarried = 0; /* sum of these must not exceed capacity */
[Sync]
public int gemsCarried = 0;
public bool IsFull { get { return oreCarried + gemsCarried == Rules.General.BailCount; } }

View File

@@ -5,6 +5,7 @@ namespace OpenRa.Game.Traits
{
class IronCurtainable : IResolveOrder, IDamageModifier, ITick
{
[Sync]
int RemainingTicks = 0;
public IronCurtainable(Actor self) { }

View File

@@ -4,6 +4,7 @@ namespace OpenRa.Game.Traits
{
class LimitedAmmo : INotifyAttack, IPips
{
[Sync]
int ammo;
Actor self;

View File

@@ -9,6 +9,7 @@ namespace OpenRa.Game.Traits
{
readonly Actor self;
[Sync]
int2 __fromCell;
public int2 fromCell
{

View File

@@ -74,6 +74,7 @@ namespace OpenRa.Game.Traits
}
// Key: Production category.
// TODO: sync this
readonly Cache<string, List<ProductionItem>> production
= new Cache<string, List<ProductionItem>>( _ => new List<ProductionItem>() );

View File

@@ -6,6 +6,7 @@ namespace OpenRa.Game.Traits
{
class RallyPoint : IRender, IIssueOrder, IResolveOrder, ITick
{
[Sync]
public int2 rallyPoint;
public Animation anim;

View File

@@ -7,7 +7,9 @@ namespace OpenRa.Game.Traits
class RenderWarFactory : IRender, INotifyBuildComplete, INotifyDamage, ITick, INotifyProduction
{
public Animation roof;
[Sync]
bool doneBuilding;
[Sync]
bool isOpen;
public readonly Actor self;

View File

@@ -6,6 +6,7 @@ namespace OpenRa.Game.Traits
{
class Submarine : IRenderModifier, INotifyAttack, ITick, INotifyDamage
{
[Sync]
int remainingSurfaceTime = 2; /* setup for initial dive */
public Submarine(Actor self) { }

View File

@@ -8,6 +8,7 @@ namespace OpenRa.Game.Traits
const float proneDamage = .5f;
const float proneSpeed = .5f;
[Sync]
int remainingProneTime = 0;
public bool IsProne { get { return remainingProneTime > 0; } }

View File

@@ -10,18 +10,18 @@ namespace OpenRa.Game.Traits
// depends on the order of pips in WorldRenderer.cs!
enum PipType { Transparent, Green, Yellow, Red, Gray };
enum TagType { None, Fake, Primary };
interface ITick { void Tick(Actor self); }
interface IRender { IEnumerable<Renderable> Render(Actor self); }
interface IIssueOrder { Order IssueOrder( Actor self, int2 xy, MouseInput mi, Actor underCursor ); }
interface IResolveOrder { void ResolveOrder( Actor self, Order order ); }
interface INotifySold { void Sold(Actor self); }
interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
interface INotifyBuildComplete { void BuildingComplete (Actor self); }
interface INotifyProduction { void UnitProduced(Actor self, Actor other); }
interface IAcceptThief { void OnSteal(Actor self, Actor thief); }
interface IIssueOrder { Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor); }
interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
interface IProducer
{
bool Produce( Actor self, UnitInfo producee );

View File

@@ -3,6 +3,7 @@ namespace OpenRa.Game.Traits
{
class Turreted : ITick
{
[Sync]
public int turretFacing = 0;
public int? desiredFacing;

View File

@@ -3,7 +3,9 @@ namespace OpenRa.Game.Traits
{
class Unit : INotifyDamage
{
[Sync]
public int Facing;
[Sync]
public int Altitude;
public Unit( Actor self ) { }