Skip to content

Commit 01ed6b6

Browse files
authored
Merge branch 'starlight-dev' into GroupHowlEvent
2 parents e03f99f + ff5aa75 commit 01ed6b6

254 files changed

Lines changed: 77971 additions & 70535 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.

Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,36 @@ private void OnInit(EntityUid uid, PipeAppearanceComponent component, ComponentI
2929

3030
var numberOfPipeLayers = GetNumberOfPipeLayers(uid, out _);
3131

32+
// Starlight START
33+
_sprite.LayerMapTryGet((uid, sprite), PipeVisualLayers.Pipe, out var pipeIndex, false);
34+
// Starlight END
35+
3236
foreach (var layerKey in Enum.GetValues<PipeConnectionLayer>())
3337
{
3438
for (byte i = 0; i < numberOfPipeLayers; i++)
3539
{
3640
var layerName = layerKey.ToString() + i.ToString();
37-
var layer = _sprite.LayerMapReserve((uid, sprite), layerName);
41+
42+
// Starlight START
43+
// The generated layer should go directly after the main pipe layer, not at the end, hence the pipeIndex+1.
44+
if (!_sprite.LayerMapTryGet((uid, sprite), layerName, out var layer, false))
45+
{
46+
layer = pipeIndex + 1;
47+
_sprite.AddBlankLayer((uid, sprite), layer);
48+
_sprite.LayerMapSet((uid, sprite), layerName, layer);
49+
}
50+
// Starlight END
51+
3852
_sprite.LayerSetRsi((uid, sprite), layer, component.Sprite[i].RsiPath);
3953
_sprite.LayerSetRsiState((uid, sprite), layer, component.Sprite[i].RsiState);
4054
_sprite.LayerSetDirOffset((uid, sprite), layer, ToOffset(layerKey));
55+
56+
// Starlight START
57+
// The generated pipe inlet/outlets don't have the correct offset, but we can simply use the inverse
58+
// of the whole sprite offset to fix that. This fixes things like large tanks where the body sprite
59+
// and "the tile" are offset from one another.
60+
_sprite.LayerSetOffset((uid, sprite), layer, -sprite.Offset);
61+
// Starlight END
4162
}
4263
}
4364
}

Content.Client/Construction/ConstructionSystem.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ public bool TrySpawnGhost(
317317
var targetSprite = EnsureComp<SpriteComponent>(dummy);
318318
EntityManager.System<AppearanceSystem>().OnChangeData(dummy, targetSprite);
319319

320+
var destIndex = 0; // Starlight: Track how many layers we've actually added
320321
for (var i = 0; i < targetSprite.AllLayers.Count(); i++)
321322
{
322323
if (!targetSprite[i].Visible || !targetSprite[i].RsiState.IsValid)
@@ -327,12 +328,21 @@ public bool TrySpawnGhost(
327328
state.StateId.Name is null)
328329
continue;
329330

330-
_sprite.AddBlankLayer((ghost.Value, sprite), i);
331-
_sprite.LayerSetSprite((ghost.Value, sprite), i, new SpriteSpecifier.Rsi(rsi.Path, state.StateId.Name));
332-
sprite.LayerSetShader(i, "unshaded");
333-
_sprite.LayerSetVisible((ghost.Value, sprite), i, true);
334-
_sprite.LayerSetOffset((ghost.Value, sprite), i, // Starlight: Fix offset not being copied
335-
targetSprite.Offset + ((SpriteComponent.Layer)targetSprite[i]).Offset); // Starlight
331+
// Starlight START
332+
// Most of these lines only changed i => destIndex. By counting how many layers we add we prevent
333+
// empty layers since empty/missing layer indices causes bugs *elsewhere*. Yay.
334+
_sprite.AddBlankLayer((ghost.Value, sprite), destIndex);
335+
_sprite.LayerSetSprite((ghost.Value, sprite), destIndex, new SpriteSpecifier.Rsi(rsi.Path, state.StateId.Name));
336+
sprite.LayerSetShader(destIndex, "unshaded");
337+
_sprite.LayerSetVisible((ghost.Value, sprite), destIndex, true);
338+
339+
// This is new: Fix offset not being copied
340+
_sprite.LayerSetOffset((ghost.Value, sprite), destIndex,
341+
targetSprite.Offset + ((SpriteComponent.Layer)targetSprite[i]).Offset);
342+
343+
// Count the added layer
344+
destIndex++;
345+
// Starlight END
336346
}
337347

338348
sprite.NoRotation = targetSprite.NoRotation; // Starlight: Fix NoRotation also being ignored.

Content.Client/Toggleable/ToggleableVisualsComponent.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,26 @@ public sealed partial class ToggleableVisualsComponent : Component
2727
/// </summary>
2828
[DataField]
2929
public Dictionary<string, List<PrototypeLayerData>> ClothingVisuals = new();
30+
31+
#region Starlight
32+
33+
/// <summary>
34+
/// Additional layers to toggle.
35+
/// </summary>
36+
/// <remarks>
37+
/// Added to avoid needing to alter several dozen prototypes.
38+
/// </remarks>
39+
[DataField] public List<string> AdditionalLayers = [];
40+
41+
/// <summary>
42+
/// List of layers to ignore when modulating color with appearance data.
43+
/// </summary>
44+
[DataField] public List<string> ModulateIgnoreLayers = [];
45+
46+
/// <summary>
47+
/// Toggleable visuals for when wielding item.
48+
/// </summary>
49+
[DataField] public Dictionary<HandLocation, List<PrototypeLayerData>> WieldingVisuals = [];
50+
51+
#endregion
3052
}

