Merge pull request #2814 from Mailaender/desync-debug
Yet Another Desync Debug Pull Request
This commit is contained in:
@@ -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; } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user