mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-20 06:19:05 -04:00
https://files.facepunch.com/antopilo/1b0311b1/sbox-dev_Ghn3TRf8eM.mp4 https://files.facepunch.com/antopilo/1b0311b1/sbox-dev_yALD2nMaPw.mp4
56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
namespace Sandbox.Clutter;
|
|
|
|
/// <summary>
|
|
/// Infinite/streaming clutter mode
|
|
/// </summary>
|
|
public sealed partial class ClutterComponent
|
|
{
|
|
/// <summary>
|
|
/// Returns true if in infinite streaming mode.
|
|
/// </summary>
|
|
[Hide]
|
|
public bool Infinite => Mode == ClutterMode.Infinite;
|
|
|
|
/// <summary>
|
|
/// Gets the current clutter settings for the grid system.
|
|
/// </summary>
|
|
internal ClutterSettings GetCurrentSettings()
|
|
{
|
|
if ( Clutter == null )
|
|
return default;
|
|
|
|
return new ClutterSettings( Seed, Clutter );
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clears all infinite mode tiles for this component.
|
|
/// </summary>
|
|
public void ClearInfinite()
|
|
{
|
|
var gridSystem = Scene.GetSystem<ClutterGridSystem>();
|
|
gridSystem?.ClearComponent( this );
|
|
}
|
|
|
|
/// <summary>
|
|
/// Invalidates the tile at the given world position, causing it to regenerate.
|
|
/// </summary>
|
|
public void InvalidateTileAt( Vector3 worldPosition )
|
|
{
|
|
if ( Mode != ClutterMode.Infinite ) return;
|
|
|
|
var gridSystem = Scene.GetSystem<ClutterGridSystem>();
|
|
gridSystem.InvalidateTileAt( this, worldPosition );
|
|
}
|
|
|
|
/// <summary>
|
|
/// Invalidates all tiles within the given bounds, causing them to regenerate.
|
|
/// </summary>
|
|
public void InvalidateTilesInBounds( BBox bounds )
|
|
{
|
|
if ( Mode != ClutterMode.Infinite ) return;
|
|
|
|
var gridSystem = Scene.GetSystem<ClutterGridSystem>();
|
|
gridSystem.InvalidateTilesInBounds( this, bounds );
|
|
}
|
|
}
|