Team IDs start from 1 (-> monsters don't count as members of the team 0)
This commit is contained in:
@@ -1,7 +1,4 @@
|
|||||||
using System;
|
using Barotrauma.Networking;
|
||||||
using Barotrauma;
|
|
||||||
|
|
||||||
using Barotrauma.Networking;
|
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -47,11 +44,11 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (i < halfPlayers)
|
if (i < halfPlayers)
|
||||||
{
|
{
|
||||||
randList[i].TeamID = 0;
|
randList[i].TeamID = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
randList[i].TeamID = 1;
|
randList[i].TeamID = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,42 +67,30 @@ namespace Barotrauma
|
|||||||
TeamASub = Submarine.MainSubs[0];
|
TeamASub = Submarine.MainSubs[0];
|
||||||
TeamBSub = Submarine.MainSubs[1];
|
TeamBSub = Submarine.MainSubs[1];
|
||||||
TeamBSub.SetPosition(Level.Loaded.EndPosition - new Vector2(0.0f, 2000.0f));
|
TeamBSub.SetPosition(Level.Loaded.EndPosition - new Vector2(0.0f, 2000.0f));
|
||||||
|
|
||||||
for (int i = 0; i < Character.CharacterList.Count; i++)
|
|
||||||
{
|
|
||||||
if (Character.CharacterList[i].TeamID==0)
|
|
||||||
{
|
|
||||||
TeamACrew.Add(Character.CharacterList[i]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TeamBCrew.Add(Character.CharacterList[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
if (TeamACrew.Count == 0 && TeamBCrew.Count == 0)
|
if (TeamACrew.Count == 0 && TeamBCrew.Count == 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Character.CharacterList.Count; i++)
|
if (GameMain.Server != null)
|
||||||
{
|
{
|
||||||
if (Character.CharacterList[i].TeamID == 0)
|
GameMain.Server.AllowRespawn = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Character character in Character.CharacterList)
|
||||||
|
{
|
||||||
|
if (character.TeamID == 1)
|
||||||
{
|
{
|
||||||
TeamACrew.Add(Character.CharacterList[i]);
|
TeamACrew.Add(character);
|
||||||
}
|
}
|
||||||
else
|
else if (character.TeamID == 2)
|
||||||
{
|
{
|
||||||
TeamBCrew.Add(Character.CharacterList[i]);
|
TeamBCrew.Add(character);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameMain.Server != null)
|
|
||||||
{
|
|
||||||
GameMain.Server.AllowRespawn = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ADead = TeamACrew.All(c => c.IsDead);
|
bool ADead = TeamACrew.All(c => c.IsDead);
|
||||||
bool BDead = TeamBCrew.All(c => c.IsDead);
|
bool BDead = TeamBCrew.All(c => c.IsDead);
|
||||||
|
|
||||||
|
|||||||
@@ -906,10 +906,10 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
if (AllowRespawn) respawnManager = new RespawnManager(this, selectedShuttle);
|
if (AllowRespawn) respawnManager = new RespawnManager(this, selectedShuttle);
|
||||||
|
|
||||||
for (int j = 0; j < teamCount; j++)
|
for (int j = 1; j <= teamCount; j++)
|
||||||
{
|
{
|
||||||
List<Client> teamClients = connectedClients.FindAll(c => c.TeamID == j).ToList();
|
List<Client> teamClients = connectedClients.FindAll(c => c.TeamID == j);
|
||||||
if (teamClients == null) continue;
|
if (!teamClients.Any()) continue;
|
||||||
|
|
||||||
AssignJobs(teamClients);
|
AssignJobs(teamClients);
|
||||||
|
|
||||||
@@ -934,7 +934,7 @@ namespace Barotrauma.Networking
|
|||||||
characterInfos.Add(characterInfo);
|
characterInfos.Add(characterInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
WayPoint[] assignedWayPoints = WayPoint.SelectCrewSpawnPoints(characterInfos, Submarine.MainSubs[j]);
|
WayPoint[] assignedWayPoints = WayPoint.SelectCrewSpawnPoints(characterInfos, Submarine.MainSubs[j - 1]);
|
||||||
|
|
||||||
for (int i = 0; i < teamClients.Count; i++)
|
for (int i = 0; i < teamClients.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -947,8 +947,8 @@ namespace Barotrauma.Networking
|
|||||||
teamClients[i].Character.TeamID = teamClients[i].TeamID;
|
teamClients[i].Character.TeamID = teamClients[i].TeamID;
|
||||||
}
|
}
|
||||||
|
|
||||||
//host plays in team 0
|
//host plays in team 1
|
||||||
if (characterInfo != null && j == 0)
|
if (characterInfo != null && j == 1)
|
||||||
{
|
{
|
||||||
myCharacter = Character.Create(characterInfo, assignedWayPoints[assignedWayPoints.Length - 1].WorldPosition, false, false);
|
myCharacter = Character.Create(characterInfo, assignedWayPoints[assignedWayPoints.Length - 1].WorldPosition, false, false);
|
||||||
Character.Controlled = myCharacter;
|
Character.Controlled = myCharacter;
|
||||||
|
|||||||
Reference in New Issue
Block a user