Skip to content

Commit

Permalink
Merge pull request ArcadiaStation#24 from ZeroDayDaemon/merge-upstream
Browse files Browse the repository at this point in the history
Merge upstream 2024-12-25
  • Loading branch information
ZeroDayDaemon authored Dec 25, 2024
2 parents 47b0938 + 4376a43 commit 8fc674d
Show file tree
Hide file tree
Showing 102 changed files with 9,610 additions and 4,212 deletions.
12 changes: 6 additions & 6 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
# Sorting by path instead of by who added it one day :(
# this isn't how codeowners rules work pls read the first comment instead of trying to force a sorting order

/Resources/ConfigPresets/WizardsDen/ @nikthechampiongr
/Content.*/Administration/ @DrSmugleaf @nikthechampiongr
/Resources/ServerInfo/ @nikthechampiongr
/Resources/ServerInfo/Guidebook/ServerRules/ @nikthechampiongr
/Resources/ConfigPresets/WizardsDen/ @nikthechampiongr @crazybrain23
/Content.*/Administration/ @DrSmugleaf @nikthechampiongr @crazybrain23
/Resources/ServerInfo/ @nikthechampiongr @crazybrain23
/Resources/ServerInfo/Guidebook/ServerRules/ @nikthechampiongr @crazybrain23

/Resources/Prototypes/Maps/** @Emisse

/Resources/Prototypes/Body/ @DrSmugleaf # suffering
/Resources/Prototypes/Entities/Mobs/Player/ @DrSmugleaf
/Resources/Prototypes/Entities/Mobs/Species/ @DrSmugleaf
/Resources/Prototypes/Guidebook/rules.yml @nikthechampiongr
/Resources/Prototypes/Guidebook/rules.yml @nikthechampiongr @crazybrain23
/Content.*/Body/ @DrSmugleaf
/Content.YAMLLinter @DrSmugleaf
/Content.Shared/Damage/ @DrSmugleaf
Expand All @@ -25,7 +25,7 @@

# SKREEEE
/Content.*.Database/ @PJB3005 @DrSmugleaf
/Content.Shared.Database/Log*.cs @PJB3005 @DrSmugleaf @nikthechampiongr
/Content.Shared.Database/Log*.cs @PJB3005 @DrSmugleaf @nikthechampiongr @crazybrain23
/Pow3r/ @PJB3005
/Content.Server/Power/Pow3r/ @PJB3005

Expand Down
63 changes: 54 additions & 9 deletions Content.Client/Communications/UI/CommunicationsConsoleMenu.xaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,62 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'comms-console-menu-title'}"
MinSize="400 225">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" Margin="5">
<TextEdit Name="MessageInput" HorizontalExpand="True" VerticalExpand="True" Margin="0 0 0 5" MinHeight="100" />
<Button Name="AnnounceButton" Text="{Loc 'comms-console-menu-announcement-button'}" ToolTip="{Loc 'comms-console-menu-announcement-button-tooltip'}" StyleClasses="OpenLeft" Access="Public" />
<Button Name="BroadcastButton" Text="{Loc 'comms-console-menu-broadcast-button'}" ToolTip="{Loc 'comms-console-menu-broadcast-button-tooltip'}" StyleClasses="OpenLeft" Access="Public" />
MinSize="400 300">

<OptionButton Name="AlertLevelButton" ToolTip="{Loc 'comms-console-menu-alert-level-button-tooltip'}" StyleClasses="OpenRight" Access="Public" />
<!-- Main Container -->
<BoxContainer Orientation="Vertical"
HorizontalExpand="False"
VerticalExpand="True"
Margin="6 6 6 5">

<Control MinSize="10 10" />
<TextEdit Name="MessageInput"
VerticalExpand="True"
HorizontalExpand="True"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
MinHeight="100"/>

