Network/WaterNode.cs

A small data model for a water graph node used by the game's water tool. It stores an Id, position, an AutoTangents flag controlling automatic tangent syncing, and a CornerRadius with a clamp in the setter.

Native Interop
using Sandbox;

namespace RedSnail.WaterTool2;

/// <summary>
/// A point of the water graph: a river's source or end, a bend where a river passes through, a confluence once three
/// or more rivers meet there, or the mouth where a river opens into a lake. Positions are in network-local space, and
/// a node's height is the height of the water surface there.
/// </summary>
public sealed class WaterNode
{
	public int Id { get; set; }

	public Vector3 Position { get; set; }

	/// <summary>
	/// While set, the network keeps the tangent handles of every river at this node in sync with its neighbours:
	/// smooth through a bend, straight at a river end and into a confluence. Cleared once the handles are placed by
	/// hand.
	/// </summary>
	public bool AutoTangents { get; set; } = true;

	/// <summary>
	/// Radius of the rounded banks where rivers meet at this node. 0 gives sharp corners.
	/// </summary>
	[Range(0.0f, 2000.0f)] public float CornerRadius { get; set { field = value.Clamp(0.0f, 100000.0f); } } = 150.0f;
}