пара фиксов

This commit is contained in:
Remuchi
2024-03-30 11:33:13 +07:00
parent d4aba17eaa
commit 297cfd23ad
8 changed files with 123 additions and 243 deletions

View File

@@ -39,7 +39,7 @@ public sealed class VoiceMaskBoundUserInterface : BoundUserInterface
return;
}
_window.UpdateState(cast.Name, cast.Verb);
_window.UpdateState(cast.Name, cast.Voice, cast.Verb);
}
protected override void Dispose(bool disposing)

View File

@@ -122,8 +122,7 @@ namespace Content.Server.Administration.Managers
else
{
_chat.DispatchServerMessage(session, Loc.GetString("admin-manager-stealthed-message"));
_chat.SendAdminAnnouncement(Loc.GetString("admin-manager-self-re-admin-message",
("newAdminName", session.Name)), flagWhitelist: AdminFlags.Stealth);
_chat.SendAdminAnnouncement(Loc.GetString("admin-manager-self-re-admin-message", ("newAdminName", session.Name)));
}
SendPermsChangedEvent(session);

View File

@@ -75,7 +75,6 @@ namespace Content.Server.Bed.Sleep
}
emitSound.MinInterval = sleepSound.Interval;
emitSound.MaxInterval = sleepSound.MaxInterval;
emitSound.PopUp = sleepSound.PopUp;
}
return;

View File

@@ -111,7 +111,7 @@ public sealed class RespiratorSystem : EntitySystem
if (TryComp(uid, out VoidAdaptationComponent? voidAdaptation))
{
voidAdaptation.ChemMultiplier = 0.75f;
StopSuffocation(uid, respirator);
StopSuffocation((uid, respirator));
respirator.SuffocationCycles = 0;
continue;
}

View File

@@ -28,7 +28,7 @@ namespace Content.Server.Chat.Managers
bool TrySendNewMessage(ICommonSession session, string newMessage, bool checkLength = false);
// WD-EDIT
void SendAdminAnnouncement(string message, AdminFlags? flagBlacklist = null, AdminFlags? flagWhitelist = null);
void SendAdminAnnouncement(string message);
void SendAdminAlert(string message);
void SendAdminAlert(EntityUid player, string message);

View File

@@ -1,26 +1,16 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Chat.Systems;
using Content.Server.GameTicking.Rules;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Station.Components;
using Content.Shared.Database;
using Content.Shared.Physics;
using Robust.Server.GameObjects;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Collections;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Timing;
namespace Content.Server._White.AspectsSystem.Base
{
namespace Content.Server._White.AspectsSystem.Base;
/// <summary>
/// Base class for aspect systems.
/// </summary>
@@ -31,9 +21,6 @@ namespace Content.Server._White.AspectsSystem.Base
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
[Dependency] private readonly TransformSystem _transform = default!;
protected ISawmill Sawmill = default!;
@@ -136,42 +123,6 @@ namespace Content.Server._White.AspectsSystem.Base
GameTicker.EndGameRule(uid, component);
}
protected bool TryGetRandomStation(
[NotNullWhen(true)] out EntityUid? station,
Func<EntityUid, bool>? filter = null)
{
var stations = new ValueList<EntityUid>();
if (filter == null)
{
var stationCount = Count<StationEventEligibleComponent>();
if (stationCount > 0)
{
stations.EnsureCapacity(stationCount);
}
}
filter ??= _ => true;
var query = AllEntityQuery<StationEventEligibleComponent>();
while (query.MoveNext(out var uid, out _))
{
if (!filter(uid))
continue;
stations.Add(uid);
}
if (stations.Count == 0)
{
station = null;
return false;
}
station = stations[_robustRandom.Next(stations.Count)];
return true;
}
protected bool TryGetStationGrids(
[NotNullWhen(true)] out EntityUid? targetStation,
[NotNullWhen(true)] out HashSet<EntityUid>? grids)
@@ -188,75 +139,5 @@ namespace Content.Server._White.AspectsSystem.Base
return grids.Count > 0;
}
protected bool TryFindRandomTile(
out Vector2i tile,
[NotNullWhen(true)] out EntityUid? targetStation,
out EntityUid targetGrid,
out EntityCoordinates targetCoords)
{
tile = default;
targetCoords = EntityCoordinates.Invalid;
if (!TryGetStationGrids(out targetStation, out var possibleTargets))
{
targetGrid = EntityUid.Invalid;
return false;
}
targetGrid = _robustRandom.Pick(possibleTargets);
foreach (var target in possibleTargets.Where(HasComp<BecomesStationComponent>))
{
targetGrid = target;
break;
}
if (!TryComp<MapGridComponent>(targetGrid, out var gridComp))
return false;
var found = false;
var gridBounds = gridComp.LocalAABB.Scale(0.6f);
for (var i = 0; i < 10; i++)
{
var randomX = _robustRandom.Next((int) gridBounds.Left, (int) gridBounds.Right);
var randomY = _robustRandom.Next((int) gridBounds.Bottom, (int) gridBounds.Top);
tile = new Vector2i(randomX, randomY);
if (_atmosphere.IsTileSpace(targetGrid, Transform(targetGrid).MapUid, tile,
mapGridComp: gridComp)
|| _atmosphere.IsTileAirBlocked(targetGrid, tile, mapGridComp: gridComp))
{
continue;
}
var physQuery = GetEntityQuery<PhysicsComponent>();
var valid = true;
foreach (var ent in gridComp.GetAnchoredEntities(tile))
{
if (!physQuery.TryGetComponent(ent, out var body))
continue;
if (body.BodyType != BodyType.Static ||
!body.Hard ||
(body.CollisionLayer & (int) CollisionGroup.Impassable) == 0)
continue;
valid = false;
break;
}
if (!valid)
continue;
found = true;
targetCoords = gridComp.GridTileToLocal(tile);
break;
}
return found;
}
#endregion
}
}

