Skip to content

Commit

Permalink
Merge Upstream (Goob-Station#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
Piras314 authored Sep 10, 2024
2 parents 8ab8df6 + f966dd5 commit f798bcc
Show file tree
Hide file tree
Showing 285 changed files with 96,931 additions and 27,240 deletions.
44 changes: 15 additions & 29 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,33 @@
<!-- Please read these guidelines before opening your PR: https://docs.spacestation14.io/en/getting-started/pr-guideline -->
<!-- The text between the arrows are comments - they will not be visible on your PR. -->
<!-- Guidelines: https://docs.spacestation14.io/en/getting-started/pr-guideline -->

## About the PR
<!-- What did you change in this PR? -->
<!-- What did you change? -->

## Why / Balance
<!-- Why was it changed? Link any discussions or issues here. Please discuss how this would affect game balance. -->
<!-- Discuss how this would affect game balance or explain why it was changed. Link any relevant discussions or issues. -->

## Technical details
<!-- If this is a code change, summarize at high level how your new code works. This makes it easier to review. -->
<!-- Summary of code changes for easier review. -->

## Media
<!--
PRs which make ingame changes (adding clothing, items, new features, etc) are required to have media attached that showcase the changes.
Small fixes/refactors are exempt.
Any media may be used in SS14 progress reports, with clear credit given.
If you're unsure whether your PR will require media, ask a maintainer.
-->
<!-- Attach media if the PR makes ingame changes (clothing, items, features, etc).
Small fixes/refactors are exempt. Media may be used in SS14 progress reports with credit. -->

## Requirements
<!--
Due to influx of PR's we require to ensure that PR's are following the correct guidelines.
Please take a moment to read these if its your first time.
Check the boxes below to confirm that you have in fact seen these (put an X in the brackets, like [X]):
-->
- [ ] I have read and I am following the [Pull Request Guidelines](https://docs.spacestation14.com/en/general-development/codebase-info/pull-request-guidelines.html). I understand that not doing so may get my pr closed at maintainer’s discretion
- [ ] I have added screenshots/videos to this PR showcasing its changes ingame, **or** this PR does not require an ingame showcase
<!-- Confirm the following by placing an X in the brackets [X]: -->
- [ ] I have read and am following the [Pull Request and Changelog Guidelines](https://docs.spacestation14.com/en/general-development/codebase-info/pull-request-guidelines.html).
- [ ] I have added media to this PR or it does not require an ingame showcase.
<!-- You should understand that not following the above may get your PR closed at maintainer’s discretion -->

## Breaking changes
<!--
List any breaking changes, including namespace, public class/method/field changes, prototype renames; and provide instructions for fixing them. This will be pasted in #codebase-changes.
-->
<!-- List any breaking changes, including namespaces, public class/method/field changes, prototype renames; and provide instructions for fixing them.
This will be posted in #codebase-changes. -->

**Changelog**
<!-- Add a Changelog entry to make players aware of new features or changes that could affect gameplay.
Make sure to read the guidelines and take this Changelog template out of the comment block in order for it to show up.
Changelog must have a :cl: symbol, so the bot recognizes the changes and adds them to the game's changelog. -->
<!--
Make players aware of new features and changes that could affect how they play the game by adding a Changelog entry. Please read the Changelog guidelines located at: https://docs.spacestation14.io/en/getting-started/pr-guideline#changelog
-->

<!--
Make sure to take this Changelog template out of the comment block in order for it to show up. Changelog must have a :cl: symbol, so the bot recognizes the changes and adds them to the game's changelog.
:cl:
- add: Added fun!
- remove: Removed fun!
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/update-credits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:

- name: Get this week's Contributors
shell: pwsh
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: Tools/dump_github_contributors.ps1 > Resources/Credits/GitHub.txt

# TODO
Expand Down
4 changes: 3 additions & 1 deletion Content.Client/MassMedia/Ui/ArticleEditorPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
</Control>
<Control HorizontalExpand="True"/>
<BoxContainer Orientation="Horizontal">
<Button Name="ButtonSaveDraft" SetHeight="32" SetWidth="85"
StyleClasses="OpenRight" Text="{Loc news-write-ui-save-text}"/>
<Button Name="ButtonPreview" SetHeight="32" SetWidth="85"
StyleClasses="OpenRight" Text="{Loc news-write-ui-preview-text}"/>
StyleClasses="OpenBoth" Text="{Loc news-write-ui-preview-text}"/>
<Button Name="ButtonPublish" SetHeight="32" SetWidth="85" Text="{Loc news-write-ui-publish-text}" Access="Public"/>
</BoxContainer>
</BoxContainer>
Expand Down
12 changes: 12 additions & 0 deletions Content.Client/MassMedia/Ui/ArticleEditorPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Content.Client.MassMedia.Ui;
public sealed partial class ArticleEditorPanel : Control
{
public event Action? PublishButtonPressed;
public event Action<string, string>? ArticleDraftUpdated;

private bool _preview;

Expand Down Expand Up @@ -45,6 +46,7 @@ public ArticleEditorPanel()
ButtonPreview.OnPressed += OnPreview;
ButtonCancel.OnPressed += OnCancel;
ButtonPublish.OnPressed += OnPublish;
ButtonSaveDraft.OnPressed += OnDraftSaved;

TitleField.OnTextChanged += args => OnTextChanged(args.Text.Length, args.Control, SharedNewsSystem.MaxTitleLength);
ContentField.OnTextChanged += args => OnTextChanged(Rope.CalcTotalLength(args.TextRope), args.Control, SharedNewsSystem.MaxContentLength);
Expand All @@ -68,6 +70,9 @@ private void OnTextChanged(long length, Control control, long maxLength)
ButtonPublish.Disabled = false;
ButtonPreview.Disabled = false;
}

// save draft regardless; they can edit down the length later
ArticleDraftUpdated?.Invoke(TitleField.Text, Rope.Collapse(ContentField.TextRope));
}

private void OnPreview(BaseButton.ButtonEventArgs eventArgs)
Expand All @@ -92,6 +97,12 @@ private void OnPublish(BaseButton.ButtonEventArgs eventArgs)
Visible = false;
}

private void OnDraftSaved(BaseButton.ButtonEventArgs eventArgs)
{
ArticleDraftUpdated?.Invoke(TitleField.Text, Rope.Collapse(ContentField.TextRope));
Visible = false;
}

private void Reset()
{
_preview = false;
Expand All @@ -100,6 +111,7 @@ private void Reset()
PreviewLabel.SetMarkup("");
TitleField.Text = "";
ContentField.TextRope = Rope.Leaf.Empty;
ArticleDraftUpdated?.Invoke(string.Empty, string.Empty);
}

protected override void Dispose(bool disposing)
Expand Down
15 changes: 14 additions & 1 deletion Content.Client/MassMedia/Ui/NewsWriterBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ protected override void Open()
_menu.ArticleEditorPanel.PublishButtonPressed += OnPublishButtonPressed;
_menu.DeleteButtonPressed += OnDeleteButtonPressed;

_menu.CreateButtonPressed += OnCreateButtonPressed;
_menu.ArticleEditorPanel.ArticleDraftUpdated += OnArticleDraftUpdated;

SendMessage(new NewsWriterArticlesRequestMessage());
}

