Skip to content

Commit

Permalink
Merge pull request #502 from Rxup/upstream-sync
Browse files Browse the repository at this point in the history
Upstream sync
  • Loading branch information
Rxup authored Mar 6, 2024
2 parents a8eeb4e + c6a3d44 commit fedbf89
Show file tree
Hide file tree
Showing 251 changed files with 23,932 additions and 1,939 deletions.
5 changes: 5 additions & 0 deletions Content.Client/Administration/Managers/ClientAdminManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Shared.Administration.Managers;
using Robust.Client.Console;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Shared.ContentPack;
using Robust.Shared.Network;
using Robust.Shared.Player;
Expand All @@ -16,6 +17,7 @@ public sealed class ClientAdminManager : IClientAdminManager, IClientConGroupImp
[Dependency] private readonly IClientConGroupController _conGroup = default!;
[Dependency] private readonly IResourceManager _res = default!;
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterface = default!;

private AdminData? _adminData;
private readonly HashSet<string> _availableCommands = new();
Expand Down Expand Up @@ -101,6 +103,9 @@ private void UpdateMessageRx(MsgUpdateAdminStatus message)
{
var flagsText = string.Join("|", AdminFlagsHelper.FlagsToNames(_adminData.Flags));
_sawmill.Info($"Updated admin status: {_adminData.Active}/{_adminData.Title}/{flagsText}");

if (_adminData.Active)
_userInterface.DebugMonitors.SetMonitor(DebugMonitor.Coords, true);
}
else
{
Expand Down
7 changes: 7 additions & 0 deletions Content.Client/Labels/EntitySystems/LabelSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Content.Shared.Labels.EntitySystems;

namespace Content.Client.Labels;

public sealed partial class LabelSystem : SharedLabelSystem
{
}
11 changes: 1 addition & 10 deletions Content.Client/Paper/UI/PaperBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using JetBrains.Annotations;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input;
using Robust.Shared.Utility;
using static Content.Shared.Paper.SharedPaperComponent;

Expand All @@ -22,15 +21,7 @@ protected override void Open()

_window = new PaperWindow();
_window.OnClose += Close;
_window.Input.OnKeyBindDown += args => // Solution while TextEdit don't have events
{
if (args.Function == EngineKeyFunctions.MultilineTextSubmit)
{
var text = Rope.Collapse(_window.Input.TextRope);
Input_OnTextEntered(text);
args.Handle();
}
};
_window.OnSaved += Input_OnTextEntered;

if (EntMan.TryGetComponent<PaperVisualsComponent>(Owner, out var visuals))
{
Expand Down
4 changes: 4 additions & 0 deletions Content.Client/Paper/UI/PaperWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@
</PanelContainer>
</ScrollContainer>
</PanelContainer>
<!-- Bottom buttons for editing -->
<BoxContainer Name="EditButtons" Orientation="Horizontal" HorizontalAlignment="Right" Margin="6">
<Button Name="SaveButton" />
</BoxContainer>
</BoxContainer>
</paper:PaperWindow>
30 changes: 30 additions & 0 deletions Content.Client/Paper/UI/PaperWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@
using Content.Shared.Paper;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
using Robust.Client.UserInterface.RichText;
using Robust.Shared.Input;

namespace Content.Client.Paper.UI
{
[GenerateTypedNameReferences]
public sealed partial class PaperWindow : BaseWindow
{
[Dependency] private readonly IInputManager _inputManager = default!;

private static Color DefaultTextColor = new(25, 25, 25);

// <summary>
Expand Down Expand Up @@ -41,15 +45,35 @@ public sealed partial class PaperWindow : BaseWindow
typeof(ItalicTag)
};

public event Action<string>? OnSaved;

public PaperWindow()
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);

// We can't configure the RichTextLabel contents from xaml, so do it here:
BlankPaperIndicator.SetMessage(Loc.GetString("paper-ui-blank-page-message"), null, DefaultTextColor);

// Hook up the close button:
CloseButton.OnPressed += _ => Close();

Input.OnKeyBindDown += args => // Solution while TextEdit don't have events
{
if (args.Function == EngineKeyFunctions.MultilineTextSubmit)
{
RunOnSaved();
args.Handle();
}
};

SaveButton.OnPressed += _ =>
{
RunOnSaved();
};

SaveButton.Text = Loc.GetString("paper-ui-save-button",
("keybind", _inputManager.GetKeyFunctionButtonString(EngineKeyFunctions.MultilineTextSubmit)));
}

/// <summary>
Expand Down Expand Up @@ -196,6 +220,7 @@ public void Populate(SharedPaperComponent.PaperBoundUserInterfaceState state)
bool isEditing = state.Mode == SharedPaperComponent.PaperAction.Write;
bool wasEditing = InputContainer.Visible;
InputContainer.Visible = isEditing;
EditButtons.Visible = isEditing;

var msg = new FormattedMessage();
msg.AddMarkupPermissive(state.Text);
Expand Down Expand Up @@ -266,5 +291,10 @@ protected override DragMode GetDragModeFor(Vector2 relativeMousePos)
}
return mode & _allowedResizeModes;
}

