diff --git a/LifeSourcesLight/LifeSourcesLight.cs b/LifeSourcesLight/LifeSourcesLight.cs
index 531d3eb..aa9a90e 100644
--- a/LifeSourcesLight/LifeSourcesLight.cs
+++ b/LifeSourcesLight/LifeSourcesLight.cs
@@ -4,21 +4,12 @@ namespace LifeSourcesLight
{
public class LifeSourcesLight : Mod
{
- internal static bool _enableHeartCrystalLight;
- public static bool EnableHeartCrystalLight
+ public override void PostSetupContent()
{
- get { return _enableHeartCrystalLight; }
- }
+ base.PostSetupContent();
- internal static bool _enableLifeFruitLight;
- public static bool EnableLifeFruitLight
- {
- get { return _enableLifeFruitLight; }
- }
-
- public override void Load()
- {
- base.Load();
+ // Update Main.tileLighted on post-load to ensure config is properly loaded
+ LifeSourcesLightModSystem.UpdateTileLighted();
}
}
}
\ No newline at end of file
diff --git a/LifeSourcesLight/LifeSourcesLight.csproj b/LifeSourcesLight/LifeSourcesLight.csproj
index d2b6580..b4d317c 100644
--- a/LifeSourcesLight/LifeSourcesLight.csproj
+++ b/LifeSourcesLight/LifeSourcesLight.csproj
@@ -1,13 +1,16 @@
-
+
+
+
LifeSourcesLight
- net6.0
- AnyCPU
latest
+ false
+ false
+
+
-
-
\ No newline at end of file
+
diff --git a/LifeSourcesLight/LifeSourcesLightConfig.cs b/LifeSourcesLight/LifeSourcesLightConfig.cs
index 0363ce3..5185678 100644
--- a/LifeSourcesLight/LifeSourcesLightConfig.cs
+++ b/LifeSourcesLight/LifeSourcesLightConfig.cs
@@ -4,19 +4,18 @@ using Terraria.ModLoader.Config;
namespace LifeSourcesLight
{
- [Label("Config")]
public class LifeSourcesLightConfig : ModConfig
{
public override ConfigScope Mode => ConfigScope.ClientSide;
+ [LabelKey("$Mods.LifeSourcesLight.Configs.Common.EnableHeartCrystalLight.Label")]
+ [TooltipKey("$Mods.LifeSourcesLight.Configs.Common.EnableHeartCrystalLight.Tooltip")]
[DefaultValue(true)]
- [Label("Enable Lighting for Heart Crystal")]
- [Tooltip("Whether or not to enable lighting for the Heart Crystal.")]
public bool EnableHeartCrystalLight { get; set; }
+ [LabelKey("$Mods.LifeSourcesLight.Configs.Common.EnableLifeFruitLight.Label")]
+ [TooltipKey("$Mods.LifeSourcesLight.Configs.Common.EnableLifeFruitLight.Tooltip")]
[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()
diff --git a/LifeSourcesLight/LifeSourcesLightModSystem.cs b/LifeSourcesLight/LifeSourcesLightModSystem.cs
index 44bd29f..cf9ee4b 100644
--- a/LifeSourcesLight/LifeSourcesLightModSystem.cs
+++ b/LifeSourcesLight/LifeSourcesLightModSystem.cs
@@ -6,20 +6,35 @@ namespace LifeSourcesLight
{
public class LifeSourcesLightModSystem : ModSystem
{
- private LifeSourcesLightConfig _configInstance;
-
- public LifeSourcesLightModSystem() : base()
- {
- _configInstance = ModContent.GetInstance();
+ internal static bool _enableLightHeartCrystal = true;
+ public static bool EnableLightHeartCrystal {
+ get { return _enableLightHeartCrystal; }
}
+ internal static bool _enableLightLifeFruit = true;
+ public static bool EnableLightLifeFruit {
+ get { return _enableLightLifeFruit; }
+ }
+
+ // We use the booleans above later in an if-check, and to my knowledge,
+ // that if-check runs every tick or every frame.
+ // It's more efficient than calling ModContent.GetInstance() every tick
+ // (as far as I'm aware)
public void ApplySettings()
{
- LifeSourcesLight._enableHeartCrystalLight = _configInstance.EnableHeartCrystalLight;
- LifeSourcesLight._enableLifeFruitLight = _configInstance.EnableLifeFruitLight;
+ LifeSourcesLightConfig configInstance = ModContent.GetInstance();
- Main.tileLighted[TileID.Heart] = LifeSourcesLight._enableHeartCrystalLight;
- Main.tileLighted[TileID.LifeFruit] = LifeSourcesLight._enableLifeFruitLight;
+ _enableLightHeartCrystal = configInstance.EnableHeartCrystalLight;
+ _enableLightLifeFruit = configInstance.EnableLifeFruitLight;
+
+ UpdateTileLighted();
+ }
+
+ // Modified Main.tileLighted for the heart crystal & life fruit
+ // Necessary in order to enable lighting calculations for both
+ public static void UpdateTileLighted() {
+ Main.tileLighted[TileID.Heart] = EnableLightHeartCrystal;
+ Main.tileLighted[TileID.LifeFruit] = EnableLightLifeFruit;
}
}
}
diff --git a/LifeSourcesLight/LightOverrideHeartCrystal.cs b/LifeSourcesLight/LightOverrideHeartCrystal.cs
index 3a420c7..4bd2799 100644
--- a/LifeSourcesLight/LightOverrideHeartCrystal.cs
+++ b/LifeSourcesLight/LightOverrideHeartCrystal.cs
@@ -10,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 && LifeSourcesLight.EnableHeartCrystalLight)
+ if (type == TileID.Heart && LifeSourcesLightModSystem.EnableLightHeartCrystal)
{
r = (255f / 255f) * LifeCrystalBrightCoefficient;
g = (38f / 255f) * LifeCrystalBrightCoefficient;
diff --git a/LifeSourcesLight/LightOverrideLifeFruit.cs b/LifeSourcesLight/LightOverrideLifeFruit.cs
index c706c3a..e85f757 100644
--- a/LifeSourcesLight/LightOverrideLifeFruit.cs
+++ b/LifeSourcesLight/LightOverrideLifeFruit.cs
@@ -10,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 && LifeSourcesLight.EnableLifeFruitLight)
+ if (type == TileID.LifeFruit && LifeSourcesLightModSystem.EnableLightLifeFruit)
{
r = (221f / 255f) * LifeFruitBrightCoefficient;
g = (181f / 255f) * LifeFruitBrightCoefficient;
diff --git a/LifeSourcesLight/Localization/en-US_Mods.LifeSourcesLight.hjson b/LifeSourcesLight/Localization/en-US_Mods.LifeSourcesLight.hjson
index ab9bbee..a99dca7 100644
--- a/LifeSourcesLight/Localization/en-US_Mods.LifeSourcesLight.hjson
+++ b/LifeSourcesLight/Localization/en-US_Mods.LifeSourcesLight.hjson
@@ -1,15 +1,15 @@
Configs: {
- LifeSourcesLightConfig: {
- DisplayName: Config
+ Common: {
+ EnableLifeFruitLight: {
+ Tooltip: Whether or not to enable lighting for the Life Fruit.
+ Label: "[i/s1:1291] Enable Lighting for Life Fruit"
+ }
EnableHeartCrystalLight: {
- Label: Enable Lighting for Heart Crystal
Tooltip: Whether or not to enable lighting for the Heart Crystal.
- }
-
- EnableLifeFruitLight: {
- Label: Enable Lighting for Life Fruit
- Tooltip: Whether or not to enable lighting for the Life Fruit.
+ Label: "[i/s1:29] Enable Lighting for Heart Crystal"
}
}
-}
\ No newline at end of file
+
+ LifeSourcesLightConfig.DisplayName: Config
+}
diff --git a/LifeSourcesLight/Properties/launchSettings.json b/LifeSourcesLight/Properties/launchSettings.json
index 8da89ff..1011447 100644
--- a/LifeSourcesLight/Properties/launchSettings.json
+++ b/LifeSourcesLight/Properties/launchSettings.json
@@ -2,13 +2,13 @@
"profiles": {
"Terraria": {
"commandName": "Executable",
- "executablePath": "dotnet",
+ "executablePath": "$(DotNetName)",
"commandLineArgs": "$(tMLPath)",
"workingDirectory": "$(tMLSteamPath)"
},
"TerrariaServer": {
"commandName": "Executable",
- "executablePath": "dotnet",
+ "executablePath": "$(DotNetName)",
"commandLineArgs": "$(tMLServerPath)",
"workingDirectory": "$(tMLSteamPath)"
}
diff --git a/LifeSourcesLight/build.txt b/LifeSourcesLight/build.txt
index acfc89b..3f631b3 100644
--- a/LifeSourcesLight/build.txt
+++ b/LifeSourcesLight/build.txt
@@ -1,5 +1,5 @@
displayName = Heart Crystal & Life Fruit Glow
author = Chev
-version = 1.2.0
+version = 1.3.0
homepage = https://github.com/chev2/terraria-mods
side = Client
diff --git a/LifeSourcesLight/description.txt b/LifeSourcesLight/description.txt
index 73e5553..2bfdd07 100644
--- a/LifeSourcesLight/description.txt
+++ b/LifeSourcesLight/description.txt
@@ -1,6 +1,13 @@
-Makes heart crystals [i/s1:29] & life fruits [i/s1:1291] emit light.
+Makes life crystals [i/s1:29] & life fruits [i/s1:1291] emit light.
[c/00FFFF:Changelog]
+[v1.3.0] 2025-05-22
+- Attempt to fix bug where lights would sometimes not work in multiplayer until config was reloaded
+- Added some nice item icons to the config menu
+- Update mod internals to reflect newer tModLoader standards
+ - Migrate from .NET 6.0 to .NET 8.0
+ - Use newer LabelKey and TooltipKey for mod configuration
+
[v1.2.0] 2023-08-06
- Update for tModLoader v1.4.4
- Life Fruits now glow yellow instead of green to better distinguish them from Jungle Spores
diff --git a/LifeSourcesLight/description_workshop.txt b/LifeSourcesLight/description_workshop.txt
new file mode 100644
index 0000000..b932c20
--- /dev/null
+++ b/LifeSourcesLight/description_workshop.txt
@@ -0,0 +1,5 @@
+Makes life crystals & life fruits emit light.
+
+Comes with a config, if you want only life crystals or life fruits to emit light, and not both.
+
+This mod's source code is available on my Terraria mods GitHub repo: https://github.com/chev2/terraria-mods