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:
@@ -73,7 +73,7 @@ public sealed partial class StoreSystem
|
||||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
|
||||
_ui.TryCloseAll(uid, StoreUiKey.Key);
|
||||
_ui.CloseUi(uid, StoreUiKey.Key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -83,12 +83,13 @@ public sealed partial class StoreSystem
|
||||
/// <param name="store">The store entity itself</param>
|
||||
/// <param name="component">The store component being refreshed.</param>
|
||||
/// <param name="ui"></param>
|
||||
public void UpdateUserInterface(EntityUid? user, EntityUid store, StoreComponent? component = null, PlayerBoundUserInterface? ui = null)
|
||||
public void UpdateUserInterface(EntityUid? user, EntityUid store, StoreComponent? component = null)
|
||||
{
|
||||
if (!Resolve(store, ref component))
|
||||
return;
|
||||
|
||||
if (ui == null && !_ui.TryGetUi(store, StoreUiKey.Key, out ui))
|
||||
// TODO: Why is the state not being set unless this?
|
||||
if (!_ui.IsUiOpen(store, StoreUiKey.Key))
|
||||
return;
|
||||
|
||||
//this is the person who will be passed into logic for all listing filtering.
|
||||
@@ -113,12 +114,12 @@ public sealed partial class StoreSystem
|
||||
// only tell operatives to lock their uplink if it can be locked
|
||||
var showFooter = HasComp<RingerUplinkComponent>(store);
|
||||
var state = new StoreUpdateState(component.LastAvailableListings, allCurrency, showFooter, component.RefundAllowed);
|
||||
_ui.SetUiState(ui, state);
|
||||
_ui.SetUiState(store, StoreUiKey.Key, state);
|
||||
}
|
||||
|
||||
private void OnRequestUpdate(EntityUid uid, StoreComponent component, StoreRequestUpdateInterfaceMessage args)
|
||||
{
|
||||
UpdateUserInterface(args.Session.AttachedEntity, GetEntity(args.Entity), component);
|
||||
UpdateUserInterface(args.Actor, GetEntity(args.Entity), component);
|
||||
}
|
||||
|
||||
private void BeforeActivatableUiOpen(EntityUid uid, StoreComponent component, BeforeActivatableUIOpenEvent args)
|
||||
@@ -139,8 +140,7 @@ public sealed partial class StoreSystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg.Session.AttachedEntity is not { Valid: true } buyer)
|
||||
return;
|
||||
var buyer = msg.Actor;
|
||||
|
||||
//verify that we can actually buy this listing and it wasn't added
|
||||
if (!ListingHasCategory(listing, component.Categories))
|
||||
@@ -263,7 +263,7 @@ public sealed partial class StoreSystem
|
||||
$"{ToPrettyString(buyer):player} purchased listing \"{ListingLocalisationHelpers.GetLocalisedNameOrEntityName(listing, _prototypeManager)}\" from {ToPrettyString(uid)}");
|
||||
|
||||
listing.PurchaseAmount++; //track how many times something has been purchased
|
||||
_audio.PlayEntity(component.BuySuccessSound, msg.Session, uid); //cha-ching!
|
||||
_audio.PlayEntity(component.BuySuccessSound, msg.Actor, uid); //cha-ching!
|
||||
|
||||
UpdateUserInterface(buyer, uid, component);
|
||||
}
|
||||
@@ -289,8 +289,7 @@ public sealed partial class StoreSystem
|
||||
if (proto.Cash == null || !proto.CanWithdraw)
|
||||
return;
|
||||
|
||||
if (msg.Session.AttachedEntity is not { Valid: true } buyer)
|
||||
return;
|
||||
var buyer = msg.Actor;
|
||||
|
||||
FixedPoint2 amountRemaining = msg.Amount;
|
||||
var coordinates = Transform(buyer).Coordinates;
|
||||
@@ -313,7 +312,7 @@ public sealed partial class StoreSystem
|
||||
{
|
||||
// TODO: Remove guardian/holopara
|
||||
|
||||
if (args.Session.AttachedEntity is not { Valid: true } buyer)
|
||||
if (args.Actor is not { Valid: true } buyer)
|
||||
return;
|
||||
|
||||
if (!IsOnStartingMap(uid, component))
|
||||
|
||||
Reference in New Issue
Block a user