Add offset to Explodes.

This commit is contained in:
abc013
2020-10-28 22:26:31 +01:00
committed by abcdefg30
parent bb71b59e18
commit 13596c1474

View File

@@ -52,6 +52,9 @@ namespace OpenRA.Mods.Common.Traits
"Footprint (explosion on each occupied cell).")]
public readonly ExplosionType Type = ExplosionType.CenterPosition;
[Desc("Offset of the explosion from the center of the exploding actor (or cell).")]
public readonly WVec Offset = WVec.Zero;
public WeaponInfo WeaponInfo { get; private set; }
public WeaponInfo EmptyWeaponInfo { get; private set; }
@@ -121,13 +124,13 @@ namespace OpenRA.Mods.Common.Traits
{
var cells = buildingInfo.OccupiedTiles(self.Location);
foreach (var c in cells)
weapon.Impact(Target.FromPos(self.World.Map.CenterOfCell(c)), source);
weapon.Impact(Target.FromPos(self.World.Map.CenterOfCell(c) + Info.Offset), source);
return;
}
// Use .FromPos since this actor is killed. Cannot use Target.FromActor
weapon.Impact(Target.FromPos(self.CenterPosition), source);
weapon.Impact(Target.FromPos(self.CenterPosition + Info.Offset), source);
}
WeaponInfo ChooseWeaponForExplosion(Actor self)