Use map-defined stances
This commit is contained in:
@@ -23,8 +23,8 @@ namespace OpenRA.FileFormats
|
||||
public Color Color2 = Color.FromArgb(44,28,24);
|
||||
|
||||
public int InitialCash = 0;
|
||||
public string[] Allies = null;
|
||||
public string[] Enemies = null;
|
||||
public string[] Allies = {};
|
||||
public string[] Enemies = {};
|
||||
|
||||
public PlayerReference() {}
|
||||
public PlayerReference(MiniYaml my)
|
||||
|
||||
@@ -95,14 +95,25 @@ namespace OpenRA
|
||||
|
||||
// Add Map Players
|
||||
int mapPlayerIndex = -1;
|
||||
Dictionary<string, Player> MapPlayers = new Dictionary<string, Player>();
|
||||
|
||||
foreach (var kv in Map.Players)
|
||||
{
|
||||
var player = new Player(this, kv.Value, mapPlayerIndex--);
|
||||
AddPlayer(player);
|
||||
|
||||
MapPlayers.Add(kv.Key,player);
|
||||
if (kv.Value.OwnsWorld)
|
||||
WorldActor.Owner = player;
|
||||
}
|
||||
foreach(var p in MapPlayers)
|
||||
{
|
||||
foreach(var q in Map.Players[p.Key].Allies)
|
||||
p.Value.Stances[MapPlayers[q]] = Stance.Ally;
|
||||
|
||||
foreach(var q in Map.Players[p.Key].Enemies)
|
||||
p.Value.Stances[MapPlayers[q]] = Stance.Enemy;
|
||||
}
|
||||
|
||||
|
||||
// Add real players
|
||||
SetLocalPlayer(Game.orderManager.Connection.LocalClientId);
|
||||
@@ -112,8 +123,11 @@ namespace OpenRA
|
||||
|
||||
foreach (var p in players.Values)
|
||||
foreach (var q in players.Values)
|
||||
p.Stances[q] = Game.ChooseInitialStance(p, q);
|
||||
|
||||
{
|
||||
if (!p.Stances.ContainsKey(q))
|
||||
p.Stances[q] = Game.ChooseInitialStance(p, q);
|
||||
}
|
||||
|
||||
Timer.Time( "worldActor: {0}" );
|
||||
|
||||
foreach (var wlh in WorldActor.TraitsImplementing<ILoadWorldHook>())
|
||||
|
||||
@@ -18,21 +18,12 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
class DefaultShellmapScript: ILoadWorldHook, ITick
|
||||
{
|
||||
Player goodguy;
|
||||
Player greece;
|
||||
Dictionary<string, Actor> MapActors;
|
||||
|
||||
public void WorldLoaded(World w)
|
||||
{
|
||||
Game.MoveViewport((.5f * (w.Map.TopLeft + w.Map.BottomRight).ToFloat2()).ToInt2());
|
||||
// Sound.PlayMusic("hell226m.aud");
|
||||
goodguy = w.players.Values.Where(x => x.InternalName == "GoodGuy").FirstOrDefault();
|
||||
greece = w.players.Values.Where(x => x.InternalName == "Greece").FirstOrDefault();
|
||||
MapActors = w.WorldActor.Trait<SpawnMapActors>().MapActors;
|
||||
|
||||
|
||||
goodguy.Stances[greece] = Stance.Enemy;
|
||||
greece.Stances[goodguy] = Stance.Enemy;
|
||||
}
|
||||
|
||||
int ticks = 0;
|
||||
|
||||
@@ -1 +1 @@
|
||||
f78ab8d4d40ac3c263d1e404e5bf8233dce1f1a7
|
||||
5065fbcb8e5b1b6cea2a003c64f9b48fcaa33e06
|
||||
@@ -19,23 +19,38 @@ BottomRight: 118,93
|
||||
Players:
|
||||
PlayerReference@Neutral:
|
||||
Name: Neutral
|
||||
Palette:
|
||||
Race: allies
|
||||
OwnsWorld: True
|
||||
NonCombatant: True
|
||||
Color: 255,238,238,238
|
||||
Color2: 255,44,28,24
|
||||
InitialCash: 0
|
||||
Allies:
|
||||
Enemies:
|
||||
PlayerReference@GoodGuy:
|
||||
Name: GoodGuy
|
||||
Color: 85,130,204
|
||||
Color2: 17,33,71
|
||||
Palette:
|
||||
Race: allies
|
||||
OwnsWorld: False
|
||||
NonCombatant: False
|
||||
Color: 255,85,130,204
|
||||
Color2: 255,17,33,71
|
||||
InitialCash: 0
|
||||
Allies:
|
||||
Enemies: Greece
|
||||
PlayerReference@Greece:
|
||||
Name: Greece
|
||||
Color: 255,20,0
|
||||
Color2: 56,0,0
|
||||
Palette:
|
||||
Race: soviet
|
||||
OwnsWorld: False
|
||||
NonCombatant: False
|
||||
Color: 255,255,20,0
|
||||
Color2: 255,56,0,0
|
||||
InitialCash: 0
|
||||
Allies:
|
||||
Enemies: GoodGuy
|
||||
|
||||
Actors:
|
||||
Actor0: brik
|
||||
Location: 32,43
|
||||
|
||||
@@ -67,4 +67,4 @@ Movies:
|
||||
mods/ra/movies1.yaml
|
||||
mods/ra/movies2.yaml
|
||||
|
||||
ShellmapUid:f78ab8d4d40ac3c263d1e404e5bf8233dce1f1a7
|
||||
ShellmapUid:5065fbcb8e5b1b6cea2a003c64f9b48fcaa33e06
|
||||
|
||||
Reference in New Issue
Block a user