Skip to content

Commit

Permalink
Merge branch 'Rxup:master' into PilotNewUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
Agronomist-NN authored Feb 24, 2025
2 parents 7bfc318 + 13e82a8 commit 356fe03
Show file tree
Hide file tree
Showing 600 changed files with 201,960 additions and 3,441 deletions.
4 changes: 2 additions & 2 deletions Content.Client/Administration/Systems/BwoinkSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySes
OnBwoinkTextMessageRecieved?.Invoke(this, message);
}

public void Send(NetUserId channelId, string text, bool playSound)
public void Send(NetUserId channelId, string text, bool playSound, bool adminOnly)
{
// Reuse the channel ID as the 'true sender'.
// Server will ignore this and if someone makes it not ignore this (which is bad, allows impersonation!!!), that will help.
RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text, playSound: playSound));
RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text, playSound: playSound, adminOnly: adminOnly));
SendInputTextUpdated(channelId, false);
}

Expand Down
4 changes: 3 additions & 1 deletion Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
<BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="2">
<BoxContainer Access="Public" Name="BwoinkArea" VerticalExpand="True" />
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<CheckBox Visible="True" Name="PlaySound" Access="Public" Text="{Loc 'admin-bwoink-play-sound'}" Pressed="True" />
<CheckBox Name="AdminOnly" Access="Public" Text="{Loc 'admin-ahelp-admin-only'}" ToolTip="{Loc 'admin-ahelp-admin-only-tooltip'}" />
<Control HorizontalExpand="True" MinWidth="5" />
<CheckBox Name="PlaySound" Access="Public" Text="{Loc 'admin-bwoink-play-sound'}" Pressed="True" />
<Control HorizontalExpand="True" MinWidth="5" />
<Button Visible="True" Name="PopOut" Access="Public" Text="{Loc 'admin-logs-pop-out'}" StyleClasses="OpenBoth" HorizontalAlignment="Left" />
<Control HorizontalExpand="True" />
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public BwoinkControl()
_adminManager.AdminStatusUpdated += UpdateButtons;
UpdateButtons();

AdminOnly.OnToggled += args => PlaySound.Disabled = args.Pressed;

ChannelSelector.OnSelectionChanged += sel =>
{
_currentPlayer = sel;
Expand Down
8 changes: 8 additions & 0 deletions Content.Client/Backmen/Chapel/SacrificialAltarSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Shared.Backmen.Chapel;

namespace Content.Client.Backmen.Chapel;

public sealed class SacrificialAltarSystem : SharedSacrificialAltarSystem
{

}
2 changes: 1 addition & 1 deletion Content.Client/Doors/AirlockSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void OnAppearanceChange(EntityUid uid, AirlockComponent comp, ref Appear
|| state == DoorState.Opening
|| state == DoorState.Denying
|| (state == DoorState.Open && comp.OpenUnlitVisible)
|| (_appearanceSystem.TryGetData<bool>(uid, DoorVisuals.ClosedLights, out var closedLights, args.Component) && closedLights))
|| (state == DoorState.Closed && comp.OpenUnlitVisible))
&& !boltedVisible && !emergencyLightsVisible;
}

Expand Down
16 changes: 3 additions & 13 deletions Content.Client/Guidebook/Controls/GuidebookWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,14 @@ private IEnumerable<GuideEntry> GetSortedEntries(List<ProtoId<GuideEntryPrototyp
HashSet<ProtoId<GuideEntryPrototype>> entries = new(_entries.Keys);
foreach (var entry in _entries.Values)
{
if (entry.Children.Count > 0)
{
var sortedChildren = entry.Children
.Select(childId => _entries[childId])
.OrderBy(childEntry => childEntry.Priority)
.ThenBy(childEntry => Loc.GetString(childEntry.Name))
.Select(childEntry => new ProtoId<GuideEntryPrototype>(childEntry.Id))
.ToList();

entry.Children = sortedChildren;
}

entries.ExceptWith(entry.Children);
}

rootEntries = entries.ToList();
}

// Only roots need to be sorted.
// As defined in the SS14 Dev Wiki, children are already sorted based on their child field order within their parent's prototype definition.
// Roots are sorted by priority. If there is no defined priority for a root then it is by definition sorted undefined.
return rootEntries
.Select(rootEntryId => _entries[rootEntryId])
.OrderBy(rootEntry => rootEntry.Priority)
Expand Down
4 changes: 3 additions & 1 deletion Content.Client/Guidebook/GuidebookSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ private void OnGuidebookControlsTestInteractHand(EntityUid uid, GuidebookControl
if (!TryComp<SpeechComponent>(uid, out var speech) || speech.SpeechSounds is null)
return;

_audioSystem.PlayGlobal(speech.SpeechSounds, Filter.Local(), false, speech.AudioParams);
// This code is broken because SpeechSounds isn't a file name or sound specifier directly.
// Commenting out to avoid compile failure with https://github.com/space-wizards/RobustToolbox/pull/5540
// _audioSystem.PlayGlobal(speech.SpeechSounds, Filter.Local(), false, speech.AudioParams);
}

