Entity Interpolation (#197)

* Frame interpolation kinda works.

* Added null CurState check because it can be null now.

* Merge remote-tracking branch 'upstream/master' into dev-GameState
This commit is contained in:
Acruid
2019-04-13 00:46:27 -07:00
committed by Pieter-Jan Briers
parent 52af7d27da
commit b1c81ed6e6
6 changed files with 30 additions and 23 deletions

View File

@@ -35,9 +35,12 @@ namespace Content.Client.GameObjects.Components.Clothing
return null; 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; ClothingEquippedPrefix = clothingComponentState.ClothingEquippedPrefix;
EquippedPrefix = clothingComponentState.EquippedPrefix; EquippedPrefix = clothingComponentState.EquippedPrefix;
} }

View File

@@ -1,7 +1,5 @@
using Content.Shared.GameObjects; using Content.Shared.GameObjects;
using SS14.Shared.GameObjects; using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Network;
using System.Collections.Generic; using System.Collections.Generic;
namespace Content.Client.GameObjects namespace Content.Client.GameObjects
@@ -17,13 +15,13 @@ namespace Content.Client.GameObjects
public Dictionary<DamageType, int> CurrentDamage = new Dictionary<DamageType, int>(); public Dictionary<DamageType, int> CurrentDamage = new Dictionary<DamageType, int>();
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; CurrentDamage = damagestate.CurrentDamage;
} }
} }

View File

@@ -91,10 +91,14 @@ namespace Content.Client.GameObjects
serializer.DataField(ref _templateName, "Template", "HumanInventory"); serializer.DataField(ref _templateName, "Template", "HumanInventory");
} }
public override void HandleComponentState(ComponentState state) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
base.HandleComponentState(state); base.HandleComponentState(curState, nextState);
var cast = (InventoryComponentState) state;
if (curState == null)
return;
var cast = (InventoryComponentState) curState;
var doneSlots = new HashSet<Slots>(); var doneSlots = new HashSet<Slots>();

View File

@@ -69,9 +69,12 @@ namespace Content.Client.GameObjects
return null; 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) foreach (var (slot, uid) in cast.Hands)
{ {
IEntity entity = null; IEntity entity = null;

View File

@@ -61,9 +61,12 @@ namespace Content.Client.GameObjects
return resourceCache.GetResource<RSIResource>(SharedSpriteComponent.TextureRoot / RsiPath).RSI; return resourceCache.GetResource<RSIResource>(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; EquippedPrefix = itemComponentState.EquippedPrefix;
} }
} }

View File

@@ -1,6 +1,4 @@
using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Storage;
using Content.Shared.GameObjects.Components.Storage;
using SS14.Client.GameObjects;
using SS14.Client.Interfaces.GameObjects.Components; using SS14.Client.Interfaces.GameObjects.Components;
using SS14.Client.UserInterface; using SS14.Client.UserInterface;
using SS14.Client.UserInterface.Controls; using SS14.Client.UserInterface.Controls;
@@ -9,8 +7,6 @@ using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects; using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Network; using SS14.Shared.Interfaces.Network;
using SS14.Shared.IoC; using SS14.Shared.IoC;
using SS14.Shared.Log;
using SS14.Shared.Maths;
using SS14.Shared.Utility; using SS14.Shared.Utility;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -53,11 +49,11 @@ namespace Content.Client.GameObjects.Components.Storage
} }
/// <inheritdoc /> /// <inheritdoc />
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; return;
Open = storageState.Open; Open = storageState.Open;