-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- This got soaped really fucking hard. - Dumping is predicted, this required disposals to be predicte.d - Disposals required mailing (because it's tightly coupled), and a smidge of other content systems. - I also had to fix a compnetworkgenerator issue at the same time so it wouldn't mispredict.
- Loading branch information
1 parent
8ed779b
commit 77877aa
Showing
133 changed files
with
1,541 additions
and
1,643 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Content.Client.Configurable.UI; | ||
using Content.Shared.Configurable; | ||
|
||
namespace Content.Client.Configurable; | ||
|
||
public sealed class ConfigurationSystem : SharedConfigurationSystem | ||
{ | ||
[Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<ConfigurationComponent, AfterAutoHandleStateEvent>(OnConfigurationState); | ||
} | ||
|
||
private void OnConfigurationState(Entity<ConfigurationComponent> ent, ref AfterAutoHandleStateEvent args) | ||
{ | ||
if (_uiSystem.TryGetOpenUi<ConfigurationBoundUserInterface>(ent.Owner, | ||
ConfigurationComponent.ConfigurationUiKey.Key, | ||
out var bui)) | ||
{ | ||
bui.Refresh(ent); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Content.Shared.DeviceNetwork.Systems; | ||
|
||
namespace Content.Client.DeviceNetwork.Systems; | ||
|
||
public sealed class DeviceNetworkSystem : SharedDeviceNetworkSystem | ||
{ | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
90 changes: 90 additions & 0 deletions
90
Content.Client/Disposal/Mailing/MailingUnitBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
using Content.Client.Disposal.Unit; | ||
using Content.Client.Power.EntitySystems; | ||
using Content.Shared.Disposal; | ||
using Content.Shared.Disposal.Components; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.Controls; | ||
using MailingUnitComponent = Content.Shared.Disposal.Components.MailingUnitComponent; | ||
|
||
namespace Content.Client.Disposal.Mailing; | ||
|
||
public sealed class MailingUnitBoundUserInterface : BoundUserInterface | ||
{ | ||
[ViewVariables] | ||
public MailingUnitWindow? MailingUnitWindow; | ||
|
||
public MailingUnitBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
private void ButtonPressed(DisposalUnitComponent.UiButton button) | ||
{ | ||
SendMessage(new DisposalUnitComponent.UiButtonPressedMessage(button)); | ||
// If we get client-side power stuff then we can predict the button presses but for now we won't as it stuffs | ||
// the pressure lerp up. | ||
} | ||
|
||
private void TargetSelected(ItemList.ItemListSelectedEventArgs args) | ||
{ | ||
var item = args.ItemList[args.ItemIndex]; | ||
SendMessage(new TargetSelectedMessage(item.Text)); | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
MailingUnitWindow = this.CreateWindow<MailingUnitWindow>(); | ||
MailingUnitWindow.OpenCenteredRight(); | ||
|
||
MailingUnitWindow.Eject.OnPressed += _ => ButtonPressed(DisposalUnitComponent.UiButton.Eject); | ||
MailingUnitWindow.Engage.OnPressed += _ => ButtonPressed(DisposalUnitComponent.UiButton.Engage); | ||
MailingUnitWindow.Power.OnPressed += _ => ButtonPressed(DisposalUnitComponent.UiButton.Power); | ||
|
||
MailingUnitWindow.TargetListContainer.OnItemSelected += TargetSelected; | ||
|
||
if (EntMan.TryGetComponent(Owner, out MailingUnitComponent? component)) | ||
Refresh((Owner, component)); | ||
} | ||
|
||
public void Refresh(Entity<MailingUnitComponent> entity) | ||
{ | ||
if (MailingUnitWindow == null) | ||
return; | ||
|
||
// TODO: This should be decoupled from disposals | ||
if (EntMan.TryGetComponent(entity.Owner, out DisposalUnitComponent? disposals)) | ||
{ | ||
var disposalSystem = EntMan.System<DisposalUnitSystem>(); | ||
|
||
var disposalState = disposalSystem.GetState(Owner, disposals); | ||
var fullPressure = disposalSystem.EstimatedFullPressure(Owner, disposals); | ||
|
||
MailingUnitWindow.UnitState.Text = Loc.GetString($"disposal-unit-state-{disposalState}"); | ||
MailingUnitWindow.FullPressure = fullPressure; | ||
MailingUnitWindow.PressureBar.UpdatePressure(fullPressure); | ||
MailingUnitWindow.Power.Pressed = EntMan.System<PowerReceiverSystem>().IsPowered(Owner); | ||
MailingUnitWindow.Engage.Pressed = disposals.Engaged; | ||
} | ||
|
||
MailingUnitWindow.Title = Loc.GetString("ui-mailing-unit-window-title", ("tag", entity.Comp.Tag ?? " ")); | ||
//UnitTag.Text = state.Tag; | ||
MailingUnitWindow.Target.Text = entity.Comp.Target; | ||
|
||
MailingUnitWindow.TargetListContainer.Clear(); | ||
foreach (var target in entity.Comp.TargetList) | ||
{ | ||
MailingUnitWindow.TargetListContainer.AddItem(target); | ||
} | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
|
||
if (!disposing) | ||
return; | ||
|
||
MailingUnitWindow?.Dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Content.Shared.Disposal; | ||
using Content.Shared.Disposal.Components; | ||
using Content.Shared.Disposal.Mailing; | ||
|
||
namespace Content.Client.Disposal.Mailing; | ||
|
||
public sealed class MailingUnitSystem : SharedMailingUnitSystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<MailingUnitComponent, AfterAutoHandleStateEvent>(OnMailingState); | ||
} | ||
|
||
private void OnMailingState(Entity<MailingUnitComponent> ent, ref AfterAutoHandleStateEvent args) | ||
{ | ||
if (UserInterfaceSystem.TryGetOpenUi<MailingUnitBoundUserInterface>(ent.Owner, MailingUnitUiKey.Key, out var bui)) | ||
{ | ||
bui.Refresh(ent); | ||
} | ||
} | ||
} |
Oops, something went wrong.