* Mobs burn to ashes on excessive heat damage (#26971) * mobs burn to ashes on excessive heat damage * remove comment, remove random lines I didn't mean to add * combine code into behavior * clean unused * fix namespace * drop next to * fix spawn entities behavior spawning entities outside container * fix burning to ash not working on all mobs (#27158) * add ghostnado button to warp menu (#27556) * add ghostnado button to warp menu * translator ops --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * Make arguments and parameters wrap to one variable per line (#27766) * Fix ghosts getting spawned in nullspace (#27617) * Add tests for ghost spawn position * Make ghosts spawn immediately * Format mind system * Move ghost spawning to GhostSystem * Spawn ghost on grid or map This fixes the ghosts being attached the parent entity instead of the grid. * Move logging out of the ghost system * Make round start observer spawn using GhostSystem * Move GameTicker ghost spawning to GhostSystem Moved the more robust character name selection code over. Moved the TimeOfDeath code over. Added canReturn logic. * Add overrides and default for ghost spawn coordinates * Add warning log to ghost spawn fail * Clean up test * Dont spawn ghost on map delete * Minor changes to the role test * Fix role test failing to spawn ghost It was failing the map check due to using Nullspace * Fix ghost tests when running in parallel Not sure what happened, but it seems to be because they were running simultaneously and overwriting values. * Clean up ghost tests * Test that map deletion does not spawn ghosts * Spawn ghost on the next available map * Disallow spawning on deleted maps * Fix map deletion ghost test * Cleanup --------- Co-authored-by: Whisper <121047731+QuietlyWhisper@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: ShadowCommander <shadowjjt@gmail.com>
96 lines
3.1 KiB
C#
96 lines
3.1 KiB
C#
using System.Linq;
|
|
using System.Numerics;
|
|
using Content.Shared.Ghost;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
|
|
namespace Content.Client.UserInterface.Systems.Ghost.Controls
|
|
{
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class GhostTargetWindow : DefaultWindow
|
|
{
|
|
private List<(string, NetEntity)> _warps = new();
|
|
private string _searchText = string.Empty;
|
|
|
|
public event Action<NetEntity>? WarpClicked;
|
|
public event Action? OnGhostnadoClicked;
|
|
|
|
public GhostTargetWindow()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
SearchBar.OnTextChanged += OnSearchTextChanged;
|
|
|
|
GhostnadoButton.OnPressed += _ => OnGhostnadoClicked?.Invoke();
|
|
}
|
|
|
|
public void UpdateWarps(IEnumerable<GhostWarp> warps)
|
|
{
|
|
// Server COULD send these sorted but how about we just use the client to do it instead
|
|
_warps = warps
|
|
.OrderBy(w => w.IsWarpPoint)
|
|
.ThenBy(w => w.DisplayName, Comparer<string>.Create(
|
|
(x, y) => string.Compare(x, y, StringComparison.Ordinal)))
|
|
.Select(w =>
|
|
{
|
|
var name = w.IsWarpPoint
|
|
? Loc.GetString("ghost-target-window-current-button", ("name", w.DisplayName))
|
|
: w.DisplayName;
|
|
|
|
return (name, w.Entity);
|
|
})
|
|
.ToList();
|
|
}
|
|
|
|
public void Populate()
|
|
{
|
|
ButtonContainer.DisposeAllChildren();
|
|
AddButtons();
|
|
}
|
|
|
|
private void AddButtons()
|
|
{
|
|
foreach (var (name, warpTarget) in _warps)
|
|
{
|
|
var currentButtonRef = new Button
|
|
{
|
|
Text = name,
|
|
TextAlign = Label.AlignMode.Right,
|
|
HorizontalAlignment = HAlignment.Center,
|
|
VerticalAlignment = VAlignment.Center,
|
|
SizeFlagsStretchRatio = 1,
|
|
MinSize = new Vector2(340, 20),
|
|
ClipText = true,
|
|
};
|
|
|
|
currentButtonRef.OnPressed += _ => WarpClicked?.Invoke(warpTarget);
|
|
currentButtonRef.Visible = ButtonIsVisible(currentButtonRef);
|
|
|
|
ButtonContainer.AddChild(currentButtonRef);
|
|
}
|
|
}
|
|
|
|
private bool ButtonIsVisible(Button button)
|
|
{
|
|
return string.IsNullOrEmpty(_searchText) || button.Text == null || button.Text.Contains(_searchText, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
private void UpdateVisibleButtons()
|
|
{
|
|
foreach (var child in ButtonContainer.Children)
|
|
{
|
|
if (child is Button button)
|
|
button.Visible = ButtonIsVisible(button);
|
|
}
|
|
}
|
|
|
|
private void OnSearchTextChanged(LineEdit.LineEditEventArgs args)
|
|
{
|
|
_searchText = args.Text;
|
|
|
|
UpdateVisibleButtons();
|
|
}
|
|
}
|
|
}
|