(b4fd73057) Reset item position update interval when a client fails to pick it up due to it being accessible (should cause the position of the item to be corrected if the client failed to pick it up due to the position not matching the server position).
This commit is contained in:
@@ -43,8 +43,8 @@ namespace Barotrauma
|
||||
CreateNetworkEvent();
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
var item = Entity.FindEntityByID(newItemIDs[i]) as Item;
|
||||
if (item == null) continue;
|
||||
if (!(Entity.FindEntityByID(newItemIDs[i]) is Item item)) { continue; }
|
||||
item.PositionUpdateInterval = 0.0f;
|
||||
if (item.ParentInventory != null && item.ParentInventory != this)
|
||||
{
|
||||
item.ParentInventory.CreateNetworkEvent();
|
||||
@@ -80,16 +80,16 @@ namespace Barotrauma
|
||||
{
|
||||
if (newItemIDs[i] > 0)
|
||||
{
|
||||
var item = Entity.FindEntityByID(newItemIDs[i]) as Item;
|
||||
if (item == null || item == Items[i]) continue;
|
||||
if (!(Entity.FindEntityByID(newItemIDs[i]) is Item item) || item == Items[i]) { continue; }
|
||||
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
var holdable = item.GetComponent<Holdable>();
|
||||
if (holdable != null && !holdable.CanBeDeattached()) continue;
|
||||
if (holdable != null && !holdable.CanBeDeattached()) { continue; }
|
||||
|
||||
if (!prevItems.Contains(item) && !item.CanClientAccess(c))
|
||||
{
|
||||
item.PositionUpdateInterval = 0.0f;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (Item item in Items.Distinct())
|
||||
{
|
||||
if (item == null) continue;
|
||||
if (item == null) { continue; }
|
||||
if (!prevItems.Contains(item))
|
||||
{
|
||||
if (Owner == c.Character)
|
||||
@@ -127,7 +127,7 @@ namespace Barotrauma
|
||||
}
|
||||
foreach (Item item in prevItems.Distinct())
|
||||
{
|
||||
if (item == null) continue;
|
||||
if (item == null) { continue; }
|
||||
if (!Items.Contains(item))
|
||||
{
|
||||
if (Owner == c.Character)
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace Barotrauma
|
||||
public float PositionUpdateInterval
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
set;
|
||||
} = float.PositiveInfinity;
|
||||
|
||||
protected Color spriteColor;
|
||||
|
||||
Reference in New Issue
Block a user