View File

@@ -190,8 +190,8 @@ public sealed class TorchCultistsProviderSystem : EntitySystem
var ownerTransform = Transform(args.User);
if (_station.GetStationInMap(ownerTransform.MapID) is not { } station ||
!TryComp<StationDataComponent>(station, out var data) ||
_station.GetLargestGrid(data) is not { } grid)
!TryComp<StationDataComponent>(station, out var stationData) ||
_station.GetLargestGrid(stationData) is not { } grid)
{
if (ownerTransform.GridUid == null)
return;
@@ -199,13 +199,13 @@ public sealed class TorchCultistsProviderSystem : EntitySystem
grid = ownerTransform.GridUid.Value;
}
if (!TryComp<MapGridComponent>(grid, out var gridComp))
if (!TryComp<MapGridComponent>(grid, out var mapGrid))
{
return;
}
var gridTransform = Transform(grid);
var gridBounds = gridComp.LocalAABB.Scale(0.7f); // чтобы не заспавнить на самом краю станции
var gridBounds = mapGrid.LocalAABB.Scale(0.7f); // чтобы не заспавнить на самом краю станции
var targetCoords = gridTransform.Coordinates;
@@ -217,8 +217,8 @@ public sealed class TorchCultistsProviderSystem : EntitySystem
var tile = new Vector2i(randomX, randomY);
// no air-blocked areas.
if (_atmosphere.IsTileSpace(grid, gridTransform.MapUid, tile, mapGridComp: gridComp) ||
_atmosphere.IsTileAirBlocked(grid, tile, mapGridComp: gridComp))
if (_atmosphere.IsTileSpace(grid, gridTransform.MapUid, tile) ||
_atmosphere.IsTileAirBlocked(grid, tile, mapGridComp: mapGrid))
{
continue;
}
@@ -226,7 +226,7 @@ public sealed class TorchCultistsProviderSystem : EntitySystem
// don't spawn inside of solid objects
var physQuery = GetEntityQuery<PhysicsComponent>();
var valid = true;
foreach (var ent in _map.GetAnchoredEntities(grid, gridComp, tile))
foreach (var ent in _map.GetAnchoredEntities(grid, mapGrid, tile))
{
if (!physQuery.TryGetComponent(ent, out var body))
continue;
@@ -243,7 +243,7 @@ public sealed class TorchCultistsProviderSystem : EntitySystem
if (!valid)
continue;
targetCoords = _map.GridTileToLocal(grid, gridComp, tile);
targetCoords = _map.GridTileToLocal(grid, mapGrid, tile);
break;
}

View File

@@ -321,9 +321,10 @@ namespace Content.Server._White.Supermatter.Systems
//if there are space tiles next to SM
//TODO: change moles out for checking if adjacent tiles exist
foreach (var ind in _atmosphere.GetAdjacentTileMixtures(xform.GridUid.Value, indices))
var query = _atmosphere.GetAdjacentTileMixtures(xform.GridUid.Value, indices);
while(query.MoveNext(out var mix))
{
if (ind.TotalMoles != 0)
if (mix.TotalMoles != 0)
continue;
var integrity = GetIntegrity(sMcomponent.Damage, sMcomponent.ExplosionPoint);