real player spawning
This commit is contained in:
@@ -267,10 +267,11 @@ namespace OpenRA
|
|||||||
if( orderManager.GameStarted ) return;
|
if( orderManager.GameStarted ) return;
|
||||||
chat.Reset();
|
chat.Reset();
|
||||||
|
|
||||||
// todo: only spawn a neutral player + a player for each client
|
world.AddPlayer(new Player(world, null)); // neutral player
|
||||||
for (int i = 0; i < 8; i++)
|
|
||||||
world.players[i] = new Player(world, i, LobbyInfo.Clients.FirstOrDefault(a => a.Index == i));
|
|
||||||
|
|
||||||
|
foreach (var c in LobbyInfo.Clients)
|
||||||
|
world.AddPlayer(new Player(world, c));
|
||||||
|
|
||||||
world.Queries = new World.AllQueries(world);
|
world.Queries = new World.AllQueries(world);
|
||||||
|
|
||||||
foreach (var gs in world.WorldActor.traits.WithInterface<IGameStarted>())
|
foreach (var gs in world.WorldActor.traits.WithInterface<IGameStarted>())
|
||||||
|
|||||||
@@ -66,19 +66,29 @@ namespace OpenRA
|
|||||||
|
|
||||||
public Shroud Shroud;
|
public Shroud Shroud;
|
||||||
|
|
||||||
public Player( World world, int index, Session.Client client )
|
public Player( World world, Session.Client client )
|
||||||
{
|
{
|
||||||
Shroud = new Shroud(this, world.Map);
|
Shroud = new Shroud(this, world.Map);
|
||||||
|
|
||||||
this.PlayerActor = world.CreateActor("Player", new int2(int.MaxValue, int.MaxValue), this);
|
PlayerActor = world.CreateActor("Player", new int2(int.MaxValue, int.MaxValue), this);
|
||||||
this.Index = index;
|
|
||||||
this.InternalName = "Multi{0}".F(index);
|
|
||||||
|
|
||||||
var paletteIndex = client != null ? client.PaletteIndex : index;
|
if (client != null)
|
||||||
this.Palette = PlayerColors[paletteIndex].a;
|
{
|
||||||
this.Color = PlayerColors[paletteIndex].c;
|
Index = client.Index;
|
||||||
this.PlayerName = client != null ? client.Name : "Player {0}".F(index+1);
|
Palette = PlayerColors[client.PaletteIndex].a;
|
||||||
this.Country = world.GetCountries()
|
Color = PlayerColors[client.PaletteIndex].c;
|
||||||
|
PlayerName = client.Name;
|
||||||
|
InternalName = "Multi{0}".F(client.Index);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Index = -1;
|
||||||
|
PlayerName = InternalName = "Neutral";
|
||||||
|
Palette = "neutral";
|
||||||
|
Color = Color.Gray; // HACK HACK
|
||||||
|
}
|
||||||
|
|
||||||
|
Country = world.GetCountries()
|
||||||
.FirstOrDefault( c => client != null && client.Country == c.Name )
|
.FirstOrDefault( c => client != null && client.Country == c.Name )
|
||||||
?? world.GetCountries().First();
|
?? world.GetCountries().First();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user