Merge pull request #5814 from Mailaender/vamos-vamos
Fixed units not moving to the RallyPoint
This commit is contained in:
@@ -674,7 +674,7 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
{
|
{
|
||||||
var buildings = self.World.ActorsWithTrait<RallyPoint>()
|
var buildings = self.World.ActorsWithTrait<RallyPoint>()
|
||||||
.Where(rp => rp.Actor.Owner == p &&
|
.Where(rp => rp.Actor.Owner == p &&
|
||||||
!IsRallyPointValid(rp.Trait.rallyPoint, rp.Actor.Info.Traits.GetOrDefault<BuildingInfo>())).ToArray();
|
!IsRallyPointValid(rp.Trait.Location, rp.Actor.Info.Traits.GetOrDefault<BuildingInfo>())).ToArray();
|
||||||
|
|
||||||
if (buildings.Length > 0)
|
if (buildings.Length > 0)
|
||||||
BotDebug("Bot {0} needs to find rallypoints for {1} buildings.",
|
BotDebug("Bot {0} needs to find rallypoints for {1} buildings.",
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
var hasHost = host != null;
|
var hasHost = host != null;
|
||||||
var rp = hasHost ? host.TraitOrDefault<RallyPoint>() : null;
|
var rp = hasHost ? host.TraitOrDefault<RallyPoint>() : null;
|
||||||
|
|
||||||
var destination = rp != null ? rp.rallyPoint :
|
var destination = rp != null ? rp.Location :
|
||||||
(hasHost ? self.World.Map.CellContaining(host.CenterPosition) : self.Location);
|
(hasHost ? self.World.Map.CellContaining(host.CenterPosition) : self.Location);
|
||||||
|
|
||||||
return new AttackMove.AttackMoveActivity(self, self.Trait<IMove>().MoveTo(destination, 1));
|
return new AttackMove.AttackMoveActivity(self, self.Trait<IMove>().MoveTo(destination, 1));
|
||||||
|
|||||||
4
OpenRA.Mods.RA/Effects/RallyPoint.cs
Executable file → Normal file
4
OpenRA.Mods.RA/Effects/RallyPoint.cs
Executable file → Normal file
@@ -42,9 +42,9 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
{
|
{
|
||||||
flag.Tick();
|
flag.Tick();
|
||||||
circles.Tick();
|
circles.Tick();
|
||||||
if (cachedLocation != rp.rallyPoint)
|
if (cachedLocation != rp.Location)
|
||||||
{
|
{
|
||||||
cachedLocation = rp.rallyPoint;
|
cachedLocation = rp.Location;
|
||||||
circles.Play("circles");
|
circles.Play("circles");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,9 +62,8 @@ namespace OpenRA.Mods.RA
|
|||||||
var fi = producee.Traits.Get<IFacingInfo>();
|
var fi = producee.Traits.Get<IFacingInfo>();
|
||||||
var initialFacing = exitinfo.Facing < 0 ? Util.GetFacing(to - spawn, fi.GetInitialFacing()) : exitinfo.Facing;
|
var initialFacing = exitinfo.Facing < 0 ? Util.GetFacing(to - spawn, fi.GetInitialFacing()) : exitinfo.Facing;
|
||||||
|
|
||||||
var exitLocation = rp.Value != null ? rp.Value.rallyPoint : exit;
|
var exitLocation = rp.Value != null ? rp.Value.Location : exit;
|
||||||
var target = Target.FromCell(self.World, exitLocation);
|
var target = Target.FromCell(self.World, exitLocation);
|
||||||
var nearEnough = rp.Value != null ? WRange.FromCells(rp.Value.nearEnough) : WRange.Zero;
|
|
||||||
|
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
@@ -88,7 +87,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
newUnit.QueueActivity(move.MoveIntoWorld(newUnit, exit));
|
newUnit.QueueActivity(move.MoveIntoWorld(newUnit, exit));
|
||||||
newUnit.QueueActivity(new AttackMove.AttackMoveActivity(
|
newUnit.QueueActivity(new AttackMove.AttackMoveActivity(
|
||||||
newUnit, move.MoveWithinRange(target, nearEnough)));
|
newUnit, move.MoveTo(exitLocation, 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
* available to you under the terms of the GNU General Public License
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA
|
|||||||
[Desc("Used to waypoint units after production or repair is finished.")]
|
[Desc("Used to waypoint units after production or repair is finished.")]
|
||||||
public class RallyPointInfo : ITraitInfo
|
public class RallyPointInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly int[] RallyPoint = { 1, 3 };
|
public readonly CVec RallyPoint = new CVec(1, 3);
|
||||||
public readonly string IndicatorPalettePrefix = "player";
|
public readonly string IndicatorPalettePrefix = "player";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new RallyPoint(init.self, this); }
|
public object Create(ActorInitializer init) { return new RallyPoint(init.self, this); }
|
||||||
@@ -24,12 +24,11 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public class RallyPoint : IIssueOrder, IResolveOrder, ISync
|
public class RallyPoint : IIssueOrder, IResolveOrder, ISync
|
||||||
{
|
{
|
||||||
[Sync] public CPos rallyPoint;
|
[Sync] public CPos Location;
|
||||||
public int nearEnough = 1;
|
|
||||||
|
|
||||||
public RallyPoint(Actor self, RallyPointInfo info)
|
public RallyPoint(Actor self, RallyPointInfo info)
|
||||||
{
|
{
|
||||||
rallyPoint = self.Location + new CVec(info.RallyPoint[0], info.RallyPoint[1]);
|
Location = self.Location + info.RallyPoint;
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Effects.RallyPoint(self, info.IndicatorPalettePrefix)));
|
self.World.AddFrameEndTask(w => w.Add(new Effects.RallyPoint(self, info.IndicatorPalettePrefix)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +48,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "SetRallyPoint")
|
if (order.OrderString == "SetRallyPoint")
|
||||||
rallyPoint = order.TargetLocation;
|
Location = order.TargetLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
class RallyPointOrderTargeter : IOrderTargeter
|
class RallyPointOrderTargeter : IOrderTargeter
|
||||||
@@ -68,6 +67,7 @@ namespace OpenRA.Mods.RA
|
|||||||
cursor = "ability";
|
cursor = "ability";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ namespace OpenRA.Mods.RA
|
|||||||
if (rp != null)
|
if (rp != null)
|
||||||
self.QueueActivity(new CallFunc(() =>
|
self.QueueActivity(new CallFunc(() =>
|
||||||
{
|
{
|
||||||
self.SetTargetLine(Target.FromCell(self.World, rp.rallyPoint), Color.Green);
|
self.SetTargetLine(Target.FromCell(self.World, rp.Location), Color.Green);
|
||||||
self.QueueActivity(movement.MoveTo(rp.rallyPoint, order.TargetActor));
|
self.QueueActivity(movement.MoveTo(rp.Location, order.TargetActor));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ end
|
|||||||
Production.SetRallyPoint = function(factory, location)
|
Production.SetRallyPoint = function(factory, location)
|
||||||
local srp = Actor.Trait(factory, "RallyPoint")
|
local srp = Actor.Trait(factory, "RallyPoint")
|
||||||
if srp ~= nil then
|
if srp ~= nil then
|
||||||
srp.rallyPoint = location.Location
|
srp.Location = location.Location
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user