Fix store refunds (#26173)
This commit is contained in:
@@ -323,7 +323,7 @@ public sealed partial class StoreSystem
|
||||
if (!component.RefundAllowed || component.BoughtEntities.Count == 0)
|
||||
return;
|
||||
|
||||
for (var i = component.BoughtEntities.Count; i >= 0; i--)
|
||||
for (var i = component.BoughtEntities.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var purchase = component.BoughtEntities[i];
|
||||
|
||||
@@ -332,7 +332,7 @@ public sealed partial class StoreSystem
|
||||
|
||||
component.BoughtEntities.RemoveAt(i);
|
||||
|
||||
if (_actions.TryGetActionData(purchase, out var actionComponent))
|
||||
if (_actions.TryGetActionData(purchase, out var actionComponent, logError: false))
|
||||
{
|
||||
_actionContainer.RemoveAction(purchase, actionComponent);
|
||||
}
|
||||
@@ -340,6 +340,8 @@ public sealed partial class StoreSystem
|
||||
EntityManager.DeleteEntity(purchase);
|
||||
}
|
||||
|
||||
component.BoughtEntities.Clear();
|
||||
|
||||
foreach (var (currency, value) in component.BalanceSpent)
|
||||
{
|
||||
component.Balance[currency] += value;
|
||||
|
||||
Reference in New Issue
Block a user