Skip to content

Commit

Permalink
Merge branch 'maprotofix' of https://github.com/Truoizys/prison-stati…
Browse files Browse the repository at this point in the history
…on-14 into maprotofix
  • Loading branch information
Truoizys committed Jul 14, 2024
2 parents 5553fc0 + 70a7f08 commit 51e8376
Show file tree
Hide file tree
Showing 244 changed files with 11,649 additions and 12,069 deletions.
4 changes: 2 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"Changes: Map":
- changed-files:
- any-glob-to-any-file:
- 'Resources/Maps/*.yml'
- 'Resources/Prototypes/Maps/*.yml'
- 'Resources/Maps/**/*.yml'
- 'Resources/Prototypes/Maps/**/*.yml'

"Changes: UI":
- changed-files:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Popup xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client">
<PanelContainer StyleClasses="BackgroundDark">
<PanelContainer>
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BorderThickness="1" BorderColor="#18181B"/>
<gfx:StyleBoxFlat BorderThickness="2" BorderColor="#18181B" BackgroundColor="#25252a"/>
</PanelContainer.PanelOverride>
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Vertical" Margin="4 4 4 4">
<Label Name="PlayerNameLabel"/>
<Label Name="IdLabel"/>
<Label Name="TypeLabel"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,36 @@
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Prototypes;
using Content.Shared.Inventory;

namespace Content.Client.Chat.TypingIndicator;

public sealed class TypingIndicatorVisualizerSystem : VisualizerSystem<TypingIndicatorComponent>
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly InventorySystem _inventory = default!;


protected override void OnAppearanceChange(EntityUid uid, TypingIndicatorComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;

if (!_prototypeManager.TryIndex<TypingIndicatorPrototype>(component.Prototype, out var proto))
var currentTypingIndicator = component.TypingIndicatorPrototype;

var evt = new BeforeShowTypingIndicatorEvent();

if (TryComp<InventoryComponent>(uid, out var inventoryComp))
_inventory.RelayEvent((uid, inventoryComp), ref evt);

var overrideIndicator = evt.GetMostRecentIndicator();

if (overrideIndicator != null)
currentTypingIndicator = overrideIndicator.Value;

if (!_prototypeManager.TryIndex(currentTypingIndicator, out var proto))
{
Log.Error($"Unknown typing indicator id: {component.Prototype}");
Log.Error($"Unknown typing indicator id: {component.TypingIndicatorPrototype}");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ public void UpdateCountdown()
}

EmergencyShuttleButton.Text = Loc.GetString("comms-console-menu-recall-shuttle");
CountdownLabel.SetMessage($"Time remaining\n{Owner.Countdown.ToString()}s");
var infoText = Loc.GetString($"comms-console-menu-time-remaining",
("time", Owner.Countdown.ToString()));
CountdownLabel.SetMessage(infoText);
}

public override void Close()
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Fax/AdminUI/AdminFaxEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public AdminFaxEui()
_window.OnClose += () => SendMessage(new AdminFaxEuiMsg.Close());
_window.OnFollowFax += entity => SendMessage(new AdminFaxEuiMsg.Follow(entity));
_window.OnMessageSend += args => SendMessage(new AdminFaxEuiMsg.Send(args.entity, args.title,
args.stampedBy, args.message, args.stampSprite, args.stampColor));
args.stampedBy, args.message, args.stampSprite, args.stampColor, args.locked));
}

public override void Opened()
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Fax/AdminUI/AdminFaxWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</BoxContainer>
<Label Text="{Loc admin-fax-stamp-color}" />
<ColorSelectorSliders Margin="12 0 0 0" Name="StampColorSelector" Color="#BB3232"/>
<Control MinHeight="10" />
<Button Name="SendButton" Text="{Loc admin-fax-send}"></Button>
<CheckBox Name="LockPageCheckbox" Text="{Loc admin-fax-lock-page}" ToolTip="{Loc admin-fax-lock-page-tooltip}"/>
<Button Name="SendButton" Text="{Loc admin-fax-send}" Margin="0 10 0 0" />
</BoxContainer>
</DefaultWindow>
5 changes: 3 additions & 2 deletions Content.Client/Fax/AdminUI/AdminFaxWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed partial class AdminFaxWindow : DefaultWindow
{
private const string StampsRsiPath = "/Textures/Objects/Misc/bureaucracy.rsi";

public Action<(NetEntity entity, string title, string stampedBy, string message, string stampSprite, Color stampColor)>? OnMessageSend;
public Action<(NetEntity entity, string title, string stampedBy, string message, string stampSprite, Color stampColor, bool locked)>? OnMessageSend;
public Action<NetEntity>? OnFollowFax;

[Dependency] private readonly IResourceCache _resCache = default!;
Expand Down Expand Up @@ -98,6 +98,7 @@ private void SendMessage(BaseButton.ButtonEventArgs obj)

var from = FromEdit.Text;
var stampColor = StampColorSelector.Color;
OnMessageSend?.Invoke((faxEntity.Value, title, from, message, stamp, stampColor));
var locked = LockPageCheckbox.Pressed;
OnMessageSend?.Invoke((faxEntity.Value, title, from, message, stamp, stampColor, locked));
}
}
9 changes: 0 additions & 9 deletions Content.Client/Items/Systems/ItemToggleSystem.cs

