mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-06-09 13:26:34 +02:00
2ca5d9d81a
* Initial commit * Added pods * Transit tubes should no longer connect with disposal pipes * Updated the transit tube sprites * Revisited how the transit tubes work * Fixing merge conflict * Updated sprites * Simplified disposal component collections and updated yaml * Moved the majority of the disposals code to Shared * Move disposed ents via physics * Disposal unit now use generic visualizers * Followers of disposed entities have predicted movement * Made BeingDisposedSystem shared * Added documentation for some components * Code clean up * Removed unneeded container entries, tubes use directions instead of angles * Many EntityUid/Comp -> Entity<Comp> changes * Updated DisposableSystem * Review of DisposalTubeSystem * Review of DisposalUnitSystem * Review of DisposalSignalRouterSystem * Unit updates * Fixing merge conflict * Merge conflict resolved * Re-organization of systems and components * Allow trapped entities to escape endless loops * Fix for item ejection * UI updates * Minor tweak * Fixes for transit tubes * Removed placeholder sprite * Removed transit tubes (for now) * Moved exit stun time to DisposalHolderComponent * Added a limit on the amount of damage that can sustained from disposals travel * Fix for PVS-related sound issues * Added a limit on the number of entities that can be inserted into units * Clean up * Undid file scoping * Fixed test fail * Fixed test fail * Increased min default capacity of disposal units * Fixed audio spam occurring when dumping multiple items into a disposal unit * Tile prying now occurs whenever exiting an open pipe * Prevent attacking and interactions while traveling through disposals * Added generic verbs for entering/exiting disposal units * Fixed UI prediction bug * Bug fixes * Small improvements * Moved the disposal holder prototype from the disposal entry to the unit * Minor clean up * Added support for a disposal holder despawn effect * Added prediction guard * Test fail fix * Re-added new escape behavior * Removed outdated PVS code * Clean up * More escape behavior changes * More clean up * Updated exit selection logic * Bug fix * More clean up * Split up disposal unit code * Cleaned up disposal units some more * Adjusted exit throw distance * Capitalized disposal and mailing unit window titles * Bug fixes * Taggers and routers show existing tags when the UI opens * Fixed test fail * test fail fix * Minor performance improvement * Minor improvement in pathing * merge conflicts * Fix heisentest * Fixed mispredict * Updated system referencing conventions * Updated to account for changes made to the code * Attempting to fix submodule issue * Addressing test fails * Additional fixes for tests * Addressing reviewer comments * Cleaned up exit randomization * T-ray can see disposal pipes when in 'pipe' mode * Fix for flush animation flickering * mild thing * fix both --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
94 lines
3.4 KiB
C#
94 lines
3.4 KiB
C#
using Content.Client.Disposal.Unit;
|
|
using Content.Client.Power.EntitySystems;
|
|
using Content.Shared.Disposal.Components;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using System.Linq;
|
|
|
|
namespace Content.Client.Disposal.Mailing;
|
|
|
|
public sealed class MailingUnitBoundUserInterface : BoundUserInterface
|
|
{
|
|
[ViewVariables]
|
|
private MailingUnitWindow? _mailingUnitWindow;
|
|
|
|
public MailingUnitBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
|
{
|
|
}
|
|
|
|
private void ButtonPressed(DisposalUnitUiButton button)
|
|
{
|
|
SendPredictedMessage(new DisposalUnitUiButtonPressedMessage(button));
|
|
}
|
|
|
|
private void TargetSelected(ItemList.ItemListSelectedEventArgs args)
|
|
{
|
|
var item = args.ItemList[args.ItemIndex];
|
|
SendPredictedMessage(new TargetSelectedMessage(item.Text));
|
|
}
|
|
|
|
protected override void Open()
|
|
{
|
|
base.Open();
|
|
|
|
_mailingUnitWindow = this.CreateWindow<MailingUnitWindow>();
|
|
_mailingUnitWindow.OpenCenteredRight();
|
|
|
|
_mailingUnitWindow.Eject.OnPressed += _ => ButtonPressed(DisposalUnitUiButton.Eject);
|
|
_mailingUnitWindow.Engage.OnPressed += _ => ButtonPressed(DisposalUnitUiButton.Engage);
|
|
_mailingUnitWindow.Power.OnPressed += _ => ButtonPressed(DisposalUnitUiButton.Power);
|
|
|
|
_mailingUnitWindow.TargetListContainer.OnItemSelected += TargetSelected;
|
|
|
|
if (EntMan.TryGetComponent(Owner, out MailingUnitComponent? component))
|
|
{
|
|
Refresh((Owner, component));
|
|
}
|
|
}
|
|
|
|
public override void Update()
|
|
{
|
|
base.Update();
|
|
|
|
if (EntMan.TryGetComponent(Owner, out MailingUnitComponent? component))
|
|
{
|
|
Refresh((Owner, component));
|
|
}
|
|
}
|
|
|
|
public void Refresh(Entity<MailingUnitComponent> entity)
|
|
{
|
|
if (_mailingUnitWindow == null)
|
|
return;
|
|
|
|
var name = EntMan.GetComponent<MetaDataComponent>(entity.Owner).EntityName;
|
|
|
|
_mailingUnitWindow.Title = string.IsNullOrEmpty(entity.Comp.Tag)
|
|
? Loc.GetString("ui-mailing-unit-window-title", ("name", name))
|
|
: Loc.GetString("ui-mailing-unit-window-title-tagged", ("tag", entity.Comp.Tag));
|
|
_mailingUnitWindow.Target.Text = entity.Comp.Target;
|
|
|
|
var entries = entity.Comp.TargetList.Select(target => new ItemList.Item(_mailingUnitWindow.TargetListContainer)
|
|
{
|
|
Text = target,
|
|
Selected = target == entity.Comp.Target
|
|
}).ToList();
|
|
_mailingUnitWindow.TargetListContainer.SetItems(entries);
|
|
|
|
if (!EntMan.TryGetComponent(entity.Owner, out DisposalUnitComponent? disposals))
|
|
return;
|
|
|
|
var disposalSystem = EntMan.System<DisposalUnitSystem>();
|
|
var disposalState = disposalSystem.GetState((Owner, disposals));
|
|
var fullPressure = disposalSystem.EstimatedFullPressure((Owner, disposals));
|
|
var pressurePerSecond = disposals.PressurePerSecond;
|
|
|
|
_mailingUnitWindow.UnitState.Text = Loc.GetString($"disposal-unit-state-{disposalState}");
|
|
_mailingUnitWindow.FullPressure = fullPressure;
|
|
_mailingUnitWindow.PressurePerSecond = pressurePerSecond;
|
|
_mailingUnitWindow.PressureBar.UpdatePressure(fullPressure, pressurePerSecond);
|
|
_mailingUnitWindow.Power.Pressed = EntMan.System<PowerReceiverSystem>().IsPowered(Owner);
|
|
_mailingUnitWindow.Engage.Pressed = disposals.Engaged;
|
|
}
|
|
}
|