Generate initial frozen renderables for all map-placed actors.
This commit is contained in:
@@ -20,8 +20,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("This actor will remain visible (but not updated visually) under fog, once discovered.")]
|
[Desc("This actor will remain visible (but not updated visually) under fog, once discovered.")]
|
||||||
public class FrozenUnderFogInfo : ITraitInfo, Requires<BuildingInfo>, IDefaultVisibilityInfo
|
public class FrozenUnderFogInfo : ITraitInfo, Requires<BuildingInfo>, IDefaultVisibilityInfo
|
||||||
{
|
{
|
||||||
public readonly bool StartsRevealed = false;
|
|
||||||
|
|
||||||
[Desc("Players with these stances can always see the actor.")]
|
[Desc("Players with these stances can always see the actor.")]
|
||||||
public readonly Stance AlwaysVisibleStances = Stance.Ally;
|
public readonly Stance AlwaysVisibleStances = Stance.Ally;
|
||||||
|
|
||||||
@@ -55,8 +53,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
var map = init.World.Map;
|
var map = init.World.Map;
|
||||||
|
|
||||||
// Spawned actors (e.g. building husks) shouldn't be revealed
|
// Explore map-placed actors if the "Explore Map" option is enabled
|
||||||
startsRevealed = info.StartsRevealed && !init.Contains<ParentActorInit>();
|
var exploredMap = !init.World.LobbyInfo.GlobalSettings.Shroud;
|
||||||
|
startsRevealed = exploredMap && init.Contains<SpawnedByMapInit>() && !init.Contains<HiddenUnderFogInit>();
|
||||||
var footprintCells = FootprintUtils.Tiles(init.Self).ToList();
|
var footprintCells = FootprintUtils.Tiles(init.Self).ToList();
|
||||||
footprint = footprintCells.SelectMany(c => map.ProjectedCellsCovering(c.ToMPos(map))).ToArray();
|
footprint = footprintCells.SelectMany(c => map.ProjectedCellsCovering(c.ToMPos(map))).ToArray();
|
||||||
}
|
}
|
||||||
@@ -142,4 +141,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return IsVisible(self, self.World.RenderPlayer) || isRendering ? r : SpriteRenderable.None;
|
return IsVisible(self, self.World.RenderPlayer) || isRendering ? r : SpriteRenderable.None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class HiddenUnderFogInit : IActorInit { }
|
||||||
}
|
}
|
||||||
@@ -37,6 +37,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
var initDict = actorReference.InitDict;
|
var initDict = actorReference.InitDict;
|
||||||
initDict.Add(new SkipMakeAnimsInit());
|
initDict.Add(new SkipMakeAnimsInit());
|
||||||
|
initDict.Add(new SpawnedByMapInit(kv.Key));
|
||||||
var actor = world.CreateActor(actorReference.Type, initDict);
|
var actor = world.CreateActor(actorReference.Type, initDict);
|
||||||
Actors[kv.Key] = actor;
|
Actors[kv.Key] = actor;
|
||||||
LastMapActorID = actor.ActorID;
|
LastMapActorID = actor.ActorID;
|
||||||
@@ -45,4 +46,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class SkipMakeAnimsInit : IActorInit, ISuppressInitExport { }
|
public class SkipMakeAnimsInit : IActorInit, ISuppressInitExport { }
|
||||||
|
public class SpawnedByMapInit : IActorInit<string>, ISuppressInitExport
|
||||||
|
{
|
||||||
|
public readonly string Name;
|
||||||
|
public SpawnedByMapInit(string name) { Name = name; }
|
||||||
|
|
||||||
|
public string Value(World world)
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -770,6 +770,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (engineVersion < 20160418)
|
||||||
|
{
|
||||||
|
// Removed FrozenUnderFog.StartsRevealed
|
||||||
|
if (node.Key == "FrozenUnderFog")
|
||||||
|
node.Value.Nodes.RemoveAll(x => x.Key == "StartsRevealed");
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -518,7 +518,6 @@
|
|||||||
GenericStancePrefix: false
|
GenericStancePrefix: false
|
||||||
ShowOwnerRow: false
|
ShowOwnerRow: false
|
||||||
FrozenUnderFog:
|
FrozenUnderFog:
|
||||||
StartsRevealed: true
|
|
||||||
|
|
||||||
^CivBuildingHusk:
|
^CivBuildingHusk:
|
||||||
Inherits@1: ^SpriteActor
|
Inherits@1: ^SpriteActor
|
||||||
@@ -532,7 +531,6 @@
|
|||||||
GenericStancePrefix: false
|
GenericStancePrefix: false
|
||||||
ShowOwnerRow: false
|
ShowOwnerRow: false
|
||||||
FrozenUnderFog:
|
FrozenUnderFog:
|
||||||
StartsRevealed: true
|
|
||||||
ScriptTriggers:
|
ScriptTriggers:
|
||||||
|
|
||||||
^TechBuilding:
|
^TechBuilding:
|
||||||
@@ -571,7 +569,6 @@
|
|||||||
Palette: terrain
|
Palette: terrain
|
||||||
WithSpriteBody:
|
WithSpriteBody:
|
||||||
FrozenUnderFog:
|
FrozenUnderFog:
|
||||||
StartsRevealed: true
|
|
||||||
ScriptTriggers:
|
ScriptTriggers:
|
||||||
|
|
||||||
^Wall:
|
^Wall:
|
||||||
|
|||||||
@@ -521,7 +521,6 @@
|
|||||||
Name: Civilian Building
|
Name: Civilian Building
|
||||||
GenericVisibility: None
|
GenericVisibility: None
|
||||||
FrozenUnderFog:
|
FrozenUnderFog:
|
||||||
StartsRevealed: true
|
|
||||||
|
|
||||||
^FakeBuilding:
|
^FakeBuilding:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
|
|||||||
@@ -607,7 +607,6 @@
|
|||||||
RadarColorFromTerrain:
|
RadarColorFromTerrain:
|
||||||
Terrain: Tiberium
|
Terrain: Tiberium
|
||||||
FrozenUnderFog:
|
FrozenUnderFog:
|
||||||
StartsRevealed: true
|
|
||||||
SeedsResource:
|
SeedsResource:
|
||||||
ResourceType: Tiberium
|
ResourceType: Tiberium
|
||||||
Interval: 55
|
Interval: 55
|
||||||
|
|||||||
Reference in New Issue
Block a user