wiring new weapon stuff into AttackBase.CheckFire
This commit is contained in:
@@ -29,7 +29,7 @@ namespace OpenRA.GameRules
|
|||||||
{
|
{
|
||||||
public NewWeaponInfo weapon;
|
public NewWeaponInfo weapon;
|
||||||
public Actor firedBy;
|
public Actor firedBy;
|
||||||
public int2 offset;
|
public int2 src;
|
||||||
public int srcAltitude;
|
public int srcAltitude;
|
||||||
public int facing;
|
public int facing;
|
||||||
public Actor target;
|
public Actor target;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ using System.Drawing;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Effects;
|
using OpenRA.Effects;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.GameRules;
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
@@ -175,30 +176,29 @@ namespace OpenRA.Traits
|
|||||||
var srcAltitude = unit != null ? unit.Altitude : 0;
|
var srcAltitude = unit != null ? unit.Altitude : 0;
|
||||||
var destAltitude = destUnit != null ? destUnit.Altitude : 0;
|
var destAltitude = destUnit != null ? destUnit.Altitude : 0;
|
||||||
|
|
||||||
if ( weapon.RenderAsLaser )
|
|
||||||
{
|
|
||||||
// TODO: This is a hack; should probably use a particular palette index
|
|
||||||
Color bc = (weapon.UsePlayerColor) ? self.Owner.Color : Color.Red;
|
|
||||||
self.World.Add(new LaserZap(firePos, thisTarget.CenterLocation.ToInt2(), weapon.BeamRadius, bc));
|
|
||||||
}
|
|
||||||
if( weapon.RenderAsTesla )
|
|
||||||
self.World.Add( new TeslaZap( firePos, thisTarget.CenterLocation.ToInt2() ) );
|
|
||||||
|
|
||||||
if (Rules.ProjectileInfo[weapon.Projectile].ROT != 0)
|
|
||||||
{
|
|
||||||
var fireFacing = thisLocalOffset.ElementAtOrDefault(2) +
|
var fireFacing = thisLocalOffset.ElementAtOrDefault(2) +
|
||||||
(self.traits.Contains<Turreted>() ? self.traits.Get<Turreted>().turretFacing :
|
(self.traits.Contains<Turreted>() ? self.traits.Get<Turreted>().turretFacing :
|
||||||
unit != null ? unit.Facing : Util.GetFacing( thisTarget.CenterLocation - self.CenterLocation, 0 ));
|
unit != null ? unit.Facing : Util.GetFacing(thisTarget.CenterLocation - self.CenterLocation, 0));
|
||||||
|
|
||||||
self.World.Add(new Missile(weapon, self.Owner, self,
|
var newWeaponInfo = Rules.Weapons[weaponName];
|
||||||
firePos, thisTarget, srcAltitude, fireFacing));
|
var args = new ProjectileArgs
|
||||||
}
|
{
|
||||||
else
|
firedBy = self,
|
||||||
self.World.Add(new Bullet(weapon, self.Owner, self,
|
srcAltitude = srcAltitude,
|
||||||
firePos, thisTarget.CenterLocation.ToInt2(), srcAltitude, destAltitude));
|
destAltitude = destAltitude,
|
||||||
|
target = thisTarget,
|
||||||
|
facing = fireFacing,
|
||||||
|
weapon = newWeaponInfo,
|
||||||
|
src = firePos,
|
||||||
|
dest = thisTarget.CenterLocation.ToInt2()
|
||||||
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(weapon.Report))
|
var projectile = newWeaponInfo.Projectile.Create(args);
|
||||||
Sound.Play(weapon.Report + ".aud");
|
if (projectile != null)
|
||||||
|
self.World.Add(projectile);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(newWeaponInfo.Report))
|
||||||
|
Sound.Play(newWeaponInfo.Report + ".aud");
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var na in self.traits.WithInterface<INotifyAttack>())
|
foreach (var na in self.traits.WithInterface<INotifyAttack>())
|
||||||
|
|||||||
Reference in New Issue
Block a user