Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream merge 6/10/2024 #22

Merged
merged 32 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d439c5a
Revert "Merge branch 'VMSolidus-Psionic-Power-Refactor'"
VMSolidus May 29, 2024
3f44f9d
Update PsionicRegenerationPowerSystem.cs
VMSolidus May 29, 2024
0984fde
Merge branch 'master' into Psionic-Power-Refactor
VMSolidus May 29, 2024
462e91c
aaaaaaaaa
VMSolidus May 29, 2024
6fafc34
Merge branch 'Psionic-Power-Refactor' of https://github.com/VMSolidus…
VMSolidus May 29, 2024
c4db831
Update PsionicRegenerationPowerSystem.cs
VMSolidus May 29, 2024
cefe228
fun pvs fixes
VMSolidus May 29, 2024
84e4d10
Merge branch 'Simple-Station:master' into Psionic-Power-Refactor
VMSolidus May 29, 2024
c416d40
Update DispelPowerSystem.cs
VMSolidus May 29, 2024
a90fe7f
Start of Arachne Port
VMSolidus Jun 10, 2024
8432e2c
Finishing arachne system
VMSolidus Jun 10, 2024
79e1110
Oneirophage complete
VMSolidus Jun 10, 2024
7675df8
PORTING COMPLETE
VMSolidus Jun 10, 2024
90ba45b
Needed tags
VMSolidus Jun 10, 2024
30d319f
remove unused usings
VMSolidus Jun 10, 2024
82edb60
Languages (#43)
FoxxoTrystan Jun 10, 2024
9a79f00
Automatic Changelog Update (#43)
SimpleStation14 Jun 10, 2024
17c17e9
Merge branch 'master' into Psionic-Power-Refactor
VMSolidus Jun 10, 2024
e3fb454
Fixing invisibility, more feedback messages
VMSolidus Jun 10, 2024
36b2409
Merge branch 'Psionic-Power-Refactor' of https://github.com/VMSolidus…
VMSolidus Jun 10, 2024
c2a20aa
Update RegenerativeStasisPowerSystem.cs
VMSolidus Jun 10, 2024
5c5ad44
Refactor mime psionics!
VMSolidus Jun 10, 2024
efccb49
Update mime.yml
VMSolidus Jun 10, 2024
c1cbaf9
Purge a bunch of unused usings
VMSolidus Jun 11, 2024
468977d
Merge remote-tracking branch 'EE-Personal/Psionic-Power-Refactor' int…
VMSolidus Jun 11, 2024
f78d73a
Merge remote-tracking branch 'EE-Personal/Rebase-Arachne' into upstre…
VMSolidus Jun 11, 2024
c753eec
Update mutants.yml
VMSolidus Jun 11, 2024
87850a7
Misc Resprites! (#435)
FoxxoTrystan Jun 11, 2024
106cdd8
Automatic Changelog Update (#435)
SimpleStation14 Jun 11, 2024
bddcaef
Merge remote-tracking branch 'EE-Personal/master' into upstream-merge…
VMSolidus Jun 11, 2024
0fecb72
Update mutants.yml
VMSolidus Jun 11, 2024
68c8a3a
Update psionicPowers.yml
VMSolidus Jun 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 48 additions & 37 deletions Content.Client/Language/LanguageMenuWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Console;
using Robust.Shared.Utility;
using Serilog;
using static Content.Shared.Language.Systems.SharedLanguageSystem;

namespace Content.Client.Language;
Expand All @@ -23,6 +24,15 @@ public LanguageMenuWindow()
_clientLanguageSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<LanguageSystem>();
}

protected override void Opened()
{
// Refresh the window when it gets opened.
// This actually causes two refreshes: one immediately, and one after the server sends a state message.
UpdateState(_clientLanguageSystem.CurrentLanguage, _clientLanguageSystem.SpokenLanguages);
_clientLanguageSystem.RequestStateUpdate();
}


public void UpdateState(string currentLanguage, List<string> spokenLanguages)
{
var langName = Loc.GetString($"language-{currentLanguage}-name");
Expand All @@ -46,55 +56,55 @@ public void UpdateState(string currentLanguage, List<string> spokenLanguages)

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

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

// Create and add a header with the name and the button to select the language
#region Header
var header = new BoxContainer
{
var header = new BoxContainer();
header.Orientation = BoxContainer.LayoutOrientation.Horizontal;
Orientation = BoxContainer.LayoutOrientation.Horizontal,
HorizontalExpand = true,
SeparationOverride = 2
};

header.Orientation = BoxContainer.LayoutOrientation.Horizontal;
header.HorizontalExpand = true;
header.SeparationOverride = 2;
var name = new Label
{
Text = proto?.Name ?? Loc.GetString("generic-error"),
MinWidth = 50,
HorizontalExpand = true
};

var name = new Label();
name.Text = proto?.Name ?? "<error>";
name.MinWidth = 50;
name.HorizontalExpand = true;
var button = new Button { Text = "Choose" };
button.OnPressed += _ => OnLanguageChosen(language);
state.button = button;

var button = new Button();
button.Text = "Choose";
button.OnPressed += _ => OnLanguageChosen(language);
state.button = button;
header.AddChild(name);
header.AddChild(button);

header.AddChild(name);
header.AddChild(button);
container.AddChild(header);
#endregion

container.AddChild(header);
}

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

var description = new RichTextLabel();
description.SetMessage(proto?.Description ?? "<error>");
description.HorizontalExpand = true;
var description = new RichTextLabel { HorizontalExpand = true };
description.SetMessage(proto?.Description ?? Loc.GetString("generic-error"));
body.AddChild(description);

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

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

container.AddChild(collapser);
}
container.AddChild(collapser);
#endregion

// Before adding, wrap the new container in a PanelContainer to give it a distinct look
var wrapper = new PanelContainer();
Expand All @@ -106,9 +116,10 @@ private void AddLanguageEntry(string language)
_entries.Add(state);
}


private void OnLanguageChosen(string id)
{
var proto = _clientLanguageSystem.GetLanguage(id);
var proto = _clientLanguageSystem.GetLanguagePrototype(id);
if (proto != null)
_clientLanguageSystem.RequestSetLanguage(proto);
}
Expand Down
35 changes: 22 additions & 13 deletions Content.Client/Language/Systems/LanguageSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.Language;
using Content.Shared.Language.Events;
using Content.Shared.Language.Systems;
using Robust.Client;
using Robust.Shared.Console;

namespace Content.Client.Language.Systems;
Expand All @@ -14,6 +15,8 @@ namespace Content.Client.Language.Systems;
/// </remarks>
public sealed class LanguageSystem : SharedLanguageSystem
{
[Dependency] private readonly IBaseClient _client = default!;

/// <summary>
/// The current language of the entity currently possessed by the player.
/// </summary>
Expand All @@ -27,11 +30,26 @@ public sealed class LanguageSystem : SharedLanguageSystem
/// </summary>
public List<string> UnderstoodLanguages { get; private set; } = new();

[Dependency] private readonly IConsoleHost _consoleHost = default!;

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

SubscribeNetworkEvent<LanguagesUpdatedMessage>(OnLanguagesUpdated);
_client.RunLevelChanged += OnRunLevelChanged;
}

private void OnLanguagesUpdated(LanguagesUpdatedMessage message)
{
CurrentLanguage = message.CurrentLanguage;
SpokenLanguages = message.Spoken;
UnderstoodLanguages = message.Understood;
}

private void OnRunLevelChanged(object? sender, RunLevelChangedEventArgs args)
{
// Request an update when entering a game
if (args.NewLevel == ClientRunLevel.InGame)
RequestStateUpdate();
}

/// <summary>
Expand All @@ -45,23 +63,14 @@ public void RequestStateUpdate()

public void RequestSetLanguage(LanguagePrototype language)
{
// May cause some minor desync...
if (language.ID == CurrentLanguage)
return;

// (This is dumb. This is very dumb. It should be a message instead.)
// TODO Change this, soonish
_consoleHost.ExecuteCommand("languageselect " + language.ID);
RaiseNetworkEvent(new LanguagesSetMessage(language.ID));

// May cause some minor desync...
// So to reduce the probability of desync, we replicate the change locally too
if (SpokenLanguages.Contains(language.ID))
CurrentLanguage = language.ID;
}

private void OnLanguagesUpdated(LanguagesUpdatedMessage message)
{
CurrentLanguage = message.CurrentLanguage;
SpokenLanguages = message.Spoken;
UnderstoodLanguages = message.Understood;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,32 @@ namespace Content.Client.UserInterface.Systems.Language;
[UsedImplicitly]
public sealed class LanguageMenuUIController : UIController, IOnStateEntered<GameplayState>, IOnStateExited<GameplayState>
{
public LanguageMenuWindow? _languageWindow;
public LanguageMenuWindow? LanguageWindow;
private MenuButton? LanguageButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.LanguageButton;

public override void Initialize()
{
SubscribeNetworkEvent((LanguagesUpdatedMessage message, EntitySessionEventArgs args) => _languageWindow?.UpdateState(message.CurrentLanguage, message.Spoken));
SubscribeNetworkEvent((LanguagesUpdatedMessage message, EntitySessionEventArgs _) =>
LanguageWindow?.UpdateState(message.CurrentLanguage, message.Spoken));
}

public void OnStateEntered(GameplayState state)
{
DebugTools.Assert(_languageWindow == null);
DebugTools.Assert(LanguageWindow == null);

_languageWindow = UIManager.CreateWindow<LanguageMenuWindow>();
LayoutContainer.SetAnchorPreset(_languageWindow, LayoutContainer.LayoutPreset.CenterTop);
LanguageWindow = UIManager.CreateWindow<LanguageMenuWindow>();
LayoutContainer.SetAnchorPreset(LanguageWindow, LayoutContainer.LayoutPreset.CenterTop);

CommandBinds.Builder.Bind(ContentKeyFunctions.OpenLanguageMenu, InputCmdHandler.FromDelegate(_ => ToggleWindow())).Register<LanguageMenuUIController>();
CommandBinds.Builder.Bind(ContentKeyFunctions.OpenLanguageMenu,
InputCmdHandler.FromDelegate(_ => ToggleWindow())).Register<LanguageMenuUIController>();
}

public void OnStateExited(GameplayState state)
{
if (_languageWindow != null)
if (LanguageWindow != null)
{
_languageWindow.Dispose();
_languageWindow = null;
LanguageWindow.Dispose();
LanguageWindow = null;
}

CommandBinds.Unregister<LanguageMenuUIController>();
Expand All @@ -47,61 +49,41 @@ public void OnStateExited(GameplayState state)
public void UnloadButton()
{
if (LanguageButton == null)
{
return;
}

LanguageButton.OnPressed -= LanguageButtonPressed;
}

public void LoadButton()
{
if (LanguageButton == null)
{
return;
}

LanguageButton.OnPressed += LanguageButtonPressed;

if (_languageWindow == null)
{
if (LanguageWindow == null)
return;
}

_languageWindow.OnClose += DeactivateButton;
_languageWindow.OnOpen += ActivateButton;
LanguageWindow.OnClose += () => LanguageButton.Pressed = false;
LanguageWindow.OnOpen += () => LanguageButton.Pressed = true;
}

private void DeactivateButton() => LanguageButton!.Pressed = false;
private void ActivateButton() => LanguageButton!.Pressed = true;

private void LanguageButtonPressed(ButtonEventArgs args)
{
ToggleWindow();
}

private void CloseWindow()
{
_languageWindow?.Close();
}

private void ToggleWindow()
{
if (_languageWindow == null)
if (LanguageWindow == null)
return;

if (LanguageButton != null)
{
LanguageButton.SetClickPressed(!_languageWindow.IsOpen);
}
LanguageButton.SetClickPressed(!LanguageWindow.IsOpen);

if (_languageWindow.IsOpen)
{
CloseWindow();
}
if (LanguageWindow.IsOpen)
LanguageWindow.Close();
else
{
_languageWindow.Open();
}
LanguageWindow.Open();
}
}
12 changes: 12 additions & 0 deletions Content.Server/Abilities/Mime/MimePowersComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,17 @@ public sealed partial class MimePowersComponent : Component
/// </summary>
[DataField("vowCooldown")]
public TimeSpan VowCooldown = TimeSpan.FromMinutes(5);

/// <summary
/// Psionic Feedback for if a mime with their vow intact is scanned by a Mantis
/// </summary>
[DataField("mimeFeedback")]
public string MimeFeedback = "mime-feedback";

/// <summary
/// Psionic Feedback for if a mime with their vow intact is scanned by a Mantis
/// </summary>
[DataField("mimeBrokenFeedback")]
public string MimeBrokenFeedback = "mime-broken-feedback";
}
}
Loading
Loading