diff --git a/OpenRA.Mods.RA/LeavesHusk.cs b/OpenRA.Mods.RA/LeavesHusk.cs index 1fc3f91fe3..c543da970c 100644 --- a/OpenRA.Mods.RA/LeavesHusk.cs +++ b/OpenRA.Mods.RA/LeavesHusk.cs @@ -36,6 +36,7 @@ namespace OpenRA.Mods.RA { var td = new TypeDictionary { + new ParentActorInit(self), new LocationInit(self.Location), new CenterLocationInit(self.CenterLocation), new OwnerInit(self.Owner), diff --git a/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs b/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs index 14b1620797..e9bacfb9a7 100644 --- a/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs +++ b/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs @@ -19,20 +19,25 @@ namespace OpenRA.Mods.RA { public class FrozenUnderFogInfo : ITraitInfo, Requires, Requires { - public object Create(ActorInitializer init) { return new FrozenUnderFog(init.self); } + public readonly bool StartsRevealed = false; + + public object Create(ActorInitializer init) { return new FrozenUnderFog(init, this); } } public class FrozenUnderFog : IRenderModifier, IVisibilityModifier, ITickRender { FrozenActorProxy proxy; IEnumerable footprint; - bool visible; + bool visible, cacheFirstFrame; - public FrozenUnderFog(Actor self) + public FrozenUnderFog(ActorInitializer init, FrozenUnderFogInfo info) { - footprint = FootprintUtils.Tiles(self); - proxy = new FrozenActorProxy(self, footprint); - self.World.AddFrameEndTask(w => w.Add(proxy)); + footprint = FootprintUtils.Tiles(init.self); + proxy = new FrozenActorProxy(init.self, footprint); + init.world.AddFrameEndTask(w => w.Add(proxy)); + + // Spawned actors (e.g. building husks) shouldn't be revealed + cacheFirstFrame = info.StartsRevealed && !init.Contains(); } public bool IsVisible(Actor self, Player byPlayer) @@ -46,6 +51,13 @@ namespace OpenRA.Mods.RA return; visible = IsVisible(self, self.World.RenderPlayer); + + if (cacheFirstFrame) + { + visible = true; + cacheFirstFrame = false; + } + if (visible) proxy.SetRenderables(self.Render(wr)); }