Skip to content

Commit

Permalink
Merge branch 'master' into patolog
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkiich authored Jul 18, 2024
2 parents 77d64a0 + a37ed48 commit af939ac
Show file tree
Hide file tree
Showing 1,600 changed files with 148,073 additions and 120,130 deletions.
6 changes: 3 additions & 3 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"Changes: Map":
- changed-files:
- any-glob-to-any-file:
- 'Resources/Maps/*.yml'
- 'Resources/Prototypes/Maps/*.yml'
- 'Resources/Prototypes/Corvax/Maps/*.yml'
- 'Resources/Maps/**/*.yml'
- 'Resources/Prototypes/Maps/**/*.yml'
- 'Resources/Prototypes/Corvax/Maps/**/*.yml'

"Changes: UI":
- changed-files:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/labeler-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Labels: PR"
name: "Labels: PR"

on:
- pull_request_target
Expand All @@ -12,5 +12,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
sync-labels: true
with: # ADT Tweak by Schrodinger
sync-labels: true # Поправил auto-labels
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
chmod 600 ~/.ssh/id_rsa
echo "HOST *" > ~/.ssh/config
echo "StrictHostKeyChecking no" >> ~/.ssh/config
git -c submodule.Secrets.update=checkout submodule update --init
git clone [email protected]:corvax-nexus/secrets.git Secrets
cp -R Secrets/Resources/Prototypes Resources/Prototypes/CorvaxSecrets
cp -R Secrets/Resources/ServerPrototypes Resources/Prototypes/CorvaxSecretsServer
cp -R Secrets/Resources/Locale Resources/Locale/ru-RU/corvax-secrets
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*.userprefs

# Secret
Secrets
Resources/Prototypes/CorvaxSecrets
Resources/Prototypes/CorvaxSecretsServer
Resources/Textures/CorvaxSecrets
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"omnisharp.analyzeOpenDocumentsOnly": true,
"dotnet.defaultSolution": "SpaceStation14.sln"
"dotnet.defaultSolution": "SpaceStation14.sln",
"dotnet.preferCSharpExtension": true
}
51 changes: 51 additions & 0 deletions Content.Client/ADT/Language/LanguageMenuUIController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Content.Client.ADT.Language;
using Content.Client.Gameplay;
using Content.Shared.Language;
using Robust.Client.UserInterface.Controllers;
using Robust.Client.UserInterface.Controls;
using static Content.Shared.Language.Systems.SharedLanguageSystem;

namespace Content.Client.ADT.Language;

public sealed class LanguageMenuUIController : UIController, IOnStateEntered<GameplayState>, IOnStateExited<GameplayState>
{
public LanguageMenuWindow? _languageWindow;

public override void Initialize()
{
EntityManager.EventBus.SubscribeLocalEvent<LanguageSpeakerComponent, LanguageMenuActionEvent>(OnActionMenu);
EntityManager.EventBus.SubscribeEvent<LanguageMenuStateMessage>(EventSource.Network, this, OnStateUpdate);
}

private void OnStateUpdate(LanguageMenuStateMessage ev)
{
if (_languageWindow == null)
return;

_languageWindow.UpdateState(ev);
}

private void OnActionMenu(EntityUid uid, LanguageSpeakerComponent component, LanguageMenuActionEvent args)
{
if (_languageWindow == null)
return;

if (!_languageWindow.IsOpen)
{
_languageWindow.Open();
EntityManager.EntityNetManager?.SendSystemNetworkMessage(new RequestLanguageMenuStateMessage());
}
}

public void OnStateEntered(GameplayState state)
{
_languageWindow = UIManager.CreateWindow<LanguageMenuWindow>();
LayoutContainer.SetAnchorPreset(_languageWindow, LayoutContainer.LayoutPreset.Center);
}

public void OnStateExited(GameplayState state)
{
_languageWindow?.Dispose();
_languageWindow = null;
}
}
18 changes: 18 additions & 0 deletions Content.Client/ADT/Language/LanguageMenuWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls"
Title="a"
SetSize="300 200">
<BoxContainer Orientation="Vertical" SeparationOverride="4" MinWidth="150">
<PanelContainer Name="CurrentLanguageContainer" Access="Public" StyleClasses="PdaBorderRect">
<Label Name="CurrentLanguageLabel" Access="Public" Text="Current Language:" HorizontalExpand="True"></Label>
</PanelContainer>

<ui:HLine></ui:HLine>

