|
|
|
|
@@ -150,8 +150,6 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|
|
|
|
map.MapSize = new int2(mapSize, mapSize);
|
|
|
|
|
map.Bounds = Rectangle.FromLTRB(offsetX, offsetY, offsetX + width, offsetY + height);
|
|
|
|
|
|
|
|
|
|
map.Smudges = Exts.Lazy(() => new List<SmudgeReference>());
|
|
|
|
|
map.Actors = Exts.Lazy(() => new Dictionary<string, ActorReference>());
|
|
|
|
|
map.MapResources = Exts.Lazy(() => new CellLayer<ResourceTile>(TileShape.Rectangle, size));
|
|
|
|
|
map.MapTiles = Exts.Lazy(() => new CellLayer<TerrainTile>(TileShape.Rectangle, size));
|
|
|
|
|
|
|
|
|
|
@@ -190,26 +188,28 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|
|
|
|
{
|
|
|
|
|
if (kv.First <= 7)
|
|
|
|
|
{
|
|
|
|
|
var a = new ActorReference("mpspawn")
|
|
|
|
|
var ar = new ActorReference("mpspawn")
|
|
|
|
|
{
|
|
|
|
|
new LocationInit((CPos)kv.Second),
|
|
|
|
|
new OwnerInit("Neutral")
|
|
|
|
|
};
|
|
|
|
|
map.Actors.Value.Add("Actor" + map.Actors.Value.Count.ToString(), a);
|
|
|
|
|
|
|
|
|
|
map.ActorDefinitions.Add(new MiniYamlNode("Actor" + actorCount++, ar.Save()));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var a = new ActorReference("waypoint")
|
|
|
|
|
var ar = new ActorReference("waypoint")
|
|
|
|
|
{
|
|
|
|
|
new LocationInit((CPos)kv.Second),
|
|
|
|
|
new OwnerInit("Neutral")
|
|
|
|
|
};
|
|
|
|
|
map.Actors.Value.Add("waypoint" + kv.First, a);
|
|
|
|
|
|
|
|
|
|
map.ActorDefinitions.Add(new MiniYamlNode("waypoint" + kv.First, ar.Save()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create default player definitions only if there are no players to import
|
|
|
|
|
mapPlayers = new MapPlayers(map.Rules, (players.Count == 0) ? map.GetSpawnPoints().Length : 0);
|
|
|
|
|
mapPlayers = new MapPlayers(map.Rules, (players.Count == 0) ? map.SpawnPoints.Value.Length : 0);
|
|
|
|
|
foreach (var p in players)
|
|
|
|
|
LoadPlayer(file, p, legacyMapFormat == IniMapFormat.RedAlert);
|
|
|
|
|
map.PlayerDefinitions = mapPlayers.ToMiniYaml();
|
|
|
|
|
@@ -295,12 +295,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|
|
|
|
|
|
|
|
|
if (o != 255 && overlayActorMapping.ContainsKey(redAlertOverlayNames[o]))
|
|
|
|
|
{
|
|
|
|
|
map.Actors.Value.Add("Actor" + actorCount++,
|
|
|
|
|
new ActorReference(overlayActorMapping[redAlertOverlayNames[o]])
|
|
|
|
|
{
|
|
|
|
|
new LocationInit(cell),
|
|
|
|
|
new OwnerInit("Neutral")
|
|
|
|
|
});
|
|
|
|
|
var ar = new ActorReference(overlayActorMapping[redAlertOverlayNames[o]])
|
|
|
|
|
{
|
|
|
|
|
new LocationInit(cell),
|
|
|
|
|
new OwnerInit("Neutral")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
map.ActorDefinitions.Add(new MiniYamlNode("Actor" + actorCount++, ar.Save()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -315,12 +316,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|
|
|
|
foreach (var kv in terrain)
|
|
|
|
|
{
|
|
|
|
|
var loc = Exts.ParseIntegerInvariant(kv.Key);
|
|
|
|
|
map.Actors.Value.Add("Actor" + actorCount++,
|
|
|
|
|
new ActorReference(kv.Value.ToLowerInvariant())
|
|
|
|
|
{
|
|
|
|
|
new LocationInit(new CPos(loc % mapSize, loc / mapSize)),
|
|
|
|
|
new OwnerInit("Neutral")
|
|
|
|
|
});
|
|
|
|
|
var ar = new ActorReference(kv.Value.ToLowerInvariant())
|
|
|
|
|
{
|
|
|
|
|
new LocationInit(new CPos(loc % mapSize, loc / mapSize)),
|
|
|
|
|
new OwnerInit("Neutral")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
map.ActorDefinitions.Add(new MiniYamlNode("Actor" + actorCount++, ar.Save()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -355,12 +357,15 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|
|
|
|
map.MapResources.Value[cell] = new ResourceTile(res.First, res.Second);
|
|
|
|
|
|
|
|
|
|
if (overlayActorMapping.ContainsKey(kv.Value.ToLower()))
|
|
|
|
|
map.Actors.Value.Add("Actor" + actorCount++,
|
|
|
|
|
new ActorReference(overlayActorMapping[kv.Value.ToLower()])
|
|
|
|
|
{
|
|
|
|
|
new LocationInit(cell),
|
|
|
|
|
new OwnerInit("Neutral")
|
|
|
|
|
});
|
|
|
|
|
{
|
|
|
|
|
var ar = new ActorReference(overlayActorMapping[kv.Value.ToLower()])
|
|
|
|
|
{
|
|
|
|
|
new LocationInit(cell),
|
|
|
|
|
new OwnerInit("Neutral")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
map.ActorDefinitions.Add(new MiniYamlNode("Actor" + actorCount++, ar.Save()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -373,12 +378,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|
|
|
|
foreach (var kv in terrain)
|
|
|
|
|
{
|
|
|
|
|
var loc = Exts.ParseIntegerInvariant(kv.Key);
|
|
|
|
|
map.Actors.Value.Add("Actor" + actorCount++,
|
|
|
|
|
new ActorReference(kv.Value.Split(',')[0].ToLowerInvariant())
|
|
|
|
|
{
|
|
|
|
|
new LocationInit(new CPos(loc % mapSize, loc / mapSize)),
|
|
|
|
|
new OwnerInit("Neutral")
|
|
|
|
|
});
|
|
|
|
|
var ar = new ActorReference(kv.Value.Split(',')[0].ToLowerInvariant())
|
|
|
|
|
{
|
|
|
|
|
new LocationInit(new CPos(loc % mapSize, loc / mapSize)),
|
|
|
|
|
new OwnerInit("Neutral")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
map.ActorDefinitions.Add(new MiniYamlNode("Actor" + actorCount++, ar.Save()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -420,7 +426,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|
|
|
|
if (!rules.Actors.ContainsKey(parts[1].ToLowerInvariant()))
|
|
|
|
|
errorHandler("Ignoring unknown actor type: `{0}`".F(parts[1].ToLowerInvariant()));
|
|
|
|
|
else
|
|
|
|
|
map.Actors.Value.Add("Actor" + actorCount++, actor);
|
|
|
|
|
map.ActorDefinitions.Add(new MiniYamlNode("Actor" + actorCount++, actor.Save()));
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
@@ -436,7 +442,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|
|
|
|
// loc=type,loc,depth
|
|
|
|
|
var parts = s.Value.Split(',');
|
|
|
|
|
var loc = Exts.ParseIntegerInvariant(parts[1]);
|
|
|
|
|
map.Smudges.Value.Add(new SmudgeReference(parts[0].ToLowerInvariant(), new int2(loc % mapSize, loc / mapSize), Exts.ParseIntegerInvariant(parts[2])));
|
|
|
|
|
var key = "{0} {1},{2} {3}".F(parts[0].ToLowerInvariant(), loc % mapSize, loc / mapSize, Exts.ParseIntegerInvariant(parts[2]));
|
|
|
|
|
map.SmudgeDefinitions.Add(new MiniYamlNode(key, ""));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|