Skip to content

Commit 5dbadfe

Browse files
authored
A Whole host of things (#3830)
<!-- IT'S NOT WIZDENS REPO, IF YOU WANT TO ADD YOUR CHANGES ON ALL SERVERS, CREATE PR TO WIZDENS REPO --> ## Short description <!-- What do you propose to change with your PR? --> ## Why we need to add this <!-- What is the reason for adding these changes? Please post links to Discussions as well as Bug Reports here. Please describe how this will change the game balance. --> ## Media (Video/Screenshots) <!-- If your PR contains in-game changes you must provide screenshots/videos of the changes. --> ## Checks <!-- check boxes for faster reviewing of your PR --> - [ ] I do not require assistance to complete the PR. - [ ] Before posting/requesting review of a PR, I have verified that the changes work. - [ ] I have added screenshots/videos of the changes, or this PR does not change in-game mechanics. - [ ] I affirm that my changes are licensed under the [MIT License](https://github.com/ss14Starlight/space-station-14/blob/Starlight/LICENSE.TXT) and grant permission for use in this repository under its conditions. **Changelog** <!-- If you want the players to know about changes made in this PR, specify them using the template outside the comment. Short and informative. :cl: STARLIGHT TEAM - add: Added Starlight. - remove: Removed SS13. - tweak: Changed SS14. - fix: Fixed Rinary. -->
2 parents 10f5cbf + 2173477 commit 5dbadfe

342 files changed

Lines changed: 134746 additions & 93031 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
/Resources/Maps/ @ss14Starlight/maintainer @ss14Starlight/mappers
88
/Resources/Prototypes/ @ss14Starlight/maintainer @ss14Starlight/prototypers
99
/Resources/ServerInfo/ @ss14Starlight/maintainer @ss14Starlight/wiki
10+
11+
/Resources/Prototypes/_NullLink/ @StarlightHost

Content.Client/Info/PlaytimeStats/PlaytimeStatsWindow.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public sealed partial class PlaytimeStatsWindow : FancyWindow
1818
private ISawmill _sawmill = Logger.GetSawmill("PlaytimeStatsWindow");
1919
private readonly Color _altColor = Color.FromHex("#292B38");
2020
private readonly Color _defaultColor = Color.FromHex("#2F2F3B");
21+
private readonly Color _antagColor = Color.FromHex("#fe7676");
22+
private readonly Color _ghostColor = Color.FromHex("#c996e0");
2123
private bool _useAltColor;
2224

2325
public PlaytimeStatsWindow()
@@ -109,11 +111,12 @@ private void PopulatePlaytimeData()
109111

110112
OverallPlaytimeLabel.Text = Loc.GetString("ui-playtime-overall", ("time", overallPlaytime));
111113

112-
var rolePlaytimes = _jobRequirementsManager.FetchPlaytimeByRoles();
113-
114-
//starlight
114+
// Starlight BEGIN
115+
var rolePlaytimes = _jobRequirementsManager.FetchPlaytimeByRoles().ToList();
115116
var departmentPlaytimes = _jobRequirementsManager.FetchPlaytimeByDepartments();
116-
//starlight end
117+
var antagPlaytimes = _jobRequirementsManager.FetchPlaytimeByAntags();
118+
var miscellaneousPlaytimes = _jobRequirementsManager.FetchPlaytimeMiscellaneous(rolePlaytimes, antagPlaytimes);
119+
// Starlight END
117120

118121
RolesPlaytimeList.RemoveAllChildren();
119122
PopulatePlaytimeHeader();
@@ -132,6 +135,16 @@ private void PopulatePlaytimeData()
132135
var playtime = departmentPlaytime.Value;
133136
AddRolePlaytimeEntryToTable(Loc.GetString(department.Name), playtime.ToString(), textColor: department.Color); //starlight edit
134137
}
138+
foreach (var antagPlaytime in antagPlaytimes)
139+
{
140+
AddRolePlaytimeEntryToTable(Loc.GetString(antagPlaytime.Key.Name), antagPlaytime.Value.ToString(), textColor: _antagColor);
141+
}
142+
foreach (var miscellaneousPlaytime in miscellaneousPlaytimes)
143+
{
144+
var role = miscellaneousPlaytime.Key;
145+
var playtime = miscellaneousPlaytime.Value;
146+
AddRolePlaytimeEntryToTable(Loc.GetString(role.Name), playtime.ToString(), textColor: _ghostColor);
147+
}
135148
//starlight end
136149
}
137150

Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Diagnostics.CodeAnalysis;
2+
using System.Linq;
23
using Content.Shared.CCVar;
34
using Content.Shared.Players;
45
using Content.Shared.Players.JobWhitelist;
@@ -375,6 +376,50 @@ public IEnumerable<KeyValuePair<DepartmentPrototype, TimeSpan>> FetchPlaytimeByD
375376
yield return new KeyValuePair<DepartmentPrototype, TimeSpan>(department, departmentTime);
376377
}
377378
}
379+
380+
/// <summary>
381+
/// Fetches playtime per antag prototype.
382+
/// </summary>b
383+
public IEnumerable<KeyValuePair<AntagPrototype, TimeSpan>> FetchPlaytimeByAntags()
384+
{
385+
var antagsToMap = _prototypes.EnumeratePrototypes<AntagPrototype>();
386+
foreach (var antag in antagsToMap)
387+
{
388+
if (antag.PlayTimeTracker == null)
389+
continue;
390+
391+
if (_mergedRoles.TryGetValue(antag.PlayTimeTracker, out var time))
392+
yield return new KeyValuePair<AntagPrototype, TimeSpan>(antag, time);
393+
}
394+
}
395+
396+
/// <summary>
397+
/// Fetches playtime for all PlayTimeTracker prototypes that we don't see in any job or antag.
398+
/// This covers ghost roles and various admin spawns.
399+
/// </summary>
400+
public IEnumerable<KeyValuePair<PlayTimeTrackerPrototype, TimeSpan>> FetchPlaytimeMiscellaneous(
401+
IEnumerable<KeyValuePair<JobPrototype, TimeSpan>> jobPlaytimes,
402+
IEnumerable<KeyValuePair<AntagPrototype, TimeSpan>> antagPlaytimes)
403+
{
404+
var trackers = _prototypes.EnumeratePrototypes<PlayTimeTrackerPrototype>();
405+
var exclude = new HashSet<string> { "Overall" };
406+
foreach (var jobPlaytime in jobPlaytimes)
407+
exclude.Add(jobPlaytime.Key.PlayTimeTracker);
408+
foreach (var antagPlaytime in antagPlaytimes)
409+
if (antagPlaytime.Key.PlayTimeTracker != null)
410+
exclude.Add(antagPlaytime.Key.PlayTimeTracker);
411+
412+
foreach (var tracker in trackers)
413+
{
414+
if (exclude.Contains(tracker.ID))
415+
continue;
416+
417+
if (!_mergedRoles.TryGetValue(tracker.ID, out var rolePlaytime))
418+
continue;
419+
420+
yield return new KeyValuePair<PlayTimeTrackerPrototype, TimeSpan>(tracker, rolePlaytime);
421+
}
422+
}
378423
//starlight end
379424

