mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
38 lines
970 B
C#
38 lines
970 B
C#
using System.Collections.Generic;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Robust.Shared.Player;
|
|
|
|
// This partial class has game-state related code.
|
|
internal abstract partial class SharedPlayerManager
|
|
{
|
|
public void Dirty()
|
|
{
|
|
LastStateUpdate = Timing.CurTick;
|
|
}
|
|
|
|
public void GetPlayerStates(GameTick fromTick, List<SessionState> states)
|
|
{
|
|
states.Clear();
|
|
if (LastStateUpdate < fromTick)
|
|
return;
|
|
|
|
states.EnsureCapacity(InternalSessions.Count);
|
|
foreach (var player in InternalSessions.Values)
|
|
{
|
|
states.Add(player.State);
|
|
}
|
|
}
|
|
|
|
public void UpdateState(ICommonSession session)
|
|
{
|
|
var state = session.State;
|
|
state.UserId = session.UserId;
|
|
state.Status = session.Status;
|
|
state.Name = session.Name;
|
|
state.ControlledEntity = EntManager.GetNetEntity(session.AttachedEntity);
|
|
Dirty();
|
|
}
|
|
}
|