Revert "Update submodule to 172.0.0 (#21222)" (#21225)

This commit is contained in:
metalgearsloth
2023-10-24 21:55:20 +11:00
committed by GitHub
parent 517aea8bc3
commit a2bbda43cc
249 changed files with 1049 additions and 967 deletions

View File

@@ -10,7 +10,6 @@ using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
namespace Content.Server.Atmos.EntitySystems
{
@@ -28,7 +27,7 @@ namespace Content.Server.Atmos.EntitySystems
/// To modify it see <see cref="AddObserver"/> and
/// <see cref="RemoveObserver"/>.
/// </summary>
private readonly HashSet<ICommonSession> _playerObservers = new();
private readonly HashSet<IPlayerSession> _playerObservers = new();
/// <summary>
/// Overlay update ticks per second.
@@ -49,17 +48,17 @@ namespace Content.Server.Atmos.EntitySystems
_playerManager.PlayerStatusChanged -= OnPlayerStatusChanged;
}
public bool AddObserver(ICommonSession observer)
public bool AddObserver(IPlayerSession observer)
{
return _playerObservers.Add(observer);
}
public bool HasObserver(ICommonSession observer)
public bool HasObserver(IPlayerSession observer)
{
return _playerObservers.Contains(observer);
}
public bool RemoveObserver(ICommonSession observer)
public bool RemoveObserver(IPlayerSession observer)
{
if (!_playerObservers.Remove(observer))
{
@@ -77,7 +76,7 @@ namespace Content.Server.Atmos.EntitySystems
/// </summary>
/// <param name="observer">The observer to toggle.</param>
/// <returns>true if added, false if removed.</returns>
public bool ToggleObserver(ICommonSession observer)
public bool ToggleObserver(IPlayerSession observer)
{
if (HasObserver(observer))
{

View File

@@ -12,6 +12,7 @@ using Content.Shared.Toggleable;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Physics.Systems;
@@ -59,6 +60,12 @@ namespace Content.Server.Atmos.EntitySystems
private void OnGasTankToggleInternals(Entity<GasTankComponent> ent, ref GasTankToggleInternalsMessage args)
{
if (args.Session is not IPlayerSession playerSession ||
playerSession.AttachedEntity == null)
{
return;
}
ToggleInternals(ent);
}

View File

@@ -16,7 +16,6 @@ using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Threading;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
@@ -36,7 +35,7 @@ namespace Content.Server.Atmos.EntitySystems
[Robust.Shared.IoC.Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Robust.Shared.IoC.Dependency] private readonly ChunkingSystem _chunkingSys = default!;
private readonly Dictionary<ICommonSession, Dictionary<NetEntity, HashSet<Vector2i>>> _lastSentChunks = new();
private readonly Dictionary<IPlayerSession, Dictionary<NetEntity, HashSet<Vector2i>>> _lastSentChunks = new();
// Oh look its more duplicated decal system code!
private ObjectPool<HashSet<Vector2i>> _chunkIndexPool =
@@ -287,12 +286,12 @@ namespace Content.Server.Atmos.EntitySystems
// Now we'll go through each player, then through each chunk in range of that player checking if the player is still in range
// If they are, check if they need the new data to send (i.e. if there's an overlay for the gas).
// Afterwards we reset all the chunk data for the next time we tick.
var players = _playerManager.Sessions.Where(x => x.Status == SessionStatus.InGame).ToArray();
var players = _playerManager.ServerSessions.Where(x => x.Status == SessionStatus.InGame).ToArray();
var opts = new ParallelOptions { MaxDegreeOfParallelism = _parMan.ParallelProcessCount };
Parallel.ForEach(players, opts, p => UpdatePlayer(p, curTick));
}
private void UpdatePlayer(ICommonSession playerSession, GameTick curTick)
private void UpdatePlayer(IPlayerSession playerSession, GameTick curTick)
{
var chunksInRange = _chunkingSys.GetChunksForSession(playerSession, ChunkSize, _chunkIndexPool, _chunkViewerPool);
var previouslySent = _lastSentChunks[playerSession];