private void RunOnSaved()
{
OnSaved?.Invoke(Rope.Collapse(Input.TextRope));
}
}
}
8 changes: 7 additions & 1 deletion Content.Client/Popups/PopupSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public override void PopupEntity(string? message, EntityUid uid, ICommonSession
PopupEntity(message, uid, type);
}

public override void PopupEntity(string? message, EntityUid uid, Filter filter, bool recordReplay, PopupType type=PopupType.Small)
public override void PopupEntity(string? message, EntityUid uid, Filter filter, bool recordReplay, PopupType type = PopupType.Small)
{
if (!filter.Recipients.Contains(_playerManager.LocalSession))
return;
Expand All @@ -170,6 +170,12 @@ public override void PopupEntity(string? message, EntityUid uid, PopupType type
PopupMessage(message, type, transform.Coordinates, uid, true);
}

public override void PopupPredicted(string? message, EntityUid uid, EntityUid? recipient, PopupType type = PopupType.Small)
{
if (recipient != null && _timing.IsFirstTimePredicted)
PopupEntity(message, uid, recipient.Value, type);
}

#endregion

#region Network Event Handlers
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Atmos/Portable/SpaceHeaterSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private void OnTemperatureChanged(EntityUid uid, SpaceHeaterComponent spaceHeate
if (!TryComp<GasThermoMachineComponent>(uid, out var thermoMachine))
return;

thermoMachine.TargetTemperature += args.Temperature;
thermoMachine.TargetTemperature = float.Clamp(thermoMachine.TargetTemperature + args.Temperature, thermoMachine.MinTemperature, thermoMachine.MaxTemperature);

UpdateAppearance(uid);
DirtyUI(uid, spaceHeater);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
using Content.Server.Administration.Logs;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Nutrition.Components;
using Content.Server.Nutrition.EntitySystems;
using Content.Server.Labels.Components;
using Content.Server.Chemistry;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.Dispenser;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
using Robust.Server.Audio;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using System.Linq;
using Content.Shared.Labels.Components;

namespace Content.Server.Chemistry.EntitySystems
{
Expand Down
30 changes: 30 additions & 0 deletions Content.Server/Forensics/Systems/ForensicsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Server.Fluids.EntitySystems;
using Content.Server.Forensics.Components;
using Content.Server.Popups;
using Content.Shared.Chemistry.Components;
using Content.Shared.DoAfter;
using Content.Shared.Forensics;
using Content.Shared.Interaction;
Expand All @@ -27,6 +28,7 @@ public override void Initialize()

SubscribeLocalEvent<DnaComponent, BeingGibbedEvent>(OnBeingGibbed);
SubscribeLocalEvent<ForensicsComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<ForensicsComponent, GotRehydratedEvent>(OnRehydrated);
SubscribeLocalEvent<CleansForensicsComponent, AfterInteractEvent>(OnAfterInteract, after: new[] { typeof(AbsorbentSystem) });
SubscribeLocalEvent<ForensicsComponent, CleanForensicsDoAfterEvent>(OnCleanForensicsDoAfter);
SubscribeLocalEvent<DnaComponent, TransferDnaEvent>(OnTransferDnaEvent);
Expand Down Expand Up @@ -71,6 +73,34 @@ private void OnMeleeHit(EntityUid uid, ForensicsComponent component, MeleeHitEve
}
}

private void OnRehydrated(Entity<ForensicsComponent> ent, ref GotRehydratedEvent args)
{
CopyForensicsFrom(ent.Comp, args.Target);
}

/// <summary>
/// Copy forensic information from a source entity to a destination.
/// Existing forensic information on the target is still kept.
/// </summary>
public void CopyForensicsFrom(ForensicsComponent src, EntityUid target)
{
var dest = EnsureComp<ForensicsComponent>(target);
foreach (var dna in src.DNAs)
{
dest.DNAs.Add(dna);
}

foreach (var fiber in src.Fibers)
{
dest.Fibers.Add(fiber);
}

foreach (var print in src.Fingerprints)
{
dest.Fingerprints.Add(print);
}
}

private void OnAfterInteract(EntityUid uid, CleansForensicsComponent component, AfterInteractEvent args)
{
if (args.Handled)
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Friends/Systems/PettableFriendSystem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Content.Server.Chemistry.Components;
using Content.Server.Friends.Components;
using Content.Server.NPC.Components;
using Content.Server.NPC.Systems;
using Content.Shared.Chemistry.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.Popups;

Expand Down
21 changes: 17 additions & 4 deletions Content.Server/GameTicking/Rules/ZombieRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,23 @@ private List<EntityUid> GetHealthyHumans(bool includeOffStation = true)
/// </remarks>
private void InfectInitialPlayers(ZombieRuleComponent component)
{
//Get all players with initial infected enabled, and exclude those with the ZombieImmuneComponent
var eligiblePlayers = _antagSelection.GetEligiblePlayers(_playerManager.Sessions, component.PatientZeroPrototypeId, includeAllJobs: true, customExcludeCondition: x => HasComp<ZombieImmuneComponent>(x) || HasComp<InitialInfectedExemptComponent>(x));
//And get all players, excluding ZombieImmune - to fill any leftover initial infected slots
var allPlayers = _antagSelection.GetEligiblePlayers(_playerManager.Sessions, component.PatientZeroPrototypeId, acceptableAntags: Shared.Antag.AntagAcceptability.All, includeAllJobs: true, ignorePreferences: true, customExcludeCondition: HasComp<ZombieImmuneComponent>);
//Get all players with initial infected enabled, and exclude those with the ZombieImmuneComponent and roles with CanBeAntag = False
var eligiblePlayers = _antagSelection.GetEligiblePlayers(
_playerManager.Sessions,
component.PatientZeroPrototypeId,
includeAllJobs: false,
customExcludeCondition: player => HasComp<ZombieImmuneComponent>(player) || HasComp<InitialInfectedExemptComponent>(player)
);

//And get all players, excluding ZombieImmune and roles with CanBeAntag = False - to fill any leftover initial infected slots
var allPlayers = _antagSelection.GetEligiblePlayers(
_playerManager.Sessions,
component.PatientZeroPrototypeId,
acceptableAntags: Shared.Antag.AntagAcceptability.All,
includeAllJobs: false ,
ignorePreferences: true,
customExcludeCondition: HasComp<ZombieImmuneComponent>
);

//If there are no players to choose, abort
if (allPlayers.Count == 0)
Expand Down
24 changes: 0 additions & 24 deletions Content.Server/Labels/Label/Components/LabelComponent.cs

This file was deleted.

27 changes: 10 additions & 17 deletions Content.Server/Labels/Label/LabelSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Examine;
using Content.Shared.Labels;
using Content.Shared.Labels.Components;
using Content.Shared.Labels.EntitySystems;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.Utility;

namespace Content.Server.Labels
{
/// <summary>
/// A system that lets players see the contents of a label on an object.
/// </summary>
[UsedImplicitly]
public sealed class LabelSystem : EntitySystem
public sealed class LabelSystem : SharedLabelSystem
{
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
Expand All @@ -26,7 +26,6 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<LabelComponent, ExaminedEvent>(OnExamine);
SubscribeLocalEvent<LabelComponent, MapInitEvent>(OnLabelCompMapInit);
SubscribeLocalEvent<PaperLabelComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<PaperLabelComponent, ComponentRemove>(OnComponentRemove);
Expand All @@ -38,7 +37,10 @@ public override void Initialize()
private void OnLabelCompMapInit(EntityUid uid, LabelComponent component, MapInitEvent args)
{
if (!string.IsNullOrEmpty(component.CurrentLabel))
{
component.CurrentLabel = Loc.GetString(component.CurrentLabel);
Dirty(uid, component);
}
}

/// <summary>
Expand All @@ -65,13 +67,17 @@ public void Label(EntityUid uid, string? text, MetaDataComponent? metadata = nul
label.CurrentLabel = null;
label.OriginalName = null;

Dirty(uid, label);

return;
}

// Update label
label.OriginalName ??= metadata.EntityName;
label.CurrentLabel = text;
_metaData.SetEntityName(uid, $"{label.OriginalName} ({text})", metadata);

Dirty(uid, label);
}

private void OnComponentInit(EntityUid uid, PaperLabelComponent component, ComponentInit args)
Expand All @@ -89,19 +95,6 @@ private void OnComponentRemove(EntityUid uid, PaperLabelComponent component, Com
_itemSlotsSystem.RemoveItemSlot(uid, component.LabelSlot);
}

private void OnExamine(EntityUid uid, LabelComponent? label, ExaminedEvent args)
{
if (!Resolve(uid, ref label))
return;

if (label.CurrentLabel == null)
return;

var message = new FormattedMessage();
message.AddText(Loc.GetString("hand-labeler-has-label", ("label", label.CurrentLabel)));
args.PushMessage(message);
}

private void OnExamined(EntityUid uid, PaperLabelComponent comp, ExaminedEvent args)
{
if (comp.LabelSlot.Item is not {Valid: true} item)
Expand Down
Loading

0 comments on commit fedbf89

Please sign in to comment.