public void FakeClientActivateInWorld(EntityUid activated)
Expand Down
26 changes: 7 additions & 19 deletions Content.Client/Light/RoofOverlay.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Numerics;
using Content.Shared.Light.Components;
using Content.Shared.Light.EntitySystems;
using Content.Shared.Maps;
using Robust.Client.Graphics;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Map.Enumerators;
using Robust.Shared.Physics;

namespace Content.Client.Light;
Expand All @@ -17,9 +19,9 @@ public sealed class RoofOverlay : Overlay

private readonly EntityLookupSystem _lookup;
private readonly SharedMapSystem _mapSystem;
private readonly SharedRoofSystem _roof = default!;
private readonly SharedTransformSystem _xformSystem;

private readonly HashSet<Entity<OccluderComponent>> _occluders = new();
private List<Entity<MapGridComponent>> _grids = new();

public override OverlaySpace Space => OverlaySpace.BeforeLighting;
Expand All @@ -33,6 +35,7 @@ public RoofOverlay(IEntityManager entManager)

_lookup = _entManager.System<EntityLookupSystem>();
_mapSystem = _entManager.System<SharedMapSystem>();
_roof = _entManager.System<SharedRoofSystem>();
_xformSystem = _entManager.System<SharedTransformSystem>();

ZIndex = ContentZIndex;
Expand Down Expand Up @@ -86,29 +89,14 @@ protected override void Draw(in OverlayDrawArgs args)
worldHandle.SetTransform(matty);

var tileEnumerator = _mapSystem.GetTilesEnumerator(grid.Owner, grid, bounds);
var roofEnt = (grid.Owner, grid.Comp, roof);

