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
This commit is contained in:
Pieter-Jan Briers
2018-05-13 11:54:21 +02:00
committed by GitHub
parent 20cf3a6a9b
commit 85b4be3ff4
5 changed files with 15 additions and 32 deletions

View File

@@ -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<TransformComponent>();
itemTransform.LocalPosition = Owner.GetComponent<TransformComponent>().LocalPosition;
Dirty();
return true;
}
@@ -178,7 +181,7 @@ namespace Content.Server.GameObjects
var slot = ContainerManagerComponent.Create<ContainerSlot>(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);
}