From cc9b24d93289c707e0662bf67e691f11797d5be9 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 18 Jun 2016 22:41:00 +0200 Subject: [PATCH] Make WithShadow Offset and ZOffset customizable --- OpenRA.Mods.Common/Traits/Render/WithShadow.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithShadow.cs b/OpenRA.Mods.Common/Traits/Render/WithShadow.cs index adc123b775..1cd25cdd60 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithShadow.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithShadow.cs @@ -21,6 +21,12 @@ namespace OpenRA.Mods.Common.Traits.Render { [PaletteReference] public readonly string Palette = "shadow"; + [Desc("Shadow position offset relative to actor position (ground level).")] + public readonly WVec Offset = WVec.Zero; + + [Desc("Shadow Z offset relative to actor sprite.")] + public readonly int ZOffset = -5; + public override object Create(ActorInitializer init) { return new WithShadow(this); } } @@ -46,8 +52,8 @@ namespace OpenRA.Mods.Common.Traits.Render var height = self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length; var shadowSprites = r.Where(s => !s.IsDecoration) .Select(a => a.WithPalette(wr.Palette(info.Palette)) - .OffsetBy(new WVec(0, 0, -height)) - .WithZOffset(a.ZOffset + height) + .OffsetBy(info.Offset - new WVec(0, 0, height)) + .WithZOffset(a.ZOffset + (height + info.ZOffset)) .AsDecoration()); return shadowSprites.Concat(r);