Support a maximum building range (Fixes #2156).
This also implements support for a per-provider cooldown between placing structures, allowing mods with multiple structure queues to rate-limit placement around a single provider. An initial delay parameter is included to support units that deploy into a base provider and require an initial setup time (e.g. the Surveyor unit from C&C TW). The range and time restrictions are not applied to walls as a balance choice.
This commit is contained in:
@@ -19,7 +19,7 @@ using OpenRA.Mods.RA.Activities;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
public class RenderBuildingInfo : RenderSimpleInfo
|
||||
public class RenderBuildingInfo : RenderSimpleInfo, Requires<BuildingInfo>, IPlaceBuildingDecoration
|
||||
{
|
||||
public readonly bool HasMakeAnimation = true;
|
||||
public readonly float2 Origin = float2.Zero;
|
||||
@@ -30,6 +30,15 @@ namespace OpenRA.Mods.RA.Render
|
||||
return base.RenderPreview(building, pr)
|
||||
.Select(a => a.WithPos(a.Pos + building.Traits.Get<RenderBuildingInfo>().Origin));
|
||||
}
|
||||
|
||||
public void Render(WorldRenderer wr, World w, ActorInfo ai, PPos centerLocation)
|
||||
{
|
||||
if (!ai.Traits.Get<BuildingInfo>().RequiresBaseProvider)
|
||||
return;
|
||||
|
||||
foreach (var a in w.ActorsWithTrait<BaseProvider>())
|
||||
a.Trait.RenderBeforeWorld(wr, a.Actor);
|
||||
}
|
||||
}
|
||||
|
||||
public class RenderBuilding : RenderSimple, INotifyDamageStateChanged, IRenderModifier
|
||||
|
||||
Reference in New Issue
Block a user