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