<RichTextLabel Name="CountdownLabel" VerticalExpand="True" />
<Button Name="EmergencyShuttleButton" Text="Placeholder Text" ToolTip="{Loc 'comms-console-menu-emergency-shuttle-button-tooltip'}" Access="Public" />
<!-- ButtonsPart -->
<BoxContainer Orientation="Vertical"
VerticalAlignment="Bottom"
SeparationOverride="4">

<!-- AnnouncePart -->
<BoxContainer Orientation="Vertical"
Margin="0 2">

<Button Name="AnnounceButton"
Access="Public"
Text="{Loc 'comms-console-menu-announcement-button'}"
ToolTip="{Loc 'comms-console-menu-announcement-button-tooltip'}"
StyleClasses="OpenLeft"
Margin="0 0 1 0"
Disabled="True"/>

<Button Name="BroadcastButton"
Access="Public"
Text="{Loc 'comms-console-menu-broadcast-button'}"
ToolTip="{Loc 'comms-console-menu-broadcast-button-tooltip'}"
StyleClasses="OpenBoth"/>

<OptionButton Name="AlertLevelButton"
Access="Public"
ToolTip="{Loc 'comms-console-menu-alert-level-button-tooltip'}"
StyleClasses="OpenRight"/>

</BoxContainer>

<!-- EmergencyPart -->
<BoxContainer Orientation="Vertical"
SeparationOverride="6">

<RichTextLabel Name="CountdownLabel"/>

<Button Name="EmergencyShuttleButton"
Access="Public"
Text="Placeholder Text"
ToolTip="{Loc 'comms-console-menu-emergency-shuttle-button-tooltip'}"/>
</BoxContainer>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>
19 changes: 10 additions & 9 deletions Content.Client/Lobby/UI/Loadouts/LoadoutContainer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@ public LoadoutContainer(ProtoId<LoadoutPrototype> proto, bool disabled, Formatte

if (_protoManager.TryIndex(proto, out var loadProto))
{
var ent = _entManager.System<LoadoutSystem>().GetFirstOrNull(loadProto);
var ent = loadProto.DummyEntity ?? _entManager.System<LoadoutSystem>().GetFirstOrNull(loadProto);

if (ent != null)
{
_entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace);
Sprite.SetEntity(_entity);
if (ent == null)
return;

var spriteTooltip = new Tooltip();
spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription));
TooltipSupplier = _ => spriteTooltip;
}
_entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace);
Sprite.SetEntity(_entity);

var spriteTooltip = new Tooltip();
spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription));

TooltipSupplier = _ => spriteTooltip;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public sealed partial class SensorMonitoringWindow : FancyWindow, IComputerWindo
public SensorMonitoringWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
}

