mirror of
https://github.com/chev2/terraria-mods.git
synced 2026-04-26 12:41:41 +00:00
Merge pull request #5 from chev2/lifesourceslight-v1.3.0
LifeSourcesLight v1.3.0
This commit is contained in:
commit
d31127cac7
11 changed files with 67 additions and 47 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!-- Import tModLoader mod properties -->
|
||||
<Import Project="..\tModLoader.targets" />
|
||||
|
||||
<!-- General -->
|
||||
<PropertyGroup>
|
||||
<AssemblyName>LifeSourcesLight</AssemblyName>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="tModLoader.CodeAssist" Version="0.1.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -6,20 +6,35 @@ namespace LifeSourcesLight
|
|||
{
|
||||
public class LifeSourcesLightModSystem : ModSystem
|
||||
{
|
||||
private LifeSourcesLightConfig _configInstance;
|
||||
|
||||
public LifeSourcesLightModSystem() : base()
|
||||
{
|
||||
_configInstance = ModContent.GetInstance<LifeSourcesLightConfig>();
|
||||
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<LifeSourcesLightConfig>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LifeSourcesLightConfig.DisplayName: Config
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
5
LifeSourcesLight/description_workshop.txt
Normal file
5
LifeSourcesLight/description_workshop.txt
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Reference in a new issue