Expand All @@ -34,7 +37,7 @@ protected override void UpdateState(BoundUserInterfaceState state)
if (state is not NewsWriterBoundUserInterfaceState cast)
return;

_menu?.UpdateUI(cast.Articles, cast.PublishEnabled, cast.NextPublish);
_menu?.UpdateUI(cast.Articles, cast.PublishEnabled, cast.NextPublish, cast.DraftTitle, cast.DraftContent);
}

private void OnPublishButtonPressed()
Expand Down Expand Up @@ -67,4 +70,14 @@ private void OnDeleteButtonPressed(int articleNum)

SendMessage(new NewsWriterDeleteMessage(articleNum));
}

private void OnCreateButtonPressed()
{
SendMessage(new NewsWriterRequestDraftMessage());
}

private void OnArticleDraftUpdated(string title, string content)
{
SendMessage(new NewsWriterSaveDraftMessage(title, content));
}
}
9 changes: 8 additions & 1 deletion Content.Client/MassMedia/Ui/NewsWriterMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Shared.MassMedia.Systems;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

namespace Content.Client.MassMedia.Ui;

Expand All @@ -16,6 +17,8 @@ public sealed partial class NewsWriterMenu : FancyWindow

public event Action<int>? DeleteButtonPressed;

public event Action? CreateButtonPressed;

