LifeSourcesLight v1.1.0

- Formatted code a bit
- Updated description to include changelog section
- Added basic config to allow users to turn off the lights for each of the two tile types individually
This commit is contained in:
Chev 2022-08-26 18:25:47 -07:00
parent c63ef135e7
commit 5d838fb613
7 changed files with 82 additions and 16 deletions

View file

@ -1,16 +1,23 @@
using Terraria.ModLoader;
using Terraria;
using Terraria.ID;
namespace LifeSourcesLight
{
public class LifeSourcesLight : Mod
{
internal static bool _enableHeartCrystalLight;
public static bool EnableHeartCrystalLight
{
get { return _enableHeartCrystalLight; }
}
internal static bool _enableLifeFruitLight;
public static bool EnableLifeFruitLight
{
get { return _enableLifeFruitLight; }
}
public override void Load()
{
Main.tileLighted[TileID.Heart] = true;
Main.tileLighted[TileID.LifeFruit] = true;
base.Load();
}
}

View file

@ -0,0 +1,27 @@
using System.ComponentModel;
using Terraria.ModLoader;
using Terraria.ModLoader.Config;
namespace LifeSourcesLight
{
[Label("Config")]
public class LifeSourcesLightConfig : ModConfig
{
public override ConfigScope Mode => ConfigScope.ClientSide;
[DefaultValue(true)]
[Label("Enable Lighting for Heart Crystal")]
[Tooltip("Whether or not to enable lighting for the Heart Crystal.")]
public bool EnableHeartCrystalLight { get; set; }
[DefaultValue(true)]
[Label("Enable Lighting for Life Fruit")]
[Tooltip("Whether or not to enable lighting for the Life Fruit.")]
public bool EnableLifeFruitLight { get; set; }
public override void OnChanged()
{
ModContent.GetInstance<LifeSourcesLightModSystem>()?.ApplySettings();
}
}
}

View file

@ -0,0 +1,25 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace LifeSourcesLight
{
public class LifeSourcesLightModSystem : ModSystem
{
private LifeSourcesLightConfig _configInstance;
public LifeSourcesLightModSystem() : base()
{
_configInstance = ModContent.GetInstance<LifeSourcesLightConfig>();
}
public void ApplySettings()
{
LifeSourcesLight._enableHeartCrystalLight = _configInstance.EnableHeartCrystalLight;
LifeSourcesLight._enableLifeFruitLight = _configInstance.EnableLifeFruitLight;
Main.tileLighted[TileID.Heart] = LifeSourcesLight._enableHeartCrystalLight;
Main.tileLighted[TileID.LifeFruit] = LifeSourcesLight._enableLifeFruitLight;
}
}
}

View file

@ -1,5 +1,4 @@
using Terraria;
using Terraria.ID;
using Terraria.ID;
using Terraria.ModLoader;
namespace LifeSourcesLight
@ -11,7 +10,7 @@ namespace LifeSourcesLight
public override void ModifyLight(int i, int j, int type, ref float r, ref float g, ref float b)
{
if (type == TileID.Heart)
if (type == TileID.Heart && LifeSourcesLight.EnableHeartCrystalLight)
{
r = (255f / 255f) * LifeCrystalBrightCoefficient;
g = (38f / 255f) * LifeCrystalBrightCoefficient;

View file

@ -1,5 +1,4 @@
using Terraria;
using Terraria.ID;
using Terraria.ID;
using Terraria.ModLoader;
namespace LifeSourcesLight
@ -11,7 +10,7 @@ namespace LifeSourcesLight
public override void ModifyLight(int i, int j, int type, ref float r, ref float g, ref float b)
{
if (type == TileID.LifeFruit)
if (type == TileID.LifeFruit && LifeSourcesLight.EnableLifeFruitLight)
{
r = (170f / 255f) * LifeFruitBrightCoefficient;
g = (221f / 255f) * LifeFruitBrightCoefficient;

View file

@ -1,5 +1,5 @@
displayName = Heart Crystal & Life Fruit Glow
author = Chev
version = 1.0.0
version = 1.1.0
homepage = https://github.com/chev2/terraria-mods
side = Client

View file

@ -1 +1,10 @@
Makes heart crystals & life fruits emit light.
[c/00FFFF:Changelog]
[v1.1.0] 2022-08-26
- Added:
- A basic config to enable/disable the Heart Crystal and Life Fruit glows individually.
- A changelog to the mod description.
[v1.0.0] 2022-08-24
- Initial release