forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'moths-fix' into 'master-ru'
Moths sprites resolution fix See merge request Workbench-Team/space-station-14!107
- Loading branch information
Showing
1,433 changed files
with
255,806 additions
and
302,392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ on: | |
workflow_dispatch: | ||
schedule: | ||
- cron: '0 10 * * *' | ||
push: | ||
branches: [ arumoon-server ] | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "arumoon-server" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "arumoon-server" ] | ||
schedule: | ||
- cron: '20 9 * * 1' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'csharp', 'go', 'javascript', 'python' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] | ||
# Use only 'java' to analyze code written in Java, Kotlin or both | ||
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both | ||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Submodule | ||
run: | | ||
git submodule update --init --recursive | ||
- name: Pull engine updates | ||
uses: space-wizards/[email protected] | ||
|
||
- name: Update Engine Submodules | ||
run: | | ||
cd RobustToolbox/ | ||
git submodule update --init --recursive | ||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
|
||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs | ||
# queries: security-extended,security-and-quality | ||
|
||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
#- name: Autobuild | ||
# uses: github/codeql-action/autobuild@v2 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0.x | ||
|
||
- name: Install dependencies | ||
run: dotnet restore | ||
|
||
- name: Build Project | ||
run: dotnet build --configuration Debug --no-restore /p:WarningsAsErrors=nullable /m | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||
|
||
# If the Autobuild fails above, remove it and uncomment the following three lines. | ||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. | ||
|
||
# - run: | | ||
# echo "Run, Build Application using script" | ||
# ./location_of_script_within_repo/buildscript.sh | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
with: | ||
category: "/language:csharp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ on: | |
branches: | ||
- master | ||
- master-ru | ||
- arumoon-server | ||
pull_request_target: | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
Content.Client/Access/UI/AccessStorageBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System.Linq; | ||
using Content.Shared.Access.Components; | ||
using Content.Shared.Access.Systems; | ||
using Robust.Client.GameObjects; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Client.Access.UI | ||
{ | ||
public sealed class AccessStorageBoundUserInterface : BoundUserInterface | ||
{ | ||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
[Dependency] private readonly IEntityManager _entityManager = default!; | ||
|
||
public AccessStorageBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
private AccessStorageWindow? _window; | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
List<string> accessLevels; | ||
|
||
if (EntMan.TryGetComponent<AccessStorageComponent>(Owner, out var accessStorage)) | ||
{ | ||
accessLevels = accessStorage.AccessLevels; | ||
accessLevels.Sort(); | ||
} | ||
else | ||
{ | ||
accessLevels = new List<string>(); | ||
} | ||
|
||
_window = new AccessStorageWindow(this, _prototypeManager, accessLevels) {Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName}; | ||
|
||
_window.OnClose += Close; | ||
_window.OpenCentered(); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
if (!disposing) return; | ||
_window?.Dispose(); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
var castState = (AccessStorageBoundUserInterfaceState) state; | ||
_window?.UpdateState(castState); | ||
} | ||
|
||
public void SubmitData(List<string> newAccessList, List<string> newDenyTags) | ||
{ | ||
SendMessage(new WriteToTargetAccessStorageMessage(newAccessList, newDenyTags)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<DefaultWindow xmlns="https://spacestation14.io" | ||
MinSize="800 420"> | ||
<BoxContainer Orientation="Vertical"> | ||
<Control MinSize="0 8" /> | ||
<Label Text="{Loc 'access-reader-component-access-list'}" /> | ||
<GridContainer Name="AccessLevelGrid" Columns="5" HorizontalAlignment="Center"> | ||
<!-- Access level buttons are added here by the C# code --> | ||
</GridContainer> | ||
<Label Text="{Loc 'access-reader-component-deny-tags'}" /> | ||
<GridContainer Name="DenyTagsGrid" Columns="5" HorizontalAlignment="Center"> | ||
<!-- Deny tags buttons are added here by the C# code --> | ||
</GridContainer> | ||
</BoxContainer> | ||
</DefaultWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Content.Shared.Access; | ||
using Content.Shared.Access.Systems; | ||
using Content.Shared.Roles; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Localization; | ||
using Robust.Shared.Maths; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Client.Access.UI | ||
{ | ||
[GenerateTypedNameReferences] | ||
public sealed partial class AccessStorageWindow : DefaultWindow | ||
{ | ||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
|
||
private readonly AccessStorageBoundUserInterface _owner; | ||
|
||
private readonly Dictionary<string, Button> _accessButtons = new(); | ||
private readonly Dictionary<string, Button> _denyButtons = new(); | ||
|
||
public AccessStorageWindow(AccessStorageBoundUserInterface owner, IPrototypeManager prototypeManager, | ||
List<string> accessLevels) | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
|
||
_owner = owner; | ||
|
||
foreach (var access in accessLevels) | ||
{ | ||
if (!prototypeManager.TryIndex<AccessLevelPrototype>(access, out var accessLevel)) | ||
{ | ||
Logger.Error($"Unable to find accesslevel for {access}"); | ||
continue; | ||
} | ||
|
||
var newButton = new Button | ||
{ | ||
Text = GetAccessLevelName(accessLevel), | ||
ToggleMode = true, | ||
}; | ||
AccessLevelGrid.AddChild(newButton); | ||
_accessButtons.Add(accessLevel.ID, newButton); | ||
newButton.OnPressed += _ => SubmitData(); | ||
} | ||
foreach (var access in accessLevels) | ||
{ | ||
if (!prototypeManager.TryIndex<AccessLevelPrototype>(access, out var accessLevel)) | ||
{ | ||
Logger.Error($"Unable to find accesslevel for {access}"); | ||
continue; | ||
} | ||
|
||
var newButton = new Button | ||
{ | ||
Text = GetAccessLevelName(accessLevel), | ||
ToggleMode = true, | ||
}; | ||
DenyTagsGrid.AddChild(newButton); | ||
_denyButtons.Add(accessLevel.ID, newButton); | ||
newButton.OnPressed += _ => SubmitData(); | ||
} | ||
} | ||
|
||
private static string GetAccessLevelName(AccessLevelPrototype prototype) | ||
{ | ||
if (prototype.Name is { } name) | ||
return Loc.GetString(name); | ||
|
||
return prototype.ID; | ||
} | ||
|
||
private void ClearAllAccess() | ||
{ | ||
foreach (var button in _accessButtons.Values) | ||
{ | ||
if (button.Pressed) | ||
{ | ||
button.Pressed = false; | ||
} | ||
} | ||
foreach (var button in _denyButtons.Values) | ||
{ | ||
if (button.Pressed) | ||
{ | ||
button.Pressed = false; | ||
} | ||
} | ||
} | ||
|
||
public void UpdateState(AccessStorageBoundUserInterfaceState state) | ||
{ | ||
foreach (var (accessName, button) in _accessButtons) | ||
{ | ||
button.Disabled = false; | ||
button.Pressed = state.AccessList?.Contains(accessName) ?? false; | ||
} | ||
foreach (var (accessName, button) in _denyButtons) | ||
{ | ||
button.Disabled = false; | ||
button.Pressed = state.DenyTags?.Contains(accessName) ?? false; | ||
} | ||
} | ||
|
||
private void SubmitData() | ||
{ | ||
// Iterate over the buttons dictionary, filter by `Pressed`, only get key from the key/value pair | ||
_owner.SubmitData(_accessButtons.Where(x => x.Value.Pressed).Select(x => x.Key).ToList(), _denyButtons.Where(x => x.Value.Pressed).Select(x => x.Key).ToList()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.