Content.Client/Toggleable/ToggleableVisualsSystem.cs

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
using Content.Shared.Item;
88
using Content.Shared.Light.Components;
99
using Content.Shared.Toggleable;
10+
using Content.Shared.Wieldable;
11+
using Content.Shared.Wieldable.Components;
1012
using Robust.Client.GameObjects;
1113
using Robust.Shared.Utility;
1214

@@ -30,6 +32,10 @@ public override void Initialize()
3032
after: [typeof(ItemSystem)]);
3133
SubscribeLocalEvent<ToggleableVisualsComponent, GetEquipmentVisualsEvent>(OnGetEquipmentVisuals,
3234
after: [typeof(ClientClothingSystem)]);
35+
// Starlight begin
36+
SubscribeLocalEvent<ToggleableVisualsComponent, ItemWieldedEvent>(OnItemWielded);
37+
SubscribeLocalEvent<ToggleableVisualsComponent, ItemUnwieldedEvent>(OnItemUnwielded);
38+
// Starlight end
3339
}
3440

3541
protected override void OnAppearanceChange(EntityUid uid,
@@ -47,10 +53,20 @@ protected override void OnAppearanceChange(EntityUid uid,
4753
SpriteSystem.LayerMapTryGet((uid, args.Sprite), component.SpriteLayer, out var layer, false))
4854
{
4955
SpriteSystem.LayerSetVisible((uid, args.Sprite), layer, enabled);
50-
if (modulateColor)
56+
if (modulateColor && !component.ModulateIgnoreLayers.Contains(component.SpriteLayer)) // Starlight edit
5157
SpriteSystem.LayerSetColor((uid, args.Sprite), component.SpriteLayer, color);
5258
}
5359

60+
// Starlight begin
61+
foreach (var spriteLayer in component.AdditionalLayers)
62+
if (SpriteSystem.LayerMapTryGet((uid, args.Sprite), spriteLayer, out var idx, false))
63+
{
64+
SpriteSystem.LayerSetVisible((uid, args.Sprite), idx, enabled);
65+
if (modulateColor && !component.ModulateIgnoreLayers.Contains(spriteLayer))
66+
SpriteSystem.LayerSetColor((uid, args.Sprite), idx, color);
67+
}
68+
// Starlight end
69+
5470
// If there's a `ItemTogglePointLightComponent` that says to apply the color to attached lights, do so.
5571
if (TryComp<ItemTogglePointLightComponent>(uid, out var toggleLights) &&
5672
TryComp(uid, out PointLightComponent? light))
@@ -101,7 +117,7 @@ private void OnGetEquipmentVisuals(EntityUid uid,
101117
i++;
102118
}
103119

104-
if (modulateColor)
120+
if (modulateColor && !component.ModulateIgnoreLayers.Contains(key)) // Starlight edit
105121
layer.Color = color;
106122

107123
args.Layers.Add((key, layer));
@@ -115,8 +131,22 @@ private void OnGetHeldVisuals(EntityUid uid, ToggleableVisualsComponent componen
115131
|| !enabled)
116132
return;
117133

118-
if (!component.InhandVisuals.TryGetValue(args.Location, out var layers))
134+
// Starlight begin
135+
List<PrototypeLayerData>? layers;
136+
137+
if (TryComp<WieldableComponent>(uid, out var wieldable))
138+
{
139+
if (wieldable.Wielded && component.WieldingVisuals.Count > 0)
140+
{
141+
if (!component.WieldingVisuals.TryGetValue(args.Location, out layers))
142+
return;
143+
}
144+
else if (!component.InhandVisuals.TryGetValue(args.Location, out layers))
145+
return;
146+
}
147+
else if (!component.InhandVisuals.TryGetValue(args.Location, out layers))
119148
return;
149+
// Starlight end
120150

121151
var modulateColor = AppearanceSystem.TryGetData<Color>(uid, ToggleableVisuals.Color, out var color, appearance);
122152

@@ -131,10 +161,20 @@ private void OnGetHeldVisuals(EntityUid uid, ToggleableVisualsComponent componen
131161
i++;
132162
}
133163

134-
if (modulateColor)
164+
if (modulateColor && !component.ModulateIgnoreLayers.Contains(key)) // Starlight edit
135165
layer.Color = color;
136166

137167
args.Layers.Add((key, layer));
138168
}
139169
}
170+
171+
#region Starlight
172+
173+
private void OnItemWielded(Entity<ToggleableVisualsComponent> ent, ref ItemWieldedEvent args) =>
174+
_item.VisualsChanged(ent);
175+
176+
private void OnItemUnwielded(Entity<ToggleableVisualsComponent> ent, ref ItemUnwieldedEvent args) =>
177+
_item.VisualsChanged(ent);
178+
179+
#endregion
140180
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<controls:FancyWindow xmlns="https://spacestation14.io"
2+
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
3+
Title="{Loc 'content-warning-title'}"
4+
MinSize="520 775"
5+
MaxSize="520 775"><!-- Starlight: Changed size -->
6+
<BoxContainer Orientation="Vertical" Margin="20">
7+
<Label Name="TitleLabel1"
8+
StyleClasses="LabelBig"
9+
HorizontalAlignment="Center"
10+
Margin="0 0 0 5"
11+
Text="{Loc 'content-warning-label-introduction'}"/>
12+
<PanelContainer Margin="0 0 0 10">
13+
<RichTextLabel Name="ContentWarningBodyIntro" HorizontalAlignment="Center"/>
14+
</PanelContainer>
15+
<Label Name="TitleLabel2"
16+
StyleClasses="LabelBig"
17+
HorizontalAlignment="Center"
18+
Margin="0 0 0 5"
19+
Text="{Loc 'content-warning-label-information'}"/>
20+
<PanelContainer Margin="0 0 0 10">
21+
<RichTextLabel Name="ContentWarningBodyInfo" HorizontalAlignment="Center"/>
22+
</PanelContainer>
23+
<BoxContainer Orientation="Vertical" VerticalAlignment="Bottom" Margin="0 10 0 0">
24+
<Button Name="ContentWarningAccept"
25+
MinWidth="75"
26+
Text="{ Loc 'content-warning-accept' }"/>
27+
<Button Name="ContentWarningReject"
28+
MinWidth="75"
29+
Text="{ Loc 'content-warning-reject' }"/>
30+
</BoxContainer>
31+
</BoxContainer>
32+
</controls:FancyWindow>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
using Content.Client.UserInterface.Controls;
3+
using Robust.Client.AutoGenerated;
4+
using Robust.Client.Console;
5+
using Robust.Client.UserInterface.XAML;
6+
using Robust.Shared.Configuration;
7+
using Robust.Shared.Timing;
8+
using Robust.Shared.Utility;
9+
10+
namespace Content.Client._Funkystation.ContentWarning;
11+
12+
[GenerateTypedNameReferences]
13+
public sealed partial class ContentWarningPopup : FancyWindow
14+
{
15+
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
16+
17+
public event Action? OnContentWarningAccept;
18+
public event Action? OnContentWarningReject;
19+
20+
public ContentWarningPopup()
21+
{
22+
IoCManager.InjectDependencies(this);
23+
RobustXamlLoader.Load(this);
24+
25+
InitWindow();
26+
}
27+
28+
private void InitWindow()
29+
{
30+
// Starlight BEGIN: Dynamic year calculation
31+
var year = DateTime.Now.Year;
32+
year += 500;
33+
ContentWarningBodyIntro.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("content-warning-introduction", ("year", year.ToString()))));
34+
// Starlight END
35+
36+
ContentWarningBodyInfo.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("content-warning-information")));
37+
38+
ContentWarningReject.OnPressed += _ =>
39+
{
40+
OnContentWarningReject?.Invoke();
41+
};
42+
43+
ContentWarningAccept.OnPressed += obj =>
44+
{
45+
OnContentWarningAccept?.Invoke();
46+
};
47+
}
48+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using Content.Client.Gameplay;
2+
using Content.Client.Lobby;
3+
using Content.Shared._Funkystation.CCVars;
4+
using Robust.Client.Console;
5+
using Robust.Client.UserInterface.Controllers;
6+
using Robust.Shared.Configuration;
7+
8+
namespace Content.Client._Funkystation.ContentWarning;
9+
10+
public sealed partial class ContentWarningUIController : UIController, IOnStateEntered<LobbyState>, IOnStateEntered<GameplayState>
11+
{
12+
[Dependency] private readonly IConfigurationManager _cfg = default!;
13+
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
14+
15+
private ContentWarningPopup? _window;
16+
17+
private void AttemptOpenContentWarningPopup()
18+
{
19+
if (!_cfg.GetCVar(CCVars_Funky.ContentWarningDisplay) || _cfg.GetCVar(CCVars_Funky.ContentWarningAcknowledged))
20+
return;
21+
22+
OpenContentWarningPopup();
23+
}
24+
25+
public void OnStateEntered(LobbyState _)
26+
{
27+
AttemptOpenContentWarningPopup();
28+
}
29+
30+
public void OnStateEntered(GameplayState _)
31+
{
32+
AttemptOpenContentWarningPopup();
33+
}
34+
35+
private void OpenContentWarningPopup()
36+
{
37+
if (_window != null)
38+
return;
39+
40+
_window = new ContentWarningPopup();
41+
_window.OpenCentered();
42+
_window.OnContentWarningReject += () =>
43+
{
44+
_window.Close();
45+
_window = null;
46+
47+
if (_cfg.GetCVar(CCVars_Funky.ContentWarningKickOnIgnore))
48+
_consoleHost.ExecuteCommand("quit");
49+
};
50+
_window.OnContentWarningAccept += () =>
51+
{
52+
_window.Close();
53+
_window = null;
54+
_cfg.SetCVar(CCVars_Funky.ContentWarningAcknowledged, true);
55+
_cfg.SaveToFile();
56+
};
57+
}
58+
}

