1.1.1 - Recipe Fix + Table Columns clean at Save

This commit is contained in:
mikx 2025-02-17 15:27:52 -05:00
parent 89b4deb0f0
commit fdb6d9e223
8 changed files with 42 additions and 45 deletions

View File

@ -41,6 +41,8 @@ namespace tTP.Common.Systems
tTP.table.Columns.Add("y", typeof(Int64));
} else
{
int tpc = jar.Count;
Main.NewText($"[tTP] You have {tpc} Personal Teleporter in this world.", Color.Aqua);
DataSet ds = JsonConvert.DeserializeObject<DataSet>(File.ReadAllText($"tTP/{tTP.worldName}.json"));
tTP.table = ds.Tables["tp"];
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria.ModLoader;
namespace tTP.Common.Systems
{
internal class ModSystemPreSaveAndQuit : ModSystem
{
public override void PreSaveAndQuit()
{
tTP.table.Columns.Clear();
}
}
}

View File

@ -16,9 +16,10 @@ namespace tTP.Content.Items.Placeable
public override void AddRecipes()
{
tTPConfigs config = ModContent.GetInstance<tTPConfigs>();
Recipe.ClearAvailableRecipes();
Recipe recipe = CreateRecipe();
if (config.UsetMxTablets)
{
Recipe recipe = CreateRecipe();
if (ModLoader.TryGetMod("tMx", out Mod tMxft) && tMxft.TryFind<ModItem>("FrozenTablet", out ModItem FrozenTablet))
{
recipe.AddIngredient(FrozenTablet.Type, 1);
@ -35,16 +36,13 @@ namespace tTP.Content.Items.Placeable
{
recipe.AddIngredient(MoltenTablet.Type, 1);
}
recipe.AddTile(TileID.WorkBenches);
recipe.Register();
} else
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ItemID.IronBar, 10);
recipe.AddIngredient(ItemID.FallenStar, 1);
}
recipe.AddTile(TileID.WorkBenches);
recipe.Register();
}
}
}
}

23
DB.cs
View File

@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace tTP
{
internal class DB
{
public static void CreateDB()
{
/*SQLitePCL.raw.SetProvider(new SQLitePCLRaw.provider.e_sqlite3);
using (var connection = new SqliteConnection("Data Source=tTP.db"))
{
connection.Open();
var command = connection.CreateCommand();
command.CommandText = @" CREATE TABLE teleporter ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, x INTEGER NOT NULL, y INTEGER NOT NULL )";
command.ExecuteNonQuery();
}*/
}
}
}

View File

@ -1,18 +1,20 @@
# This file will automatically update with entries for new content after a build and reload.
Items: {
SwordOfTP: {
DisplayName: Sword Of T P
Tooltip:
'''
Template of an item
Replacing this tooltip is duty
It's snowing on Mt.Fuji
'''
}
PersonalTeleporter: {
DisplayName: Personal Teleporter
Tooltip: ""
}
}
Configs: {
tTPConfigs: {
UsetMxTablets: {
Tooltip: Use tMX 4 Tablets to craft a Personal Teleporter. If false, will use a recipe with vanilla materials.
Label: Use tMx Tablets
}
Headers.Craft: Craft Header
DisplayName: tTP Configs
}
}

View File

@ -1,5 +1,6 @@
displayName = tTP
author = mikx
version = 1.1.0
version = 1.1.1
sortAfter = tMx
modReferences = tMx
dllReferences = Newtonsoft.Json

View File

@ -1 +1 @@
Modify this file with a description of your mod.
Craft Personal Teleporter and place them in the world to add icon on your map you can use to teleport.