Skip to content

Commit

Permalink
Merge pull request #1207 from new-frontiers-14/march-2024-upstream-merge
Browse files Browse the repository at this point in the history
March 2024 upstream merge
  • Loading branch information
Cheackraze authored Apr 23, 2024
2 parents 6ac021f + 0e4c98d commit 46d8815
Show file tree
Hide file tree
Showing 4,112 changed files with 1,664,343 additions and 1,592,118 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ indent_style = space
tab_width = 4

# New line preferences
#end_of_line = crlf
end_of_line = crlf:suggestion
insert_final_newline = true
trim_trailing_whitespace = true

Expand Down Expand Up @@ -104,6 +104,7 @@ csharp_preferred_modifier_order = public, private, protected, internal, new, abs

# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:silent
csharp_style_namespace_declarations = file_scoped:suggestion

#### C# Formatting Rules ####

Expand Down
2 changes: 1 addition & 1 deletion .github/mapchecker/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"Kammerer", # Opportunity
"HighSecDoor",
],
"BlackMarket": [
"Syndicate": [
"Plastitanium", # And also on blackmarket ships cause syndicate.
]
}
110 changes: 55 additions & 55 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
name: PR Changelogs
concurrency: commit_action
on:
pull_request_target:
types: [closed]

env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
CHANGELOG_DIR: Resources/Changelog/Changelog.yml
PR_NUMBER: ${{ github.event.number }}

jobs:
changelog:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
permissions:
contents: write
steps:
- name: Checkout Master
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_TOKEN }}
ref: master

- name: Setup Git
run: |
git config --global user.name "${{ vars.CHANGELOG_USER }}"
git config --global user.email "${{ vars.CHANGELOG_EMAIL }}"
shell: bash

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Install Dependencies
run: |
cd "Tools/changelog"
npm install
shell: bash

- name: Generate Changelog
run: |
cd "Tools/changelog"
node changelog.js
shell: bash

- name: Commit Changelog
run: |
git pull origin master
git add *.yml
git commit -m "${{ vars.CHANGELOG_MESSAGE }} (#${{ env.PR_NUMBER }})"
git push
shell: bash
continue-on-error: true
name: PR Changelogs
concurrency: commit_action
on:
pull_request_target:
types: [closed]

env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
CHANGELOG_DIR: Resources/Changelog/Changelog.yml
PR_NUMBER: ${{ github.event.number }}

jobs:
changelog:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
permissions:
contents: write
steps:
- name: Checkout Master
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_TOKEN }}
ref: master

- name: Setup Git
run: |
git config --global user.name "${{ vars.CHANGELOG_USER }}"
git config --global user.email "${{ vars.CHANGELOG_EMAIL }}"
shell: bash

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Install Dependencies
run: |
cd "Tools/changelog"
npm install
shell: bash

- name: Generate Changelog
run: |
cd "Tools/changelog"
node changelog.js
shell: bash

- name: Commit Changelog
run: |
git pull origin master
git add *.yml
git commit -m "${{ vars.CHANGELOG_MESSAGE }} (#${{ env.PR_NUMBER }})"
git push
shell: bash
continue-on-error: true
15 changes: 15 additions & 0 deletions .github/workflows/check-crlf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CRLF Check

on:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]

jobs:
build:
name: CRLF Check
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Check for CRLF
run: Tools/check_crlf.py
2 changes: 1 addition & 1 deletion .github/workflows/close-master-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Close PR's on master
name: Close PRs on master

on:
pull_request_target:
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/labeler-untriaged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "Labels: Untriaged"

on:
issues:
types: [opened]

jobs:
add_label:
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-add-labels@v1
with:
labels: "Status: Untriaged"
91 changes: 52 additions & 39 deletions Content.Client/Access/AccessOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,73 +9,86 @@ namespace Content.Client.Access;

public sealed class AccessOverlay : Overlay
{
private const string TextFontPath = "/Fonts/NotoSans/NotoSans-Regular.ttf";
private const int TextFontSize = 12;

private readonly IEntityManager _entityManager;
private readonly EntityLookupSystem _lookup;
private readonly SharedTransformSystem _xform;
private readonly SharedTransformSystem _transformSystem;
private readonly Font _font;

public override OverlaySpace Space => OverlaySpace.ScreenSpace;

public AccessOverlay(IEntityManager entManager, IResourceCache cache, EntityLookupSystem lookup, SharedTransformSystem xform)
public AccessOverlay(IEntityManager entityManager, IResourceCache resourceCache, SharedTransformSystem transformSystem)
{
_entityManager = entManager;
_lookup = lookup;
_xform = xform;

_font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12);
_entityManager = entityManager;
_transformSystem = transformSystem;
_font = resourceCache.GetFont(TextFontPath, TextFontSize);
}

