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:
committed by
GitHub
parent
20cf3a6a9b
commit
85b4be3ff4
@@ -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);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Content.Server.GameObjects
|
||||
/// <returns></returns>
|
||||
bool Remove(IEntity toremove)
|
||||
{
|
||||
if(storage.Remove(toremove))
|
||||
if (storage.Remove(toremove))
|
||||
{
|
||||
StorageUsed -= toremove.GetComponent<StoreableComponent>().ObjectSize;
|
||||
UpdateClientInventory();
|
||||
@@ -61,7 +61,7 @@ namespace Content.Server.GameObjects
|
||||
/// <returns></returns>
|
||||
bool Insert(IEntity toinsert)
|
||||
{
|
||||
if(CanInsert(toinsert) && storage.Insert(toinsert))
|
||||
if (CanInsert(toinsert) && storage.Insert(toinsert))
|
||||
{
|
||||
StorageUsed += toinsert.GetComponent<StoreableComponent>().ObjectSize;
|
||||
UpdateClientInventory();
|
||||
@@ -77,7 +77,7 @@ namespace Content.Server.GameObjects
|
||||
/// <returns></returns>
|
||||
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<HandsComponent>();
|
||||
//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)
|
||||
|
||||
Reference in New Issue
Block a user