(6736960da) Fixes to name-based item checks that wouldn't work correctly if playing in a language other than English: - Fixed Item.ReadSpawnData failing to find the correct prefab if the client is using a different language than the server, a couple of fixes to name-based item checks. - Fixed extra cargo spawning. - Fixed clients not getting correct ID card tags for the respawn shuttle.
This commit is contained in:
@@ -193,7 +193,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (GameMain.Server == null) return;
|
if (GameMain.Server == null) return;
|
||||||
|
|
||||||
msg.Write(Prefab.Name);
|
msg.Write(Prefab.OriginalName);
|
||||||
msg.Write(Prefab.Identifier);
|
msg.Write(Prefab.Identifier);
|
||||||
msg.Write(Description != prefab.Description);
|
msg.Write(Description != prefab.Description);
|
||||||
if (Description != prefab.Description)
|
if (Description != prefab.Description)
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ namespace Barotrauma.Networking
|
|||||||
//add the ID card tags they should've gotten when spawning in the shuttle
|
//add the ID card tags they should've gotten when spawning in the shuttle
|
||||||
foreach (Item item in character.Inventory.Items)
|
foreach (Item item in character.Inventory.Items)
|
||||||
{
|
{
|
||||||
if (item == null || item.Prefab.Name != "ID Card") continue;
|
if (item == null || item.Prefab.Identifier != "idcard") continue;
|
||||||
foreach (string s in shuttleSpawnPoints[i].IdCardTags)
|
foreach (string s in shuttleSpawnPoints[i].IdCardTags)
|
||||||
{
|
{
|
||||||
item.AddTag(s);
|
item.AddTag(s);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace Barotrauma
|
|||||||
public WayPoint(MapEntityPrefab prefab, Rectangle rectangle)
|
public WayPoint(MapEntityPrefab prefab, Rectangle rectangle)
|
||||||
: this (rectangle, Submarine.MainSub)
|
: this (rectangle, Submarine.MainSub)
|
||||||
{
|
{
|
||||||
if (prefab.Name.Contains("Spawn"))
|
if (prefab.Identifier.Contains("spawn"))
|
||||||
{
|
{
|
||||||
spawnType = SpawnType.Human;
|
spawnType = SpawnType.Human;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -703,13 +703,17 @@ namespace Barotrauma.Networking
|
|||||||
Dictionary<ItemPrefab, int> extraCargo = new Dictionary<ItemPrefab, int>();
|
Dictionary<ItemPrefab, int> extraCargo = new Dictionary<ItemPrefab, int>();
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
string prefabIdentifier = msg.ReadString();
|
||||||
string prefabName = msg.ReadString();
|
string prefabName = msg.ReadString();
|
||||||
byte amount = msg.ReadByte();
|
byte amount = msg.ReadByte();
|
||||||
ItemPrefab ip = MapEntityPrefab.List.Find(p => p is ItemPrefab && p.Name.Equals(prefabName, StringComparison.InvariantCulture)) as ItemPrefab;
|
|
||||||
if (ip != null && amount > 0)
|
var itemPrefab = string.IsNullOrEmpty(prefabIdentifier) ?
|
||||||
|
MapEntityPrefab.Find(prefabName, null, showErrorMessages: false) as ItemPrefab :
|
||||||
|
MapEntityPrefab.Find(prefabName, prefabIdentifier, showErrorMessages: false) as ItemPrefab;
|
||||||
|
if (itemPrefab != null && amount > 0)
|
||||||
{
|
{
|
||||||
if (changed || !ExtraCargo.ContainsKey(ip) || ExtraCargo[ip] != amount) changed = true;
|
if (changed || !ExtraCargo.ContainsKey(itemPrefab) || ExtraCargo[itemPrefab] != amount) changed = true;
|
||||||
extraCargo.Add(ip, amount);
|
extraCargo.Add(itemPrefab, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (changed) ExtraCargo = extraCargo;
|
if (changed) ExtraCargo = extraCargo;
|
||||||
@@ -727,7 +731,9 @@ namespace Barotrauma.Networking
|
|||||||
msg.Write((UInt32)ExtraCargo.Count);
|
msg.Write((UInt32)ExtraCargo.Count);
|
||||||
foreach (KeyValuePair<ItemPrefab, int> kvp in ExtraCargo)
|
foreach (KeyValuePair<ItemPrefab, int> kvp in ExtraCargo)
|
||||||
{
|
{
|
||||||
msg.Write(kvp.Key.Name); msg.Write((byte)kvp.Value);
|
msg.Write(kvp.Key.Identifier ?? "");
|
||||||
|
msg.Write(kvp.Key.OriginalName ?? "");
|
||||||
|
msg.Write((byte)kvp.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user