refactors adminmenu a timid amount (#5095)
Co-authored-by: Paul <ritter.paul1+git@googlemail.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
13
Content.Shared/Administration/Events/FullPlayerListEvent.cs
Normal file
13
Content.Shared/Administration/Events/FullPlayerListEvent.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Administration.Events
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public class FullPlayerListEvent : EntityEventArgs
|
||||
{
|
||||
public List<PlayerInfo> PlayersInfo = new();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Administration.Events
|
||||
{
|
||||
[NetSerializable, Serializable]
|
||||
public class PlayerInfoChangedEvent : EntityEventArgs
|
||||
{
|
||||
public PlayerInfo? PlayerInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Administration.Events
|
||||
{
|
||||
[NetSerializable, Serializable]
|
||||
public class PlayerInfoRemovalMessage : EntityEventArgs
|
||||
{
|
||||
public NetUserId NetUserId;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Lidgren.Network;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
namespace Content.Shared.Administration.Menu
|
||||
{
|
||||
public class AdminMenuPlayerListMessage : NetMessage
|
||||
{
|
||||
public override MsgGroups MsgGroup => MsgGroups.Command;
|
||||
|
||||
public List<PlayerInfo> PlayersInfo = new();
|
||||
|
||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
||||
{
|
||||
var count = buffer.ReadInt32();
|
||||
|
||||
PlayersInfo.Clear();
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var username = buffer.ReadString();
|
||||
var characterName = buffer.ReadString();
|
||||
var antag = buffer.ReadBoolean();
|
||||
var uid = buffer.ReadEntityUid();
|
||||
|
||||
PlayersInfo.Add(new PlayerInfo(username, characterName, antag, uid));
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
||||
{
|
||||
buffer.Write(PlayersInfo.Count);
|
||||
|
||||
foreach (var player in PlayersInfo)
|
||||
{
|
||||
buffer.Write(player.Username);
|
||||
buffer.Write(player.CharacterName);
|
||||
buffer.Write(player.Antag);
|
||||
buffer.Write(player.EntityUid);
|
||||
}
|
||||
}
|
||||
|
||||
public record PlayerInfo(string Username, string CharacterName, bool Antag, EntityUid EntityUid);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using Lidgren.Network;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
namespace Content.Shared.Administration.Menu
|
||||
{
|
||||
public class AdminMenuPlayerListRequest : NetMessage
|
||||
{
|
||||
public override MsgGroups MsgGroup => MsgGroups.Command;
|
||||
|
||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
||||
{
|
||||
}
|
||||
|
||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Content.Shared/Administration/PlayerInfo.cs
Normal file
10
Content.Shared/Administration/PlayerInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Administration
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public record PlayerInfo(string Username, string CharacterName, bool Antag, EntityUid EntityUid, NetUserId SessionId);
|
||||
}
|
||||
Reference in New Issue
Block a user