<ScrollContainer HorizontalExpand="True" VerticalExpand="True" HScrollEnabled="False" VScrollEnabled="True" MinHeight="50">
<BoxContainer Name="OptionsList" Access="Public" HorizontalExpand="True" SeparationOverride="2" Orientation="Vertical">
<!-- The rest here is generated programmatically -->
</BoxContainer>
</ScrollContainer>
</BoxContainer>
</DefaultWindow>
124 changes: 124 additions & 0 deletions Content.Client/ADT/Language/LanguageMenuWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
using Content.Client.Language.Systems;
using Content.Shared.Language;
using Content.Shared.Language.Systems;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Console;
using Robust.Shared.Utility;
using static Content.Shared.Language.Systems.SharedLanguageSystem;

namespace Content.Client.ADT.Language; // This EXACT class must have the _NF part because of xaml linking

[GenerateTypedNameReferences]
public sealed partial class LanguageMenuWindow : DefaultWindow
{
[Dependency] private readonly IConsoleHost _consoleHost = default!;
private readonly LanguageSystem _language;

private readonly List<EntryState> _entries = new();

public LanguageMenuWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_language = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<LanguageSystem>();

Title = Loc.GetString("language-menu-window-title");
}

public void UpdateState(LanguageMenuStateMessage state)
{
var clanguage = _language.GetLanguage(state.CurrentLanguage);
CurrentLanguageLabel.Text = Loc.GetString("language-menu-current-language", ("language", clanguage?.LocalizedName ?? "<error>"));

OptionsList.RemoveAllChildren();
_entries.Clear();

foreach (var language in state.Options)
{
AddLanguageEntry(language);
}

// Disable the button for the currently chosen language
foreach (var entry in _entries)
{
if (entry.button != null)
entry.button.Disabled = entry.language == state.CurrentLanguage;
}
}

private void AddLanguageEntry(string language)
{
var proto = _language.GetLanguage(language);
var state = new EntryState { language = language };

var container = new BoxContainer();
container.Orientation = BoxContainer.LayoutOrientation.Vertical;

// Create and add a header with the name and the button to select the language
{
var header = new BoxContainer();
header.Orientation = BoxContainer.LayoutOrientation.Horizontal;

header.Orientation = BoxContainer.LayoutOrientation.Horizontal;
header.HorizontalExpand = true;
header.SeparationOverride = 2;

var name = new Label();
name.Text = proto?.LocalizedName ?? "<error>";
name.MinWidth = 50;
name.HorizontalExpand = true;

var button = new Button();
button.Text = "Выбрать";
button.OnPressed += _ => OnLanguageChosen(language);
state.button = button;

header.AddChild(name);
header.AddChild(button);

container.AddChild(header);
}

// Create and add a collapsible description
{
var body = new CollapsibleBody();
body.HorizontalExpand = true;
body.Margin = new Thickness(4f, 4f);

var description = new RichTextLabel();
description.SetMessage(proto?.LocalizedDescription ?? "<error>");
description.HorizontalExpand = true;

body.AddChild(description);

var collapser = new Collapsible(Loc.GetString("language-menu-description-header"), body);
collapser.Orientation = BoxContainer.LayoutOrientation.Vertical;
collapser.HorizontalExpand = true;

container.AddChild(collapser);
}

// Before adding, wrap the new container in a PanelContainer to give it a distinct look
var wrapper = new PanelContainer();
wrapper.StyleClasses.Add("PdaBorderRect");

wrapper.AddChild(container);
OptionsList.AddChild(wrapper);

_entries.Add(state);
}

private void OnLanguageChosen(string id)
{
_consoleHost.ExecuteCommand("lsselectlang " + id);
}

private struct EntryState
{
public string language;
public Button? button;
}
}
8 changes: 8 additions & 0 deletions Content.Client/ADT/Language/Systems/LanguageSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Shared.Language.Systems;

namespace Content.Client.Language.Systems;

public sealed class LanguageSystem : SharedLanguageSystem
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Shared.Language.Systems;

namespace Content.Client.Language.Systems;