public void UpdateState(ConsoleUIState state)
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Tips/TippyUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private Vector2 UpdatePosition(TippyUI tippy, Vector2 screenSize, FrameEventArgs
? -WaddleRotation
: WaddleRotation;

if (EntityManager.TryGetComponent(_entity, out FootstepModifierComponent? step))
if (EntityManager.TryGetComponent(_entity, out FootstepModifierComponent? step) && step.FootstepSoundCollection != null)
{
var audioParams = step.FootstepSoundCollection.Params
.AddVolume(-7f)
Expand Down
6 changes: 3 additions & 3 deletions Content.IntegrationTests/Tests/StoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ await server.WaitAssertion(() =>
var discountComponent = entManager.GetComponent<StoreDiscountComponent>(pda);
Assert.That(
discountComponent.Discounts,
Has.Exactly(3).Items,
$"After applying discount total discounted items count was expected to be '3' "
Has.Exactly(6).Items,
$"After applying discount total discounted items count was expected to be '6' "
+ $"but was actually {discountComponent.Discounts.Count}- this can be due to discount "
+ $"categories settings (maxItems, weight) not being realistically set, or default "
+ $"discounted count being changed from '3' in StoreDiscountSystem.InitializeDiscounts."
+ $"discounted count being changed from '6' in StoreDiscountSystem.InitializeDiscounts."
);
var discountedListingItems = storeComponent.FullListingsCatalog
.Where(x => x.IsCostModified)
Expand Down
20 changes: 17 additions & 3 deletions Content.IntegrationTests/Tests/Toolshed/AdminTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Content.Server.Administration.Managers;
using Robust.Shared.Toolshed;

namespace Content.IntegrationTests.Tests.Toolshed;
Expand All @@ -10,10 +11,23 @@ public sealed class AdminTest : ToolshedTest
[Test]
public async Task AllCommandsHavePermissions()
{
var toolMan = Server.ResolveDependency<ToolshedManager>();
var admin = Server.ResolveDependency<IAdminManager>();
var ignored = new HashSet<Assembly>()
{typeof(LocTest).Assembly, typeof(Robust.UnitTesting.Shared.Toolshed.LocTest).Assembly};

await Server.WaitAssertion(() =>
{
Assert.That(InvokeCommand("cmd:list where { acmd:perms isnull }", out var res));
Assert.That((IEnumerable<CommandSpec>) res, Is.Empty, "All commands must have admin permissions set up.");
Assert.Multiple(() =>
{
foreach (var cmd in toolMan.DefaultEnvironment.AllCommands())
{
if (ignored.Contains(cmd.Cmd.GetType().Assembly))
continue;

Assert.That(admin.TryGetCommandFlags(cmd, out _), $"Command does not have admin permissions set up: {cmd.FullName()}");
}
});
});
}
}
23 changes: 20 additions & 3 deletions Content.IntegrationTests/Tests/Toolshed/LocTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Globalization;
using Robust.Shared.IoC;
using System.Reflection;
using Robust.Shared.Localization;
using Robust.Shared.Toolshed;

Expand All @@ -14,10 +14,27 @@ public sealed class LocTest : ToolshedTest
[Test]
public async Task AllCommandsHaveDescriptions()
{
var locMan = Server.ResolveDependency<ILocalizationManager>();
var toolMan = Server.ResolveDependency<ToolshedManager>();
var locStrings = new HashSet<string>();

var ignored = new HashSet<Assembly>()
{typeof(LocTest).Assembly, typeof(Robust.UnitTesting.Shared.Toolshed.LocTest).Assembly};

await Server.WaitAssertion(() =>
{
Assert.That(InvokeCommand("cmd:list where { cmd:descloc loc:tryloc isnull }", out var res));
Assert.That((IEnumerable<CommandSpec>)res!, Is.Empty, "All commands must have localized descriptions.");
Assert.Multiple(() =>
{
foreach (var cmd in toolMan.DefaultEnvironment.AllCommands())
{
if (ignored.Contains(cmd.Cmd.GetType().Assembly))
continue;

var descLoc = cmd.DescLocStr();
Assert.That(locStrings.Add(descLoc), $"Duplicate command description key: {descLoc}");
Assert.That(locMan.TryGetString(descLoc, out _), $"Failed to get command description for command {cmd.FullName()}");
}
});
});
}
}
27 changes: 22 additions & 5 deletions Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ protected T InvokeCommand<T>(string command)
return (T) res!;
}

protected void ParseCommand(string command, Type? inputType = null, Type? expectedType = null, bool once = false)
protected void ParseCommand(string command, Type? inputType = null, Type? expectedType = null)
{
var parser = new ParserContext(command, Toolshed);
var success = CommandRun.TryParse(false, parser, inputType, expectedType, once, out _, out _, out var error);
var success = CommandRun.TryParse(parser, inputType, expectedType, out _);

if (error is not null)
ReportError(error);
if (parser.Error is not null)
ReportError(parser.Error);

if (error is null)
if (parser.Error is null)
Assert.That(success, $"Parse failed despite no error being reported. Parsed {command}");
}

Expand Down Expand Up @@ -153,11 +153,28 @@ public IEnumerable<IConError> GetErrors()
return _errors;
}

