Custom solution transfer volume popup and item status panel fix (#29852)
* Fix for custom solution transfer volume * Dirty call to prevent issues * Another fix, git issue --------- Co-authored-by: Winkarst-cpu <Winkarst@users.noreply.github.com>
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Content.Shared.Chemistry.Components;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gives click behavior for transferring to/from other reagent containers.
|
/// Gives click behavior for transferring to/from other reagent containers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent, NetworkedComponent]
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||||
public sealed partial class SolutionTransferComponent : Component
|
public sealed partial class SolutionTransferComponent : Component
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -14,6 +14,7 @@ public sealed partial class SolutionTransferComponent : Component
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("transferAmount")]
|
[DataField("transferAmount")]
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[AutoNetworkedField]
|
||||||
public FixedPoint2 TransferAmount { get; set; } = FixedPoint2.New(5);
|
public FixedPoint2 TransferAmount { get; set; } = FixedPoint2.New(5);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -38,11 +38,15 @@ public sealed class SolutionTransferSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnTransferAmountSetValueMessage(Entity<SolutionTransferComponent> ent, ref TransferAmountSetValueMessage message)
|
private void OnTransferAmountSetValueMessage(Entity<SolutionTransferComponent> ent, ref TransferAmountSetValueMessage message)
|
||||||
{
|
{
|
||||||
var newTransferAmount = FixedPoint2.Clamp(message.Value, ent.Comp.MinimumTransferAmount, ent.Comp.MaximumTransferAmount);
|
var (uid, comp) = ent;
|
||||||
ent.Comp.TransferAmount = newTransferAmount;
|
|
||||||
|
var newTransferAmount = FixedPoint2.Clamp(message.Value, comp.MinimumTransferAmount, comp.MaximumTransferAmount);
|
||||||
|
comp.TransferAmount = newTransferAmount;
|
||||||
|
|
||||||
if (message.Actor is { Valid: true } user)
|
if (message.Actor is { Valid: true } user)
|
||||||
_popup.PopupClient(Loc.GetString("comp-solution-transfer-set-amount", ("amount", newTransferAmount)), ent, user);
|
_popup.PopupEntity(Loc.GetString("comp-solution-transfer-set-amount", ("amount", newTransferAmount)), uid, user);
|
||||||
|
|
||||||
|
Dirty(uid, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddSetTransferVerbs(Entity<SolutionTransferComponent> ent, ref GetVerbsEvent<AlternativeVerb> args)
|
private void AddSetTransferVerbs(Entity<SolutionTransferComponent> ent, ref GetVerbsEvent<AlternativeVerb> args)
|
||||||
@@ -78,7 +82,10 @@ public sealed class SolutionTransferSystem : EntitySystem
|
|||||||
verb.Act = () =>
|
verb.Act = () =>
|
||||||
{
|
{
|
||||||
comp.TransferAmount = amount;
|
comp.TransferAmount = amount;
|
||||||
|
|
||||||
_popup.PopupClient(Loc.GetString("comp-solution-transfer-set-amount", ("amount", amount)), uid, user);
|
_popup.PopupClient(Loc.GetString("comp-solution-transfer-set-amount", ("amount", amount)), uid, user);
|
||||||
|
|
||||||
|
Dirty(uid, comp);
|
||||||
};
|
};
|
||||||
|
|
||||||
// we want to sort by size, not alphabetically by the verb text.
|
// we want to sort by size, not alphabetically by the verb text.
|
||||||
|
|||||||
Reference in New Issue
Block a user