Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore NukePower support for proxy actors. #17457

Merged
merged 1 commit into from Dec 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs
Expand Up @@ -16,7 +16,7 @@

namespace OpenRA.Mods.Common.Traits
{
class NukePowerInfo : SupportPowerInfo, IRulesetLoaded, Requires<BodyOrientationInfo>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IRulesetLoaded removal isn't part of the fix, but it was redundant because we inherit from SupportPowerInfo.

class NukePowerInfo : SupportPowerInfo
{
[WeaponReference]
[FieldLoader.Require]
Expand Down Expand Up @@ -124,15 +124,20 @@ public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
class NukePower : SupportPower
{
readonly NukePowerInfo info;
readonly BodyOrientation body;
BodyOrientation body;

public NukePower(Actor self, NukePowerInfo info)
: base(self, info)
{
body = self.Trait<BodyOrientation>();
this.info = info;
}

protected override void Created(Actor self)
{
body = self.TraitOrDefault<BodyOrientation>();
base.Created(self);
}

public override void Activate(Actor self, Order order, SupportPowerManager manager)
{
base.Activate(self, order, manager);
Expand All @@ -147,10 +152,13 @@ public void Activate(Actor self, WPos targetPosition)
launchpad.Launching(self);

var palette = info.IsPlayerPalette ? info.MissilePalette + self.Owner.InternalName : info.MissilePalette;
var skipAscent = info.SkipAscent || body == null;
var launchPos = skipAscent ? WPos.Zero : self.CenterPosition + body.LocalToWorld(info.SpawnOffset);

var missile = new NukeLaunch(self.Owner, info.MissileWeapon, info.WeaponInfo, palette, info.MissileUp, info.MissileDown,
self.CenterPosition + body.LocalToWorld(info.SpawnOffset),
launchPos,
targetPosition, info.DetonationAltitude, info.RemoveMissileOnDetonation,
info.FlightVelocity, info.MissileDelay, info.FlightDelay, info.SkipAscent,
info.FlightVelocity, info.MissileDelay, info.FlightDelay, skipAscent,
info.FlashType,
info.TrailImage, info.TrailSequences, info.TrailPalette, info.TrailUsePlayerPalette, info.TrailDelay, info.TrailInterval);

Expand Down