380425
public IReadOnlyDictionary<string, TimeSpan> GetPlayTimes(ICommonSession session)

Content.Client/Silicons/StationAi/StationAiOverlay.cs

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,17 @@ public sealed class StationAiOverlay : Overlay
3636
private readonly NavMapControl _navMap = new(); // Carpmosia-edit - AI Navmap
3737

3838
private readonly OverlayResourceCache<CachedResources> _resources = new();
39-
private Dictionary<Color, Color> _sRGBLookUp = new(); // Carpmosia-edit - AI Navmap
4039

41-
private float _updateRate = 1f / 30f;
40+
// Carpmosia-start - AI Navmap
41+
private readonly Dictionary<Color, Color> _sRgbLookUp = new();
42+
private static readonly RenderTargetFormatParameters RenderTargetFormatParameters = new(RenderTargetColorFormat.Rgba8Srgb);
43+
44+
private static readonly List<Vector2> TileLinesToDraw = [];
45+
private static readonly List<Vector2> TileRectsToDraw = [];
46+
47+
private const float UpdateRate = 1f / 30f;
48+
// Carpmosia-end - AI Navmap
49+
4250
private float _accumulator;
4351

4452
public StationAiOverlay()
@@ -59,30 +67,32 @@ protected override void Draw(in OverlayDrawArgs args)
5967
{
6068
res.StaticTexture?.Dispose();
6169
res.StencilTexture?.Dispose();
62-
res.StencilTexture = _clyde.CreateRenderTarget(args.Viewport.Size, new RenderTargetFormatParameters(RenderTargetColorFormat.Rgba8Srgb), name: "station-ai-stencil");
70+
71+
// Carpmosia-start - AI Navmap
72+
res.StencilTexture = _clyde.CreateRenderTarget(args.Viewport.Size, RenderTargetFormatParameters, name: "station-ai-stencil");
6373
res.StaticTexture = _clyde.CreateRenderTarget(args.Viewport.Size,
64-
new RenderTargetFormatParameters(RenderTargetColorFormat.Rgba8Srgb),
74+
RenderTargetFormatParameters,
6575
name: "station-ai-static");
76+
// Carpmosia-end - AI Navmap
6677
}
6778

