From fdb6d9e223f2e731c68f0eca6ba89ed941071c12 Mon Sep 17 00:00:00 2001 From: mikx Date: Mon, 17 Feb 2025 15:27:52 -0500 Subject: [PATCH] 1.1.1 - Recipe Fix + Table Columns clean at Save --- Common/Systems/ModPlayerOnEnterWorld.cs | 2 ++ Common/Systems/ModSystemPreSaveAndQuit.cs | 17 ++++++++++++++ Content/Items/Placeable/PersonalTeleporter.cs | 16 ++++++------- DB.cs | 23 ------------------- Localization/en-US_Mods.tTP.hjson | 22 ++++++++++-------- build.txt | 3 ++- description.txt | 2 +- tTP.cs | 2 +- 8 files changed, 42 insertions(+), 45 deletions(-) create mode 100644 Common/Systems/ModSystemPreSaveAndQuit.cs delete mode 100644 DB.cs diff --git a/Common/Systems/ModPlayerOnEnterWorld.cs b/Common/Systems/ModPlayerOnEnterWorld.cs index 6198cdc..e7470b8 100644 --- a/Common/Systems/ModPlayerOnEnterWorld.cs +++ b/Common/Systems/ModPlayerOnEnterWorld.cs @@ -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(File.ReadAllText($"tTP/{tTP.worldName}.json")); tTP.table = ds.Tables["tp"]; } diff --git a/Common/Systems/ModSystemPreSaveAndQuit.cs b/Common/Systems/ModSystemPreSaveAndQuit.cs new file mode 100644 index 0000000..dca0be3 --- /dev/null +++ b/Common/Systems/ModSystemPreSaveAndQuit.cs @@ -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(); + } + } +} diff --git a/Content/Items/Placeable/PersonalTeleporter.cs b/Content/Items/Placeable/PersonalTeleporter.cs index 2c7b54c..70ae0d3 100644 --- a/Content/Items/Placeable/PersonalTeleporter.cs +++ b/Content/Items/Placeable/PersonalTeleporter.cs @@ -16,9 +16,10 @@ namespace tTP.Content.Items.Placeable public override void AddRecipes() { tTPConfigs config = ModContent.GetInstance(); + Recipe.ClearAvailableRecipes(); + Recipe recipe = CreateRecipe(); if (config.UsetMxTablets) { - Recipe recipe = CreateRecipe(); if (ModLoader.TryGetMod("tMx", out Mod tMxft) && tMxft.TryFind("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(); - } + recipe.AddIngredient(ItemID.FallenStar, 1); + } + recipe.AddTile(TileID.WorkBenches); + recipe.Register(); } } } \ No newline at end of file diff --git a/DB.cs b/DB.cs deleted file mode 100644 index 78219ba..0000000 --- a/DB.cs +++ /dev/null @@ -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(); - }*/ - } - } -} diff --git a/Localization/en-US_Mods.tTP.hjson b/Localization/en-US_Mods.tTP.hjson index b29431a..3e5bac2 100644 --- a/Localization/en-US_Mods.tTP.hjson +++ b/Localization/en-US_Mods.tTP.hjson @@ -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 + } +} diff --git a/build.txt b/build.txt index 0155807..69b2144 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,6 @@ displayName = tTP author = mikx -version = 1.1.0 +version = 1.1.1 +sortAfter = tMx modReferences = tMx dllReferences = Newtonsoft.Json \ No newline at end of file diff --git a/description.txt b/description.txt index 0e95bc7..571d421 100644 --- a/description.txt +++ b/description.txt @@ -1 +1 @@ -Modify this file with a description of your mod. \ No newline at end of file +Craft Personal Teleporter and place them in the world to add icon on your map you can use to teleport. \ No newline at end of file diff --git a/tTP.cs b/tTP.cs index f92c3c4..b00196e 100644 --- a/tTP.cs +++ b/tTP.cs @@ -25,7 +25,7 @@ namespace tTP public override void Unload() { - + } } }