Skip to content

Commit

Permalink
Revert "upstream merge 15/11" (#2272)
Browse files Browse the repository at this point in the history
Revert "upstream merge 15/11 (#2205)"

This reverts commit 1b7830a.
  • Loading branch information
deltanedas authored Nov 24, 2024
1 parent d7a3696 commit 7ccafa8
Show file tree
Hide file tree
Showing 447 changed files with 5,259 additions and 8,712 deletions.
File renamed without changes.
21 changes: 0 additions & 21 deletions .github/workflows/labeler-size.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/labeler-untriaged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
on:
issues:
types: [opened]
pull_request_target:
types: [opened]

jobs:
add_label:
Expand Down
1 change: 0 additions & 1 deletion Content.Client/Administration/UI/Notes/NoteEdit.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<Label Name="ExpiryLabel" Text="{Loc admin-note-editor-expiry-label}" Visible="False" />
<HistoryLineEdit Name="ExpiryLineEdit" PlaceHolder="{Loc admin-note-editor-expiry-placeholder}"
Visible="False" HorizontalExpand="True" />
<OptionButton Name="ExpiryLengthDropdown" Visible="False" />
</BoxContainer>
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<OptionButton Name="TypeOption" HorizontalAlignment="Center" />
Expand Down
53 changes: 3 additions & 50 deletions Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ public sealed partial class NoteEdit : FancyWindow
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IClientConsoleHost _console = default!;

private enum Multipliers
{
Minutes,
Hours,
Days,
Weeks,
Months,
Years,
Centuries
}

public event Action<int, NoteType, string, NoteSeverity?, bool, DateTime?>? SubmitPressed;

public NoteEdit(SharedAdminNote? note, string playerName, bool canCreate, bool canEdit)
Expand All @@ -42,20 +31,6 @@ public NoteEdit(SharedAdminNote? note, string playerName, bool canCreate, bool c

ResetSubmitButton();

// It's weird to use minutes as the IDs, but it works and makes sense kind of :)
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-minutes"), (int) Multipliers.Minutes);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-hours"), (int) Multipliers.Hours);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-days"), (int) Multipliers.Days);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-weeks"), (int) Multipliers.Weeks);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-months"), (int) Multipliers.Months);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-years"), (int) Multipliers.Years);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-centuries"), (int) Multipliers.Centuries);
ExpiryLengthDropdown.OnItemSelected += OnLengthChanged;

ExpiryLengthDropdown.SelectId((int) Multipliers.Weeks);

ExpiryLineEdit.OnTextChanged += OnTextChanged;

TypeOption.AddItem(Loc.GetString("admin-note-editor-type-note"), (int) NoteType.Note);
TypeOption.AddItem(Loc.GetString("admin-note-editor-type-message"), (int) NoteType.Message);
TypeOption.AddItem(Loc.GetString("admin-note-editor-type-watchlist"), (int) NoteType.Watchlist);
Expand Down Expand Up @@ -197,9 +172,8 @@ private void UpdatePermanentCheckboxFields()
{
ExpiryLabel.Visible = !PermanentCheckBox.Pressed;
ExpiryLineEdit.Visible = !PermanentCheckBox.Pressed;
ExpiryLengthDropdown.Visible = !PermanentCheckBox.Pressed;

ExpiryLineEdit.Text = !PermanentCheckBox.Pressed ? 1.ToString() : string.Empty;
ExpiryLineEdit.Text = !PermanentCheckBox.Pressed ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty;
}

private void OnSecretPressed(BaseButton.ButtonEventArgs _)
Expand All @@ -213,16 +187,6 @@ private void OnSeverityChanged(OptionButton.ItemSelectedEventArgs args)
SeverityOption.SelectId(args.Id);
}

private void OnLengthChanged(OptionButton.ItemSelectedEventArgs args)
{
ExpiryLengthDropdown.SelectId(args.Id);
}

private void OnTextChanged(HistoryLineEdit.LineEditEventArgs args)
{
ParseExpiryTime();
}

private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs args)
{
if (!ParseExpiryTime())
Expand Down Expand Up @@ -299,24 +263,13 @@ private bool ParseExpiryTime()
return true;
}

if (string.IsNullOrWhiteSpace(ExpiryLineEdit.Text) || !uint.TryParse(ExpiryLineEdit.Text, out var inputInt))
if (string.IsNullOrWhiteSpace(ExpiryLineEdit.Text) || !DateTime.TryParse(ExpiryLineEdit.Text, out var result) || DateTime.UtcNow > result)
{
ExpiryLineEdit.ModulateSelfOverride = Color.Red;
return false;
}

var mult = ExpiryLengthDropdown.SelectedId switch
{
(int) Multipliers.Minutes => TimeSpan.FromMinutes(1).TotalMinutes,
(int) Multipliers.Hours => TimeSpan.FromHours(1).TotalMinutes,
(int) Multipliers.Days => TimeSpan.FromDays(1).TotalMinutes,
(int) Multipliers.Weeks => TimeSpan.FromDays(7).TotalMinutes,
(int) Multipliers.Months => TimeSpan.FromDays(30).TotalMinutes,
(int) Multipliers.Years => TimeSpan.FromDays(365).TotalMinutes,
(int) Multipliers.Centuries => TimeSpan.FromDays(36525).TotalMinutes,
_ => throw new ArgumentOutOfRangeException(nameof(ExpiryLengthDropdown.SelectedId), "Multiplier out of range :(")
};
ExpiryTime = DateTime.UtcNow.AddMinutes(inputInt * mult);
ExpiryTime = result.ToUniversalTime();
ExpiryLineEdit.ModulateSelfOverride = null;
return true;
}
Expand Down
15 changes: 5 additions & 10 deletions Content.Client/Alerts/ClientAlertsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Content.Shared.Alert;
using JetBrains.Annotations;
using Robust.Client.Player;
using Robust.Shared.GameStates;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

Expand All @@ -25,7 +24,8 @@ public override void Initialize()

SubscribeLocalEvent<AlertsComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<AlertsComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<AlertsComponent, ComponentHandleState>(OnHandleState);

SubscribeLocalEvent<AlertsComponent, AfterAutoHandleStateEvent>(ClientAlertsHandleState);
}
protected override void LoadPrototypes()
{
Expand All @@ -47,22 +47,17 @@ public IReadOnlyDictionary<AlertKey, AlertState>? ActiveAlerts
}
}

private void OnHandleState(Entity<AlertsComponent> alerts, ref ComponentHandleState args)
protected override void AfterShowAlert(Entity<AlertsComponent> alerts)
{
if (args.Current is not AlertComponentState cast)
return;

alerts.Comp.Alerts = cast.Alerts;

UpdateHud(alerts);
}

protected override void AfterShowAlert(Entity<AlertsComponent> alerts)
protected override void AfterClearAlert(Entity<AlertsComponent> alerts)
{
UpdateHud(alerts);
}

protected override void AfterClearAlert(Entity<AlertsComponent> alerts)
private void ClientAlertsHandleState(Entity<AlertsComponent> alerts, ref AfterAutoHandleStateEvent args)
{
UpdateHud(alerts);
}
Expand Down
24 changes: 5 additions & 19 deletions Content.Client/Clothing/ClientClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public override void Initialize()
base.Initialize();

SubscribeLocalEvent<ClothingComponent, GetEquipmentVisualsEvent>(OnGetVisuals);
SubscribeLocalEvent<ClothingComponent, InventoryTemplateUpdated>(OnInventoryTemplateUpdated);

SubscribeLocalEvent<InventoryComponent, VisualsChangedEvent>(OnVisualsChanged);
SubscribeLocalEvent<SpriteComponent, DidUnequipEvent>(OnDidUnequip);
Expand All @@ -71,7 +70,11 @@ private void OnAppearanceUpdate(EntityUid uid, InventoryComponent component, ref
if (args.Sprite == null)
return;

UpdateAllSlots(uid, component);
var enumerator = _inventorySystem.GetSlotEnumerator((uid, component));
while (enumerator.NextItem(out var item, out var slot))
{
RenderEquipment(uid, item, slot.Name, component);
}

// No clothing equipped -> make sure the layer is hidden, though this should already be handled by on-unequip.
if (args.Sprite.LayerMapTryGet(HumanoidVisualLayers.StencilMask, out var layer))
Expand All @@ -81,23 +84,6 @@ private void OnAppearanceUpdate(EntityUid uid, InventoryComponent component, ref
}
}

private void OnInventoryTemplateUpdated(Entity<ClothingComponent> ent, ref InventoryTemplateUpdated args)
{
UpdateAllSlots(ent.Owner, clothing: ent.Comp);
}

private void UpdateAllSlots(
EntityUid uid,
InventoryComponent? inventoryComponent = null,
ClothingComponent? clothing = null)
{
var enumerator = _inventorySystem.GetSlotEnumerator((uid, inventoryComponent));
while (enumerator.NextItem(out var item, out var slot))
{
RenderEquipment(uid, item, slot.Name, inventoryComponent, clothingComponent: clothing);
}
}

private void OnGetVisuals(EntityUid uid, ClothingComponent item, GetEquipmentVisualsEvent args)
{
if (!TryComp(args.Equipee, out InventoryComponent? inventory))
Expand Down
4 changes: 1 addition & 3 deletions Content.Client/Commands/ShowHealthBarsCommand.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using Content.Shared.Damage.Prototypes;
using Content.Shared.Overlays;
using Robust.Client.Player;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;
using System.Linq;

namespace Content.Client.Commands;
Expand Down Expand Up @@ -36,7 +34,7 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
var showHealthBarsComponent = new ShowHealthBarsComponent
{
DamageContainers = args.Select(arg => new ProtoId<DamageContainerPrototype>(arg)).ToList(),
DamageContainers = args.ToList(),
HealthStatusIcon = null,
NetSyncEnabled = false
};
Expand Down
10 changes: 0 additions & 10 deletions Content.Client/Effects/ColorFlashEffectSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ private void OnColorFlashEffect(ColorFlashEffectEvent ev)
continue;
}

var targetEv = new GetFlashEffectTargetEvent(ent);
RaiseLocalEvent(ent, ref targetEv);
ent = targetEv.Target;

EnsureComp<ColorFlashEffectComponent>(ent, out comp);
comp.NetSyncEnabled = false;
comp.Color = sprite.Color;
Expand All @@ -136,9 +132,3 @@ private void OnColorFlashEffect(ColorFlashEffectEvent ev)
}
}
}

/// <summary>
/// Raised on an entity to change the target for a color flash effect.
/// </summary>
[ByRefEvent]
public record struct GetFlashEffectTargetEvent(EntityUid Target);
16 changes: 1 addition & 15 deletions Content.Client/Inventory/ClientInventorySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,23 +235,9 @@ public void UIInventoryAltActivateItem(string slot, EntityUid uid)
EntityManager.RaisePredictiveEvent(new InteractInventorySlotEvent(GetNetEntity(item.Value), altInteract: true));
}

protected override void UpdateInventoryTemplate(Entity<InventoryComponent> ent)
{
base.UpdateInventoryTemplate(ent);

if (TryComp(ent, out InventorySlotsComponent? inventorySlots))
{
foreach (var slot in ent.Comp.Slots)
{
if (inventorySlots.SlotData.TryGetValue(slot.Name, out var slotData))
slotData.SlotDef = slot;
}
}
}

