From 85b4be3ff450dc7e34008f8708884e5e81abd8ea Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 13 May 2018 11:54:21 +0200 Subject: [PATCH] Updates for the netcode refactor. (#69) * Updates for the netcode refactor. * Change HandsGui to control. Why? No idea but drawing of it works again. * Fix hand change sync. * Update submodule --- Content.Client/UserInterface/HandsGui.cs | 2 +- .../Components/GUI/ServerHandsComponent.cs | 14 ++++++++----- .../Items/Storage/ServerStorageComponent.cs | 8 +++---- SpaceStation14Content.sln | 21 ------------------- engine | 2 +- 5 files changed, 15 insertions(+), 32 deletions(-) diff --git a/Content.Client/UserInterface/HandsGui.cs b/Content.Client/UserInterface/HandsGui.cs index 05aa425d0c..3dc525b664 100644 --- a/Content.Client/UserInterface/HandsGui.cs +++ b/Content.Client/UserInterface/HandsGui.cs @@ -17,7 +17,7 @@ using SS14.Shared.Maths; namespace Content.Client.UserInterface { - public class HandsGui : HBoxContainer + public class HandsGui : Control { private static readonly Color _inactiveColor = new Color(90, 90, 90); private const int BOX_SPACING = 1; diff --git a/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs b/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs index 962cab1b8c..b3fbf04083 100644 --- a/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs @@ -30,6 +30,7 @@ namespace Content.Server.GameObjects } activeIndex = value; + Dirty(); } } @@ -107,6 +108,7 @@ namespace Content.Server.GameObjects } var slot = hands[index]; + Dirty(); return slot.Insert(item.Owner); } @@ -153,6 +155,7 @@ namespace Content.Server.GameObjects // TODO: The item should be dropped to the container our owner is in, if any. var itemTransform = item.Owner.GetComponent(); itemTransform.LocalPosition = Owner.GetComponent().LocalPosition; + Dirty(); return true; } @@ -178,7 +181,7 @@ namespace Content.Server.GameObjects var slot = ContainerManagerComponent.Create(Name + "_" + index, Owner); hands[index] = slot; - if(!orderedHands.Contains(index)) + if (!orderedHands.Contains(index)) { orderedHands.Add(index); } @@ -186,6 +189,7 @@ namespace Content.Server.GameObjects { ActiveIndex = index; } + Dirty(); } public void RemoveHand(string index) @@ -210,6 +214,7 @@ namespace Content.Server.GameObjects activeIndex = orderedHands[0]; } } + Dirty(); } public bool HasHand(string index) @@ -234,7 +239,7 @@ namespace Content.Server.GameObjects } return new HandsComponentState(dict, ActiveIndex); } - + private void SwapHands() { var index = orderedHands.FindIndex(x => x == ActiveIndex); @@ -246,12 +251,11 @@ namespace Content.Server.GameObjects ActiveIndex = orderedHands[index]; } - public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null) { base.HandleMessage(message, netChannel, component); - + switch (message) { case ClientChangedHandMsg msg: @@ -293,7 +297,7 @@ namespace Content.Server.GameObjects break; case BoundKeyFunctions.ActivateItemInHand: var used = GetActiveHand?.Owner; - if(used != null) + if (used != null) { InteractionSystem.TryUseInteraction(Owner, used); } diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index 8ddcf7b616..d0f8982502 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -45,7 +45,7 @@ namespace Content.Server.GameObjects /// bool Remove(IEntity toremove) { - if(storage.Remove(toremove)) + if (storage.Remove(toremove)) { StorageUsed -= toremove.GetComponent().ObjectSize; UpdateClientInventory(); @@ -61,7 +61,7 @@ namespace Content.Server.GameObjects /// bool Insert(IEntity toinsert) { - if(CanInsert(toinsert) && storage.Insert(toinsert)) + if (CanInsert(toinsert) && storage.Insert(toinsert)) { StorageUsed += toinsert.GetComponent().ObjectSize; UpdateClientInventory(); @@ -77,7 +77,7 @@ namespace Content.Server.GameObjects /// bool CanInsert(IEntity toinsert) { - if(toinsert.TryGetComponent(out StoreableComponent store)) + if (toinsert.TryGetComponent(out StoreableComponent store)) { if (store.ObjectSize <= (StorageCapacityMax - StorageUsed)) return true; @@ -95,7 +95,7 @@ namespace Content.Server.GameObjects { var hands = user.GetComponent(); //Check that we can drop the item from our hands first otherwise we obviously cant put it inside - if(hands.Drop(hands.ActiveIndex)) + if (hands.Drop(hands.ActiveIndex)) { var inserted = Insert(attackwith); if (inserted) diff --git a/SpaceStation14Content.sln b/SpaceStation14Content.sln index 55edfbab5c..11505fd242 100644 --- a/SpaceStation14Content.sln +++ b/SpaceStation14Content.sln @@ -40,8 +40,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SS14.Client", "engine\SS14. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SS14.Client.Godot", "engine\SS14.Client.Godot\SS14.Client.Godot.csproj", "{8AF31169-49B1-4A12-B8F4-2A0674A9E7CB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SS14.Shared.Bsdiff", "engine\SS14.Shared.Bsdiff\SS14.Shared.Bsdiff\SS14.Shared.Bsdiff.csproj", "{0E0723E8-D785-4F61-81F4-182A12BCAA52}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -235,24 +233,6 @@ Global {8AF31169-49B1-4A12-B8F4-2A0674A9E7CB}.Tools|x64.Build.0 = Tools|Any CPU {8AF31169-49B1-4A12-B8F4-2A0674A9E7CB}.Tools|x86.ActiveCfg = Tools|Any CPU {8AF31169-49B1-4A12-B8F4-2A0674A9E7CB}.Tools|x86.Build.0 = Tools|Any CPU - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Debug|x64.ActiveCfg = Debug|x64 - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Debug|x64.Build.0 = Debug|x64 - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Debug|x86.ActiveCfg = Debug|x86 - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Debug|x86.Build.0 = Debug|x86 - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Release|Any CPU.Build.0 = Release|Any CPU - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Release|x64.ActiveCfg = Release|x64 - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Release|x64.Build.0 = Release|x64 - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Release|x86.ActiveCfg = Release|x86 - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Release|x86.Build.0 = Release|x86 - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Tools|Any CPU.ActiveCfg = Debug|Any CPU - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Tools|Any CPU.Build.0 = Debug|Any CPU - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Tools|x64.ActiveCfg = Debug|x64 - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Tools|x64.Build.0 = Debug|x64 - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Tools|x86.ActiveCfg = Debug|x86 - {0E0723E8-D785-4F61-81F4-182A12BCAA52}.Tools|x86.Build.0 = Debug|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -265,7 +245,6 @@ Global {C899FCA4-7037-4E49-ABC2-44DE72487110} = {3202E94D-E985-4181-9F69-F458A7F6574F} {83429BD6-6358-4B18-BE51-401DF8EA2673} = {B01693E5-CF08-4DB7-8920-407F8D6603A1} {8AF31169-49B1-4A12-B8F4-2A0674A9E7CB} = {B01693E5-CF08-4DB7-8920-407F8D6603A1} - {0E0723E8-D785-4F61-81F4-182A12BCAA52} = {B01693E5-CF08-4DB7-8920-407F8D6603A1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {AA37ED9F-F8D6-468E-A101-658AD605B09A} diff --git a/engine b/engine index 1375da7f70..0a195fe3c7 160000 --- a/engine +++ b/engine @@ -1 +1 @@ -Subproject commit 1375da7f70c37c0dac32a6c944b2792155cf23ab +Subproject commit 0a195fe3c7f75045bd7e0264a86ef2fc793de8d8