6879
var worldHandle = args.WorldHandle;
6980

7081
var worldBounds = args.WorldBounds;
71-
// var playerEnt = _player.LocalEntity;
7282

73-
// Starlight-start: moved to be after new playerEnt definition with edit
74-
var playerEnt = _player.LocalEntity;
83+
// Starlight-start: moved to be after new playerEnt definition with edit
84+
var playerEnt = _player.LocalEntity;
7585

7686
// Check for cross-grid viewing (e.g., Abductor remote eye) BEFORE getting gridUid
77-
if (_entManager.TryGetComponent(playerEnt, out StationAiOverlayComponent? stationAiOverlay)
78-
&& stationAiOverlay.AllowCrossGrid
87+
if (_entManager.TryGetComponent(playerEnt, out StationAiOverlayComponent? stationAiOverlay)
88+
&& stationAiOverlay.AllowCrossGrid
7989
&& _entManager.TryGetComponent(playerEnt, out RelayInputMoverComponent? relay))
8090
playerEnt = relay.RelayEntity;
8191

8292
// Starlight - start
8393
_entManager.TryGetComponent(playerEnt, out StationAiOverlayComponent? relayStationAiOverlay);
8494
// Starlight - end
85-
95+
8696
_entManager.TryGetComponent(playerEnt, out TransformComponent? playerXform);
8797
var gridUid = playerXform?.GridUid ?? EntityUid.Invalid;
8898
_entManager.TryGetComponent(gridUid, out MapGridComponent? grid);
@@ -101,10 +111,10 @@ protected override void Draw(in OverlayDrawArgs args)
101111
if (stationAiOverlay is not null) // 🌟Starlight🌟
102112
color = color.WithAlpha(stationAiOverlay.Alfa); // 🌟Starlight🌟
103113

104-
_navMap.AiFrameUpdate((float) _timing.FrameTime.TotalSeconds, gridUid); // Carpmosia-edit - AI Navmap
114+
_navMap.AiFrameUpdate((float)_timing.FrameTime.TotalSeconds, gridUid); // Carpmosia-edit - AI Navmap
105115
if (_accumulator <= 0f)
106116
{
107-
_accumulator = MathF.Max(0f, _accumulator + _updateRate);
117+
_accumulator = MathF.Max(0f, _accumulator + UpdateRate); // Carpmosia-edit - AI Navmap
108118
_visibleTiles.Clear();
109119
// Starlight - start
110120
_visibleTileTags.Clear();
@@ -212,65 +222,67 @@ public void Dispose()
212222
// Carpmosia-start - AI Navmap
213223
protected void DrawNavMap(DrawingHandleWorld handle, MapGridComponent grid)
214224
{
215-
if (!_sRGBLookUp.TryGetValue(_navMap.WallColor, out var wallsRGB))
225+
if (!_sRgbLookUp.TryGetValue(_navMap.WallColor, out var wallsRgb))
216226
{
217-
wallsRGB = Color.ToSrgb(_navMap.WallColor);
218-
_sRGBLookUp[_navMap.WallColor] = wallsRGB;
227+
wallsRgb = Color.ToSrgb(_navMap.WallColor);
228+
_sRgbLookUp[_navMap.WallColor] = wallsRgb;
219229
}
220230

221231
// Draw floor tiles
222-
if (_navMap.TilePolygons.Any())
232+
if (_navMap.TilePolygons.Count != 0)
223233
{
224234
foreach (var (polygonVerts, polygonColor) in _navMap.TilePolygons)
225235
{
226-
handle.DrawPrimitives(DrawPrimitiveTopology.TriangleFan, polygonVerts[..polygonVerts.Length], polygonColor);
236+
handle.DrawPrimitives(DrawPrimitiveTopology.TriangleFan, polygonVerts.AsSpan()[..], polygonColor);
227237
}
228238
}
229239

230240
// Draw map lines
231-
if (_navMap.TileLines.Any())
241+
if (_navMap.TileLines.Count != 0)
232242
{
233-
var lines = new ValueList<Vector2>(_navMap.TileLines.Count * 2);
243+
TileLinesToDraw.Clear();
244+
TileLinesToDraw.EnsureCapacity(_navMap.TileLines.Count * 2);
234245

235246
foreach (var (o, t) in _navMap.TileLines)
236247
{
237-
var origin = new Vector2(o.X, -o.Y);
238-
var terminus = new Vector2(t.X, -t.Y);
248+
var origin = o with { Y = -o.Y };
249+
var terminus = t with { Y = -t.Y };
239250

240-
lines.Add(origin);
241-
lines.Add(terminus);
251+
TileLinesToDraw.Add(origin);
252+
TileLinesToDraw.Add(terminus);
242253
}
243254

244-
if (lines.Count > 0)
245-
handle.DrawPrimitives(DrawPrimitiveTopology.LineList, lines.Span, wallsRGB);
255+
if (TileLinesToDraw.Count > 0)
256+
handle.DrawPrimitives(DrawPrimitiveTopology.LineList, TileLinesToDraw, wallsRgb);
246257
}
247258

248259
// Draw map rects
249-
if (_navMap.TileRects.Any())
260+
if (_navMap.TileRects.Count != 0)
250261
{
251-
var rects = new ValueList<Vector2>(_navMap.TileRects.Count * 8);
262+
TileRectsToDraw.Clear();
263+
TileRectsToDraw.EnsureCapacity(_navMap.TileRects.Count * 8);
252264

253265
foreach (var (lt, rb) in _navMap.TileRects)
254266
{
255-
var leftTop = new Vector2(lt.X, -lt.Y);
256-
var rightBottom = new Vector2(rb.X, -rb.Y);
267+
var leftTop = lt with { Y = -lt.Y };
268+
var rightBottom = rb with { Y = -rb.Y };
257269

258270
var rightTop = new Vector2(rightBottom.X, leftTop.Y);
259271
var leftBottom = new Vector2(leftTop.X, rightBottom.Y);
260272

261-
rects.Add(leftTop);
262-
rects.Add(rightTop);
263-
rects.Add(rightTop);
264-
rects.Add(rightBottom);
265-
rects.Add(rightBottom);
266-
rects.Add(leftBottom);
267-
rects.Add(leftBottom);
268-
rects.Add(leftTop);
273+
TileRectsToDraw.Add(leftTop);
274+
TileRectsToDraw.Add(rightTop);
275+
TileRectsToDraw.Add(rightTop);
276+
TileRectsToDraw.Add(rightBottom);
277+
TileRectsToDraw.Add(rightBottom);
278+
TileRectsToDraw.Add(leftBottom);
279+
TileRectsToDraw.Add(leftBottom);
280+
TileRectsToDraw.Add(leftTop);
269281
}
270282

271-
if (rects.Count > 0)
272-
handle.DrawPrimitives(DrawPrimitiveTopology.LineList, rects.Span, wallsRGB);
283+
if (TileRectsToDraw.Count > 0)
284+
handle.DrawPrimitives(DrawPrimitiveTopology.LineList, TileRectsToDraw, wallsRgb);
273285
}
274286
}
275287
// Carpmosia-end - AI Navmap
276-
}
288+
}

