Simple network replication for hands, untested.
This commit is contained in:
@@ -56,6 +56,8 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="EntryPoint.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="GameObjects\Components\Items\HandsComponent.cs" />
|
||||
<Compile Include="GameObjects\Components\NetIDs.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\engine\Lidgren.Network\Lidgren.Network.csproj">
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using SS14.Shared.GameObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Content.Shared.GameObjects
|
||||
{
|
||||
public abstract class SharedHandsComponent : Component
|
||||
{
|
||||
public sealed override string Name => "Hands";
|
||||
public sealed override uint? NetID => ContentNetIDs.HANDS;
|
||||
public sealed override Type StateType => typeof(HandsComponentState);
|
||||
}
|
||||
|
||||
// The IDs of the items get synced over the network.
|
||||
[Serializable]
|
||||
public class HandsComponentState : ComponentState
|
||||
{
|
||||
public readonly Dictionary<string, int> Hands;
|
||||
|
||||
public HandsComponentState(Dictionary<string, int> hands)
|
||||
{
|
||||
Hands = hands;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Content.Shared/GameObjects/Components/NetIDs.cs
Normal file
7
Content.Shared/GameObjects/Components/NetIDs.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Content.Shared.GameObjects
|
||||
{
|
||||
public static class ContentNetIDs
|
||||
{
|
||||
public const uint HANDS = 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user