public NewsWriterMenu()
{
RobustXamlLoader.Load(this);
Expand All @@ -31,7 +34,7 @@ public NewsWriterMenu()
ButtonCreate.OnPressed += OnCreate;
}

public void UpdateUI(NewsArticle[] articles, bool publishEnabled, TimeSpan nextPublish)
public void UpdateUI(NewsArticle[] articles, bool publishEnabled, TimeSpan nextPublish, string draftTitle, string draftContent)
{
ArticlesContainer.Children.Clear();
ArticleCount.Text = Loc.GetString("news-write-ui-article-count-text", ("count", articles.Length));
Expand All @@ -54,6 +57,9 @@ public void UpdateUI(NewsArticle[] articles, bool publishEnabled, TimeSpan nextP

ButtonCreate.Disabled = !publishEnabled;
_nextPublish = nextPublish;

ArticleEditorPanel.TitleField.Text = draftTitle;
ArticleEditorPanel.ContentField.TextRope = new Rope.Leaf(draftContent);
}

protected override void FrameUpdate(FrameEventArgs args)
Expand Down Expand Up @@ -93,5 +99,6 @@ protected override void Dispose(bool disposing)
private void OnCreate(BaseButton.ButtonEventArgs buttonEventArgs)
{
ArticleEditorPanel.Visible = true;
CreateButtonPressed?.Invoke();
}
}
2 changes: 1 addition & 1 deletion Content.Client/Nuke/NukeMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void UpdateState(NukeUiState state)
FirstStatusLabel.Text = firstMsg;
SecondStatusLabel.Text = secondMsg;

EjectButton.Disabled = !state.DiskInserted || state.Status == NukeStatus.ARMED;
EjectButton.Disabled = !state.DiskInserted || state.Status == NukeStatus.ARMED || !state.IsAnchored;
AnchorButton.Disabled = state.Status == NukeStatus.ARMED;
AnchorButton.Pressed = state.IsAnchored;
ArmButton.Disabled = !state.AllowArm || !state.IsAnchored;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Robust.Client.GameObjects;
using Robust.Shared.Utility;
using Robust.Client.Graphics; // Goobstation - anythingburgers i dont even remember if i need this
using Robust.Shared.Graphics; // Goobstation - anythingburgers i dont even remember if i need this
using Robust.Shared.Prototypes; // Goobstation - anythingburgers
using Robust.Shared.Utility;

namespace Content.Client.Nutrition.EntitySystems;

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Power/APC/ApcBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public ApcBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
protected override void Open()
{
base.Open();

_menu = this.CreateWindow<ApcMenu>();
_menu.SetEntity(Owner);
_menu.OnBreaker += BreakerPressed;
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Atmos/EntitySystems/FlammableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public void SetFireStacks(EntityUid uid, float stacks, FlammableComponent? flamm
}
else
{
flammable.OnFire = ignite;
flammable.OnFire |= ignite;
UpdateAppearance(uid, flammable);
}
}
Expand Down
7 changes: 0 additions & 7 deletions Content.Server/Dragon/Components/DragonRuleComponent.cs

This file was deleted.

