From 7c37ba09556f5f9698ca3f425150dceb088f5073 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 21 Dec 2017 22:31:48 +0200 Subject: [PATCH 1/3] Characters can only have one picking timer active at a time. Closes #179 --- .../Source/Characters/Character.cs | 34 +++++++++++-------- .../Items/Components/Holdable/Pickable.cs | 16 +++++---- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs index ad03fcce7..1bb7c5150 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs @@ -197,7 +197,7 @@ namespace Barotrauma { get { return !IsUnconscious && Stun <= 0.0f && !isDead; } } - + public bool CanInteract { get { return AllowInput && IsHumanoid && !LockHands; } @@ -303,11 +303,11 @@ namespace Barotrauma get { return needsAir; } set { needsAir = value; } } - + public float Oxygen { get { return oxygen; } - set + set { if (!MathUtils.IsValid(value)) return; oxygen = MathHelper.Clamp(value, -100.0f, 100.0f); @@ -331,7 +331,7 @@ namespace Barotrauma { if (GameMain.Client != null) return; - SetStun(value); + SetStun(value); } } @@ -358,7 +358,7 @@ namespace Barotrauma } } } - + public float MaxHealth { get { return maxHealth; } @@ -367,32 +367,32 @@ namespace Barotrauma public float Bleeding { get { return bleeding; } - set + set { if (!MathUtils.IsValid(value)) return; if (GameMain.Client != null) return; - float newBleeding = MathHelper.Clamp(value, 0.0f, 5.0f); + float newBleeding = MathHelper.Clamp(value, 0.0f, 5.0f); if (newBleeding == bleeding) return; bleeding = newBleeding; - + if (GameMain.Server != null) GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status }); } } - + public HuskInfection huskInfection; public float HuskInfectionState { - get - { - return huskInfection == null ? 0.0f : huskInfection.IncubationTimer; + get + { + return huskInfection == null ? 0.0f : huskInfection.IncubationTimer; } set { if (ConfigPath != humanConfigFile) return; - + if (value <= 0.0f) { if (huskInfection != null) @@ -448,7 +448,7 @@ namespace Barotrauma get; set; } - + public Item[] SelectedItems { get { return selectedItems; } @@ -465,6 +465,12 @@ namespace Barotrauma get { return focusedItem; } } + public Item PickingItem + { + get; + set; + } + public virtual AIController AIController { get { return null; } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Pickable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Pickable.cs index 69e06f783..482aee51f 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Pickable.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Pickable.cs @@ -13,7 +13,6 @@ namespace Barotrauma.Items.Components private float pickTimer; - public List AllowedSlots { get { return allowedSlots; } @@ -55,13 +54,15 @@ namespace Barotrauma.Items.Components public override bool Pick(Character picker) { //return if someone is already trying to pick the item - if (pickTimer>0.0f) return false; + if (pickTimer > 0.0f) return false; if (picker == null || picker.Inventory == null) return false; - if (PickingTime>0.0f) + if (PickingTime > 0.0f) { - CoroutineManager.StartCoroutine(WaitForPick(picker, PickingTime)); - + if (picker.PickingItem == null) + { + CoroutineManager.StartCoroutine(WaitForPick(picker, PickingTime)); + } return false; } else @@ -104,6 +105,8 @@ namespace Barotrauma.Items.Components private IEnumerable WaitForPick(Character picker, float requiredTime) { + picker.PickingItem = item; + var leftHand = picker.AnimController.GetLimb(LimbType.LeftHand); var rightHand = picker.AnimController.GetLimb(LimbType.RightHand); @@ -151,7 +154,8 @@ namespace Barotrauma.Items.Components private void StopPicking(Character picker) { picker.AnimController.Anim = AnimController.Animation.None; - pickTimer = 0.0f; + picker.PickingItem = null; + pickTimer = 0.0f; } protected void DropConnectedWires(Character character) From 2287ddda2907c67c43d2ab5113ed9f8154675f54 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Fri, 22 Dec 2017 01:17:43 +0200 Subject: [PATCH 2/3] Added empty default client permission file --- Barotrauma/BarotraumaShared/BarotraumaShared.projitems | 3 +++ Barotrauma/BarotraumaShared/Data/clientpermissions.xml | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 Barotrauma/BarotraumaShared/Data/clientpermissions.xml diff --git a/Barotrauma/BarotraumaShared/BarotraumaShared.projitems b/Barotrauma/BarotraumaShared/BarotraumaShared.projitems index 4e403bd7f..d534f0866 100644 --- a/Barotrauma/BarotraumaShared/BarotraumaShared.projitems +++ b/Barotrauma/BarotraumaShared/BarotraumaShared.projitems @@ -739,6 +739,9 @@ PreserveNewest + + Always + PreserveNewest diff --git a/Barotrauma/BarotraumaShared/Data/clientpermissions.xml b/Barotrauma/BarotraumaShared/Data/clientpermissions.xml new file mode 100644 index 000000000..ccc105b28 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Data/clientpermissions.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file From ac53c5f80dcd49401309a36dd48c4d66b754ed10 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Fri, 22 Dec 2017 01:18:16 +0200 Subject: [PATCH 3/3] Fixed campaign view button overlapping with the spectate button in NetLobbyScreen. Closes #117 --- Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs index 16a7277ad..0006eb558 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs @@ -436,7 +436,7 @@ namespace Barotrauma InfoFrame.FindChild("showlog").Visible = GameMain.Server != null; - campaignViewButton = new GUIButton(new Rectangle(0, 0, 130, 30), "Campaign view", Alignment.BottomRight, "", defaultModeContainer); + campaignViewButton = new GUIButton(new Rectangle(-80, 0, 120, 30), "Campaign view", Alignment.BottomRight, "", defaultModeContainer); campaignViewButton.OnClicked = (btn, obj) => { ToggleCampaignView(true); return true; }; campaignViewButton.Visible = false;