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

@@ -54,21 +54,20 @@ public sealed partial class CargoSystem
private void UpdatePalletConsoleInterface(EntityUid uid)
{
var bui = _uiSystem.GetUi(uid, CargoPalletConsoleUiKey.Sale);
if (Transform(uid).GridUid is not EntityUid gridUid)
{
_uiSystem.SetUiState(bui,
_uiSystem.SetUiState(uid, CargoPalletConsoleUiKey.Sale,
new CargoPalletConsoleInterfaceState(0, 0, false));
return;
}
GetPalletGoods(gridUid, out var toSell, out var amount);
_uiSystem.SetUiState(bui,
_uiSystem.SetUiState(uid, CargoPalletConsoleUiKey.Sale,
new CargoPalletConsoleInterfaceState((int) amount, toSell.Count, true));
}
private void OnPalletUIOpen(EntityUid uid, CargoPalletConsoleComponent component, BoundUIOpenedEvent args)
{
var player = args.Session.AttachedEntity;
var player = args.Actor;
if (player == null)
return;
@@ -86,7 +85,7 @@ public sealed partial class CargoSystem
private void OnPalletAppraise(EntityUid uid, CargoPalletConsoleComponent component, CargoPalletAppraiseMessage args)
{
var player = args.Session.AttachedEntity;
var player = args.Actor;
if (player == null)
return;
@@ -108,8 +107,8 @@ public sealed partial class CargoSystem
var orders = GetProjectedOrders(station ?? EntityUid.Invalid, orderDatabase, shuttle);
var shuttleName = orderDatabase?.Shuttle != null ? MetaData(orderDatabase.Shuttle.Value).EntityName : string.Empty;
if (_uiSystem.TryGetUi(uid, CargoConsoleUiKey.Shuttle, out var bui))
_uiSystem.SetUiState(bui, new CargoShuttleConsoleBoundUserInterfaceState(
if (_uiSystem.HasUi(uid, CargoConsoleUiKey.Shuttle))
_uiSystem.SetUiState(uid, CargoConsoleUiKey.Shuttle, new CargoShuttleConsoleBoundUserInterfaceState(
station != null ? MetaData(station.Value).EntityName : Loc.GetString("cargo-shuttle-console-station-unknown"),
string.IsNullOrEmpty(shuttleName) ? Loc.GetString("cargo-shuttle-console-shuttle-not-found") : shuttleName,
orders
@@ -314,17 +313,16 @@ public sealed partial class CargoSystem
private void OnPalletSale(EntityUid uid, CargoPalletConsoleComponent component, CargoPalletSellMessage args)
{
var player = args.Session.AttachedEntity;
var player = args.Actor;
if (player == null)
return;
var bui = _uiSystem.GetUi(uid, CargoPalletConsoleUiKey.Sale);
var xform = Transform(uid);
if (xform.GridUid is not EntityUid gridUid)
{
_uiSystem.SetUiState(bui,
_uiSystem.SetUiState(uid, CargoPalletConsoleUiKey.Sale,
new CargoPalletConsoleInterfaceState(0, 0, false));
return;
}