// Due to stencilling we essentially draw on unrooved tiles
while (tileEnumerator.MoveNext(out var tileRef))
{
if ((tileRef.Tile.Flags & (byte) TileFlag.Roof) == 0x0)
if (!_roof.IsRooved(roofEnt, tileRef.GridIndices))
{
// Check if the tile is occluded in which case hide it anyway.
// This is to avoid lit walls bleeding over to unlit tiles.
_occluders.Clear();
_lookup.GetLocalEntitiesIntersecting(grid.Owner, tileRef.GridIndices, _occluders);
var found = false;

foreach (var occluder in _occluders)
{
if (!occluder.Comp.Enabled)
continue;

found = true;
break;
}

if (!found)
continue;
continue;
}

var local = _lookup.GetLocalBounds(tileRef, grid.Comp.TileSize);
Expand Down
4 changes: 3 additions & 1 deletion Content.Client/Overlays/StencilOverlay.Weather.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Numerics;
using Content.Shared.Light.Components;
using Content.Shared.Weather;
using Robust.Client.Graphics;
using Robust.Shared.Map.Components;
Expand Down Expand Up @@ -34,11 +35,12 @@ private void DrawWeather(in OverlayDrawArgs args, WeatherPrototype weatherProto,
var matrix = _transform.GetWorldMatrix(grid, xformQuery);
var matty = Matrix3x2.Multiply(matrix, invMatrix);
worldHandle.SetTransform(matty);
_entManager.TryGetComponent(grid.Owner, out RoofComponent? roofComp);

foreach (var tile in _map.GetTilesIntersecting(grid.Owner, grid, worldAABB))
{
// Ignored tiles for stencil
if (_weather.CanWeatherAffect(grid.Owner, grid, tile))
if (_weather.CanWeatherAffect(grid.Owner, grid, tile, roofComp))
{
continue;
}
Expand Down
21 changes: 14 additions & 7 deletions Content.Client/Sprite/SpriteFadeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,21 @@ public sealed class SpriteFadeSystem : EntitySystem

private readonly HashSet<FadingSpriteComponent> _comps = new();

private EntityQuery<SpriteComponent> _spriteQuery;
private EntityQuery<SpriteFadeComponent> _fadeQuery;
private EntityQuery<FadingSpriteComponent> _fadingQuery;

private const float TargetAlpha = 0.4f;
private const float ChangeRate = 1f;

public override void Initialize()
{
base.Initialize();

_spriteQuery = GetEntityQuery<SpriteComponent>();
_fadeQuery = GetEntityQuery<SpriteFadeComponent>();
_fadingQuery = GetEntityQuery<FadingSpriteComponent>();

SubscribeLocalEvent<FadingSpriteComponent, ComponentShutdown>(OnFadingShutdown);
}

Expand All @@ -42,28 +51,26 @@ public override void FrameUpdate(float frameTime)
base.FrameUpdate(frameTime);

var player = _playerManager.LocalEntity;
var spriteQuery = GetEntityQuery<SpriteComponent>();
var change = ChangeRate * frameTime;

if (TryComp(player, out TransformComponent? playerXform) &&
_stateManager.CurrentState is GameplayState state &&
spriteQuery.TryGetComponent(player, out var playerSprite))
_spriteQuery.TryGetComponent(player, out var playerSprite))
{
var fadeQuery = GetEntityQuery<SpriteFadeComponent>();
var mapPos = _transform.GetMapCoordinates(_playerManager.LocalEntity!.Value, xform: playerXform);

// Also want to handle large entities even if they may not be clickable.
foreach (var ent in state.GetClickableEntities(mapPos))
{
if (ent == player ||
!fadeQuery.HasComponent(ent) ||
!spriteQuery.TryGetComponent(ent, out var sprite) ||
!_fadeQuery.HasComponent(ent) ||
!_spriteQuery.TryGetComponent(ent, out var sprite) ||
sprite.DrawDepth < playerSprite.DrawDepth)
{
continue;
}

if (!TryComp<FadingSpriteComponent>(ent, out var fading))
if (!_fadingQuery.TryComp(ent, out var fading))
{
fading = AddComp<FadingSpriteComponent>(ent);
fading.OriginalAlpha = sprite.Color.A;
Expand All @@ -85,7 +92,7 @@ _stateManager.CurrentState is GameplayState state &&
if (_comps.Contains(comp))
continue;

if (!spriteQuery.TryGetComponent(uid, out var sprite))
if (!_spriteQuery.TryGetComponent(uid, out var sprite))
continue;

var newColor = Math.Min(sprite.Color.A + change, comp.OriginalAlpha);
Expand Down
12 changes: 6 additions & 6 deletions Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public void EnsureUIHelper()
UIHelper = isAdmin ? new AdminAHelpUIHandler(ownerUserId) : new UserAHelpUIHandler(ownerUserId);
UIHelper.DiscordRelayChanged(_discordRelayActive);

UIHelper.SendMessageAction = (userId, textMessage, playSound) => _bwoinkSystem?.Send(userId, textMessage, playSound);
UIHelper.SendMessageAction = (userId, textMessage, playSound, adminOnly) => _bwoinkSystem?.Send(userId, textMessage, playSound, adminOnly);
UIHelper.InputTextChanged += (channel, text) => _bwoinkSystem?.SendInputTextUpdated(channel, text.Length > 0);
UIHelper.OnClose += () => { SetAHelpPressed(false); };
UIHelper.OnOpen += () => { SetAHelpPressed(true); };
Expand Down Expand Up @@ -325,7 +325,7 @@ public interface IAHelpUIHandler : IDisposable
public void PeopleTypingUpdated(BwoinkPlayerTypingUpdated args);
public event Action OnClose;
public event Action OnOpen;
public Action<NetUserId, string, bool>? SendMessageAction { get; set; }
public Action<NetUserId, string, bool, bool>? SendMessageAction { get; set; }
public event Action<NetUserId, string>? InputTextChanged;
}
public sealed class AdminAHelpUIHandler : IAHelpUIHandler
Expand Down Expand Up @@ -409,7 +409,7 @@ public void PeopleTypingUpdated(BwoinkPlayerTypingUpdated args)

public event Action? OnClose;
public event Action? OnOpen;
public Action<NetUserId, string, bool>? SendMessageAction { get; set; }
public Action<NetUserId, string, bool, bool>? SendMessageAction { get; set; }
public event Action<NetUserId, string>? InputTextChanged;

public void Open(NetUserId channelId, bool relayActive)
Expand Down Expand Up @@ -463,7 +463,7 @@ public BwoinkPanel EnsurePanel(NetUserId channelId)
if (_activePanelMap.TryGetValue(channelId, out var existingPanel))
return existingPanel;

_activePanelMap[channelId] = existingPanel = new BwoinkPanel(text => SendMessageAction?.Invoke(channelId, text, Window?.Bwoink.PlaySound.Pressed ?? true));
_activePanelMap[channelId] = existingPanel = new BwoinkPanel(text => SendMessageAction?.Invoke(channelId, text, Window?.Bwoink.PlaySound.Pressed ?? true, Window?.Bwoink.AdminOnly.Pressed ?? false));
existingPanel.InputTextChanged += text => InputTextChanged?.Invoke(channelId, text);
existingPanel.Visible = false;
if (!Control!.BwoinkArea.Children.Contains(existingPanel))
Expand Down Expand Up @@ -549,7 +549,7 @@ public void PeopleTypingUpdated(BwoinkPlayerTypingUpdated args)

public event Action? OnClose;
public event Action? OnOpen;
public Action<NetUserId, string, bool>? SendMessageAction { get; set; }
public Action<NetUserId, string, bool, bool>? SendMessageAction { get; set; }
public event Action<NetUserId, string>? InputTextChanged;

public void Open(NetUserId channelId, bool relayActive)
Expand All @@ -562,7 +562,7 @@ private void EnsureInit(bool relayActive)
{
if (_window is { Disposed: false })
return;
_chatPanel = new BwoinkPanel(text => SendMessageAction?.Invoke(_ownerId, text, true));
_chatPanel = new BwoinkPanel(text => SendMessageAction?.Invoke(_ownerId, text, true, false));
_chatPanel.InputTextChanged += text => InputTextChanged?.Invoke(_ownerId, text);
_chatPanel.RelayedToDiscordLabel.Visible = relayActive;
_window = new DefaultWindow()
Expand Down
4 changes: 3 additions & 1 deletion Content.Client/Weather/WeatherSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Numerics;
using Content.Shared.Light.Components;
using Content.Shared.Weather;
using Robust.Client.Audio;
using Robust.Client.GameObjects;
Expand Down Expand Up @@ -57,6 +58,7 @@ protected override void Run(EntityUid uid, WeatherData weather, WeatherPrototype
// Work out tiles nearby to determine volume.
if (TryComp<MapGridComponent>(entXform.GridUid, out var grid))
{
TryComp(entXform.GridUid, out RoofComponent? roofComp);
var gridId = entXform.GridUid.Value;
// FloodFill to the nearest tile and use that for audio.
var seed = _mapSystem.GetTileRef(gridId, grid, entXform.Coordinates);
Expand All @@ -71,7 +73,7 @@ protected override void Run(EntityUid uid, WeatherData weather, WeatherPrototype
if (!visited.Add(node.GridIndices))
continue;

if (!CanWeatherAffect(entXform.GridUid.Value, grid, node))
if (!CanWeatherAffect(entXform.GridUid.Value, grid, node, roofComp))
{
// Add neighbors
// TODO: Ideally we pick some deterministically random direction and use that
Expand Down
1 change: 1 addition & 0 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public sealed class PostMapInitTest
"BackmenRook",
"BargeVsShip",
"BackmenDelta",
"BackmenBox",
//end-backmen
"Saltern",
"Reach",
Expand Down
12 changes: 6 additions & 6 deletions Content.Server/Administration/Systems/BwoinkSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySes
var personalChannel = senderSession.UserId == message.UserId;
var senderAdmin = _adminManager.GetAdminData(senderSession);
var senderAHelpAdmin = senderAdmin?.HasFlag(AdminFlags.Adminhelp) ?? false;
var authorized = personalChannel || senderAHelpAdmin;
var authorized = personalChannel && !message.AdminOnly || senderAHelpAdmin;
if (!authorized)
{
// Unauthorized bwoink (log?)
Expand Down Expand Up @@ -678,11 +678,11 @@ protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySes
bwoinkText = $"{senderSession.Name}";
}

bwoinkText = $"{(message.PlaySound ? "" : "(S) ")}{bwoinkText}: {escapedText}";
bwoinkText = $"{(message.AdminOnly ? Loc.GetString("bwoink-message-admin-only") : !message.PlaySound ? Loc.GetString("bwoink-message-silent") : "")} {bwoinkText}: {escapedText}";

// If it's not an admin / admin chooses to keep the sound then play it.
var playSound = !senderAHelpAdmin || message.PlaySound;
var msg = new BwoinkTextMessage(message.UserId, senderSession.UserId, bwoinkText, playSound: playSound);
// If it's not an admin / admin chooses to keep the sound and message is not an admin only message, then play it.
var playSound = (!senderAHelpAdmin || message.PlaySound) && !message.AdminOnly;
var msg = new BwoinkTextMessage(message.UserId, senderSession.UserId, bwoinkText, playSound: playSound, adminOnly: message.AdminOnly);

LogBwoink(msg);

Expand All @@ -702,7 +702,7 @@ protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySes
}

// Notify player
if (_playerManager.TryGetSessionById(message.UserId, out var session))
if (_playerManager.TryGetSessionById(message.UserId, out var session) && !message.AdminOnly)
{
if (!admins.Contains(session.Channel))
{
Expand Down
Loading

0 comments on commit 356fe03

Please sign in to comment.