Skip to content

Commit

Permalink
Merge branch 'upstream' into our
Browse files Browse the repository at this point in the history
  • Loading branch information
v0id-rift committed Feb 21, 2025
2 parents f23770f + f654e52 commit 9dd7fdf
Show file tree
Hide file tree
Showing 1,075 changed files with 119,932 additions and 51,541 deletions.
9 changes: 7 additions & 2 deletions Content.Client/Labels/UI/HandLabelerWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Labels.UI
Expand Down Expand Up @@ -33,8 +33,13 @@ public HandLabelerWindow()
_focused = false;
LabelLineEdit.Text = _label;
};
}

protected override void Opened()
{
base.Opened();

// Give the editor keybard focus, since that's the only
// Give the editor keyboard focus, since that's the only
// thing the user will want to be doing with this UI
LabelLineEdit.GrabKeyboardFocus();
}
Expand Down
11 changes: 8 additions & 3 deletions Content.Client/UserInterface/Controls/DialogWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ public DialogWindow(string title, List<QuickDialogEntry> entries, bool ok = true
Prompts.AddChild(box);
}

// Grab keyboard focus for the first dialog entry
_promptLines[0].Item2.GrabKeyboardFocus();

OkButton.OnPressed += _ => Confirm();

CancelButton.OnPressed += _ =>
Expand All @@ -110,6 +107,14 @@ public DialogWindow(string title, List<QuickDialogEntry> entries, bool ok = true
OpenCentered();
}

protected override void Opened()
{
base.Opened();

// Grab keyboard focus for the first dialog entry
_promptLines[0].Item2.GrabKeyboardFocus();
}

private void Confirm()
{
var results = new Dictionary<string, string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ private void OnPiecePressed(GUIBoundKeyEventArgs args, ItemGridPiece control)
//
// _menuDragHelper.MouseDown(control);
// _menuDragHelper.Update(0f);
//
// args.Handle();

// This Handle here is what prevents always inserting and allows InteractUsing on items in storage.
args.Handle();
}
else if (args.Function == ContentKeyFunctions.SaveItemLocation)
{
Expand Down
49 changes: 49 additions & 0 deletions Content.Client/_RMC14/Aura/AuraSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Content.Shared._RMC14.Aura;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Prototypes;

namespace Content.Client._RMC14.Aura;

public sealed class AuraSystem : SharedAuraSystem
{
[Dependency] private readonly IPrototypeManager _prototypes = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<AuraComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<AuraComponent, ComponentShutdown>(OnShutdown);
}

private void OnStartup(Entity<AuraComponent> ent, ref ComponentStartup args)
{
if (!TryComp(ent, out SpriteComponent? sprite))
return;

sprite.PostShader = _prototypes.Index<ShaderPrototype>("RMCAuraOutline").InstanceUnique();
}

private void OnShutdown(Entity<AuraComponent> ent, ref ComponentShutdown args)
{
if (TerminatingOrDeleted(ent))
return;

if (!TryComp(ent, out SpriteComponent? sprite))
return;

sprite.PostShader = null;
}

public override void Update(float frameTime)
{
base.Update(frameTime);

var auraQuery = EntityQueryEnumerator<AuraComponent, SpriteComponent>();

while (auraQuery.MoveNext(out var uid, out var aura, out var sprite))
{
sprite.PostShader?.SetParameter("outline_color", aura.Color);
}
}
}
111 changes: 67 additions & 44 deletions Content.Client/_RMC14/Dropship/Weapon/DropshipWeaponsBui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Client.Eye;
using Content.Client.UserInterface.ControlExtensions;
using Content.Shared._RMC14.Dropship.AttachmentPoint;
using Content.Shared._RMC14.Dropship.Utility.Components;
using Content.Shared._RMC14.Dropship.Weapon;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
Expand Down Expand Up @@ -130,15 +131,20 @@ string TargetAcquisition()
("yOffset", terminal.Offset.Y));
}

void AddTargets(
void AddButtons(
Func<NetEntity, BoundUserInterfaceMessage> selectMsg,
BoundUserInterfaceMessage previousMsg,
BoundUserInterfaceMessage nextMsg,
DropshipWeaponsButtonRow row,
List<TargetEnt> targets,
int page,
out DropshipWeaponsButtonData? previous,
out DropshipWeaponsButtonData? next)
{
previous = default;
next = default;

var firstTarget = terminal.TargetsPage * 5;
var targets = terminal.Targets;
var firstTarget = page * 5;
if (targets.Count <= 5)
firstTarget = 0;
else if (firstTarget > targets.Count - 5)
Expand All @@ -149,58 +155,36 @@ void AddTargets(
if (!targets.TryGetValue(index, out var target))
return null;

var msg = new DropshipTerminalWeaponsTargetsSelectMsg(target.Id);
var msg = selectMsg(target.Id);
return new DropshipWeaponsButtonData(target.Name, _ => SendPredictedMessage(msg));
}

if (firstTarget > 0)
previous = ButtonAction("previous", _ => SendPredictedMessage(new DropshipTerminalWeaponsTargetsPreviousMsg()));
previous = ButtonAction("previous", _ => SendPredictedMessage(previousMsg));

if (firstTarget + 4 < targets.Count - 1)
next = ButtonAction("next", _ => SendPredictedMessage(new DropshipTerminalWeaponsTargetsNextMsg()));
next = ButtonAction("next", _ => SendPredictedMessage(nextMsg));

var one = GetTargetData(firstTarget);
var two = GetTargetData(firstTarget + 1);
var three = GetTargetData(firstTarget + 2);
var four = GetTargetData(firstTarget + 3);
var five = GetTargetData(firstTarget + 4);
screen.RightRow.SetData(one, two, three, four, five);
row.SetData(one, two, three, four, five);
}

void AddMedevacs(
out DropshipWeaponsButtonData? previous,
out DropshipWeaponsButtonData? next)
void AddTargets(out DropshipWeaponsButtonData? previous, out DropshipWeaponsButtonData? next)
{
var firstTarget = terminal.MedevacsPage * 5;
var targets = terminal.Medevacs;
if (targets.Count <= 5)
firstTarget = 0;
else if (firstTarget > targets.Count - 5)
firstTarget = targets.Count - 5;

DropshipWeaponsButtonData? GetTargetData(int index)
{
if (!targets.TryGetValue(index, out var target))
return null;

var msg = new DropshipTerminalWeaponsMedevacSelectMsg(target.Id);
return new DropshipWeaponsButtonData(target.Name, _ => SendPredictedMessage(msg));
}

previous = default;
if (firstTarget > 0)
previous = ButtonAction("previous", _ => SendPredictedMessage(new DropshipTerminalWeaponsMedevacPreviousMsg()));

next = default;
if (firstTarget + 4 < targets.Count - 1)
next = ButtonAction("next", _ => SendPredictedMessage(new DropshipTerminalWeaponsMedevacNextMsg()));

var one = GetTargetData(firstTarget);
var two = GetTargetData(firstTarget + 1);
var three = GetTargetData(firstTarget + 2);
var four = GetTargetData(firstTarget + 3);
var five = GetTargetData(firstTarget + 4);
screen.LeftRow.SetData(one, two, three, four, five);
AddButtons(
id => new DropshipTerminalWeaponsTargetsSelectMsg(id),
new DropshipTerminalWeaponsTargetsPreviousMsg(),
new DropshipTerminalWeaponsTargetsNextMsg(),
screen.RightRow,
terminal.Targets,
terminal.TargetsPage,
out previous,
out next
);
}

var equip = Button("equip", Equip);
Expand Down Expand Up @@ -352,7 +336,33 @@ void AddWeaponEntry(DropshipWeaponsButtonData? data)
break;
case Medevac:
{
AddMedevacs(out var previous, out var next);
AddButtons(
id => new DropshipTerminalWeaponsMedevacSelectMsg(id),
new DropshipTerminalWeaponsMedevacPreviousMsg(),
new DropshipTerminalWeaponsMedevacNextMsg(),
screen.LeftRow,
terminal.Medevacs,
terminal.MedevacsPage,
out var previous,
out var next
);
screen.TopRow.SetData(equip);
screen.BottomRow.SetData(exit);
screen.RightRow.SetData(one: previous, five: next);
break;
}
case Fulton:
{
AddButtons(
id => new DropshipTerminalWeaponsFultonSelectMsg(id),
new DropshipTerminalWeaponsFultonPreviousMsg(),
new DropshipTerminalWeaponsFultonNextMsg(),
screen.LeftRow,
terminal.Fultons,
terminal.FultonsPage,
out var previous,
out var next
);
screen.TopRow.SetData(equip);
screen.BottomRow.SetData(exit);
screen.RightRow.SetData(one: previous, five: next);
Expand Down Expand Up @@ -402,14 +412,27 @@ private void TryGetWeapons(
_container.TryGetContainer(pointId, utilityComp.UtilitySlotId, out var utilityContainer) &&
utilityContainer.ContainedEntities.Count > 0)
{
string text;
BoundUserInterfaceMessage msg;
var utilityMount = utilityContainer.ContainedEntities[0];
if (!EntMan.HasComponent<MedevacComponent>(utilityMount))
if (EntMan.HasComponent<MedevacComponent>(utilityMount))
{
text = "Medeva";
msg = new DropshipTerminalWeaponsChooseMedevacMsg(first);
}
else if (EntMan.HasComponent<RMCFultonComponent>(utilityMount))
{
text = "Fulton";
msg = new DropshipTerminalWeaponsChooseFultonMsg(first);
}
else
{
continue;
}

var netEnt = EntMan.GetNetEntity(utilityMount);
var msg = new DropshipTerminalWeaponsChooseMedevacMsg(first);
var data = new DropshipWeaponsButtonData(
"Medeva",
text,
_ => SendPredictedMessage(msg),
netEnt
);
Expand Down
37 changes: 37 additions & 0 deletions Content.Client/_RMC14/Intel/IntelDetectorOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.Numerics;
using Content.Client._RMC14.MotionDetector;
using Content.Shared._RMC14.Intel.Detector;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Enums;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

namespace Content.Client._RMC14.Intel;

public sealed class IntelDetectorOverlay : Overlay
{
[Dependency] private readonly IEntityManager _entity = default!;
[Dependency] private readonly IGameTiming _timing = default!;

public override OverlaySpace Space => OverlaySpace.WorldSpace;

private TimeSpan _last;
private readonly List<Vector2> _blips = new();

private MotionDetectorOverlaySystem _motionDetector;
private SpriteSystem _sprite;

public IntelDetectorOverlay()
{
IoCManager.InjectDependencies(this);
_motionDetector = _entity.System<MotionDetectorOverlaySystem>();
_sprite = _entity.System<SpriteSystem>();
}

protected override void Draw(in OverlayDrawArgs args)
{
var frame = _sprite.GetFrame(new SpriteSpecifier.Rsi(new ResPath("/Textures/_RMC14/Objects/Tools/intel_detector.rsi"), "data_blip"), _timing.CurTime);
_motionDetector.DrawBlips<IntelDetectorComponent>(args.WorldHandle, ref _last, _blips, frame);
}
}
19 changes: 19 additions & 0 deletions Content.Client/_RMC14/Intel/IntelDetectorOverlaySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Robust.Client.Graphics;

namespace Content.Client._RMC14.Intel;

public sealed class IntelDetectorOverlaySystem : EntitySystem
{
[Dependency] private readonly IOverlayManager _overlay = default!;

public override void Initialize()
{
if (!_overlay.HasOverlay<IntelDetectorOverlay>())
_overlay.AddOverlay(new IntelDetectorOverlay());
}

public override void Shutdown()
{
_overlay.RemoveOverlay<IntelDetectorOverlay>();
}
}
30 changes: 30 additions & 0 deletions Content.Client/_RMC14/Intel/IntelUISystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Content.Shared._RMC14.Intel;

namespace Content.Client._RMC14.Intel;

public sealed class IntelUISystem : EntitySystem
{
public override void Initialize()
{
SubscribeLocalEvent<ViewIntelObjectivesComponent, AfterAutoHandleStateEvent>(OnViewIntelObjectivesAfterState);
}

private void OnViewIntelObjectivesAfterState(Entity<ViewIntelObjectivesComponent> ent, ref AfterAutoHandleStateEvent args)
{
try
{
if (!TryComp(ent, out UserInterfaceComponent? ui))
return;

foreach (var bui in ui.ClientOpenInterfaces.Values)
{
if (bui is ViewIntelObjectivesBui intelUi)
intelUi.Refresh();
}
}
catch (Exception e)
{
Log.Error($"Error refreshing {nameof(ViewIntelObjectivesBui)}\n{e}");
}
}
}
Loading

0 comments on commit 9dd7fdf

Please sign in to comment.