TankSlot.cs

Represents one physical aquarium tank slot with its water type, name, capacity, unlock state, chosen habitat, lists of fish and decor, and helpers to apply or reset habitat. It exposes computed properties derived from HabitatId and the resolved HabitatDef.

Reflection
namespace NoChillquarium;

/// <summary>
/// One physical tank (fresh or salt) with its own fish, capacity, decor, habitat.
/// </summary>
public sealed class TankSlot
{
	public WaterType Water { get; init; }
	public string Name { get; set; }
	public int Capacity { get; set; } = TankSim.DefaultCapacity;
	public bool Unlocked { get; set; }
	public string HabitatId { get; set; }
	public List<FishActor> Fish { get; } = new();
	public List<DecorPiece> Decor { get; } = new();

	public HabitatDef Habitat =>
		HabitatDef.Find( HabitatId ) ?? HabitatDef.StarterFor( Water );

	public int MaxDecor => Math.Max( 8, Habitat.MaxDecor );

	public float IncomeMult => Math.Max( 0.5f, Habitat.IncomeMult );

	public int HabitatRank => Habitat.Rank;

	public void ApplyHabitat( HabitatDef def, bool keepCapacityFloor = true )
	{
		if ( def is null || !HabitatDef.MatchesTank( def, Water ) )
			return;

		HabitatId = def.Id;
		Name = def.Name;
		if ( keepCapacityFloor )
			Capacity = Math.Max( Capacity, def.BaseCapacity );
		else
			Capacity = def.BaseCapacity;
	}

	public void ResetToStarter()
	{
		var starter = HabitatDef.StarterFor( Water );
		HabitatId = starter.Id;
		Name = starter.Name;
		Capacity = starter.BaseCapacity;
	}
}