v0.2: iteminventory sync bugfix, meleeweapon "reload time", spears can be picked even if they're stuck inside a wall, tutorial bugfixes, "submarine godmode", removed round duration, drag character sync, reliable structure damage messages, job assignment bugfixes, some extra sounds
This commit is contained in:
@@ -247,12 +247,15 @@ namespace Barotrauma.Networking
|
||||
if (connectionStatus != NetConnectionStatus.Connected)
|
||||
{
|
||||
string denyMessage = inc.ReadString();
|
||||
DebugConsole.ThrowError(denyMessage);
|
||||
|
||||
new GUIMessageBox("Couldn't connect to server", denyMessage);
|
||||
connectCanceled = true;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine(inc.ReadString() + " Strange message");
|
||||
connectCanceled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -457,9 +460,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
double durationMinutes = inc.ReadDouble();
|
||||
|
||||
TimeSpan duration = new TimeSpan(0, (int)durationMinutes, 0);
|
||||
Rand.SetSyncedSeed(seed);
|
||||
//int gameModeIndex = inc.ReadInt32();
|
||||
|
||||
@@ -467,7 +467,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
GameMain.GameSession.StartShift(duration, levelSeed);
|
||||
GameMain.GameSession.StartShift(levelSeed);
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
@@ -501,9 +501,10 @@ namespace Barotrauma.Networking
|
||||
|
||||
public IEnumerable<object> EndGame(string endMessage)
|
||||
{
|
||||
var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300);
|
||||
|
||||
if (!gameStarted) yield return CoroutineStatus.Success;
|
||||
gameStarted = false;
|
||||
|
||||
var messageBox = new GUIMessageBox("The round has ended", endMessage);
|
||||
|
||||
Character.Controlled = null;
|
||||
GameMain.LightManager.LosEnabled = false;
|
||||
@@ -529,7 +530,7 @@ namespace Barotrauma.Networking
|
||||
yield return CoroutineStatus.Running;
|
||||
} while (secondsLeft > 0.0f);
|
||||
|
||||
messageBox.Text = endMessage;
|
||||
messageBox.Close(null,null);
|
||||
|
||||
Submarine.Unload();
|
||||
|
||||
|
||||
@@ -601,7 +601,7 @@ namespace Barotrauma.Networking
|
||||
int seed = DateTime.Now.Millisecond;
|
||||
Rand.SetSyncedSeed(seed);
|
||||
GameMain.GameSession = new GameSession(selectedSub, "", GameMain.NetLobbyScreen.SelectedMode);
|
||||
GameMain.GameSession.StartShift(GameMain.NetLobbyScreen.GameDuration, GameMain.NetLobbyScreen.LevelSeed);
|
||||
GameMain.GameSession.StartShift(GameMain.NetLobbyScreen.LevelSeed);
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
@@ -662,7 +662,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
msg.Write(GameMain.NetLobbyScreen.SelectedMode.Name);
|
||||
|
||||
msg.Write(GameMain.NetLobbyScreen.GameDuration.TotalMinutes);
|
||||
//msg.Write(GameMain.NetLobbyScreen.GameDuration.TotalMinutes);
|
||||
|
||||
msg.Write((myCharacter == null) ? connectedClients.Count : connectedClients.Count + 1);
|
||||
foreach (Client client in connectedClients)
|
||||
@@ -703,8 +703,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
public IEnumerable<object> EndGame(string endMessage)
|
||||
{
|
||||
|
||||
var messageBox = new GUIMessageBox("The round has ended", endMessage);
|
||||
var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300);
|
||||
|
||||
Character.Controlled = null;
|
||||
GameMain.GameScreen.Cam.TargetPos = Vector2.Zero;
|
||||
@@ -754,6 +753,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
Submarine.Unload();
|
||||
|
||||
messageBox.Close(null, null);
|
||||
|
||||
GameMain.NetLobbyScreen.Select();
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
@@ -1003,17 +1004,18 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
|
||||
//share the rest of the jobs according to the ''commonness'' of the job
|
||||
float totalCommonness = 0.0f;
|
||||
for (int i = 0; i < JobPrefab.List.Count; i++)
|
||||
{
|
||||
if (JobPrefab.List[i].AllowAlways || JobPrefab.List[i].MaxNumber == 0) continue;
|
||||
//float totalCommonness = 0.0f;
|
||||
//for (int i = 0; i < JobPrefab.List.Count; i++)
|
||||
//{
|
||||
// if (JobPrefab.List[i].AllowAlways || JobPrefab.List[i].MaxNumber == 0) continue;
|
||||
|
||||
totalCommonness += JobPrefab.List[i].Commonness;
|
||||
}
|
||||
// totalCommonness += JobPrefab.List[i].Commonness;
|
||||
//}
|
||||
|
||||
for (int preferenceIndex = 0; preferenceIndex < 3; preferenceIndex++)
|
||||
//find a suitable job for the rest of the players
|
||||
for (int i = unassigned.Count - 1; i >= 0; i--)
|
||||
{
|
||||
for (int i = unassigned.Count - 1; i >= 0; i--)
|
||||
for (int preferenceIndex = 0; preferenceIndex < 3; preferenceIndex++)
|
||||
{
|
||||
int jobIndex = JobPrefab.List.FindIndex(jp => jp == unassigned[i].jobPreferences[preferenceIndex]);
|
||||
|
||||
@@ -1024,6 +1026,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
assignedClientCount[jobIndex]++;
|
||||
unassigned.RemoveAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1038,6 +1041,7 @@ namespace Barotrauma.Networking
|
||||
foreach (Client c in clients)
|
||||
{
|
||||
int index = c.jobPreferences.FindIndex(jp => jp == job);
|
||||
if (index == -1) index = 1000;
|
||||
if (preferredClient == null || index < bestPreference)
|
||||
{
|
||||
bestPreference = index;
|
||||
|
||||
@@ -11,14 +11,17 @@ namespace Barotrauma.Networking
|
||||
DropItem = 3,
|
||||
InventoryUpdate = 4,
|
||||
PickItem = 5,
|
||||
UpdateProperty = 6
|
||||
UpdateProperty = 6,
|
||||
WallDamage = 7,
|
||||
SelectCharacter = 8
|
||||
}
|
||||
|
||||
class NetworkEvent
|
||||
{
|
||||
public static List<NetworkEvent> events = new List<NetworkEvent>();
|
||||
|
||||
private static bool[] isImportant = { false, true, false, true, true, true, true };
|
||||
private static bool[] isImportant = { false, true, false, true, true, true, true, true, true };
|
||||
private static bool[] overridePrevious = { true, false, true, false, false, false, true, true, true };
|
||||
|
||||
private int id;
|
||||
|
||||
@@ -68,7 +71,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
eventType = type;
|
||||
|
||||
if (!isImportant[(int)type])
|
||||
if (overridePrevious[(int)type])
|
||||
{
|
||||
if (events.Find(e => e.id == id && e.eventType == type) != null) return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user