Add LifeSourcesLight and ZenithRecipeTooltips mods

This commit is contained in:
Chev 2022-08-24 16:06:54 -07:00
parent ca0fc1a6ee
commit 5b1b7e5780
16 changed files with 197 additions and 0 deletions

View file

@ -0,0 +1,17 @@
using Terraria.ModLoader;
using Terraria;
using Terraria.ID;
namespace LifeSourcesLight
{
public class LifeSourcesLight : Mod
{
public override void Load()
{
Main.tileLighted[TileID.Heart] = true;
Main.tileLighted[TileID.LifeFruit] = true;
base.Load();
}
}
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\tModLoader.targets" />
<PropertyGroup>
<AssemblyName>LifeSourcesLight</AssemblyName>
<TargetFramework>net6.0</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="tModLoader.CodeAssist" Version="0.1.*" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,22 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace LifeSourcesLight
{
public class LightOverrideHeartCrystal : GlobalTile
{
// Modify overall light brightness
private static readonly float LifeCrystalBrightCoefficient = 0.7f;
public override void ModifyLight(int i, int j, int type, ref float r, ref float g, ref float b)
{
if (type == TileID.Heart)
{
r = (255f / 255f) * LifeCrystalBrightCoefficient;
g = (38f / 255f) * LifeCrystalBrightCoefficient;
b = (106f / 255f) * LifeCrystalBrightCoefficient;
}
}
}
}

View file

@ -0,0 +1,22 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace LifeSourcesLight
{
public class LightOverrideLifeFruit : GlobalTile
{
// Modify overall light brightness
private static readonly float LifeFruitBrightCoefficient = 0.7f;
public override void ModifyLight(int i, int j, int type, ref float r, ref float g, ref float b)
{
if (type == TileID.LifeFruit)
{
r = (170f / 255f) * LifeFruitBrightCoefficient;
g = (221f / 255f) * LifeFruitBrightCoefficient;
b = (43f / 255f) * LifeFruitBrightCoefficient;
}
}
}
}

View file

@ -0,0 +1,16 @@
{
"profiles": {
"Terraria": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "$(tMLPath)",
"workingDirectory": "$(tMLSteamPath)"
},
"TerrariaServer": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "$(tMLServerPath)",
"workingDirectory": "$(tMLSteamPath)"
}
}
}

View file

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

View file

@ -0,0 +1 @@
Makes heart crystals & life fruits emit light.

BIN
LifeSourcesLight/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -1,2 +1,7 @@
# terraria-mods
My mods for Terraria's tModLoader.
## Mods list
* **LifeSourcesLight** - Makes heart crystals & life fruits emit light.
* **ZenithRecipeTooltips** - Shows "Required for Zenith" in the tooltips of every sword used in the Zenith crafting recipe.

View file

@ -0,0 +1,53 @@
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace ZenithRecipeTooltips
{
public class HookZenithIngredientTooltips : GlobalItem
{
private static readonly Dictionary<int, bool> RecipeItemIDs = new()
{
{ ItemID.CopperShortsword, true },
{ ItemID.EnchantedSword, true },
{ ItemID.BeeKeeper, true },
{ ItemID.Starfury, true },
{ ItemID.Seedler, true },
{ ItemID.TheHorsemansBlade, true },
{ ItemID.InfluxWaver, true },
{ ItemID.StarWrath, true },
{ ItemID.Meowmere, true },
{ ItemID.TerraBlade, true }
};
private static readonly string TooltipPrefixColor = "E10643";
private static bool IsMaterialTooltip(TooltipLine line)
{
return line.Name == "Material";
}
public override void ModifyTooltips(Item item, List<TooltipLine> tooltips)
{
if (RecipeItemIDs.ContainsKey(item.type))
{
TooltipLine tooltip = new(Mod, "RequiredForZenith", $"[c/{TooltipPrefixColor}:Required for Zenith]");
int materialLineIndex = tooltips.FindIndex(IsMaterialTooltip);
// If we found the index where the "Material" tooltip is
if (materialLineIndex > 0)
{
tooltips.Insert(materialLineIndex + 1, tooltip);
// If we didn't, just append it to the end
} else
{
tooltips.Add(tooltip);
}
}
base.ModifyTooltips(item, tooltips);
}
}
}

View file

@ -0,0 +1,16 @@
{
"profiles": {
"Terraria": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "$(tMLPath)",
"workingDirectory": "$(tMLSteamPath)"
},
"TerrariaServer": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "$(tMLServerPath)",
"workingDirectory": "$(tMLSteamPath)"
}
}
}

View file

@ -0,0 +1,8 @@
using Terraria.ModLoader;
namespace ZenithRecipeTooltips
{
public class ZenithRecipeTooltips : Mod
{
}
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\tModLoader.targets" />
<PropertyGroup>
<AssemblyName>ZenithRecipeTooltips</AssemblyName>
<TargetFramework>net6.0</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="tModLoader.CodeAssist" Version="0.1.*" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,5 @@
displayName = Zenith Recipe Tooltips
author = Chev
version = 1.0.0
homepage = https://github.com/chev2/terraria-mods
side = Client

View file

@ -0,0 +1 @@
Shows "Required for Zenith" in the tooltips of every sword used in the Zenith crafting recipe.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB