Skip to main content

Clientpickupsoundsuppressor

Overview

This component provides functionality to temporarily disable the pickup sound of an entity on the client-side. It is primarily used to prevent unintended pickup sounds when an entity spawns or during specific interactions where a sound would be redundant or incorrect, ensuring a smoother client-side audio experience. The suppression is brief and automatically re-enables the original sound after a short delay.

Dependencies & Tags

This component relies on the entity having a pickupsound property, which it temporarily modifies. It does not add or remove any specific tags. None identified.

Properties

PropertyTypeDefault ValueDescription
_ignorenextnet_boolfalseA network-synchronized boolean that signals whether the next potential pickup sound should be ignored. It also triggers an event listener on client instances when its value changes.

Main Functions

ClientPickupSoundSuppressor:IgnoreNextPickupSound()

  • Description: Instructs the component to suppress the entity's next pickup sound on clients. It determines if the entity has just spawned and sets the _ignorenext network boolean accordingly, which then triggers the actual sound suppression logic on client instances.
  • Parameters: None.

Events & Listeners

  • Listens For: clientpickupsoundsuppressor._ignorenext (on non-master simulations only)
    • Triggered when the _ignorenext net_bool changes its value. This event handler (OnIgnoreNext) is responsible for temporarily setting inst.pickupsound to "NONE" and scheduling its restoration after a short duration (2 frames). It includes a special check to avoid suppressing sounds if the entity just spawned on the client but isn't a new server spawn, preventing unintended sound loss for valid spawn events.