This file was deleted.

55 changes: 49 additions & 6 deletions Content.Client/Lobby/LobbyUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public sealed class LobbyUIController : UIController, IOnStateEntered<LobbyState

private CharacterSetupGui? _characterSetup;
private HumanoidProfileEditor? _profileEditor;
private CharacterSetupGuiSavePanel? _savePanel;

/// <summary>
/// This is the characher preview panel in the chat. This should only update if their character updates.
Expand Down Expand Up @@ -214,6 +215,46 @@ private void SaveProfile()
ReloadCharacterSetup();
}

private void CloseProfileEditor()
{
if (_profileEditor == null)
return;

_profileEditor.SetProfile(null, null);
_profileEditor.Visible = false;

if (_stateManager.CurrentState is LobbyState lobbyGui)
{
lobbyGui.SwitchState(LobbyGui.LobbyGuiState.Default);
}
}

private void OpenSavePanel()
{
if (_savePanel is { IsOpen: true })
return;

_savePanel = new CharacterSetupGuiSavePanel();

_savePanel.SaveButton.OnPressed += _ =>
{
SaveProfile();

_savePanel.Close();

CloseProfileEditor();
};

_savePanel.NoSaveButton.OnPressed += _ =>
{
_savePanel.Close();

CloseProfileEditor();
};

_savePanel.OpenCentered();
}

private (CharacterSetupGui, HumanoidProfileEditor) EnsureGui()
{
if (_characterSetup != null && _profileEditor != null)
Expand All @@ -240,14 +281,16 @@ private void SaveProfile()

_characterSetup.CloseButton.OnPressed += _ =>
{
// Reset sliders etc.
_profileEditor.SetProfile(null, null);
_profileEditor.Visible = false;

if (_stateManager.CurrentState is LobbyState lobbyGui)
// Open the save panel if we have unsaved changes.
if (_profileEditor.Profile != null && _profileEditor.IsDirty)
{
lobbyGui.SwitchState(LobbyGui.LobbyGuiState.Default);
OpenSavePanel();

return;
}

// Reset sliders etc.
CloseProfileEditor();
};

_profileEditor.Save += SaveProfile;
Expand Down
10 changes: 10 additions & 0 deletions Content.Client/Lobby/UI/CharacterSetupGuiSavePanel.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<DefaultWindow xmlns="https://spacestation14.io"
Title="{Loc 'character-setup-gui-save-panel-title'}"
Resizable="False">

<BoxContainer Orientation="Horizontal" SeparationOverride="4" MinSize="200 40">
<Button Name="SaveButton" Access="Public" Text="{Loc 'character-setup-gui-save-panel-save'}" StyleClasses="ButtonBig"/>
<Button Name="NoSaveButton" Access="Public" Text="{Loc 'character-setup-gui-save-panel-nosave'}" StyleClasses="ButtonBig"/>
<Button Name="CancelButton" Access="Public" Text="{Loc 'character-setup-gui-save-panel-cancel'}" StyleClasses="ButtonBig"/>
</BoxContainer>
</DefaultWindow>
21 changes: 21 additions & 0 deletions Content.Client/Lobby/UI/CharacterSetupGuiSavePanel.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Lobby.UI;

[GenerateTypedNameReferences]
public sealed partial class CharacterSetupGuiSavePanel : DefaultWindow
{
public CharacterSetupGuiSavePanel()
{
RobustXamlLoader.Load(this);

CancelButton.OnPressed += _ =>
{
Close();
};

CloseButton.Visible = false;
}
}
2 changes: 1 addition & 1 deletion Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ private void SetSpawnPriority(SpawnPriorityPreference newSpawnPriority)
SetDirty();
}

