Fixed entity IDs getting messed up and causing desync because of purchased items in multiplayer campaign. The server created cargo items first and then mission-related entities, while the clients only spawned mission entities and relied on the server to spawn the cargo, which caused mission entities to have wrong IDs. Closes #484
This commit is contained in:
@@ -1267,6 +1267,26 @@ namespace Barotrauma
|
||||
}
|
||||
}));
|
||||
|
||||
commands.Add(new Command("findentityids", "findentityids [entityname]", (string[] args) =>
|
||||
{
|
||||
if (args.Length == 0) return;
|
||||
args[0] = args[0].ToLowerInvariant();
|
||||
foreach (MapEntity mapEntity in MapEntity.mapEntityList)
|
||||
{
|
||||
if (mapEntity.Name.ToLowerInvariant() == args[0])
|
||||
{
|
||||
ThrowError(mapEntity.ID + ": " + mapEntity.Name.ToString());
|
||||
}
|
||||
}
|
||||
foreach (Character character in Character.CharacterList)
|
||||
{
|
||||
if (character.Name.ToLowerInvariant() == args[0] || character.SpeciesName.ToLowerInvariant() == args[0])
|
||||
{
|
||||
ThrowError(character.ID + ": " + character.Name.ToString());
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
commands.Add(new Command("heal", "heal [character name]: Restore the specified character to full health. If the name parameter is omitted, the controlled character will be healed.", (string[] args) =>
|
||||
{
|
||||
Character healedCharacter = (args.Length == 0) ? Character.Controlled : FindMatchingCharacter(args);
|
||||
|
||||
@@ -55,13 +55,7 @@ namespace Barotrauma
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
CargoManager.CreateItems();
|
||||
}
|
||||
|
||||
base.Start();
|
||||
lastUpdateID++;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,14 @@ namespace Barotrauma
|
||||
|
||||
EventManager.StartRound(level);
|
||||
|
||||
if (GameMode != null) GameMode.MsgBox();
|
||||
if (GameMode != null)
|
||||
{
|
||||
GameMode.MsgBox();
|
||||
if (GameMode is MultiPlayerCampaign campaign && GameMain.Server != null)
|
||||
{
|
||||
campaign.CargoManager.CreateItems();
|
||||
}
|
||||
}
|
||||
|
||||
if (GameSettings.SendUserStatistics)
|
||||
{
|
||||
@@ -234,7 +241,7 @@ namespace Barotrauma
|
||||
GameAnalyticsSDK.Net.GameAnalytics.AddProgressionEvent(GameAnalyticsSDK.Net.EGAProgressionStatus.Start,
|
||||
GameMode.Name, (Mission == null ? "None" : Mission.GetType().ToString()));
|
||||
}
|
||||
|
||||
|
||||
#if CLIENT
|
||||
roundSummary = new RoundSummary(this);
|
||||
|
||||
|
||||
@@ -315,9 +315,9 @@ namespace Barotrauma
|
||||
public override string ToString()
|
||||
{
|
||||
#if CLIENT
|
||||
return (GameMain.DebugDraw) ? Name + "(ID: " + ID + ")" : Name;
|
||||
return (GameMain.DebugDraw) ? Name + " (ID: " + ID + ")" : Name;
|
||||
#elif SERVER
|
||||
return Name + "(ID: " + ID + ")";
|
||||
return Name + " (ID: " + ID + ")";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user