69487a2...d38c50c

commit d38c50cc354476d5309645bc1487a4c03fe97d57
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Mar 20 16:27:45 2019 +0200

    Fixed inability to throw anything in the multiplayer. The clients would create a network event about dropping the item during the throw, which prevented throwing it server-side (because the item isn't in the character's inventory anymore by the time it should be launched). Closes #1318

commit 25cc1ceefcf62e346281c24c41964053d102701c
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Mar 20 16:21:33 2019 +0200

    Merge same afflictions into one icon in the preview above the health bar (instead of showing the same icon for each limb that has the affliction)
This commit is contained in:
Joonas Rikkonen
2019-03-20 16:28:15 +02:00
parent 5127038dc8
commit a8309b5766
4 changed files with 17 additions and 13 deletions

View File

@@ -448,8 +448,8 @@ namespace Barotrauma
else
{
forceAfflictionContainerUpdate = true;
currentDisplayedAfflictions = GetAllAfflictions()
.Where(a => a.Strength >= a.Prefab.ShowIconThreshold && a.Prefab.Icon != null).ToList();
currentDisplayedAfflictions = GetAllAfflictions(mergeSameAfflictions: true)
.FindAll(a => a.Strength >= a.Prefab.ShowIconThreshold && a.Prefab.Icon != null);
currentDisplayedAfflictions.Sort((a1, a2) =>
{
int dmgPerSecond = Math.Sign(a2.DamagePerSecond - a1.DamagePerSecond);

View File

@@ -471,11 +471,12 @@ namespace Barotrauma.Items.Components
if (connection.Name == "toggle")
{
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "requireditem":
if (!overrideRequiredItems) requiredItems.Clear();
overrideRequiredItems = true;
SetState(!wasOpen, false, true);
}
else if (connection.Name == "set_state")
{
SetState(signal != "0", false, true);
}
#if SERVER
if (sender != null && wasOpen != isOpen)

View File

@@ -99,13 +99,13 @@ namespace Barotrauma.Items.Components
{
Vector2 throwVector = Vector2.Normalize(picker.CursorWorldPosition - picker.WorldPosition);
//throw upwards if cursor is at the position of the character
if (!MathUtils.IsValid(throwVector)) throwVector = Vector2.UnitY;
if (!MathUtils.IsValid(throwVector)) { throwVector = Vector2.UnitY; }
#if SERVER
GameServer.Log(picker.LogName + " threw " + item.Name, ServerLog.MessageType.ItemInteraction);
#endif
item.Drop(picker);
item.Drop(picker, createNetworkEvent: GameMain.NetworkMember == null || GameMain.NetworkMember.IsServer);
item.body.ApplyLinearImpulse(throwVector * throwForce * item.body.Mass * 3.0f);
ac.GetLimb(LimbType.Head).body.ApplyLinearImpulse(throwVector*10.0f);

View File

@@ -1562,12 +1562,15 @@ namespace Barotrauma
return isCombined;
}
public void Drop(Character dropper)
public void Drop(Character dropper, bool createNetworkEvent = true)
{
if (parentInventory != null && !parentInventory.Owner.Removed && !Removed &&
GameMain.NetworkMember != null && (GameMain.NetworkMember.IsServer || Character.Controlled == dropper))
if (createNetworkEvent)
{
parentInventory.CreateNetworkEvent();
if (parentInventory != null && !parentInventory.Owner.Removed && !Removed &&
GameMain.NetworkMember != null && (GameMain.NetworkMember.IsServer || Character.Controlled == dropper))
{
parentInventory.CreateNetworkEvent();
}
}
foreach (ItemComponent ic in components) { ic.Drop(dropper); }