diff --git a/Content.Client/Commands/CreditsCommand.cs b/Content.Client/Commands/CreditsCommand.cs new file mode 100644 index 0000000000..47643b11ac --- /dev/null +++ b/Content.Client/Commands/CreditsCommand.cs @@ -0,0 +1,20 @@ +using Content.Client.UserInterface; +using JetBrains.Annotations; +using Robust.Client.Interfaces.Console; + +namespace Content.Client.Commands +{ + [UsedImplicitly] + public sealed class CreditsCommand : IConsoleCommand + { + public string Command => "credits"; + public string Description => "Opens the credits window"; + public string Help => "credits"; + + public bool Execute(IDebugConsole console, params string[] args) + { + new CreditsWindow().Open(); + return false; + } + } +} diff --git a/Content.Client/State/LobbyState.cs b/Content.Client/State/LobbyState.cs index b411316a18..0a60e3adf1 100644 --- a/Content.Client/State/LobbyState.cs +++ b/Content.Client/State/LobbyState.cs @@ -92,6 +92,7 @@ namespace Content.Client.State }; _lobby.LeaveButton.OnPressed += args => _console.ProcessCommand("disconnect"); + _lobby.CreditsButton.OnPressed += args => new CreditsWindow().Open(); UpdatePlayerList(); diff --git a/Content.Client/UILinks.cs b/Content.Client/UILinks.cs new file mode 100644 index 0000000000..8362ff0e4c --- /dev/null +++ b/Content.Client/UILinks.cs @@ -0,0 +1,11 @@ +namespace Content.Client +{ + public static class UILinks + { + public const string GitHub = "https://github.com/space-wizards/space-station-14/"; + public const string Patreon = "https://www.patreon.com/spacestation14"; + + public const string Discord = "https://discordapp.com/invite/t2jac3p"; + public const string Website = "https://spacestation14.io"; + } +} diff --git a/Content.Client/UserInterface/CreditsWindow.cs b/Content.Client/UserInterface/CreditsWindow.cs new file mode 100644 index 0000000000..56ac89f153 --- /dev/null +++ b/Content.Client/UserInterface/CreditsWindow.cs @@ -0,0 +1,219 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Content.Client.UserInterface.Stylesheets; +using Newtonsoft.Json; +using Robust.Client.Credits; +using Robust.Client.Interfaces.ResourceManagement; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controls; +using Robust.Client.UserInterface.CustomControls; +using Robust.Shared.IoC; +using Robust.Shared.Localization; +using Robust.Shared.Maths; +using Robust.Shared.Utility; + +#nullable enable + +namespace Content.Client.UserInterface +{ + public sealed class CreditsWindow : SS14Window + { + [Dependency] private readonly IResourceCache _resourceManager = default!; + + private static readonly Dictionary PatronTierPriority = new Dictionary + { + ["Nuclear Operative"] = 1, + ["Syndicate Agent"] = 2, + ["Revolutionary"] = 3 + }; + + public CreditsWindow() + { + IoCManager.InjectDependencies(this); + + Title = Loc.GetString("Credits"); + + var rootContainer = new TabContainer(); + + var patronsList = new ScrollContainer(); + var ss14ContributorsList = new ScrollContainer(); + var licensesList = new ScrollContainer(); + + rootContainer.AddChild(ss14ContributorsList); + rootContainer.AddChild(patronsList); + rootContainer.AddChild(licensesList); + + TabContainer.SetTabTitle(patronsList, Loc.GetString("Patrons")); + TabContainer.SetTabTitle(ss14ContributorsList, Loc.GetString("Credits")); + TabContainer.SetTabTitle(licensesList, Loc.GetString("Open Source Licenses")); + + PopulatePatronsList(patronsList); + PopulateCredits(ss14ContributorsList); + PopulateLicenses(licensesList); + + Contents.AddChild(rootContainer); + + CustomMinimumSize = (650, 450); + } + + private void PopulateLicenses(ScrollContainer licensesList) + { + var margin = new MarginContainer {MarginLeftOverride = 2, MarginTopOverride = 2}; + var vBox = new VBoxContainer(); + margin.AddChild(vBox); + + foreach (var entry in CreditsManager.GetLicenses().OrderBy(p => p.Name)) + { + vBox.AddChild(new Label {StyleClasses = {StyleBase.StyleClassLabelHeading}, Text = entry.Name}); + + // We split these line by line because otherwise + // the LGPL causes Clyde to go out of bounds in the rendering code. + foreach (var line in entry.License.Split("\n")) + { + vBox.AddChild(new Label {Text = line, FontColorOverride = new Color(200, 200, 200)}); + } + } + + licensesList.AddChild(margin); + } + + private void PopulatePatronsList(Control patronsList) + { + var margin = new MarginContainer {MarginLeftOverride = 2, MarginTopOverride = 2}; + var vBox = new VBoxContainer(); + margin.AddChild(vBox); + var patrons = ReadJson("/Credits/Patrons.json"); + + Button patronButton; + vBox.AddChild(patronButton = new Button + { + Text = "Become a Patron", + SizeFlagsHorizontal = SizeFlags.ShrinkCenter + }); + + var first = true; + foreach (var tier in patrons.GroupBy(p => p.Tier).OrderBy(p => PatronTierPriority[p.Key])) + { + if (!first) + { + vBox.AddChild(new Control {CustomMinimumSize = (0, 10)}); + } + + first = false; + vBox.AddChild(new Label {StyleClasses = {StyleBase.StyleClassLabelHeading}, Text = $"{tier.Key}"}); + + var msg = string.Join(", ", tier.OrderBy(p => p.Name).Select(p => p.Name)); + + var label = new RichTextLabel(); + label.SetMessage(msg); + + vBox.AddChild(label); + } + + + patronButton.OnPressed += + _ => IoCManager.Resolve().OpenUri(UILinks.Patreon); + + patronsList.AddChild(margin); + } + + private void PopulateCredits(Control contributorsList) + { + Button contributeButton; + + var margin = new MarginContainer + { + MarginLeftOverride = 2, + MarginTopOverride = 2 + }; + var vBox = new VBoxContainer(); + margin.AddChild(vBox); + + vBox.AddChild(new HBoxContainer + { + SizeFlagsHorizontal = SizeFlags.ShrinkCenter, + SeparationOverride = 20, + Children = + { + new Label {Text = "Want to get on this list?"}, + (contributeButton = new Button {Text = "Contribute!"}) + } + }); + + var first = true; + void AddSection(string title, string path, bool markup = false) + { + if (!first) + { + vBox.AddChild(new Control {CustomMinimumSize = (0, 10)}); + } + + first = false; + vBox.AddChild(new Label {StyleClasses = {StyleBase.StyleClassLabelHeading}, Text = title}); + + var label = new RichTextLabel(); + var text = _resourceManager.ContentFileReadAllText($"/Credits/{path}"); + if (markup) + { + label.SetMessage(FormattedMessage.FromMarkup(text.Trim())); + } + else + { + label.SetMessage(text); + } + + vBox.AddChild(label); + } + + AddSection("Space Station 14 Contributors", "GitHub.txt"); + AddSection("Space Station 13 Codebases", "SpaceStation13.txt"); + AddSection("Original Space Station 13 Remake Team", "OriginalRemake.txt"); + AddSection("Special Thanks", "SpecialThanks.txt", true); + + contributorsList.AddChild(margin); + + contributeButton.OnPressed += _ => + IoCManager.Resolve().OpenUri(UILinks.GitHub); + } + + private static IEnumerable Lines(TextReader reader) + { + while (true) + { + var line = reader.ReadLine(); + if (line == null) + { + yield break; + } + + yield return line; + } + } + + private T ReadJson(string path) + { + var serializer = new JsonSerializer(); + + using var stream = _resourceManager.ContentFileRead(path); + using var streamReader = new StreamReader(stream); + using var jsonTextReader = new JsonTextReader(streamReader); + + return serializer.Deserialize(jsonTextReader)!; + } + + [JsonObject(ItemRequired = Required.Always)] + private sealed class PatronEntry + { + public string Name { get; set; } = default!; + public string Tier { get; set; } = default!; + } + + [JsonObject(ItemRequired = Required.Always)] + private sealed class OpenSourceLicense + { + public string Name { get; set; } = default!; + public string License { get; set; } = default!; + } + } +} diff --git a/Content.Client/UserInterface/LobbyGui.cs b/Content.Client/UserInterface/LobbyGui.cs index 4904eb6322..413587a8ed 100644 --- a/Content.Client/UserInterface/LobbyGui.cs +++ b/Content.Client/UserInterface/LobbyGui.cs @@ -18,6 +18,7 @@ namespace Content.Client.UserInterface public Label StartTime { get; } public Button ReadyButton { get; } public Button ObserveButton { get; } + public Button CreditsButton { get; } public Button LeaveButton { get; } public ChatBox Chat { get; } public ItemList OnlinePlayerItemList { get; } @@ -85,6 +86,13 @@ namespace Content.Client.UserInterface VAlign = Label.VAlignMode.Center, SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter }), + (CreditsButton = new Button + { + SizeFlagsHorizontal = SizeFlags.ShrinkEnd, + Text = Loc.GetString("Credits"), + StyleClasses = {StyleNano.StyleClassButtonBig}, + //GrowHorizontal = GrowDirection.Begin + }), (LeaveButton = new Button { SizeFlagsHorizontal = SizeFlags.ShrinkEnd, diff --git a/Content.Client/UserInterface/ServerInfo.cs b/Content.Client/UserInterface/ServerInfo.cs index aa87ee6e12..4b16abc907 100644 --- a/Content.Client/UserInterface/ServerInfo.cs +++ b/Content.Client/UserInterface/ServerInfo.cs @@ -8,9 +8,6 @@ namespace Content.Client.UserInterface { public class ServerInfo : VBoxContainer { - private const string DiscordUrl = "https://discordapp.com/invite/t2jac3p"; - private const string WebsiteUrl = "https://spacestation14.io"; - private readonly RichTextLabel _richTextLabel; public ServerInfo() @@ -27,10 +24,10 @@ namespace Content.Client.UserInterface var uriOpener = IoCManager.Resolve(); var discordButton = new Button {Text = Loc.GetString("Join us on Discord!")}; - discordButton.OnPressed += args => uriOpener.OpenUri(DiscordUrl); + discordButton.OnPressed += args => uriOpener.OpenUri(UILinks.Discord); var websiteButton = new Button {Text = Loc.GetString("Website")}; - websiteButton.OnPressed += args => uriOpener.OpenUri(WebsiteUrl); + websiteButton.OnPressed += args => uriOpener.OpenUri(UILinks.Website); buttons.AddChild(discordButton); buttons.AddChild(websiteButton); diff --git a/Resources/Credits/GitHub.txt b/Resources/Credits/GitHub.txt new file mode 100644 index 0000000000..8cd2499881 --- /dev/null +++ b/Resources/Credits/GitHub.txt @@ -0,0 +1 @@ +20kdc, 4dplanner, Acruid, actioninja, AJCM-git, ancientpower, as334, avghdev, BGare, BobdaBiscuit, boiled-water-tsar, Bright0, brndd, CakeQ, CatTheSystem, CC-4477, Centronias, chairbender, clusterfack, Clyybber, collinlunn, ComicIronic, Cyberboss, DamianX, Daracke, deathrat, Decappi, Dezandor, dylanstrategie, fizzle7, Fouin, gbasood, gituhabu, GlassEclipse, h3half, halworsen, harikattar, Hugal31, ike709, Injazz, InquisitivePenguin, JiimBob, johnku1, kalanosh, lzimann, Macoron, metalgearsloth, micheel665, Miniwoffer, Moneyl, N3X15, NickPowers43, nullarmo, Pangogie, partyaddict, patrikturi, PaulRitter, Pireax, PJB3005, ProfanedBane, PrPleGoo, psykzz, Quantomicus, Qustinnus, RednoWCirabrab, RemieRichards, remove32, renodubois, Rockdtben, Rohesie, rok-povsic, SamV522, ScumbagDog, Serkket, ShadowCommander, SignalWalker, Silvertorch5, Soundwavesghost, SpaceManiac, spoogemonster, SweptWasTaken, Szunti, tentekal, thatrandomcanadianguy, theOperand, tkdrg, Tomeno, Tyler-IN, unusualcrow, UristMcDorf, volundr-, wixoaGit, YotaXP, ZelteHonor, ZNixian, Zth--, Zumorica diff --git a/Resources/Credits/OriginalRemake.txt b/Resources/Credits/OriginalRemake.txt new file mode 100644 index 0000000000..39bf37d40a --- /dev/null +++ b/Resources/Credits/OriginalRemake.txt @@ -0,0 +1,2 @@ +For creating and releasing the original remake, which this project is based on: +DrSingh, Edad, Hamshot (Ben Guilbert), Keelin, Nannek (a wanker), Nyxation (Tyler Merta), Ostaf, Supernorn (Adam Riches), Synchronic (Joseph Riches), Tan Teck Weng, Volundr diff --git a/Resources/Credits/Patrons.json b/Resources/Credits/Patrons.json new file mode 100644 index 0000000000..efe85c9b0a --- /dev/null +++ b/Resources/Credits/Patrons.json @@ -0,0 +1 @@ +[{"Name":"Acvisy","Tier":"Syndicate Agent"},{"Name":"Arian Jafari","Tier":"Nuclear Operative"},{"Name":"Await Future","Tier":"Syndicate Agent"},{"Name":"Calvin Balke","Tier":"Nuclear Operative"},{"Name":"Crocs Enthusiast .","Tier":"Revolutionary"},{"Name":"Daniel Thompson","Tier":"Revolutionary"},{"Name":"dean","Tier":"Nuclear Operative"},{"Name":"Kyle Hipke","Tier":"Nuclear Operative"},{"Name":"LeoZ","Tier":"Revolutionary"},{"Name":"MetalClone","Tier":"Nuclear Operative"},{"Name":"NetGlitch","Tier":"Syndicate Agent"},{"Name":"Ninja","Tier":"Syndicate Agent"},{"Name":"ThatGuyGW","Tier":"Nuclear Operative"},{"Name":"Tomeno","Tier":"Revolutionary"},{"Name":"Trevor McConnell","Tier":"Nuclear Operative"},{"Name":"Tyler Young","Tier":"Nuclear Operative"}] diff --git a/Resources/Credits/SpaceStation13.txt b/Resources/Credits/SpaceStation13.txt new file mode 100644 index 0000000000..3afb51d468 --- /dev/null +++ b/Resources/Credits/SpaceStation13.txt @@ -0,0 +1,2 @@ +For creating and maintaining this awesome game: Goonstation, /tg/station, Baystation12, CEV-Eris, /vg/station, and countless others. +Many art assets taken from various SS13 codebases under the CC-BY-SA-3.0 license. Goonstation assets licensed under CC-BY-SA-NC-30. diff --git a/Resources/Credits/SpecialThanks.txt b/Resources/Credits/SpecialThanks.txt new file mode 100644 index 0000000000..e48dcd8c2d --- /dev/null +++ b/Resources/Credits/SpecialThanks.txt @@ -0,0 +1,3 @@ +Exadv1 for creating Space Station 13. +All the uncountable people providing feedback and support throughout the community. +[color=white]You[/color], without whom there'd be no point to all this. diff --git a/Tools/dump_github_contributors.ps1 b/Tools/dump_github_contributors.ps1 new file mode 100755 index 0000000000..4873eb93ce --- /dev/null +++ b/Tools/dump_github_contributors.ps1 @@ -0,0 +1,20 @@ +#!/usr/bin/env pwsh + +# TODO: This is definitely gonna stop being accurate when we get above 100 contributors on one of the repos. +$engineJson = (Invoke-WebRequest "https://api.github.com/repos/space-wizards/RobustToolbox/contributors?per_page=100").Content | convertfrom-json +$contentJson = (Invoke-WebRequest "https://api.github.com/repos/space-wizards/space-station-14/contributors?per_page=100").Content | convertfrom-json + +if ($engineJson.Count -ge 100) +{ + Write-Warning "Engine is reporting 100 contributors. It might not be a complete list due to API pagination!" +} + +if ($contentJson.Count -ge 100) +{ + Write-Warning "Content is reporting 100 contributors. It might not be a complete list due to API pagination!" +} + +$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent +$bad = get-content $(join-path $scriptDir "ignored_github_contributors.txt") + +($engineJson).login + ($contentJson).login | select -unique | where { $bad -notcontains $_ } | Sort-object | Join-String -Separator ", " diff --git a/Tools/dump_patrons.ps1 b/Tools/dump_patrons.ps1 new file mode 100755 index 0000000000..04cc1f3edf --- /dev/null +++ b/Tools/dump_patrons.ps1 @@ -0,0 +1,8 @@ +#!/usr/bin/env pwsh + +param([string]$csvPath) + +# Dumps Patreon's CSV download into a JSON file the game reads. + +# Have to trim patron names because apparently Patreon doesn't which is quite ridiculous. +Get-content $csvPath | ConvertFrom-Csv -Delimiter "," | select @{l="Name";e={$_.Name.Trim()}},Tier | ConvertTo-Json -Compress diff --git a/Tools/ignored_github_contributors.txt b/Tools/ignored_github_contributors.txt new file mode 100644 index 0000000000..43efdba4c1 --- /dev/null +++ b/Tools/ignored_github_contributors.txt @@ -0,0 +1,3 @@ +ZDDM +TYoung86 +PJBot