Store Refund - Add more disable scenerios & time to disable refund. (#34671)

* Puts disable refund logic into a helper method. Removes action check. Disables refund on action use.

* Adds check if refund is disabled for the store already

* Adds a way to disable refunds based on time

* Checks if the ent is on the starting map and the end time is below the current time before disabling refund

* Replaces instances of component.RefundAllowed = false with DisableRefund for more consistency and easier tracking

* Adds methods to handle inhand and shooting events

* Removes gamestates

---------

Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
This commit is contained in:
keronshb
2025-02-15 11:17:29 -05:00
committed by GitHub
parent 71b5133a53
commit 0cb11241d7
4 changed files with 68 additions and 11 deletions

View File

@@ -164,7 +164,7 @@ public sealed partial class StoreSystem
}
if (!IsOnStartingMap(uid, component))
component.RefundAllowed = false;
DisableRefund(uid, component);
//subtract the cash
foreach (var (currency, amount) in cost)
@@ -332,7 +332,7 @@ public sealed partial class StoreSystem
if (!IsOnStartingMap(uid, component))
{
component.RefundAllowed = false;
DisableRefund(uid, component);
UpdateUserInterface(buyer, uid, component);
}
@@ -376,6 +376,7 @@ public sealed partial class StoreSystem
component.BoughtEntities.Add(purchase);
var refundComp = EnsureComp<StoreRefundComponent>(purchase);
refundComp.StoreEntity = uid;
refundComp.BoughtTime = _timing.CurTime;
}
private bool IsOnStartingMap(EntityUid store, StoreComponent component)