Functional GUI!
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using SS14.Shared.GameObjects;
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
using SS14.Server.Interfaces.GameObjects;
|
||||
using System;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
@@ -20,6 +21,11 @@ namespace Content.Server.GameObjects
|
||||
}
|
||||
|
||||
ContainingSlot = null;
|
||||
|
||||
foreach (var component in Owner.GetComponents<ISpriteRenderableComponent>())
|
||||
{
|
||||
component.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void EquippedToSlot(IInventorySlot slot)
|
||||
@@ -30,6 +36,11 @@ namespace Content.Server.GameObjects
|
||||
}
|
||||
|
||||
ContainingSlot = slot;
|
||||
|
||||
foreach (var component in Owner.GetComponents<ISpriteRenderableComponent>())
|
||||
{
|
||||
component.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,11 @@ using SS14.Server.GameObjects.Events;
|
||||
using SS14.Server.Interfaces.GameObjects;
|
||||
using SS14.Shared;
|
||||
using SS14.Shared.GameObjects;
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
using SS14.Shared.Utility;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
using Lidgren.Network;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
{
|
||||
@@ -224,7 +223,7 @@ namespace Content.Server.GameObjects
|
||||
dict[hand.Key] = hand.Value.Item.Owner.Uid;
|
||||
}
|
||||
}
|
||||
return new HandsComponentState(dict);
|
||||
return new HandsComponentState(dict, ActiveIndex);
|
||||
}
|
||||
|
||||
// Game logic goes here.
|
||||
@@ -276,5 +275,19 @@ namespace Content.Server.GameObjects
|
||||
|
||||
PutInHand(item, ActiveIndex, fallback: false);
|
||||
}
|
||||
|
||||
public override void HandleNetworkMessage(IncomingEntityComponentMessage message, NetConnection sender)
|
||||
{
|
||||
if (message.MessageParameters.Count != 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var index = message.MessageParameters[0];
|
||||
if (index is string newIndex && HasHand(newIndex))
|
||||
{
|
||||
ActiveIndex = newIndex;
|
||||
}
|
||||
base.HandleNetworkMessage(message, sender);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user