public bool HasErrors => _errors.Count > 0;

public void ClearErrors()
{
_errors.Clear();
}

public object? ReadVar(string name)
{
return Variables.GetValueOrDefault(name);
}

public void WriteVar(string name, object? value)
{
Variables[name] = value;
}

public IEnumerable<string> GetVars()
{
return Variables.Keys;
}

public Dictionary<string, object?> Variables { get; } = new();

protected void ExpectError(Type err)
Expand Down
17 changes: 4 additions & 13 deletions Content.Server/Access/AddAccessLogCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ namespace Content.Server.Access;
public sealed class AddAccessLogCommand : ToolshedCommand
{
[CommandImplementation]
public void AddAccessLog(
[CommandInvocationContext] IInvocationContext ctx,
[CommandArgument] EntityUid input,
[CommandArgument] float seconds,
[CommandArgument] ValueRef<string> accessor)
public void AddAccessLog(IInvocationContext ctx, EntityUid input, float seconds, string accessor)
{
var accessReader = EnsureComp<AccessReaderComponent>(input);

Expand All @@ -23,19 +19,14 @@ public void AddAccessLog(
ctx.WriteLine($"WARNING: Surpassing the limit of the log by {accessLogCount - accessReader.AccessLogLimit+1} entries!");

var accessTime = TimeSpan.FromSeconds(seconds);
var accessName = accessor.Evaluate(ctx)!;
accessReader.AccessLog.Enqueue(new AccessRecord(accessTime, accessName));
accessReader.AccessLog.Enqueue(new AccessRecord(accessTime, accessor));
ctx.WriteLine($"Successfully added access log to {input} with this information inside:\n " +
$"Time of access: {accessTime}\n " +
$"Accessed by: {accessName}");
$"Accessed by: {accessor}");
}

[CommandImplementation]
public void AddAccessLogPiped(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] float seconds,
[CommandArgument] ValueRef<string> accessor)
public void AddAccessLogPiped(IInvocationContext ctx, [PipedArgument] EntityUid input, float seconds, string accessor)
{
AddAccessLog(ctx, input, seconds, accessor);
}
Expand Down
11 changes: 11 additions & 0 deletions Content.Server/Administration/Managers/AdminManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,17 @@ private async void LoginAdminMaybe(ICommonSession session)
}

private async Task<(AdminData dat, int? rankId, bool specialLogin)?> LoadAdminData(ICommonSession session)
{
var result = await LoadAdminDataCore(session);

// Make sure admin didn't disconnect while data was loading.
if (session.Status != SessionStatus.InGame)
return null;

return result;
}

private async Task<(AdminData dat, int? rankId, bool specialLogin)?> LoadAdminDataCore(ICommonSession session)
{
var promoteHost = IsLocal(session) && _cfg.GetCVar(CCVars.ConsoleLoginLocal)
|| _promotedPlayers.Contains(session.UserId)
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Administration/Toolshed/MarkedCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Content.Server.Administration.Toolshed;
public sealed class MarkedCommand : ToolshedCommand
{
[CommandImplementation]
public IEnumerable<EntityUid> Marked([CommandInvocationContext] IInvocationContext ctx)
public IEnumerable<EntityUid> Marked(IInvocationContext ctx)
{
var res = (IEnumerable<EntityUid>?)ctx.ReadVar("marked");
res ??= Array.Empty<EntityUid>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public IEnumerable<EntityUid> Rejuvenate([PipedArgument] IEnumerable<EntityUid>
}

[CommandImplementation]
public void Rejuvenate([CommandInvocationContext] IInvocationContext ctx)
public void Rejuvenate(IInvocationContext ctx)
{
_rejuvenate ??= GetSys<RejuvenateSystem>();
if (ExecutingEntity(ctx) is not { } ent)
Expand Down
Loading

0 comments on commit 8fc674d

Please sign in to comment.