public sealed class TranslatorImplanterSystem : SharedTranslatorImplanterSystem
{

}
4 changes: 1 addition & 3 deletions Content.Client/Administration/UI/AdminMenuWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
xmlns:tabs="clr-namespace:Content.Client.Administration.UI.Tabs"
xmlns:playerTab="clr-namespace:Content.Client.Administration.UI.Tabs.PlayerTab"
xmlns:objectsTab="clr-namespace:Content.Client.Administration.UI.Tabs.ObjectsTab"
xmlns:panic="clr-namespace:Content.Client.Administration.UI.Tabs.PanicBunkerTab"
xmlns:baby="clr-namespace:Content.Client.Administration.UI.Tabs.BabyJailTab">
xmlns:panic="clr-namespace:Content.Client.Administration.UI.Tabs.PanicBunkerTab">
<TabContainer Name="MasterTabContainer">
<adminTab:AdminTab />
<adminbusTab:AdminbusTab />
<atmosTab:AtmosTab />
<tabs:RoundTab />
<tabs:ServerTab />
<panic:PanicBunkerTab Name="PanicBunkerControl" Access="Public" />
<baby:BabyJailTab Name="BabyJailControl" Access="Public" />
<playerTab:PlayerTab Name="PlayerTabControl" Access="Public" />
<objectsTab:ObjectsTab Name="ObjectsTabControl" Access="Public" />
</TabContainer>
Expand Down
73 changes: 44 additions & 29 deletions Content.Client/Administration/UI/AdminMenuWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,53 @@
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Administration.UI
namespace Content.Client.Administration.UI;

[GenerateTypedNameReferences]
public sealed partial class AdminMenuWindow : DefaultWindow
{
[GenerateTypedNameReferences]
public sealed partial class AdminMenuWindow : DefaultWindow
public event Action? OnDisposed;

public AdminMenuWindow()
{
MinSize = new Vector2(650, 250);
Title = Loc.GetString("admin-menu-title");
RobustXamlLoader.Load(this);
MasterTabContainer.SetTabTitle(0, Loc.GetString("admin-menu-admin-tab"));
MasterTabContainer.SetTabTitle(1, Loc.GetString("admin-menu-adminbus-tab"));
MasterTabContainer.SetTabTitle(2, Loc.GetString("admin-menu-atmos-tab"));
MasterTabContainer.SetTabTitle(3, Loc.GetString("admin-menu-round-tab"));
MasterTabContainer.SetTabTitle(4, Loc.GetString("admin-menu-server-tab"));
MasterTabContainer.SetTabTitle(5, Loc.GetString("admin-menu-panic-bunker-tab"));
MasterTabContainer.SetTabTitle(6, Loc.GetString("admin-menu-players-tab"));
MasterTabContainer.SetTabTitle(7, Loc.GetString("admin-menu-objects-tab"));
MasterTabContainer.OnTabChanged += OnTabChanged;
}

private void OnTabChanged(int tabIndex)
{
public event Action? OnDisposed;
var tabEnum = (TabIndex)tabIndex;
if (tabEnum == TabIndex.Objects)
ObjectsTabControl.RefreshObjectList();
}

public AdminMenuWindow()
{
MinSize = new Vector2(650, 250);
Title = Loc.GetString("admin-menu-title");
RobustXamlLoader.Load(this);
MasterTabContainer.SetTabTitle(0, Loc.GetString("admin-menu-admin-tab"));
MasterTabContainer.SetTabTitle(1, Loc.GetString("admin-menu-adminbus-tab"));
MasterTabContainer.SetTabTitle(2, Loc.GetString("admin-menu-atmos-tab"));
MasterTabContainer.SetTabTitle(3, Loc.GetString("admin-menu-round-tab"));
MasterTabContainer.SetTabTitle(4, Loc.GetString("admin-menu-server-tab"));
MasterTabContainer.SetTabTitle(5, Loc.GetString("admin-menu-panic-bunker-tab"));
/*
* TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
*/
MasterTabContainer.SetTabTitle(6, Loc.GetString("admin-menu-baby-jail-tab"));
MasterTabContainer.SetTabTitle(7, Loc.GetString("admin-menu-players-tab"));
MasterTabContainer.SetTabTitle(8, Loc.GetString("admin-menu-objects-tab"));
}
protected override void Dispose(bool disposing)
{
OnDisposed?.Invoke();
base.Dispose(disposing);
OnDisposed = null;
}

protected override void Dispose(bool disposing)
{
OnDisposed?.Invoke();
base.Dispose(disposing);
OnDisposed = null;
}
private enum TabIndex
{
Admin = 0,
Adminbus,
Atmos,
Round,
Server,
PanicBunker,
BabyJail,
Players,
Objects,
}
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit af939ac

Please sign in to comment.