Content.Client/Store/Ui/StoreListingControl.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private void UpdateBuyButtonText()
103103
var m = _priceNumberRegex.Match(_price);
104104
if (m.Success)
105105
{
106-
StoreItemBuyButton.Text = $"{m.Groups[1].Value}¢";
106+
StoreItemBuyButton.Text = $"{m.Groups[1].Value}¢";
107107
}
108108
else
109109
{

Content.Client/_NullLink/UI/Hub.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
namespace Content.Client._NullLink.UI;
2525

26-
// It’s not finished, still needs a lot of info displayed, scroll support once more servers show up, max hub width, a hide button, etc.
27-
// But I’m rushing it for the upstream, will finish it properly someday.
26+
// It’s not finished, still needs a lot of info displayed, scroll support once more servers show up, max hub width, a hide button, etc.
27+
// But I’m rushing it for the upstream, will finish it properly someday.
2828
internal sealed class Hub : PanelContainer, IDisposable
2929
{
3030
[Dependency] private readonly ILogManager _logs = default!;
@@ -59,8 +59,8 @@ public Hub()
5959
};
6060
AddChild(_gridContainer);
6161

62-
// This crap throws a NullRef exception—what the hell, the Try method doesn’t even check for null,
63-
// and Init is private, so there’s no way to figure out what’s going on in there.
62+
// This crap throws a NullRef exception—what the hell, the Try method doesn’t even check for null,
63+
// and Init is private, so there’s no way to figure out what’s going on in there.
6464
//try
6565
//{
6666
// if (_systemManager.TryGetEntitySystem<HubSystem>(out var hub))
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Content.Client._Starlight.Logs;
2+
using Robust.Client.UserInterface;
3+
using Robust.Shared.Console;
4+
5+
namespace Content.Client._Starlight.Commands;
6+
7+
public sealed class OpenLogLevelsCommand : IConsoleCommand
8+
{
9+
public string Command => "logs";
10+
public string Description => "Open the sawmill log level configuration window.";
11+
public string Help => "logs";
12+
13+
public void Execute(IConsoleShell shell, string argStr, string[] args)
14+
{
15+
var window = new LogLevelsWindow();
16+
window.OpenCentered();
17+
}
18+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using Content.Shared.Starlight.CCVar;
2+
using Robust.Shared.Configuration;
3+
using Robust.Shared.Log;
4+
5+
namespace Content.Client._Starlight.Logs;
6+
7+
/// <summary>
8+
/// Restores persisted sawmill log levels from CVar on startup.
9+
/// </summary>
10+
public sealed class LogLevelSystem : EntitySystem
11+
{
12+
[Dependency] private readonly ILogManager _logManager = default!;
13+
[Dependency] private readonly IConfigurationManager _cfg = default!;
14+
15+
public override void Initialize()
16+
{
17+
base.Initialize();
18+
ApplySavedLevels();
19+
}
20+
21+
private void ApplySavedLevels()
22+
{
23+
var raw = _cfg.GetCVar(StarlightCCVars.LogSawmillLevels);
24+
if (string.IsNullOrEmpty(raw))
25+
return;
26+
27+
foreach (var entry in raw.Split(';', StringSplitOptions.RemoveEmptyEntries))
28+
{
29+
var sep = entry.IndexOf('=');
30+
if (sep <= 0)
31+
continue;
32+
33+
var name = entry[..sep];
34+
var levelStr = entry[(sep + 1)..];
35+
36+
if (!Enum.TryParse<LogLevel>(levelStr, out var level))
37+
continue;
38+
39+
var sawmill = _logManager.GetSawmill(name);
40+
sawmill.Level = level;
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)