Skip to content

Commit

Permalink
Merge branch 'space-sunrise:master' into Ping-Cute-Working-Man
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinary1 authored Jun 13, 2024
2 parents 6ad3283 + f46fc25 commit 2b06143
Show file tree
Hide file tree
Showing 18 changed files with 157 additions and 170 deletions.
169 changes: 88 additions & 81 deletions Content.Client/Changelog/ChangelogTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,112 +36,118 @@ public void CleanChangelog()
// Sunrise-End

public void PopulateChangelog(ChangelogManager.Changelog changelog)
{
var byDay = changelog.Entries
.GroupBy(e => e.Time.ToLocalTime().Date)
.OrderByDescending(c => c.Key);
{
var byDay = changelog.Entries
.GroupBy(e => e.Time.ToLocalTime().Date)
.OrderByDescending(c => c.Key);

var hasRead = changelog.Name != MainChangelogName ||
_changelog.MaxId <= _changelog.LastReadId;
var hasRead = changelog.Name != MainChangelogName ||
_changelog.MaxId <= _changelog.LastReadId;

foreach (var dayEntries in byDay)
{
var day = dayEntries.Key;

var groupedEntries = dayEntries
.GroupBy(c => (c.Author, Read: c.Id <= _changelog.LastReadId))
.OrderBy(c => c.Key.Read)
.ThenBy(c => c.Key.Author);

string dayNice;
var today = DateTime.Today;
if (day == today)
dayNice = Loc.GetString("changelog-today");
else if (day == today.AddDays(-1))
dayNice = Loc.GetString("changelog-yesterday");
else
dayNice = day.ToShortDateString();

ChangelogBody.AddChild(new Label
foreach (var dayEntries in byDay)
{
var day = dayEntries.Key;

var groupedEntries = dayEntries
.GroupBy(c => c.Id <= _changelog.LastReadId)
.OrderBy(g => g.Key)
.Select(g => new
{
Text = dayNice,
StyleClasses = { StyleBase.StyleClassLabelHeading },
Margin = new Thickness(4, 6, 0, 0)
g.Key,
Entries = g.OrderByDescending(e => e.Time) // Сортировка по времени в убывающем порядке
});

var first = true;
string dayNice;
var today = DateTime.Today;
if (day == today)
dayNice = Loc.GetString("changelog-today");
else if (day == today.AddDays(-1))
dayNice = Loc.GetString("changelog-yesterday");
else
dayNice = day.ToShortDateString();

foreach (var groupedEntry in groupedEntries)
{
var (author, read) = groupedEntry.Key;
ChangelogBody.AddChild(new Label
{
Text = dayNice,
StyleClasses = { StyleBase.StyleClassLabelHeading },
Margin = new Thickness(4, 6, 0, 0)
});

if (!first)
{
ChangelogBody.AddChild(new Control { Margin = new Thickness(4) });
}
var first = true;

if (read && !hasRead)
{
hasRead = true;
foreach (var groupedEntry in groupedEntries)
{
var read = groupedEntry.Key;

var upArrow =
_resourceCache.GetTexture("/Textures/Interface/Changelog/up_arrow.svg.192dpi.png");
if (!first)
{
ChangelogBody.AddChild(new Control { Margin = new Thickness(4) });
}

var readDivider = new BoxContainer
{
Orientation = LayoutOrientation.Vertical
};
if (read && !hasRead)
{
hasRead = true;

var hBox = new BoxContainer
var upArrow =
_resourceCache.GetTexture("/Textures/Interface/Changelog/up_arrow.svg.192dpi.png");

var readDivider = new BoxContainer
{
Orientation = LayoutOrientation.Vertical
};

var hBox = new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
HorizontalAlignment = HAlignment.Center,
Children =
{
Orientation = LayoutOrientation.Horizontal,
HorizontalAlignment = HAlignment.Center,
Children =
new TextureRect
{
new TextureRect
{
Texture = upArrow,
ModulateSelfOverride = Color.FromHex("#888"),
TextureScale = new Vector2(0.5f, 0.5f),
Margin = new Thickness(4, 3),
VerticalAlignment = VAlignment.Bottom
},
new Label
{
Align = Label.AlignMode.Center,
Text = Loc.GetString("changelog-new-changes"),
FontColorOverride = Color.FromHex("#888"),
},
new TextureRect
{
Texture = upArrow,
ModulateSelfOverride = Color.FromHex("#888"),
TextureScale = new Vector2(0.5f, 0.5f),
Margin = new Thickness(4, 3),
VerticalAlignment = VAlignment.Bottom
}
Texture = upArrow,
ModulateSelfOverride = Color.FromHex("#888"),
TextureScale = new Vector2(0.5f, 0.5f),
Margin = new Thickness(4, 3),
VerticalAlignment = VAlignment.Bottom
},
new Label
{
Align = Label.AlignMode.Center,
Text = Loc.GetString("changelog-new-changes"),
FontColorOverride = Color.FromHex("#888"),
},
new TextureRect
{
Texture = upArrow,
ModulateSelfOverride = Color.FromHex("#888"),
TextureScale = new Vector2(0.5f, 0.5f),
Margin = new Thickness(4, 3),
VerticalAlignment = VAlignment.Bottom
}
};
}
};

readDivider.AddChild(hBox);
readDivider.AddChild(new PanelContainer { StyleClasses = { StyleBase.ClassLowDivider } });
ChangelogBody.AddChild(readDivider);
readDivider.AddChild(hBox);
readDivider.AddChild(new PanelContainer { StyleClasses = { StyleBase.ClassLowDivider } });
ChangelogBody.AddChild(readDivider);

if (first)
readDivider.SetPositionInParent(ChangelogBody.ChildCount - 2);
}
if (first)
readDivider.SetPositionInParent(ChangelogBody.ChildCount - 2);
}

first = false;
first = false;

foreach (var changeEntry in groupedEntry.Entries)
{
var authorLabel = new RichTextLabel
{
Margin = new Thickness(6, 0, 0, 0),
};
authorLabel.SetMessage(
FormattedMessage.FromMarkup(Loc.GetString("changelog-author-changed", ("author", author))));
FormattedMessage.FromMarkup(Loc.GetString("changelog-author-changed", ("author", changeEntry.Author))));
ChangelogBody.AddChild(authorLabel);

foreach (var change in groupedEntry.SelectMany(c => c.Changes))
foreach (var change in changeEntry.Changes)
{
var text = new RichTextLabel();
text.SetMessage(FormattedMessage.FromMarkup(change.Message));
Expand All @@ -159,6 +165,7 @@ public void PopulateChangelog(ChangelogManager.Changelog changelog)
}
}
}
}

private TextureRect GetIcon(ChangelogLineType type)
{
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/Shuttles/Systems/ArrivalsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,13 @@ public List<EntityCoordinates> GetArrivalsSpawnPoints()
public EntityUid? SpawnPlayersOnArrivals(EntityUid? station, JobComponent? job, HumanoidCharacterProfile? profile)
{
var possiblePositions = GetArrivalsSpawnPoints();

if (possiblePositions == null || possiblePositions.Count == 0)
{
Logger.Error("No valid arrival points found!");
return null;
}


var spawnLoc = _random.Pick(possiblePositions);

Expand Down
41 changes: 34 additions & 7 deletions Content.Server/_Sunrise/EvilTwin/EvilTwinSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Server.DetailExaminable;
using Content.Server.Forensics;
using Content.Server.GameTicking;
using Content.Server.Humanoid;
using Content.Server.Jobs;
Expand All @@ -11,11 +12,13 @@
using Content.Server.Roles;
using Content.Server.Roles.Jobs;
using Content.Server.Station.Systems;
using Content.Shared.Clothing;
using Content.Shared.Humanoid;
using Content.Shared.Mind.Components;
using Content.Shared.Objectives.Components;
using Content.Shared.Objectives.Systems;
using Content.Shared.Preferences;
using Content.Shared.Preferences.Loadouts;
using Content.Shared.Roles;
using Robust.Shared.Map;
using Robust.Shared.Player;
Expand All @@ -38,6 +41,8 @@ public sealed class EvilTwinSystem : EntitySystem
[Dependency] private readonly MetaDataSystem _metaDataSystem = default!;
[Dependency] private readonly TargetObjectiveSystem _target = default!;
[Dependency] private readonly SharedObjectivesSystem _objectives = default!;
[Dependency] private readonly LoadoutSystem _loadoutSystem = default!;


[ValidatePrototypeId<AntagPrototype>]
private const string EvilTwinRole = "EvilTwin";
Expand All @@ -49,8 +54,8 @@ public sealed class EvilTwinSystem : EntitySystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<_Sunrise.EvilTwin.EvilTwinSpawnerComponent, PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<_Sunrise.EvilTwin.EvilTwinComponent, MindAddedMessage>(OnMindAdded);
SubscribeLocalEvent<EvilTwinSpawnerComponent, PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<EvilTwinComponent, MindAddedMessage>(OnMindAdded);
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEnd);
}

Expand All @@ -70,9 +75,9 @@ private void OnPlayerAttached(EntityUid uid, _Sunrise.EvilTwin.EvilTwinSpawnerCo
}
}

private void OnMindAdded(EntityUid uid, _Sunrise.EvilTwin.EvilTwinComponent component, MindAddedMessage args)
private void OnMindAdded(EntityUid uid, EvilTwinComponent component, MindAddedMessage args)
{
if (!TryComp<_Sunrise.EvilTwin.EvilTwinComponent>(uid, out var evilTwin) ||
if (!TryComp<EvilTwinComponent>(uid, out var evilTwin) ||
!_mindSystem.TryGetMind(uid, out var mindId, out var mind))
return;

Expand All @@ -89,13 +94,13 @@ private void OnMindAdded(EntityUid uid, _Sunrise.EvilTwin.EvilTwinComponent comp

private void OnRoundEnd(RoundEndTextAppendEvent ev)
{
var twinsCount = EntityQuery<_Sunrise.EvilTwin.EvilTwinComponent>().Count();
var twinsCount = EntityQuery<EvilTwinComponent>().Count();
if (twinsCount == 0)
return;

var result = Loc.GetString("evil-twin-round-end-result", ("evil-twin-count", twinsCount));

var query = EntityQueryEnumerator<_Sunrise.EvilTwin.EvilTwinComponent>();
var query = EntityQueryEnumerator<EvilTwinComponent>();
while (query.MoveNext(out var uid, out var twin))
{
if (!_mindSystem.TryGetMind(uid, out var mindId, out var mind))
Expand Down Expand Up @@ -218,6 +223,22 @@ private bool TryGetEligibleHumanoid([NotNullWhen(true)] out EntityUid? uid)

if (_jobSystem.MindTryGetJob(mindId, out _, out var jobProto) && jobProto.StartingGear != null)
{
var jobLoadout = LoadoutSystem.GetJobPrototype(jobProto.ID);

if (_prototype.TryIndex(jobLoadout, out RoleLoadoutPrototype? roleProto))
{
pref.Loadouts.TryGetValue(jobLoadout, out var loadout);

// Set to default if not present
if (loadout == null)
{
loadout = new RoleLoadout(jobLoadout);
loadout.SetDefault(_prototype);
}

_stationSpawning.EquipRoleLoadout(twinUid, loadout, roleProto);
}

if (_prototype.TryIndex<StartingGearPrototype>(jobProto.StartingGear, out var gear))
{
_stationSpawning.EquipStartingGear(twinUid, gear);
Expand All @@ -231,7 +252,13 @@ private bool TryGetEligibleHumanoid([NotNullWhen(true)] out EntityUid? uid)
}
}

EnsureComp<_Sunrise.EvilTwin.EvilTwinComponent>(twinUid).TargetMindId = mindId;
if (TryComp<DnaComponent>(target, out var dnaComponent))
{
var dna = EnsureComp<DnaComponent>(twinUid);
dna.DNA = dnaComponent.DNA;
}

EnsureComp<EvilTwinComponent>(twinUid).TargetMindId = mindId;

return twinUid;
}
Expand Down
57 changes: 1 addition & 56 deletions Resources/Audio/Lobby/attributions.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
- files: ["thunderdome.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "-Sector11 by MashedByMachines. Converted from MP3 to OGG."
source: "https://www.newgrounds.com/audio/listen/312622"

- files: ["endless_space.ogg"]
- files: ["endless_space.ogg"]
license: "CC-BY-3.0"
copyright: "Endless Space by SolusLunes. Converted from MP3 to OGG."
source: "https://www.newgrounds.com/audio/listen/67583"
Expand All @@ -18,53 +13,3 @@
license: "CC-BY-NC-SA-3.0"
copyright: "Absconditus by ZhayTee. Converted from MP3 to OGG."
source: "https://bandcamp.zhaytee.net/track/absconditus"

- files: ["atomicamnesiammx.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "Atomic Amnesia MMX by Philip Dyer. Converted from MP3 to OGG."
source: "https://soundcloud.com/3kliksphilip/atomic-amnesia-mmx-1"

- files: ["singuloose.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "Singuloose by Janis Schiedková. Converted from MP3 to OGG."
source: "https://soundcloud.com/js_m/singuloose"

- files: ["title2.ogg"]
license: "Custom"
copyright: "Originally composed by Jonathan Dunn for Robocop 2 Gameboy published by Ocean Software. Remixed by Eric Shumaker for his video Dilbert 3. As of October 9th, 2008 nobody owns the rights to this song and copyright action has never been taken against anyone using this song in their projects."
source: "https://www.youtube.com/watch?v=4o6_8Unj2mQ"

- files: ["title3.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "Title3 by Cuboos. It is a remix of the song 'Tintin on the Moon'. Converted from MP3 to OGG."
source: "https://www.youtube.com/watch?v=YKVmXn-Gv0M"

- files: ["comet_haley.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "Comet Haley by Stellardrone. Converted from MP3 to OGG."
source: "https://freemusicarchive.org/music/Stellardrone/Light_Years_1227/07_Comet_Halley"

- files: ["mod.flip-flap.ogg"]
license: "Custom"
copyright: "Flip Flap by X-ceed is licensed under a short but clear license (see flip-flap.txt in this directory) and is free for non-commercial use. It was converted from MOD to WAV using Schism Tracker, in 16 Bit, Non-Interpolated mode, no output equalizer settings, Ramp volume at start of sample enabled. From there it was converted to OGG Vorbis with `ffmpeg -i flip-flap.wav -q 2.9 flip-flap-renc.ogg` (quality scale chosen to match size of the OGG file being replaced). Non-interpolated mode was chosen as the module has a high enough sample rate to balance it out, but seems muffled in other interpolation modes. If 'Ramp volume at start of sample' is not enabled, a clicking phenomenon results."
source: "http://aminet.net/package/mods/xceed/Flipflap"

- files: ["Spac_Stac.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "Spac Stac by Hayabusa. Converted from MP3 to OGG."
source: "https://www.youtube.com/watch?v=grUBe-SZgr0"

- files: ["pwmur.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "phoron will make us rich by Alexander Divine."
source: "https://soundcloud.com/alexanderdivine/phoron-will-make-us-rich"

- files: ["lasers_rip_apart_the_bulkhead.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "lasers rip apart the bulkhead by Alexander Divine."
source: "https://soundcloud.com/alexanderdivine/lasers-rip-apart-the-bulkhead"

- files: ["every_light_is_blinking_at_once.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "every light is blinking at once by Alexander Divine."
source: "https://soundcloud.com/alexanderdivine/every-light-is-blinking-at-once"
Loading

0 comments on commit 2b06143

Please sign in to comment.