Merge pull request #2814 from Mailaender/desync-debug

Yet Another Desync Debug Pull Request
This commit is contained in:
Matthias Mailänder
2013-03-26 14:26:09 -07:00
2 changed files with 31 additions and 4 deletions

View File

@@ -33,10 +33,11 @@ namespace OpenRA.Mods.RA
readonly AutoTargetInfo Info;
readonly AttackBase attack;
[Sync] int nextScanTime = 0;
[Sync] public int nextScanTime = 0;
public UnitStance stance;
[Sync] public int stanceNumber { get { return (int)stance; } }
public UnitStance predictedStance; /* NOT SYNCED: do not refer to this anywhere other than UI code */
[Sync] public int AggressorID;
public AutoTarget(Actor self, AutoTargetInfo info)
{
@@ -68,6 +69,8 @@ namespace OpenRA.Mods.RA
if (e.Damage < 0) return; // don't retaliate against healers
AggressorID = (int)e.Attacker.ActorID;
attack.AttackTarget(Target.FromActor(e.Attacker), false, Info.AllowMovement && stance != UnitStance.Defend);
}
@@ -134,4 +137,28 @@ namespace OpenRA.Mods.RA
[Desc("Will not get automatically targeted by enemy (like walls)")]
class AutoTargetIgnoreInfo : TraitInfo<AutoTargetIgnore> { }
class AutoTargetIgnore { }
public class DebugRetiliateAgainstAggressorInfo : ITraitInfo, Requires<AutoTargetInfo>
{
public object Create(ActorInitializer init) { return new DebugRetiliateAgainstAggressor(init.self); }
}
public class DebugRetiliateAgainstAggressor : ISync
{
readonly AutoTarget a;
public DebugRetiliateAgainstAggressor(Actor self){ a = self.Trait<AutoTarget>(); }
[Sync] public int Aggressor { get { return a.AggressorID; } }
}
public class DebugNextAutoTargetScanTimeInfo : ITraitInfo, Requires<AutoTargetInfo>
{
public object Create(ActorInitializer init) { return new DebugNextAutoTargetScanTime(init.self); }
}
public class DebugNextAutoTargetScanTime : ISync
{
readonly AutoTarget a;
public DebugNextAutoTargetScanTime(Actor self){ a = self.Trait<AutoTarget>(); }
[Sync] public int NextAutoTargetScanTime { get { return a.nextScanTime; } }
}
}

View File

@@ -21,10 +21,10 @@ namespace OpenRA.Mods.RA
public readonly int Range = 3;
}
class CarpetBomb : ITick // todo: maybe integrate this better with the normal weapons system?
class CarpetBomb : ITick, ISync // todo: maybe integrate this better with the normal weapons system?
{
CPos Target;
int dropDelay;
[Sync] CPos Target;
[Sync] int dropDelay;
public void SetTarget(CPos targetCell) { Target = targetCell; }