protected override void Draw(in OverlayDrawArgs args)
{
if (args.ViewportControl == null)
return;

var readerQuery = _entityManager.GetEntityQuery<AccessReaderComponent>();
var xformQuery = _entityManager.GetEntityQuery<TransformComponent>();

foreach (var ent in _lookup.GetEntitiesIntersecting(args.MapId, args.WorldAABB,
LookupFlags.Static | LookupFlags.Approximate))
var textBuffer = new StringBuilder();
var query = _entityManager.EntityQueryEnumerator<AccessReaderComponent, TransformComponent>();
while (query.MoveNext(out var uid, out var accessReader, out var transform))
{
if (!readerQuery.TryGetComponent(ent, out var reader) ||
!xformQuery.TryGetComponent(ent, out var xform))
textBuffer.Clear();

var entityName = _entityManager.ToPrettyString(uid);
textBuffer.AppendLine(entityName.Prototype);
textBuffer.Append("UID: ");
textBuffer.Append(entityName.Uid.Id);
textBuffer.Append(", NUID: ");
textBuffer.Append(entityName.Nuid.Id);
textBuffer.AppendLine();

if (!accessReader.Enabled)
{
textBuffer.AppendLine("-Disabled");
continue;
}

var text = new StringBuilder();
var index = 0;
var a = $"{_entityManager.ToPrettyString(ent)}";
text.Append(a);

foreach (var list in reader.AccessLists)
if (accessReader.AccessLists.Count > 0)
{
a = $"Tag {index}";
text.AppendLine(a);

foreach (var entry in list)
var groupNumber = 0;
foreach (var accessList in accessReader.AccessLists)
{
a = $"- {entry}";
text.AppendLine(a);
groupNumber++;
foreach (var entry in accessList)
{
textBuffer.Append("+Set ");
textBuffer.Append(groupNumber);
textBuffer.Append(": ");
textBuffer.Append(entry.Id);
textBuffer.AppendLine();
}
}

index++;
}

string textStr;

if (text.Length >= 2)
else
{
textStr = text.ToString();
textStr = textStr[..^2];
textBuffer.AppendLine("+Unrestricted");
}
else

foreach (var key in accessReader.AccessKeys)
{
textStr = "";
textBuffer.Append("+Key ");
textBuffer.Append(key.OriginStation);
textBuffer.Append(": ");
textBuffer.Append(key.Id);
textBuffer.AppendLine();
}

var screenPos = args.ViewportControl.WorldToScreen(_xform.GetWorldPosition(xform));
foreach (var tag in accessReader.DenyTags)
{
textBuffer.Append("-Tag ");
textBuffer.AppendLine(tag.Id);
}

args.ScreenHandle.DrawString(_font, screenPos, textStr, Color.Gold);
var accessInfoText = textBuffer.ToString();
var screenPos = args.ViewportControl.WorldToScreen(_transformSystem.GetWorldPosition(transform));
args.ScreenHandle.DrawString(_font, screenPos, accessInfoText, Color.Gold);
}
}
}
15 changes: 11 additions & 4 deletions Content.Client/Access/Commands/ShowAccessReadersCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ namespace Content.Client.Access.Commands;
public sealed class ShowAccessReadersCommand : IConsoleCommand
{
public string Command => "showaccessreaders";
public string Description => "Shows all access readers in the viewport";
public string Help => $"{Command}";

public string Description => "Toggles showing access reader permissions on the map";
public string Help => """
Overlay Info:
-Disabled | The access reader is disabled
+Unrestricted | The access reader has no restrictions
+Set [Index]: [Tag Name]| A tag in an access set (accessor needs all tags in the set to be allowed by the set)
+Key [StationUid]: [StationRecordKeyId] | A StationRecordKey that is allowed
-Tag [Tag Name] | A tag that is not allowed (takes priority over other allows)
""";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var collection = IoCManager.Instance;
Expand All @@ -26,10 +34,9 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)

var entManager = collection.Resolve<IEntityManager>();
var cache = collection.Resolve<IResourceCache>();
var lookup = entManager.System<EntityLookupSystem>();
var xform = entManager.System<SharedTransformSystem>();

overlay.AddOverlay(new AccessOverlay(entManager, cache, lookup, xform));
overlay.AddOverlay(new AccessOverlay(entManager, cache, xform));
shell.WriteLine($"Set access reader debug overlay to true");
}
}
4 changes: 4 additions & 0 deletions Content.Client/Access/UI/AccessLevelControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<GridContainer xmlns="https://spacestation14.io"
Columns="5"
HorizontalAlignment="Center">
</GridContainer>
52 changes: 52 additions & 0 deletions Content.Client/Access/UI/AccessLevelControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.Linq;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Content.Shared.Access;
using Content.Shared.Access.Systems;

namespace Content.Client.Access.UI;

[GenerateTypedNameReferences]
public sealed partial class AccessLevelControl : GridContainer
{
public readonly Dictionary<ProtoId<AccessLevelPrototype>, Button> ButtonsList = new();

public AccessLevelControl()
{
RobustXamlLoader.Load(this);
}

public void Populate(List<ProtoId<AccessLevelPrototype>> accessLevels, IPrototypeManager prototypeManager)
{
foreach (var access in accessLevels)
{
if (!prototypeManager.TryIndex(access, out var accessLevel))
{
Logger.Error($"Unable to find accesslevel for {access}");
continue;
}

var newButton = new Button
{
Text = accessLevel.GetAccessLevelName(),
ToggleMode = true,
};
AddChild(newButton);
ButtonsList.Add(accessLevel.ID, newButton);
}
}

public void UpdateState(
List<ProtoId<AccessLevelPrototype>> pressedList,
List<ProtoId<AccessLevelPrototype>>? enabledList = null)
{
foreach (var (accessName, button) in ButtonsList)
{
button.Pressed = pressedList.Contains(accessName);
button.Disabled = !(enabledList?.Contains(accessName) ?? true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected override void UpdateState(BoundUserInterfaceState state)
_window?.UpdateState(castState);
}

public void SubmitData(List<string> newAccessList)
public void SubmitData(List<ProtoId<AccessLevelPrototype>> newAccessList)
{
SendMessage(new WriteToTargetAccessReaderIdMessage(newAccessList));
}
Expand Down
Loading

0 comments on commit 46d8815

Please sign in to comment.