Content update for UI prediction (#27214)

* Content update for UI refactor

* Big update

* Sharing

* Remaining content updates

* First big update

* Prototype updates

* AUGH

* Fix UI comp ref

* Cleanup

- Fix predicted message, fix item slots, fix interaction range check.

* Fix regressions

* Make this predictive

idk why it wasn't.

* Fix slime merge

* Merge conflict

* Fix merge
This commit is contained in:
metalgearsloth
2024-04-26 18:16:24 +10:00
committed by GitHub
parent 32b81de8c5
commit 5896e68752
279 changed files with 1308 additions and 1582 deletions

View File

@@ -102,12 +102,12 @@ namespace Content.Server.Cargo.Systems
private void OnApproveOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleApproveOrderMessage args)
{
if (args.Session.AttachedEntity is not { Valid: true } player)
if (args.Actor is not { Valid: true } player)
return;
if (!_accessReaderSystem.IsAllowed(player, uid))
{
ConsolePopup(args.Session, Loc.GetString("cargo-console-order-not-allowed"));
ConsolePopup(args.Actor, Loc.GetString("cargo-console-order-not-allowed"));
PlayDenySound(uid, component);
return;
}
@@ -119,7 +119,7 @@ namespace Content.Server.Cargo.Systems
!TryComp(station, out StationDataComponent? stationData) ||
!TryGetOrderDatabase(station, out var orderDatabase))
{
ConsolePopup(args.Session, Loc.GetString("cargo-console-station-not-found"));
ConsolePopup(args.Actor, Loc.GetString("cargo-console-station-not-found"));
PlayDenySound(uid, component);
return;
}
@@ -134,7 +134,7 @@ namespace Content.Server.Cargo.Systems
// Invalid order
if (!_protoMan.HasIndex<EntityPrototype>(order.ProductId))
{
ConsolePopup(args.Session, Loc.GetString("cargo-console-invalid-product"));
ConsolePopup(args.Actor, Loc.GetString("cargo-console-invalid-product"));
PlayDenySound(uid, component);
return;
}
@@ -145,7 +145,7 @@ namespace Content.Server.Cargo.Systems
// Too many orders, avoid them getting spammed in the UI.
if (amount >= capacity)
{
ConsolePopup(args.Session, Loc.GetString("cargo-console-too-many"));
ConsolePopup(args.Actor, Loc.GetString("cargo-console-too-many"));
PlayDenySound(uid, component);
return;
}
@@ -156,7 +156,7 @@ namespace Content.Server.Cargo.Systems
if (cappedAmount != order.OrderQuantity)
{
order.OrderQuantity = cappedAmount;
ConsolePopup(args.Session, Loc.GetString("cargo-console-snip-snip"));
ConsolePopup(args.Actor, Loc.GetString("cargo-console-snip-snip"));
PlayDenySound(uid, component);
}
@@ -165,7 +165,7 @@ namespace Content.Server.Cargo.Systems
// Not enough balance
if (cost > bank.Balance)
{
ConsolePopup(args.Session, Loc.GetString("cargo-console-insufficient-funds", ("cost", cost)));
ConsolePopup(args.Actor, Loc.GetString("cargo-console-insufficient-funds", ("cost", cost)));
PlayDenySound(uid, component);
return;
}
@@ -180,7 +180,7 @@ namespace Content.Server.Cargo.Systems
if (ev.FulfillmentEntity == null)
{
ConsolePopup(args.Session, Loc.GetString("cargo-console-unfulfilled"));
ConsolePopup(args.Actor, Loc.GetString("cargo-console-unfulfilled"));
PlayDenySound(uid, component);
return;
}
@@ -200,7 +200,7 @@ namespace Content.Server.Cargo.Systems
("approverJob", approverJob),
("cost", cost));
_radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false);
ConsolePopup(args.Session, Loc.GetString("cargo-console-trade-station", ("destination", MetaData(ev.FulfillmentEntity.Value).EntityName)));
ConsolePopup(args.Actor, Loc.GetString("cargo-console-trade-station", ("destination", MetaData(ev.FulfillmentEntity.Value).EntityName)));
// Log order approval
_adminLogger.Add(LogType.Action, LogImpact.Low,
@@ -271,7 +271,7 @@ namespace Content.Server.Cargo.Systems
private void OnAddOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleAddOrderMessage args)
{
if (args.Session.AttachedEntity is not { Valid: true } player)
if (args.Actor is not { Valid: true } player)
return;
if (args.Amount <= 0)
@@ -319,9 +319,9 @@ namespace Content.Server.Cargo.Systems
!TryComp<StationCargoOrderDatabaseComponent>(station, out var orderDatabase) ||
!TryComp<StationBankAccountComponent>(station, out var bankAccount)) return;
if (_uiSystem.TryGetUi(consoleUid, CargoConsoleUiKey.Orders, out var bui))
if (_uiSystem.HasUi(consoleUid, CargoConsoleUiKey.Orders))
{
_uiSystem.SetUiState(bui, new CargoConsoleInterfaceState(
_uiSystem.SetUiState(consoleUid, CargoConsoleUiKey.Orders, new CargoConsoleInterfaceState(
MetaData(station.Value).EntityName,
GetOutstandingOrderCount(orderDatabase),
orderDatabase.Capacity,
@@ -331,9 +331,9 @@ namespace Content.Server.Cargo.Systems
}
}
private void ConsolePopup(ICommonSession session, string text)
private void ConsolePopup(EntityUid actor, string text)
{
_popup.PopupCursor(text, session);
_popup.PopupCursor(text, actor);
}
private void PlayDenySound(EntityUid uid, CargoOrderConsoleComponent component)