Standardize ModType.Register overrides
This commit is contained in:
1 parent
2363f886b6
commit
164d6243d4
6 files changed
+12
-8
No files matched your search
@@ -46,6 +46,7 @@ namespace CalamityMod.CalPlayer.Dashes
|
||||
|
||||
protected sealed override void Register()
|
||||
{
|
||||
ModTypeLookup<PlayerDashEffect>.Register(this);
|
||||
PlayerDashManager.DashIdentificationTable[DashID] = this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user