diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/RoundSummary.cs b/Barotrauma/BarotraumaClient/Source/GameSession/RoundSummary.cs index 3475bfa48..6ad8eda1b 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/RoundSummary.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/RoundSummary.cs @@ -26,7 +26,7 @@ namespace Barotrauma { bool singleplayer = GameMain.NetworkMember == null; - bool gameOver = gameSession.CrewManager.GetCharacters().All(c => c.IsDead); + bool gameOver = gameSession.CrewManager.GetCharacters().All(c => c.IsDead || c.IsUnconscious); bool progress = Submarine.MainSub.AtEndPosition; GUIFrame frame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.8f, null); @@ -36,15 +36,18 @@ namespace Barotrauma int y = 0; - if (singleplayer) + if (!singleplayer) { - string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" : - (progress ? "progress" : "return")); - - var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, "", innerFrame, true); - y += infoText.Rect.Height; + //Game over if everyone dead or didn't progress + gameOver = gameOver || !progress; + SoundPlayer.OverrideMusicType = gameOver ? "crewdead" : "endround"; } + string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" : + (progress ? "progress" : "return")); + + var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, "", innerFrame, true); + y += infoText.Rect.Height; if (!string.IsNullOrWhiteSpace(endMessage)) { diff --git a/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs index 6c609618e..42a26e51e 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs @@ -142,6 +142,10 @@ namespace Barotrauma { wasPut = character.SelectedCharacter.Inventory.TryPutItem(doubleClickedItem, Character.Controlled, doubleClickedItem.AllowedSlots, true); } + else if (character.SelectedBy != null && Character.Controlled == character.SelectedBy && character.SelectedBy.Inventory != null) + { + wasPut = character.SelectedBy.Inventory.TryPutItem(doubleClickedItem, Character.Controlled, doubleClickedItem.AllowedSlots, true); + } else //doubleclicked and no other inventory is selected { //not equipped -> attempt to equip diff --git a/Barotrauma/BarotraumaShared/BarotraumaShared.projitems b/Barotrauma/BarotraumaShared/BarotraumaShared.projitems index c89c3914b..a8b61c502 100644 --- a/Barotrauma/BarotraumaShared/BarotraumaShared.projitems +++ b/Barotrauma/BarotraumaShared/BarotraumaShared.projitems @@ -742,6 +742,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Barotrauma/BarotraumaShared/Content/Items/Medical/medical.xml b/Barotrauma/BarotraumaShared/Content/Items/Medical/medical.xml index 8f1521911..9c4e1fca2 100644 --- a/Barotrauma/BarotraumaShared/Content/Items/Medical/medical.xml +++ b/Barotrauma/BarotraumaShared/Content/Items/Medical/medical.xml @@ -49,7 +49,7 @@ - @@ -69,7 +69,7 @@ - + @@ -93,7 +93,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -135,7 +135,7 @@ - + @@ -153,7 +153,7 @@ - + @@ -171,7 +171,7 @@ - + @@ -193,7 +193,7 @@ - + @@ -214,7 +214,7 @@ - + @@ -239,7 +239,7 @@ - + @@ -265,7 +265,7 @@ - + @@ -285,7 +285,7 @@ - + @@ -304,7 +304,7 @@ - + @@ -323,7 +323,7 @@ - + @@ -336,14 +336,13 @@ spritecolor="0.6,0.8,1.0,1.0" Tags="smallitem,chem,medical" impacttolerance="8" - canuseonself="true" description="A mildy toxic solution that slowly releases oxygen into the bloodstream when injected."> - + @@ -367,7 +366,7 @@ - + @@ -388,7 +387,7 @@ - + @@ -406,7 +405,7 @@ - + @@ -424,7 +423,7 @@ - + @@ -443,7 +442,7 @@ - + @@ -462,7 +461,7 @@ - + @@ -481,7 +480,7 @@ - + @@ -508,7 +507,7 @@ - + diff --git a/Barotrauma/BarotraumaShared/Data/clientpermissions.xml b/Barotrauma/BarotraumaShared/Data/clientpermissions.xml new file mode 100644 index 000000000..e8edf48f8 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Data/clientpermissions.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs index ff9fa7497..8d265ec58 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs @@ -30,6 +30,8 @@ namespace Barotrauma.Items.Components protected bool canBePicked; protected bool canBeSelected; + protected bool canBeCombined; + protected bool removeOnCombined; public bool WasUsed; @@ -124,6 +126,22 @@ namespace Barotrauma.Items.Components set { canBeSelected = value; } } + //Transfer conditions between same prefab items + [Serialize(false, false)] + public bool CanBeCombined + { + get { return canBeCombined; } + set { canBeCombined = value; } + } + + //Remove item if combination results in 0 condition + [Serialize(false, false)] + public bool RemoveOnCombined + { + get { return removeOnCombined; } + set { removeOnCombined = value; } + } + public InputType PickKey { get; @@ -323,6 +341,43 @@ namespace Barotrauma.Items.Components public virtual bool Combine(Item item) { + if (canBeCombined && this.item.Prefab == item.Prefab && item.Condition > 0.0f && this.item.Condition > 0.0f) + { + float transferAmount = 0.0f; + if (this.Item.Condition <= item.Condition) + transferAmount = Math.Min(item.Condition, this.item.Prefab.Health - this.item.Condition); + else + transferAmount = -Math.Min(this.item.Condition, item.Prefab.Health - item.Condition); + + if (transferAmount == 0.0f) + return false; + this.Item.Condition += transferAmount; + item.Condition -= transferAmount; + if (removeOnCombined) + { + if (item.Condition <= 0.0f) + { + if (item.ParentInventory != null) + { + Character owner = (Character)item.ParentInventory.Owner; + if (owner != null && owner.HasSelectedItem(item)) item.Unequip(owner); + item.ParentInventory.RemoveItem(item); + } + Entity.Spawner.AddToRemoveQueue(item); + } + if (this.Item.Condition <= 0.0f) + { + if (this.Item.ParentInventory != null) + { + Character owner = (Character)this.Item.ParentInventory.Owner; + if (owner != null && owner.HasSelectedItem(this.Item)) this.Item.Unequip(owner); + this.Item.ParentInventory.RemoveItem(this.Item); + } + Entity.Spawner.AddToRemoveQueue(this.Item); + } + } + return true; + } return false; } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemContainer.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemContainer.cs index e427d8aa2..30923113c 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemContainer.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemContainer.cs @@ -170,7 +170,7 @@ namespace Barotrauma.Items.Components if (effect.Targets.HasFlag(StatusEffect.TargetType.This)) effect.Apply(ActionType.OnContaining, deltaTime, item, item.AllPropertyObjects); if (effect.Targets.HasFlag(StatusEffect.TargetType.Contained)) - effect.Apply(ActionType.OnContaining, deltaTime, item, contained.AllPropertyObjects); + effect.Apply(ActionType.OnContaining, deltaTime, item, contained.AllPropertyObjects); } } @@ -192,7 +192,7 @@ namespace Barotrauma.Items.Components return true; } - return false; + return false; } public override void OnMapLoaded() diff --git a/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs index 9094b43bc..4d7ebcc4b 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs @@ -1509,7 +1509,9 @@ namespace Barotrauma.Networking yield return CoroutineStatus.Running; } while (cinematic.Running);//(secondsLeft > 0.0f); - +#if CLIENT + SoundPlayer.OverrideMusicType = null; +#endif Submarine.Unload(); entityEventManager.Clear();