Add Lua Scripting for Carryall.

This commit is contained in:
Mustafa Alperen Seki
2021-04-03 18:08:46 +03:00
committed by abcdefg30
parent 860ec642b8
commit d149624b84
6 changed files with 77 additions and 15 deletions

View File

@@ -12,6 +12,7 @@
using System.Collections.Generic;
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Activities
@@ -22,19 +23,21 @@ namespace OpenRA.Mods.Common.Activities
readonly BodyOrientation body;
readonly bool assignTargetOnFirstRun;
readonly WDist deliverRange;
readonly Color? targetLineColor;
Target destination;
public DeliverUnit(Actor self, WDist deliverRange)
: this(self, Target.Invalid, deliverRange)
public DeliverUnit(Actor self, WDist deliverRange, Color? targetLineColor)
: this(self, Target.Invalid, deliverRange, targetLineColor)
{
assignTargetOnFirstRun = true;
}
public DeliverUnit(Actor self, in Target destination, WDist deliverRange)
public DeliverUnit(Actor self, in Target destination, WDist deliverRange, Color? targetLineColor)
{
this.destination = destination;
this.deliverRange = deliverRange;
this.targetLineColor = targetLineColor;
carryall = self.Trait<Carryall>();
body = self.Trait<BodyOrientation>();
@@ -59,7 +62,8 @@ namespace OpenRA.Mods.Common.Activities
public override IEnumerable<TargetLineNode> TargetLineNodes(Actor self)
{
yield return new TargetLineNode(destination, carryall.Info.TargetLineColor);
if (targetLineColor != null)
yield return new TargetLineNode(destination, targetLineColor.Value);
}
class ReleaseUnit : Activity