public sealed class SlotData
{
public SlotDefinition SlotDef;
public readonly SlotDefinition SlotDef;
public EntityUid? HeldEntity => Container?.ContainedEntity;
public bool Blocked;
public bool Highlighted;
Expand Down
3 changes: 1 addition & 2 deletions Content.Client/Overlays/EquipmentHudSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public abstract class EquipmentHudSystem<T> : EntitySystem where T : IComponent
{
[Dependency] private readonly IPlayerManager _player = default!;

[ViewVariables]
protected bool IsActive;
protected virtual SlotFlags TargetSlots => ~SlotFlags.POCKET;

Expand Down Expand Up @@ -103,7 +102,7 @@ protected virtual void OnRefreshComponentHud(EntityUid uid, T component, Refresh
args.Components.Add(component);
}

protected void RefreshOverlay(EntityUid uid)
private void RefreshOverlay(EntityUid uid)
{
if (uid != _player.LocalSession?.AttachedEntity)
return;
Expand Down
7 changes: 0 additions & 7 deletions Content.Client/Overlays/ShowHealthBarsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,9 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ShowHealthBarsComponent, AfterAutoHandleStateEvent>(OnHandleState);

_overlay = new(EntityManager, _prototype);
}

private void OnHandleState(Entity<ShowHealthBarsComponent> ent, ref AfterAutoHandleStateEvent args)
{
RefreshOverlay(ent);
}

protected override void UpdateInternal(RefreshEquipmentHudEvent<ShowHealthBarsComponent> component)
{
base.UpdateInternal(component);
Expand Down
7 changes: 0 additions & 7 deletions Content.Client/Overlays/ShowHealthIconsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ public sealed class ShowHealthIconsSystem : EquipmentHudSystem<ShowHealthIconsCo
{
[Dependency] private readonly IPrototypeManager _prototypeMan = default!;

[ViewVariables]
public HashSet<string> DamageContainers = new();

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<DamageableComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
SubscribeLocalEvent<ShowHealthIconsComponent, AfterAutoHandleStateEvent>(OnHandleState);
}

protected override void UpdateInternal(RefreshEquipmentHudEvent<ShowHealthIconsComponent> component)
Expand All @@ -45,11 +43,6 @@ protected override void DeactivateInternal()
DamageContainers.Clear();
}

private void OnHandleState(Entity<ShowHealthIconsComponent> ent, ref AfterAutoHandleStateEvent args)
{
RefreshOverlay(ent);
}

private void OnGetStatusIconsEvent(Entity<DamageableComponent> entity, ref GetStatusIconsEvent args)
{
if (!IsActive)
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Overlays/ShowThirstIconsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ private void OnGetStatusIconsEvent(EntityUid uid, ThirstComponent component, ref
return;

if (_thirst.TryGetStatusIconPrototype(component, out var iconPrototype))
ev.StatusIcons.Add(iconPrototype);
ev.StatusIcons.Add(iconPrototype!);
}
}
16 changes: 0 additions & 16 deletions Content.Client/Physics/Controllers/MoverController.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using Content.Shared.Alert;
using Content.Shared.CCVar;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Systems;
using Robust.Client.GameObjects;
using Robust.Client.Physics;
using Robust.Client.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Physics.Components;
using Robust.Shared.Player;
using Robust.Shared.Timing;
Expand All @@ -17,8 +14,6 @@ public sealed class MoverController : SharedMoverController
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly AlertsSystem _alerts = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -140,15 +135,4 @@ protected override bool CanSound()
{
return _timing is { IsFirstTimePredicted: true, InSimulation: true };
}

public override void SetSprinting(Entity<InputMoverComponent> entity, ushort subTick, bool walking)
{
// Logger.Info($"[{_gameTiming.CurTick}/{subTick}] Sprint: {enabled}");
base.SetSprinting(entity, subTick, walking);

if (walking && _cfg.GetCVar(CCVars.ToggleWalk))
_alerts.ShowAlert(entity, WalkingAlert, showCooldown: false, autoRemove: false);
else
_alerts.ClearAlert(entity, WalkingAlert);
}
}
Loading

0 comments on commit 7ccafa8

Please sign in to comment.