private bool IsDirty
public bool IsDirty
{
get => _isDirty;
set
Expand Down
5 changes: 5 additions & 0 deletions Content.Client/Ninja/Systems/ItemCreatorSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Content.Shared.Ninja.Systems;

namespace Content.Client.Ninja.Systems;

public sealed class ItemCreatorSystem : SharedItemCreatorSystem;
7 changes: 1 addition & 6 deletions Content.Client/Ninja/Systems/NinjaGlovesSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@

namespace Content.Client.Ninja.Systems;

/// <summary>
/// Does nothing special, only exists to provide a client implementation.
/// </summary>
public sealed class NinjaGlovesSystem : SharedNinjaGlovesSystem
{
}
public sealed class NinjaGlovesSystem : SharedNinjaGlovesSystem;
21 changes: 1 addition & 20 deletions Content.Client/Ninja/Systems/NinjaSuitSystem.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Ninja.Components;
using Content.Shared.Ninja.Systems;

namespace Content.Client.Ninja.Systems;

/// <summary>
/// Disables cloak prediction since client has no knowledge of battery power.
/// Cloak will still be enabled after server tells it.
/// </summary>
public sealed class NinjaSuitSystem : SharedNinjaSuitSystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<NinjaSuitComponent, AttemptStealthEvent>(OnAttemptStealth);
}

private void OnAttemptStealth(EntityUid uid, NinjaSuitComponent comp, AttemptStealthEvent args)
{
args.Cancel();
}
}
public sealed class NinjaSuitSystem : SharedNinjaSuitSystem;
9 changes: 1 addition & 8 deletions Content.Client/Ninja/Systems/NinjaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@

namespace Content.Client.Ninja.Systems;

/// <summary>
/// Currently does nothing special clientside.
/// All functionality is in shared and server.
/// Only exists to prevent crashing.
/// </summary>
public sealed class SpaceNinjaSystem : SharedSpaceNinjaSystem
{
}
public sealed class SpaceNinjaSystem : SharedSpaceNinjaSystem;
5 changes: 5 additions & 0 deletions Content.Client/Ninja/Systems/SpiderChargeSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Content.Shared.Ninja.Systems;

namespace Content.Client.Ninja.Systems;

public sealed class SpiderChargeSystem : SharedSpiderChargeSystem;
1 change: 0 additions & 1 deletion Content.Client/Throwing/ThrownItemVisualizerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ private void OnShutdown(EntityUid uid, ThrownItemComponent component, ComponentS
if (length <= TimeSpan.Zero)
return null;

length += TimeSpan.FromSeconds(ThrowingSystem.FlyTime);
var scale = ent.Comp2.Scale;
var lenFloat = (float) length.TotalSeconds;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:windows="clr-namespace:Content.Client.UserInterface.Systems.Actions.Windows"
Name="ActionsList"
HorizontalExpand="True"
Title="Actions"
Title="{Loc ui-actionmenu-title}"
VerticalExpand="True"
Resizable="True"
MinHeight="300"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ActionsWindow()

foreach (var filter in Enum.GetValues<Filters>())
{
FilterButton.AddItem(filter.ToString(), filter);
FilterButton.AddItem(Loc.GetString($"ui-actionmenu-{filter.ToString().ToLower()}"), filter);
}
}

Expand Down
53 changes: 53 additions & 0 deletions Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.EntitySystems;
using Robust.Shared.GameObjects;

namespace Content.IntegrationTests.Tests.Atmos;

[TestFixture]
public sealed class GridJoinTest
{
private const string CanisterProtoId = "AirCanister";

[Test]
public async Task TestGridJoinAtmosphere()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;

var entMan = server.EntMan;
var protoMan = server.ProtoMan;
var atmosSystem = entMan.System<AtmosphereSystem>();
var atmosDeviceSystem = entMan.System<AtmosDeviceSystem>();
var transformSystem = entMan.System<SharedTransformSystem>();

var testMap = await pair.CreateTestMap();

await server.WaitPost(() =>
{
// Spawn an atmos device on the grid
var canister = entMan.Spawn(CanisterProtoId);
transformSystem.SetCoordinates(canister, testMap.GridCoords);
var deviceComp = entMan.GetComponent<AtmosDeviceComponent>(canister);
var canisterEnt = (canister, deviceComp);

// Make sure the canister is tracked as an off-grid device
Assert.That(atmosDeviceSystem.IsJoinedOffGrid(canisterEnt));

// Add an atmosphere to the grid
entMan.AddComponent<GridAtmosphereComponent>(testMap.Grid);

// Force AtmosDeviceSystem to update off-grid devices
// This means the canister is now considered on-grid,
// but it's still tracked as off-grid!
Assert.DoesNotThrow(() => atmosDeviceSystem.Update(atmosSystem.AtmosTime));

// Make sure that the canister is now properly tracked as on-grid
Assert.That(atmosDeviceSystem.IsJoinedOffGrid(canisterEnt), Is.False);
});

await pair.CleanReturnAsync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ await Server.WaitPost(() =>
// turn on welders
if (enableToggleable && SEntMan.TryGetComponent(item, out itemToggle) && !itemToggle.Activated)
{
Assert.That(ItemToggleSys.TryActivate(item, playerEnt, itemToggle: itemToggle));
Assert.That(ItemToggleSys.TryActivate((item, itemToggle), user: playerEnt));
}
});

Expand Down
Loading

0 comments on commit 51e8376

Please sign in to comment.