Standardize ModType.Register overrides

This commit is contained in:
Flowaria committed 2025-12-06 11:32:43 +09:00
1 parent 2363f886b6
commit 164d6243d4
6 files changed
+12 -8

No files matched your search

+1
View File
@@ -46,6 +46,7 @@ namespace CalamityMod.CalPlayer.Dashes
protected sealed override void Register()
{
ModTypeLookup<PlayerDashEffect>.Register(this);
PlayerDashManager.DashIdentificationTable[DashID] = this;
}
}
+2 -1
View File
@@ -235,8 +235,9 @@ namespace CalamityMod.Systems
public abstract class DifficultyMode : ModType
{
protected override void Register()
protected sealed override void Register()
{
ModTypeLookup<DifficultyMode>.Register(this);
// This is registered in DifficultyModeSystem.OnModLoad
// Note that DifficultyModeSystem.Load can't ensure system is loaded after all modes
}
+6 -5
View File
@@ -128,7 +128,8 @@ namespace CalamityMod.Systems
if (tileLight.G < 200 * brightness) tileLight.G = (byte)(200 * brightness);
if (tileLight.B < 200 * brightness) tileLight.B = (byte)(200 * brightness);
returnColor = tileLight;
} else
}
else
if (effect is BurrowerPingTileEffect b && effect.Active && effect.ShouldRegisterTile(i, j))
{
float distanceFromCenter = (new Point(i, j).ToWorldCoordinates() - BurrowerPingTileEffect.PingCenter).Length();
@@ -436,7 +437,7 @@ namespace CalamityMod.Systems
public class BurrowerPingTileEffect : ModType, IPingedTileEffect
{
protected override void Register()
protected sealed override void Register()
{
ModTypeLookup<BurrowerPingTileEffect>.Register(this);
}
@@ -450,7 +451,7 @@ namespace CalamityMod.Systems
public static Vector2 PingCenter = Vector2.Zero;
public static int PingTimer = 0;
public static float PingProgress => (MaxPingLife - PingTimer) / (float)MaxPingLife;
public bool Active => PingTimer > 0;
public BlendState BlendState => BlendState.Additive;
@@ -458,9 +459,9 @@ namespace CalamityMod.Systems
public bool TryAddPing(Vector2 position, Player pinger)
{
if (Active)
{
{
PingCenter = position;
PingTimer = Math.Max(PingTimer, MaxPingLife-MaxPingTravelTime);
PingTimer = Math.Max(PingTimer, MaxPingLife - MaxPingTravelTime);
return false;
}
PingCenter = position;
+1
View File
@@ -43,6 +43,7 @@ namespace CalamityMod.Systems
#region Setups
protected sealed override void Register()
{
ModTypeLookup<TileBlendTexture>.Register(this);
Slot = TileBlendTextureLoader.Register(this);
TextureAsset = ModContent.Request<Texture2D>(Texture);
BlendTextures = new RenderTarget2D[3];
+1 -1
View File
@@ -19,7 +19,7 @@ namespace CalamityMod.UI
public abstract Color InvasionBarColor { get; }
public abstract Texture2D IconTexture { get; }
protected override void Register()
protected sealed override void Register()
{
ModTypeLookup<InvasionProgressUI>.Register(this);
InvasionProgressUIManager.gUIs.Add(this);
+1 -1
View File
@@ -12,7 +12,7 @@ namespace CalamityMod.UI
public bool Active;
public virtual int FadeTimeMax { get; set; } = 30;
protected override void Register()
protected sealed override void Register()
{
ModTypeLookup<PopupGUI>.Register(this);
PopupGUIManager.gUIs.Add(this);