diff --git a/Content.Client/GameObjects/Components/Clothing/ClothingComponent.cs b/Content.Client/GameObjects/Components/Clothing/ClothingComponent.cs index 831d296383..21e70c823a 100644 --- a/Content.Client/GameObjects/Components/Clothing/ClothingComponent.cs +++ b/Content.Client/GameObjects/Components/Clothing/ClothingComponent.cs @@ -35,9 +35,12 @@ namespace Content.Client.GameObjects.Components.Clothing return null; } - public override void HandleComponentState(ComponentState state) + public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - var clothingComponentState = (ClothingComponentState)state; + if (curState == null) + return; + + var clothingComponentState = (ClothingComponentState)curState; ClothingEquippedPrefix = clothingComponentState.ClothingEquippedPrefix; EquippedPrefix = clothingComponentState.EquippedPrefix; } diff --git a/Content.Client/GameObjects/Components/DamageableComponent.cs b/Content.Client/GameObjects/Components/DamageableComponent.cs index 70ab4811ce..c17d430c15 100644 --- a/Content.Client/GameObjects/Components/DamageableComponent.cs +++ b/Content.Client/GameObjects/Components/DamageableComponent.cs @@ -1,7 +1,5 @@ using Content.Shared.GameObjects; using SS14.Shared.GameObjects; -using SS14.Shared.Interfaces.GameObjects; -using SS14.Shared.Interfaces.Network; using System.Collections.Generic; namespace Content.Client.GameObjects @@ -17,13 +15,13 @@ namespace Content.Client.GameObjects public Dictionary CurrentDamage = new Dictionary(); - public override void HandleComponentState(ComponentState state) + public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - base.HandleComponentState(state); + base.HandleComponentState(curState, nextState); - if(state is DamageComponentState) + if(curState is DamageComponentState) { - var damagestate = (DamageComponentState)state; + var damagestate = (DamageComponentState)curState; CurrentDamage = damagestate.CurrentDamage; } } diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs index 703934fa60..7448fdfc5e 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs @@ -91,10 +91,14 @@ namespace Content.Client.GameObjects serializer.DataField(ref _templateName, "Template", "HumanInventory"); } - public override void HandleComponentState(ComponentState state) + public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - base.HandleComponentState(state); - var cast = (InventoryComponentState) state; + base.HandleComponentState(curState, nextState); + + if (curState == null) + return; + + var cast = (InventoryComponentState) curState; var doneSlots = new HashSet(); diff --git a/Content.Client/GameObjects/Components/Items/ClientHandsComponent.cs b/Content.Client/GameObjects/Components/Items/ClientHandsComponent.cs index 17c8e81ec0..6a35768f42 100644 --- a/Content.Client/GameObjects/Components/Items/ClientHandsComponent.cs +++ b/Content.Client/GameObjects/Components/Items/ClientHandsComponent.cs @@ -69,9 +69,12 @@ namespace Content.Client.GameObjects return null; } - public override void HandleComponentState(ComponentState state) + public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - var cast = (HandsComponentState) state; + if (curState == null) + return; + + var cast = (HandsComponentState) curState; foreach (var (slot, uid) in cast.Hands) { IEntity entity = null; diff --git a/Content.Client/GameObjects/Components/Items/ItemComponent.cs b/Content.Client/GameObjects/Components/Items/ItemComponent.cs index 3db6de991e..3bbfa35eea 100644 --- a/Content.Client/GameObjects/Components/Items/ItemComponent.cs +++ b/Content.Client/GameObjects/Components/Items/ItemComponent.cs @@ -61,9 +61,12 @@ namespace Content.Client.GameObjects return resourceCache.GetResource(SharedSpriteComponent.TextureRoot / RsiPath).RSI; } - public override void HandleComponentState(ComponentState state) + public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - var itemComponentState = (ItemComponentState)state; + if(curState == null) + return; + + var itemComponentState = (ItemComponentState)curState; EquippedPrefix = itemComponentState.EquippedPrefix; } } diff --git a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs index e0317257ed..f112bb8e7e 100644 --- a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs +++ b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs @@ -1,6 +1,4 @@ -using Content.Shared.GameObjects; -using Content.Shared.GameObjects.Components.Storage; -using SS14.Client.GameObjects; +using Content.Shared.GameObjects.Components.Storage; using SS14.Client.Interfaces.GameObjects.Components; using SS14.Client.UserInterface; using SS14.Client.UserInterface.Controls; @@ -9,8 +7,6 @@ using SS14.Shared.GameObjects; using SS14.Shared.Interfaces.GameObjects; using SS14.Shared.Interfaces.Network; using SS14.Shared.IoC; -using SS14.Shared.Log; -using SS14.Shared.Maths; using SS14.Shared.Utility; using System; using System.Collections.Generic; @@ -53,11 +49,11 @@ namespace Content.Client.GameObjects.Components.Storage } /// - public override void HandleComponentState(ComponentState state) + public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - base.HandleComponentState(state); + base.HandleComponentState(curState, nextState); - if (!(state is StorageComponentState storageState)) + if (!(curState is StorageComponentState storageState)) return; Open = storageState.Open;