revert CaptureActor.Range, PascalCase conventions, compatibilty
the hardcoded Range=3 was crap for smaller/bigger buildings try not to break TransformOnCapture as it is used for cnc husks
This commit is contained in:
committed by
Chris Forbes
parent
3a1c4d1e6f
commit
affa9ca336
@@ -9,8 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.RA.Move;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
@@ -26,6 +26,12 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (target == null || !target.IsInWorld || target.IsDead()) return NextActivity;
|
||||
if (target.Owner == self.Owner) return NextActivity;
|
||||
|
||||
// Need to be next to building, TODO: stop capture when going away
|
||||
var mobile = self.Trait<Mobile>();
|
||||
var nearest = target.OccupiesSpace.NearestCellTo(mobile.toCell);
|
||||
if ((nearest - mobile.toCell).LengthSquared > 2)
|
||||
return Util.SequenceActivities(new MoveAdjacentTo(Target.FromActor(target)), this);
|
||||
|
||||
var capturable = target.TraitOrDefault<Capturable>();
|
||||
if (capturable != null && capturable.CaptureInProgress && capturable.Captor.Owner.Stances[self.Owner] == Stance.Ally)
|
||||
return NextActivity;
|
||||
@@ -34,12 +40,9 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (sellable != null && sellable.Selling)
|
||||
return NextActivity;
|
||||
|
||||
var captures = self.TraitOrDefault<Captures>();
|
||||
target.Trait<Capturable>().BeginCapture(target, self);
|
||||
|
||||
var capturesInfo = self.Info.Traits.Get<CapturesInfo>();
|
||||
if (captures != null && Combat.IsInRange(self.CenterLocation, capturesInfo.Range, target))
|
||||
target.Trait<Capturable>().BeginCapture(target, self);
|
||||
else
|
||||
return Util.SequenceActivities(self.Trait<Mobile>().MoveWithinRange(Target.FromActor(target), capturesInfo.Range), this);
|
||||
if (capturesInfo != null && capturesInfo.wastedAfterwards)
|
||||
self.World.AddFrameEndTask(w => self.Destroy());
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace OpenRA.Mods.RA
|
||||
class CapturesInfo : ITraitInfo
|
||||
{
|
||||
public string[] CaptureTypes = {"building"};
|
||||
public int Range = 3;
|
||||
public bool wastedAfterwards = true;
|
||||
public object Create(ActorInitializer init) { return new Captures(init.self, this); }
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
[ActorReference] public readonly string IntoActor = null;
|
||||
public readonly int ForceHealthPercentage = 0;
|
||||
public readonly bool SkipMakeAnims = true;
|
||||
|
||||
public virtual object Create(ActorInitializer init) { return new TransformOnCapture(this); }
|
||||
}
|
||||
@@ -32,7 +33,7 @@ namespace OpenRA.Mods.RA
|
||||
var facing = self.TraitOrDefault<IFacing>();
|
||||
var transform = new Transform(self, Info.IntoActor) { ForceHealthPercentage = Info.ForceHealthPercentage };
|
||||
if (facing != null) transform.Facing = facing.Facing;
|
||||
transform.SkipMakeAnims = true;
|
||||
transform.SkipMakeAnims = Info.SkipMakeAnims;
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(transform);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ V01:
|
||||
Range: 10
|
||||
TransformOnCapture:
|
||||
IntoActor: v01.sniper
|
||||
SkipMakeAnims: true
|
||||
Capturable:
|
||||
Type: civilianbuilding
|
||||
CaptureCompleteTime: 0
|
||||
|
||||
Reference in New Issue
Block a user