1 change: 1 addition & 0 deletions Content.Server/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Content.Server.IoC;
using Content.Server.Maps;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.Objectives;
using Content.Server.Players;
using Content.Server.Players.JobWhitelist;
using Content.Server.Players.PlayTimeTracking;
Expand Down
27 changes: 21 additions & 6 deletions Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,27 @@ private void SpawnPlayer(ICommonSession player,

if (lateJoin && !silent)
{
_chatSystem.DispatchStationAnnouncement(station,
Loc.GetString("latejoin-arrival-announcement",
("character", MetaData(mob).EntityName),
("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(jobName))),
Loc.GetString("latejoin-arrival-sender"),
playDefaultSound: false);
if (jobPrototype.JoinNotifyCrew)
{
_chatSystem.DispatchStationAnnouncement(station,
Loc.GetString("latejoin-arrival-announcement-special",
("character", MetaData(mob).EntityName),
("entity", mob),
("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(jobName))),
Loc.GetString("latejoin-arrival-sender"),
playDefaultSound: false,
colorOverride: Color.Gold);
}
else
{
_chatSystem.DispatchStationAnnouncement(station,
Loc.GetString("latejoin-arrival-announcement",
("character", MetaData(mob).EntityName),
("entity", mob),
("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(jobName))),
Loc.GetString("latejoin-arrival-sender"),
playDefaultSound: false);
}
}

if (player.UserId == new Guid("{e887eb93-f503-4b65-95b6-2f282c014192}"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Content.Server.GameTicking.Rules.Components;

[RegisterComponent]
public sealed partial class DragonRuleComponent : Component;
52 changes: 52 additions & 0 deletions Content.Server/GameTicking/Rules/DragonRuleSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Content.Server.Antag;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared.Localizations;
using Robust.Server.GameObjects;

namespace Content.Server.GameTicking.Rules;

public sealed class DragonRuleSystem : GameRuleSystem<DragonRuleComponent>
{
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly AntagSelectionSystem _antag = default!;
[Dependency] private readonly StationSystem _station = default!;

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

SubscribeLocalEvent<DragonRuleComponent, AfterAntagEntitySelectedEvent>(AfterAntagEntitySelected);
}

private void AfterAntagEntitySelected(Entity<DragonRuleComponent> ent, ref AfterAntagEntitySelectedEvent args)
{
_antag.SendBriefing(args.EntityUid, MakeBriefing(args.EntityUid), null, null);
}

private string MakeBriefing(EntityUid dragon)
{
var direction = string.Empty;

var dragonXform = Transform(dragon);

var station = _station.GetStationInMap(dragonXform.MapID);
EntityUid? stationGrid = null;
if (TryComp<StationDataComponent>(station, out var stationData))
stationGrid = _station.GetLargestGrid(stationData);

if (stationGrid is not null)
{
var stationPosition = _transform.GetWorldPosition((EntityUid)stationGrid);
var dragonPosition = _transform.GetWorldPosition(dragon);

var vectorToStation = stationPosition - dragonPosition;
direction = ContentLocalizationManager.FormatDirection(vectorToStation.GetDir());
}

var briefing = Loc.GetString("dragon-role-briefing", ("direction", direction));

return briefing;
}
}
1 change: 1 addition & 0 deletions Content.Server/IoC/ServerContentIoC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Content.Server.Maps;
using Content.Server.MoMMI;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.Objectives;
using Content.Server.Players;
using Content.Server.Players.JobWhitelist;
using Content.Server.Players.PlayTimeTracking;
Expand Down
12 changes: 12 additions & 0 deletions Content.Server/MassMedia/Components/NewsWriterComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@ public sealed partial class NewsWriterComponent : Component

[DataField]
public SoundSpecifier ConfirmSound = new SoundPathSpecifier("/Audio/Machines/scan_finish.ogg");

/// <summary>
/// This stores the working title of the current article
/// </summary>
[DataField, ViewVariables]
public string DraftTitle = "";

/// <summary>
/// This stores the working content of the current article
/// </summary>
[DataField, ViewVariables]
public string DraftContent = "";
}
Loading

0 comments on commit f798bcc

Please sign in to comment.