Convert Combat.DoExplosion to world coords.
This commit is contained in:
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Cnc.Effects
|
||||
void Finish(World world)
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Remove(this));
|
||||
Combat.DoExplosion(firedBy, "IonCannon", target.CenterLocation, 0);
|
||||
Combat.DoExplosion(firedBy, "IonCannon", target.CenterPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
if (aircraft.Altitude <= 0)
|
||||
{
|
||||
if (info.Explosion != null)
|
||||
Combat.DoExplosion(self, info.Explosion, self.CenterLocation, 0);
|
||||
Combat.DoExplosion(self, info.Explosion, self.CenterPosition);
|
||||
|
||||
self.Destroy();
|
||||
return null;
|
||||
|
||||
@@ -139,22 +139,24 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
|
||||
public static void DoExplosion(Actor attacker, string weapontype, PPos pos, int altitude)
|
||||
public static void DoExplosion(Actor attacker, string weapontype, WPos pos)
|
||||
{
|
||||
var pxPos = PPos.FromWPos(pos);
|
||||
var altitude = pos.Z * Game.CellSize / 1024;
|
||||
var args = new ProjectileArgs
|
||||
{
|
||||
src = pos,
|
||||
dest = pos,
|
||||
src = pxPos,
|
||||
dest = pxPos,
|
||||
srcAltitude = altitude,
|
||||
destAltitude = altitude,
|
||||
firedBy = attacker,
|
||||
target = Target.FromPos(pos),
|
||||
target = Target.FromPos(pxPos),
|
||||
weapon = Rules.Weapons[weapontype.ToLowerInvariant()],
|
||||
facing = 0
|
||||
};
|
||||
|
||||
if (args.weapon.Report != null && args.weapon.Report.Any())
|
||||
Sound.Play(args.weapon.Report.Random(attacker.World.SharedRandom), pos);
|
||||
Sound.Play(args.weapon.Report.Random(attacker.World.SharedRandom), pxPos);
|
||||
|
||||
DoImpacts(args);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public override void Activate(Actor collector)
|
||||
{
|
||||
Combat.DoExplosion(self, (info as ExplodeCrateActionInfo).Weapon, collector.CenterLocation, 0);
|
||||
Combat.DoExplosion(self, (info as ExplodeCrateActionInfo).Weapon, collector.CenterPosition);
|
||||
base.Activate(collector);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
void Explode(World world)
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Remove(this));
|
||||
Combat.DoExplosion(firedBy.PlayerActor, weapon, PPos.FromWPos(pos), pos.Z * Game.CellSize / 1024);
|
||||
Combat.DoExplosion(firedBy.PlayerActor, weapon, pos);
|
||||
world.WorldActor.Trait<ScreenShaker>().AddEffect(20, PPos.FromWPos(pos).ToFloat2(), 5);
|
||||
|
||||
foreach (var a in world.ActorsWithTrait<NukePaletteEffect>())
|
||||
|
||||
@@ -42,11 +42,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
var weapon = ChooseWeaponForExplosion(self);
|
||||
if (weapon != null)
|
||||
{
|
||||
var move = self.TraitOrDefault<IMove>();
|
||||
var altitude = move != null ? move.Altitude : 0;
|
||||
Combat.DoExplosion(e.Attacker, weapon, self.CenterLocation, altitude);
|
||||
}
|
||||
Combat.DoExplosion(e.Attacker, weapon, self.CenterPosition);
|
||||
}
|
||||
|
||||
string ChooseWeaponForExplosion(Actor self)
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace OpenRA.Mods.RA.Missions
|
||||
.Where(a => a.HasTrait<Bridge>() && !a.IsDead())
|
||||
.OrderBy(a => (startJeep.CenterLocation - a.CenterLocation).LengthSquared)
|
||||
.First();
|
||||
Combat.DoExplosion(bridge, "Demolish", bridge.CenterLocation, 0);
|
||||
Combat.DoExplosion(bridge, "Demolish", bridge.CenterPosition);
|
||||
world.WorldActor.Trait<ScreenShaker>().AddEffect(15, bridge.CenterLocation.ToFloat2(), 6);
|
||||
bridge.Kill(bridge);
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user