Completely destroyed game
Looks like a lot more than just netcode is getting rewritten. Removing coroutines because there are better ways of handling asynchronous tasks, removing filestream because that's to be reimplemented later
This commit is contained in:
@@ -100,7 +100,6 @@ namespace Barotrauma
|
||||
ushort itemID = Items[slotIndex].ID;
|
||||
|
||||
Items[slotIndex].ApplyStatusEffects(ActionType.OnUse, 1.0f, character);
|
||||
new NetworkEvent(NetworkEventType.ApplyStatusEffect, character.ID, true, itemID);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -142,7 +141,7 @@ namespace Barotrauma
|
||||
/// <summary>
|
||||
/// If there is room, puts the item in the inventory and returns true, otherwise returns false
|
||||
/// </summary>
|
||||
public override bool TryPutItem(Item item, List<InvSlotType> allowedSlots = null, bool createNetworkEvent = true)
|
||||
public override bool TryPutItem(Item item, List<InvSlotType> allowedSlots = null)
|
||||
{
|
||||
if (allowedSlots == null || ! allowedSlots.Any()) return false;
|
||||
|
||||
@@ -153,7 +152,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (Items[i] != null || limbSlots[i] != InvSlotType.Any) continue;
|
||||
|
||||
PutItem(item, i, createNetworkEvent);
|
||||
PutItem(item, i);
|
||||
item.Unequip(character);
|
||||
return true;
|
||||
}
|
||||
@@ -179,7 +178,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (allowedSlot.HasFlag(limbSlots[i]) && Items[i] == null)
|
||||
{
|
||||
PutItem(item, i, createNetworkEvent, !placed);
|
||||
PutItem(item, i, !placed);
|
||||
item.Equip(character);
|
||||
placed = true;
|
||||
}
|
||||
@@ -195,7 +194,7 @@ namespace Barotrauma
|
||||
return placed;
|
||||
}
|
||||
|
||||
public override bool TryPutItem(Item item, int index, bool allowSwapping, bool createNetworkEvent)
|
||||
public override bool TryPutItem(Item item, int index, bool allowSwapping)
|
||||
{
|
||||
//there's already an item in the slot
|
||||
if (Items[index] != null)
|
||||
@@ -208,9 +207,9 @@ namespace Barotrauma
|
||||
System.Diagnostics.Debug.Assert(Items[index] != null);
|
||||
|
||||
Inventory otherInventory = Items[index].ParentInventory;
|
||||
if (otherInventory != null && otherInventory.Owner!=null && createNetworkEvent)
|
||||
if (otherInventory != null && otherInventory.Owner!=null)
|
||||
{
|
||||
new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, otherInventory.Owner.ID, true, true);
|
||||
|
||||
}
|
||||
|
||||
combined = true;
|
||||
@@ -225,10 +224,10 @@ namespace Barotrauma
|
||||
Items[currentIndex] = null;
|
||||
Items[index] = null;
|
||||
//if the item in the slot can be moved to the slot of the moved item
|
||||
if (TryPutItem(existingItem, currentIndex, false, false) &&
|
||||
TryPutItem(item, index, false, false))
|
||||
if (TryPutItem(existingItem, currentIndex, false) &&
|
||||
TryPutItem(item, index, false))
|
||||
{
|
||||
new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, Owner.ID, true, true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -250,7 +249,7 @@ namespace Barotrauma
|
||||
if (!item.AllowedSlots.Contains(InvSlotType.Any)) return false;
|
||||
if (Items[index] != null) return Items[index] == item;
|
||||
|
||||
PutItem(item, index, createNetworkEvent, true);
|
||||
PutItem(item, index, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -276,7 +275,7 @@ namespace Barotrauma
|
||||
|
||||
if (!slotsFree) return false;
|
||||
|
||||
return TryPutItem(item, new List<InvSlotType>() {placeToSlots}, createNetworkEvent);
|
||||
return TryPutItem(item, new List<InvSlotType>() {placeToSlots});
|
||||
}
|
||||
|
||||
public void DrawOwn(SpriteBatch spriteBatch, Vector2 offset)
|
||||
@@ -492,8 +491,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
DropItem(draggingItem);
|
||||
|
||||
new NetworkEvent(NetworkEventType.DropItem, draggingItem.ID, true);
|
||||
|
||||
//draggingItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,17 +63,7 @@ namespace Barotrauma.Items.Components
|
||||
if (PickingTime>0.0f)
|
||||
{
|
||||
CoroutineManager.StartCoroutine(WaitForPick(picker, PickingTime));
|
||||
|
||||
//create a networkevent here, because the item doesn't count as picked yet and the character won't create one
|
||||
new NetworkEvent(NetworkEventType.PickItem, picker.ID, true,
|
||||
new int[]
|
||||
{
|
||||
item.ID,
|
||||
picker.IsKeyHit(InputType.Select) ? 1 : 0,
|
||||
picker.IsKeyHit(InputType.Use) ? 1 : 0
|
||||
});
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -86,7 +76,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private bool OnPicked(Character picker)
|
||||
{
|
||||
if (picker.Inventory.TryPutItem(item, allowedSlots, picker == Character.Controlled))
|
||||
if (picker.Inventory.TryPutItem(item, allowedSlots))
|
||||
{
|
||||
if (!picker.HasSelectedItem(item) && item.body != null) item.body.Enabled = false;
|
||||
this.picker = picker;
|
||||
|
||||
@@ -253,7 +253,7 @@ namespace Barotrauma.Items.Components
|
||||
Item item = MapEntity.FindEntityByID(itemIds[i]) as Item;
|
||||
if (item == null) continue;
|
||||
|
||||
Inventory.TryPutItem(item, i, false, false);
|
||||
Inventory.TryPutItem(item, i, false);
|
||||
}
|
||||
|
||||
itemIds = null;
|
||||
|
||||
@@ -141,9 +141,7 @@ namespace Barotrauma
|
||||
|
||||
Item item = frame.UserData as Item;
|
||||
if (item == null) return true;
|
||||
|
||||
new NetworkEvent(NetworkEventType.ItemFixed, item.ID, true, (byte)item.FixRequirements.IndexOf(requirement) );
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,21 +93,21 @@ namespace Barotrauma
|
||||
/// <summary>
|
||||
/// If there is room, puts the item in the inventory and returns true, otherwise returns false
|
||||
/// </summary>
|
||||
public virtual bool TryPutItem(Item item, List<InvSlotType> allowedSlots = null, bool createNetworkEvent = true)
|
||||
public virtual bool TryPutItem(Item item, List<InvSlotType> allowedSlots = null)
|
||||
{
|
||||
int slot = FindAllowedSlot(item);
|
||||
if (slot < 0) return false;
|
||||
|
||||
PutItem(item, slot, createNetworkEvent);
|
||||
PutItem(item, slot);
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool TryPutItem(Item item, int i, bool allowSwapping, bool createNetworkEvent)
|
||||
public virtual bool TryPutItem(Item item, int i, bool allowSwapping)
|
||||
{
|
||||
if (Owner == null) return false;
|
||||
if (CanBePut(item,i))
|
||||
{
|
||||
PutItem(item, i, createNetworkEvent);
|
||||
PutItem(item, i);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -116,7 +116,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
protected void PutItem(Item item, int i, bool createNetworkEvent, bool removeItem = true)
|
||||
protected void PutItem(Item item, int i, bool removeItem = true)
|
||||
{
|
||||
if (Owner == null) return;
|
||||
|
||||
@@ -132,8 +132,6 @@ namespace Barotrauma
|
||||
{
|
||||
item.body.Enabled = false;
|
||||
}
|
||||
|
||||
if (createNetworkEvent) new NetworkEvent(NetworkEventType.InventoryUpdate, Owner.ID, true, true);
|
||||
}
|
||||
|
||||
public Item FindItem(string itemName)
|
||||
@@ -216,7 +214,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (Owner!=null)
|
||||
{
|
||||
new NetworkEvent(NetworkEventType.InventoryUpdate, Owner.ID, true);
|
||||
|
||||
}
|
||||
|
||||
DropItem(draggingItem);
|
||||
|
||||
@@ -165,8 +165,6 @@ namespace Barotrauma
|
||||
condition = MathHelper.Clamp(value, 0.0f, 100.0f);
|
||||
if (condition == 0.0f && prev>0.0f)
|
||||
{
|
||||
new NetworkEvent(this.ID, false);
|
||||
|
||||
ApplyStatusEffects(ActionType.OnBroken, 1.0f, null);
|
||||
foreach (FixRequirement req in FixRequirements)
|
||||
{
|
||||
@@ -719,7 +717,7 @@ namespace Barotrauma
|
||||
Vector2 moveAmount = body.SimPosition - body.LastSentPosition;
|
||||
if (parentInventory == null && moveAmount != Vector2.Zero && moveAmount.Length() > NetConfig.ItemPosUpdateDistance)
|
||||
{
|
||||
new NetworkEvent(NetworkEventType.PhysicsBodyPosition, ID, false);
|
||||
|
||||
}
|
||||
|
||||
Vector2 displayPos = ConvertUnits.ToDisplayUnits(body.SimPosition);
|
||||
@@ -784,7 +782,6 @@ namespace Barotrauma
|
||||
if (ImpactTolerance > 0.0f && impact > ImpactTolerance)
|
||||
{
|
||||
ApplyStatusEffects(ActionType.OnImpact, 1.0f);
|
||||
new NetworkEvent(NetworkEventType.ApplyStatusEffect, this.ID, false, ActionType.OnImpact);
|
||||
}
|
||||
|
||||
var containedItems = ContainedItems;
|
||||
@@ -1384,7 +1381,7 @@ namespace Barotrauma
|
||||
return isCombined;
|
||||
}
|
||||
|
||||
public void Drop(Character dropper = null, bool createNetworkEvent = true)
|
||||
public void Drop(Character dropper = null)
|
||||
{
|
||||
//if (dropper == Character.Controlled)
|
||||
// new NetworkEvent(NetworkEventType.DropItem, ID, true);
|
||||
@@ -1450,9 +1447,7 @@ namespace Barotrauma
|
||||
if (objectProperty.TrySetValue(text))
|
||||
{
|
||||
textBox.Text = text;
|
||||
|
||||
new NetworkEvent(NetworkEventType.UpdateProperty, ID, true, objectProperty.Name);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -1620,9 +1615,6 @@ namespace Barotrauma
|
||||
public void NewComponentEvent(ItemComponent ic, bool isClient, bool isImportant)
|
||||
{
|
||||
int index = components.IndexOf(ic);
|
||||
|
||||
new NetworkEvent(isImportant ?
|
||||
NetworkEventType.ImportantComponentUpdate : NetworkEventType.ComponentUpdate, ID, isClient, index);
|
||||
}
|
||||
|
||||
public override void Remove()
|
||||
|
||||
@@ -44,9 +44,9 @@ namespace Barotrauma
|
||||
return (item!=null && Items[i]==null && container.CanBeContained(item));
|
||||
}
|
||||
|
||||
public override bool TryPutItem(Item item, int i, bool allowSwapping, bool createNetworkEvent)
|
||||
public override bool TryPutItem(Item item, int i, bool allowSwapping)
|
||||
{
|
||||
bool wasPut = base.TryPutItem(item, i, allowSwapping, createNetworkEvent);
|
||||
bool wasPut = base.TryPutItem(item, i, allowSwapping);
|
||||
|
||||
if (wasPut)
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Barotrauma
|
||||
AddToSpawnedList(item);
|
||||
|
||||
var inventory = (Inventory)itemInfo.Second;
|
||||
inventory.TryPutItem(item, null, false);
|
||||
inventory.TryPutItem(item, null);
|
||||
|
||||
items.Add(item);
|
||||
//inventories.Add(inventory);
|
||||
|
||||
Reference in New Issue
Block a user