* 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>
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using Content.Server.Store.Systems;
|
|
|
|
namespace Content.Server.Store.Components;
|
|
|
|
// TODO: Refund on a per-item/action level.
|
|
// Requires a refund button next to each purchase (disabled/invis by default)
|
|
// Interactions with ActionUpgrades would need to be modified to reset all upgrade progress and return the original action purchase to the store.
|
|
|
|
/// <summary>
|
|
/// Keeps track of entities bought from stores for refunds, especially useful if entities get deleted before they can be refunded.
|
|
/// </summary>
|
|
[RegisterComponent, Access(typeof(StoreSystem))]
|
|
public sealed partial class StoreRefundComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// The store this entity was bought from
|
|
/// </summary>
|
|
[DataField]
|
|
public EntityUid? StoreEntity;
|
|
|
|
/// <summary>
|
|
/// The time this entity was bought
|
|
/// </summary>
|
|
[DataField]
|
|
public TimeSpan? BoughtTime;
|
|
|
|
/// <summary>
|
|
/// How long until this entity disables refund purchase?
|
|
/// </summary>
|
|
[DataField]
|
|
public TimeSpan DisableTime = TimeSpan.FromSeconds(300);
|
|
}
|