using Content.Server._DV.CosmicCult.EntitySystems;
using Content.Shared.Maps;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server._DV.CosmicCult.Components;
[RegisterComponent, Access(typeof(CosmicCorruptingSystem))]
[AutoGenerateComponentPause]
public sealed partial class CosmicCorruptingComponent : Component
{
///
/// Our timer for corruption checks.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField] public TimeSpan CorruptionTimer = default!;
///
/// the list of tiles that can be corrupted by this corruptor.
///
[DataField]
public HashSet CorruptableTiles = [];
///
/// If this corruption source can move. if true, only corrupt the immediate area around it.
/// Slightly hacky but works for our purposes.
///
[DataField]
public bool Mobile;
///
/// if this corruption source should floodfill through all corruptible tiles to initialise its corruptible tile set on activation.
///
[DataField]
public bool FloodFillStarting;
///
/// How many times has this corruption source ticked?
///
[DataField]
public int CorruptionTicks;
///
/// The maximum amount of ticks this source can do.
///
[DataField]
public int CorruptionMaxTicks = 50;
///
/// The chance that a tile and/or wall is replaced.
///
[DataField]
public float CorruptionChance = 0.51f;
///
/// The reduction applied to corruption chance every tick.
///
[DataField]
public float CorruptionReduction;
///
/// Wether or not the CosmicCorruptingSystem should be running on this entity. use CosmicCorruptingSystem.Enable() instead of directly interacting with this variable.
///
[DataField]
public bool Enabled = true;
///
/// Wether or not the CosmicCorruptingSystem should spawn VFX when converting tiles and walls.
///
[DataField]
public bool UseVFX = true;
///
/// Wether or not the CosmicCorruptingSystem should ignore this component when it reaches max growth. Saves performance.
///
[DataField]
public bool AutoDisable = true;
///
/// How much time between tile corruptions.
///
[DataField, AutoNetworkedField]
public TimeSpan CorruptionSpeed = TimeSpan.FromSeconds(6);
///
/// The tile we spawn when replacing a normal tile.
///
[DataField] //not a dict like the entity conversion below because there's too many fucking tiles
public ProtoId ConversionTile = "FloorCosmicCorruption";
///
/// Dictionary for what entities to convert to which prototypes. Similar to CosmicCorruptibleComponent, but
/// non-inheriting.
///
[DataField]
public Dictionary EntityConversionDict = new Dictionary()
{
{"Window", "WindowCosmicCult"},
{"Table", "CosmicTable"},
{"Chair", "CosmicChair"},
};
///
/// The VFX entity we spawn when corruption occurs.
///
[DataField]
public EntProtoId TileConvertVFX = "CosmicFloorSpawnVFX";
///
/// The VFX entity we spawn when walls get deleted.
///
[DataField]
public EntProtoId TileDisintegrateVFX = "CosmicGenericVFX";
}