Map/Shop.cs

A scene component representing an upgrades shop in the game world. It plays a store sound, stops the player's velocity, and asks the player's client to open the shop UI when used.

NetworkingFile Access
using Sandbox;

namespace BrickJam;

/// <summary>
/// Upgrades-shop counter. Scene-System port of legacy <c>Shop</c>. The shop UI panel is deferred to
/// the UI system; this opens it via <see cref="OpenShop"/> (a no-op hook for now) and plays the SFX.
/// </summary>
[Title( "Shop" )]
[Category( "Map" )]
public sealed partial class Shop : LegacyUsableComponent
{
	public override bool ShouldCenterInteractionHint => false;
	public override float InteractionDuration { get; set; } = 0.7f;
	public override string UseString { get => "open the upgrades shop"; set { } }

	public override void Use( Player user )
	{
		SoundExtensions.BroadcastPlay( "sounds/store/store.sound", user.WorldPosition + user.WorldRotation.Forward * 50f, 0.3f );
		user.Velocity = Vector3.Zero;

		// Ask the interacting player's client to open the shop UI.
		user.OpenShopUi();
	}
}