Skip to content

Commit

Permalink
Merge pull request #1835 from DexlerXD/upstream-merge-61
Browse files Browse the repository at this point in the history
Upstream merge 61
  • Loading branch information
TheArturZh authored Sep 11, 2024
2 parents bb9bc10 + e5496fc commit fd70a9b
Show file tree
Hide file tree
Showing 334 changed files with 99,188 additions and 28,407 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!-- ЭТО ШАБЛОН ВАШЕГО PULL REQUEST. Текст между стрелками - это комментарии - они не будут видны в PR. -->

***ЕСЛИ ВЫ ХОТИТЕ, ЧТОБЫ ВАШ PULL REQUEST БЫЛ УСПЕШНО ЗАМЁРДЖЕН, ТО ОЗНАКОМТЕСЬ С НАСТАВЛЕНИЕМ ПО РАБОТЕ С РЕПОЗИТОРИЕМ: https://serbiastrong-220.github.io/ss220-docs/development/ss220-guidelines/ ! ЭТУ СТРОЧКУ НУЖНО УДАЛИТЬ ИЗ ШАБЛОНА ПРИ ОТКРЫТИИ PULL REQUEST'А!***
## Описание PR
<!-- Ниже опишите ваш Pull Request. Что он изменяет? На что еще это может повлиять? Постарайтесь описать все внесённые вами изменения! -->

Expand All @@ -11,6 +10,7 @@
**Проверки**
<!-- Выполнение всех следующих действий, если это приемлемо для вида изменений сильно ускорит разбор вашего PR -->
- [ ] PR полностью завершён и мне не нужна помощь чтобы его закончить.
- [ ] Я **ознакомился** с [наставлением по работе с репозиторием](https://serbiastrong-220.github.io/ss220-docs/development/ss220-guidelines/) и следовал им при создании PR'а.
- [ ] Я внимательно просмотрел все свои изменения и багов в них не нашёл.
- [ ] Я запускал локальный сервер со своими изменениями и всё протестировал.
- [ ] Я добавил скриншот/видео демонстрации PR в игре, **или** этот PR этого не требует.
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 @@ -67,8 +67,10 @@
<BoxContainer Orientation="Horizontal">
<!-- SS220 Text Edit Limits begin -->
<!--
<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"/>
-->
<Button Name="ButtonPreview" SetHeight="32" SetWidth="150"
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 readonly HashSet<Control> _invalidInputs = new(); // SS220 Text Edit Limits
private bool _preview;
Expand Down Expand Up @@ -53,6 +54,7 @@ public ArticleEditorPanel()
ButtonPreview.OnPressed += OnPreview;
ButtonCancel.OnPressed += OnCancel;
ButtonPublish.OnPressed += OnPublish;
//ButtonSaveDraft.OnPressed += OnDraftSaved; SS220-upstream-merge

// SS220 Text Edit Limits begin
//TitleField.OnTextChanged += args => OnTextChanged(args.Text.Length, args.Control, SharedNewsSystem.MaxTitleLength);
Expand Down Expand Up @@ -93,6 +95,9 @@ private void OnTextChanged(long length, Control control, long maxLength)
ButtonPreview.Disabled = false;
} // SS220 Text Edit Limits
}

// 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 @@ -117,6 +122,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 @@ -125,6 +136,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 @@ -70,4 +73,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,7 +1,6 @@
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Robust.Client.GameObjects;
using Robust.Shared.Utility;

namespace Content.Client.Nutrition.EntitySystems;

Expand Down Expand Up @@ -50,6 +49,7 @@ private void UpdateFoodVisuals(Entity<FoodSequenceStartPointComponent> start, Sp
sprite.AddBlankLayer(index);
sprite.LayerMapSet(keyCode, index);
sprite.LayerSetSprite(index, state.Sprite);
sprite.LayerSetScale(index, state.Scale);

//Offset the layer
var layerPos = start.Comp.StartPosition;
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 @@ -18,6 +18,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
16 changes: 15 additions & 1 deletion Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,27 @@ private void SpawnPlayer(ICommonSession player,

if (lateJoin && !silent)
{
_chatSystem.DispatchStationAnnouncement(station,
if (jobPrototype.JoinNotifyCrew)
{
_chatSystem.DispatchStationAnnouncement(station,
Loc.GetString("latejoin-arrival-announcement-special",
("character", MetaData(mob).EntityName),
("gender", character.Gender), //SS220-upstream-merge
("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(jobName))),
Loc.GetString("latejoin-arrival-sender"),
playSound: false,
colorOverride: Color.Gold);
}
else
{
_chatSystem.DispatchStationAnnouncement(station,
Loc.GetString("latejoin-arrival-announcement",
("character", MetaData(mob).EntityName),
("gender", character.Gender), // Corvax-LastnameGender
("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(jobName))),
Loc.GetString("latejoin-arrival-sender"),
playSound: 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 @@ -18,6 +18,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 = "";
}
14 changes: 13 additions & 1 deletion Content.Server/MassMedia/Systems/NewsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public override void Initialize()
subs.Event<NewsWriterDeleteMessage>(OnWriteUiDeleteMessage);
subs.Event<NewsWriterArticlesRequestMessage>(OnRequestArticlesUiMessage);
subs.Event<NewsWriterPublishMessage>(OnWriteUiPublishMessage);
subs.Event<NewsWriterSaveDraftMessage>(OnNewsWriterDraftUpdatedMessage);
subs.Event<NewsWriterRequestDraftMessage>(OnRequestArticleDraftMessage);
});

// News reader
Expand Down Expand Up @@ -259,7 +261,7 @@ private void UpdateWriterUi(Entity<NewsWriterComponent> ent)
if (!TryGetArticles(ent, out var articles))
return;

var state = new NewsWriterBoundUserInterfaceState(articles.ToArray(), ent.Comp.PublishEnabled, ent.Comp.NextPublish);
var state = new NewsWriterBoundUserInterfaceState(articles.ToArray(), ent.Comp.PublishEnabled, ent.Comp.NextPublish, ent.Comp.DraftTitle, ent.Comp.DraftContent);
_ui.SetUiState(ent.Owner, NewsWriterUiKey.Key, state);
}

Expand Down Expand Up @@ -321,4 +323,14 @@ private bool CanUse(EntityUid user, EntityUid console)
return true;
}

private void OnNewsWriterDraftUpdatedMessage(Entity<NewsWriterComponent> ent, ref NewsWriterSaveDraftMessage args)
{
ent.Comp.DraftTitle = args.DraftTitle;
ent.Comp.DraftContent = args.DraftContent;
}

private void OnRequestArticleDraftMessage(Entity<NewsWriterComponent> ent, ref NewsWriterRequestDraftMessage msg)
{
UpdateWriterUi(ent);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Materials;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;

namespace Content.Server.Materials.Components;

/// <summary>
/// This is used for a machine that turns produce into a specified material.
/// </summary>
[RegisterComponent, Access(typeof(ProduceMaterialExtractorSystem))]
public sealed partial class ProduceMaterialExtractorComponent : Component
{
/// <summary>
/// The material that produce is converted into
/// </summary>
[DataField]
public ProtoId<MaterialPrototype> ExtractedMaterial = "Biomass";

/// <summary>
/// List of reagents that determines how much material is yielded from a produce.
/// </summary>
[DataField]
public List<ProtoId<ReagentPrototype>> ExtractionReagents = new()
{
"Nutriment"
};

[DataField]
public SoundSpecifier? ExtractSound = new SoundPathSpecifier("/Audio/Effects/waterswirl.ogg");
}
Loading

0 comments on commit fd70a9b

Please sign in to comment.