Content.Client/_Moffstation/Antags/UI/AntagEntry.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
HorizontalAlignment="Center"
2727
SetSize="20 20"
2828
Stretch="KeepAspectCentered"
29+
MouseFilter="Stop"
2930
TexturePath="/Textures/Interface/VerbIcons/lock.svg.192dpi.png"
30-
Visible="False"/>
31+
Visible="False"/> <!-- Starlight, enable unlock requirements again -->
3132
</BoxContainer>
3233

3334
<!-- Trait Info -->

Content.Client/_Moffstation/Antags/UI/AntagEntry.xaml.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Content.Shared.Roles;
88
using Robust.Client.AutoGenerated;
99
using Robust.Client.UserInterface.Controls;
10+
using Robust.Client.UserInterface.CustomControls;
1011
using Robust.Client.UserInterface.XAML;
1112
using Robust.Shared.Prototypes;
1213

@@ -63,9 +64,19 @@ private void SetupRequirements(HumanoidCharacterProfile? profile) // Starlight
6364
AntagCheckbox.Visible = !locked;
6465
AntagCheckbox.Disabled = locked;
6566
LockIcon.Visible = locked;
66-
LockIcon.TooltipSupplier = reason != null
67+
#region Starlight
68+
/*LockIcon.TooltipSupplier = reason != null
6769
? _ => new RichTextLabel { Text = reason.ToString() }
68-
: null;
70+
: null;*/
71+
72+
if (!reason.IsEmpty)
73+
{
74+
var tooltip = new Tooltip();
75+
tooltip.SetMessage(reason);
76+
AntagCheckbox.TooltipSupplier = _ => tooltip;
77+
LockIcon.TooltipSupplier = _ => tooltip;
78+
}
79+
#endregion
6980

7081
if (locked)
7182
{

0 commit comments

Comments
 (0)