Represents a single fish tank slot. Stores tank water type, name, capacity, unlock state, habitat and decoration IDs, lists of FishActor and DecorPiece, and provides helpers to apply or reset habitat and computed properties based on HabitatDef.
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; }
/// <summary>One back-glass poster id, or empty for default water.</summary>
public string BackdropId { get; set; }
/// <summary>One gravel / sand floor id, or empty for stock lot dirt.</summary>
public string GravelId { 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( 4, 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;
BackdropId = null;
GravelId = null;
}
}