commit b86194551153ddbfe9cf70abc8b38d78fb31db28 Author: mikx Date: Tue Feb 11 16:04:10 2025 -0500 0.2.0 commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c4efe2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,261 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/Content/Items/Materials/FrozenTablet.cs b/Content/Items/Materials/FrozenTablet.cs new file mode 100644 index 0000000..1ea6ff2 --- /dev/null +++ b/Content/Items/Materials/FrozenTablet.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria; + +namespace tMx.Content.Items.Materials +{ + public class FrozenTablet : ModItem + { + public override void SetDefaults() + { + Item.ResearchUnlockCount = 666; + Item.value = Item.buyPrice(gold: 1); + Item.rare = ItemRarityID.Blue; + Item.material = true; + Item.maxStack = 666; + } + } +} diff --git a/Content/Items/Materials/FrozenTablet.png b/Content/Items/Materials/FrozenTablet.png new file mode 100644 index 0000000..f04a248 Binary files /dev/null and b/Content/Items/Materials/FrozenTablet.png differ diff --git a/Content/Items/Materials/FrozenTablet.psd b/Content/Items/Materials/FrozenTablet.psd new file mode 100644 index 0000000..4ebec70 Binary files /dev/null and b/Content/Items/Materials/FrozenTablet.psd differ diff --git a/Content/Items/Materials/MoltenTablet.cs b/Content/Items/Materials/MoltenTablet.cs new file mode 100644 index 0000000..9ccafaf --- /dev/null +++ b/Content/Items/Materials/MoltenTablet.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria; + +namespace tMx.Content.Items.Materials +{ + public class MoltenTablet : ModItem + { + public override void SetDefaults() + { + Item.ResearchUnlockCount = 666; + Item.value = Item.buyPrice(gold: 1); + Item.rare = ItemRarityID.Red; + Item.material = true; + Item.maxStack = 666; + } + } +} diff --git a/Content/Items/Materials/MoltenTablet.png b/Content/Items/Materials/MoltenTablet.png new file mode 100644 index 0000000..6366ca7 Binary files /dev/null and b/Content/Items/Materials/MoltenTablet.png differ diff --git a/Content/Items/Materials/MoltenTablet.psd b/Content/Items/Materials/MoltenTablet.psd new file mode 100644 index 0000000..3dcd459 Binary files /dev/null and b/Content/Items/Materials/MoltenTablet.psd differ diff --git a/Content/Items/Weapons/Boomrangs/MeteorHammer.cs b/Content/Items/Weapons/Boomrangs/MeteorHammer.cs new file mode 100644 index 0000000..df0d247 --- /dev/null +++ b/Content/Items/Weapons/Boomrangs/MeteorHammer.cs @@ -0,0 +1,47 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace tMx.Content.Items.Weapons.Boomrangs +{ + public class MeteorHammer : ModItem + { + public override void SetDefaults() + { + Item.damage = 80; + Item.DamageType = DamageClass.Melee; + Item.width = 30; + Item.height = 30; + Item.useTime = 5; + Item.useAnimation = 10; + Item.noUseGraphic = true; + Item.useStyle = 1; + Item.knockBack = 3; + Item.value = 8; + Item.rare = ItemRarityID.Orange; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + } + public override void AddRecipes() + { + Recipe recipe = CreateRecipe(); + recipe.AddIngredient(ItemID.DirtBlock, 10); + recipe.AddTile(TileID.WorkBenches); + recipe.Register(); + } + public override bool CanUseItem(Player player) //this make that you can shoot only 1 boomerang at once + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == Item.shoot) + { + return false; + } + } + return true; + } + } +} diff --git a/Content/Items/Weapons/Boomrangs/MeteorHammer.png b/Content/Items/Weapons/Boomrangs/MeteorHammer.png new file mode 100644 index 0000000..00bb350 Binary files /dev/null and b/Content/Items/Weapons/Boomrangs/MeteorHammer.png differ diff --git a/Content/Items/tMxSword.cs b/Content/Items/tMxSword.cs new file mode 100644 index 0000000..f98cca7 --- /dev/null +++ b/Content/Items/tMxSword.cs @@ -0,0 +1,37 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace tMx.Content.Items +{ + // This is a basic item template. + // Please see tModLoader's ExampleMod for every other example: + // https://github.com/tModLoader/tModLoader/tree/stable/ExampleMod + public class tMxSword : ModItem + { + // The Display Name and Tooltip of this item can be edited in the 'Localization/en-US_Mods.tMx.hjson' file. + public override void SetDefaults() + { + Item.damage = 50; + Item.DamageType = DamageClass.Melee; + Item.width = 40; + Item.height = 40; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 6; + Item.value = Item.buyPrice(silver: 1); + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + } + + public override void AddRecipes() + { + Recipe recipe = CreateRecipe(); + recipe.AddIngredient(ItemID.DirtBlock, 10); + recipe.AddTile(TileID.WorkBenches); + recipe.Register(); + } + } +} diff --git a/Content/Items/tMxSword.png b/Content/Items/tMxSword.png new file mode 100644 index 0000000..b54922e Binary files /dev/null and b/Content/Items/tMxSword.png differ diff --git a/Content/Projectiles/MeteorHammerProjectile.cs b/Content/Projectiles/MeteorHammerProjectile.cs new file mode 100644 index 0000000..3486fd4 --- /dev/null +++ b/Content/Projectiles/MeteorHammerProjectile.cs @@ -0,0 +1,86 @@ +using tMx.Content.Items; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using System; +using Terraria.Audio; +using Microsoft.Xna.Framework; + +namespace tMx.Content.Projectiles +{ + // This file showcases the concept of piercing. + // The code of the item that spawns it is located at the bottom. + + // NPC.immune determines if an npc can be hit by a item or projectile owned by a particular player (it is an array, each slot corresponds to different players (whoAmI)) + // NPC.immune is decremented towards 0 every update + // Melee items set NPC.immune to player.itemAnimation, which starts at item.useAnimation and decrements towards 0 + // Projectiles, however, provide mechanisms for custom immunity. + // 1. penetrate == 1: A projectile with penetrate set to 1 in SetDefaults will hit regardless of the NPC's immunity counters (The penetrate from SetDefaults is remembered in maxPenetrate) + // Ex: Wooden Arrow. + // 2. No code and penetrate > 1, penetrate == -1, or (appliesImmunityTimeOnSingleHits && penetrate == 1): npc.immune[owner] will be set to 10. + // The NPC will be hit if not immune and will become immune to all damage for 10 ticks + // Ex: Unholy Arrow + // 3. Override OnHitNPC: If not immune, when it hits it manually set an immune other than 10 + // Ex: Arkhalis: Sets it to 5 + // Ex: Sharknado Minion: Sets to 20 + // Video: https://media-1.discordapp.net/attachments/242228770855976960/1150275205017636995/Projectile_Immunity_Sharknado_Arkhalis_Example.mp4 Notice how Sharknado minion hits prevent Arkhalis hits for a brief moment. + // 4. Projectile.usesIDStaticNPCImmunity and Projectile.idStaticNPCHitCooldown: Specifies that a type of projectile has a shared immunity timer for each npc. + // Use this if you want other projectiles a chance to damage, but don't want the same projectile type to hit an npc rapidly. + // Ex: Ghastly Glaive is the only one who uses this. + // 5. Projectile.usesLocalNPCImmunity and Projectile.localNPCHitCooldown: Specifies the projectile manages it's own immunity timers for each npc + // Use this if you want the multiple projectiles of the same type to have a chance to attack rapidly, but don't want a single projectile to hit rapidly. A -1 value prevents the same projectile from ever hitting the npc again. + // Ex: Lightning Aura sentries use this. (localNPCHitCooldown = 3, but other code controls how fast the projectile itself hits) + // Overlapping Auras all have a chance to hit after each other even though they share the same ID. + // Try the above by uncommenting out the respective bits of code in the projectile below. + + // This is a simple item that is based on the FlintlockPistol and shoots ExamplePiercingProjectile to showcase it. + internal class MeteorHammerProjectile : ModProjectile + { + public override void SetDefaults() + { + Projectile.width = 8; // The width of projectile hitbox + Projectile.height = 8; // The height of projectile hitbox + Projectile.aiStyle = 1; // The ai style of the projectile, please reference the source code of Terraria + Projectile.friendly = true; // Can the projectile deal damage to enemies? + Projectile.hostile = false; // Can the projectile deal damage to the player? + Projectile.DamageType = DamageClass.Melee; // Is the projectile shoot by a ranged weapon? + Projectile.penetrate = 0; // How many monsters the projectile can penetrate. (OnTileCollide below also decrements penetrate for bounces as well) + Projectile.timeLeft = 60; // The live time for the projectile (60 = 1 second, so 600 is 10 seconds) + Projectile.alpha = 5; // The transparency of the projectile, 255 for completely transparent. (aiStyle 1 quickly fades the projectile in) Make sure to delete this if you aren't using an aiStyle that fades in. You'll wonder why your projectile is invisible. + Projectile.light = 10.0f; // How much light emit around the projectile + Projectile.ignoreWater = true; // Does the projectile's speed be influenced by water? + Projectile.tileCollide = true; // Can the projectile collide with tiles? + Projectile.extraUpdates = 1; // Set to above 0 if you want the projectile to update multiple time in a frame + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + // If collide with tile, reduce the penetrate. + // So the projectile can reflect at most 5 times + Projectile.penetrate--; + if (Projectile.penetrate <= 0) + { + Projectile.Kill(); + } + else + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + + // If the projectile hits the left or right side of the tile, reverse the X velocity + if (Math.Abs(Projectile.velocity.X - oldVelocity.X) > float.Epsilon) + { + Projectile.velocity.X = -oldVelocity.X; + } + + // If the projectile hits the top or bottom side of the tile, reverse the Y velocity + if (Math.Abs(Projectile.velocity.Y - oldVelocity.Y) > float.Epsilon) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + } + + return false; + } + } +} diff --git a/Content/Projectiles/MeteorHammerProjectile.png b/Content/Projectiles/MeteorHammerProjectile.png new file mode 100644 index 0000000..c0208fe Binary files /dev/null and b/Content/Projectiles/MeteorHammerProjectile.png differ diff --git a/Localization/en-US_Mods.tMx.hjson b/Localization/en-US_Mods.tMx.hjson new file mode 100644 index 0000000..6bcec69 --- /dev/null +++ b/Localization/en-US_Mods.tMx.hjson @@ -0,0 +1,59 @@ +# This file will automatically update with entries for new content after a build and reload. + +Items: { + tMxSword: { + DisplayName: tMx Sword + Tooltip: + ''' + Template of an item + Replacing this tooltip is duty + It's snowing on Mt.Fuji + ''' + } + + MeteorHammer: { + DisplayName: Meteor Hammer + Tooltip: "" + } + + ExamplePiercingProjectileItem: { + DisplayName: Example Piercing Projectile Item + Tooltip: "" + } + + MoltenTablet: { + DisplayName: Molten Tablet + Tooltip: You can barely hold it in your hand. It's hot! + } + + FrozenTablet: { + DisplayName: Frozen Tablet + Tooltip: You can barely hold it in your hand. It's cold! + } +} + +Projectiles: { + MeteorHammerProjectile.DisplayName: Meteor Hammer Projectile + ExamplePiercingProjectileItem.DisplayName: Example Piercing Projectile Item +} + +Configs: { + tMxConfigs: { + DisplayName: tMx Configs + + NoPotionDelay: { + Label: No Potions Delay + Tooltip: No delay between healing/mana potions use. Debuff = Off + } + + Headers: { + Tweaks: Tweaks Header + Mechanics: Mechanics Header + } + + CleanResearchedPiggyProtect: { + Tooltip: The clean command will not delete item(s) in your piggy bank. + Label: Protect item(s) from pig. + } + } +} diff --git a/Mechanics/CleanResearched/CleanResearchedCommand.cs b/Mechanics/CleanResearched/CleanResearchedCommand.cs new file mode 100644 index 0000000..fb1fa32 --- /dev/null +++ b/Mechanics/CleanResearched/CleanResearchedCommand.cs @@ -0,0 +1,98 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace tMx.Mechanics.CleanResearched +{ + public class CleanResearchedCommand : ModCommand + { + public override CommandType Type + => CommandType.Chat; + + public override string Command + => "tmx"; + + public override string Description + => "Clean all researched objects from inventory and your hotbar."; + + public override void Action(CommandCaller caller, string input, string[] args) + { + tMxConfigs config = ModContent.GetInstance(); + Player p = caller.Player; + int pic = 0; + + if (args.Length == 0) + { + Main.NewText($"[tMx] You must specify an argument.", Color.Red); + Main.NewText($"[tMx] /tmx clean - Clean your inventory and your hotbar of any fully searched item(s).", Color.Red); + } + if (args.Contains("clean")) + { + List piggy = new List(); + foreach (Item i in p.bank.item) + { + if (i.type != ItemID.None) + { + piggy.Add(i.type); + } + } + // Clean the inventory of any fully researched item(s) + int ic = 0; + for (int index = 10; index < 50; index++) + { + Item i = p.inventory[index]; + if (Main.LocalPlayerCreativeTracker.ItemSacrifices.TryGetSacrificeNumbers(i.type, out var amountWeHave, out var amountNeededTotal) && amountWeHave >= amountNeededTotal + && !i.potion + && !piggy.Contains(i.type)) + { + ic++; + p.inventory[index].TurnToAir(); + } else if (piggy.Contains(i.type) && config.CleanResearchedPiggyProtect) + { + pic++; + } + } + Main.NewText($"[tMx] Cleaned {ic} item(s) from your inventory.", Color.Brown); + + // Clean the hotbar of any fully researched item(s) + int ichot = 0; + for (int indexhot = 0; indexhot < 10; indexhot++) + { + Item i = p.inventory[indexhot]; + if (Main.LocalPlayerCreativeTracker.ItemSacrifices.TryGetSacrificeNumbers(i.type, out var amountWeHave, out var amountNeededTotal) + && amountWeHave >= amountNeededTotal + && !i.potion + && !i.GetPrefixCategories().Contains(PrefixCategory.Accessory) + && !i.GetPrefixCategories().Contains(PrefixCategory.AnyWeapon) + && i.type != ItemID.Torch + && i.type != ItemID.FallenStar + && !piggy.Contains(i.type)) + { + ichot++; + p.inventory[indexhot].TurnToAir(); + } else if (piggy.Contains(i.type) && config.CleanResearchedPiggyProtect) + { + pic++; + } + } + Main.NewText($"[tMx] Cleaned {ichot} item(s) from your hotbar.", Color.Brown); + if (pic == 1) + { + Main.NewText($"[tMx] {pic} item was protected for being in your piggy bank.", Color.Brown); + } else if (pic > 1) + { + Main.NewText($"[tMx] {pic} items were protected for being in your piggy bank.", Color.Brown); + } + ic = 0; + ichot = 0; + } + } + } +} diff --git a/NPCs/CustomLoot/FrozenTabletOnKill.cs b/NPCs/CustomLoot/FrozenTabletOnKill.cs new file mode 100644 index 0000000..f01aff3 --- /dev/null +++ b/NPCs/CustomLoot/FrozenTabletOnKill.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria; +using Terraria.ModLoader.IO; +using static Terraria.GameContent.Bestiary.IL_BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions; +using Microsoft.Xna.Framework; + +namespace tMx.NPCs.CustomLoot +{ + public class FrozenTabletOnKill : GlobalNPC + { + public override void OnKill(NPC npc) + { + if (Main.rand.NextBool(3)) // ~33% + { + if (npc.type == NPCID.IceSlime + || npc.type == NPCID.IceBat) + { + int dropItemType = ModContent.ItemType(); + int newItem = Item.NewItem(npc.GetSource_FromThis(), npc.Hitbox, dropItemType); + + if (Main.netMode == NetmodeID.MultiplayerClient && newItem >= 0) + { + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, newItem, 1f); + } + } + } + } + } +} diff --git a/NPCs/CustomLoot/MoltenTabletOnKill.cs b/NPCs/CustomLoot/MoltenTabletOnKill.cs new file mode 100644 index 0000000..52cecef --- /dev/null +++ b/NPCs/CustomLoot/MoltenTabletOnKill.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria; +using Terraria.ModLoader.IO; +using static Terraria.GameContent.Bestiary.IL_BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions; +using Microsoft.Xna.Framework; + +namespace tMx.NPCs.CustomLoot +{ + public class MoltenTabletOnKill : GlobalNPC + { + public override void OnKill(NPC npc) + { + if (Main.rand.NextBool(3)) // ~33% + { + if (npc.type == NPCID.Hellbat + || npc.type == NPCID.Lavabat + || npc.type == NPCID.LavaSlime + || npc.type == NPCID.FireImp) + { + int dropItemType = ModContent.ItemType(); + int newItem = Item.NewItem(npc.GetSource_FromThis(), npc.Hitbox, dropItemType); + + if (Main.netMode == NetmodeID.MultiplayerClient && newItem >= 0) + { + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, newItem, 1f); + } + } + } + } + } +} diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json new file mode 100644 index 0000000..5aa5d42 --- /dev/null +++ b/Properties/launchSettings.json @@ -0,0 +1,16 @@ +{ + "profiles": { + "Terraria": { + "commandName": "Executable", + "executablePath": "$(DotNetName)", + "commandLineArgs": "$(tMLPath)", + "workingDirectory": "$(tMLSteamPath)" + }, + "TerrariaServer": { + "commandName": "Executable", + "executablePath": "$(DotNetName)", + "commandLineArgs": "$(tMLServerPath)", + "workingDirectory": "$(tMLSteamPath)" + } + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a3de293 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +## tMx + tMx is my official tModLoader mod containing all my modifications. \ No newline at end of file diff --git a/Tweaks/Potion/NoPotionDelay.cs b/Tweaks/Potion/NoPotionDelay.cs new file mode 100644 index 0000000..b31d4ea --- /dev/null +++ b/Tweaks/Potion/NoPotionDelay.cs @@ -0,0 +1,19 @@ +using Terraria; +using Terraria.ModLoader; + +namespace tMx.Tweaks.Potion +{ + public class NoPotionDelay : GlobalItem + { + public override void OnConsumeItem(Item item, Player player) + { + tMxConfigs config = ModContent.GetInstance(); + if (item.potion && config.NoPotionDelay) + { + player.ClearBuff(21); + player.potionDelay = 0; + player.potionDelayTime = 0; + } + } + } +} diff --git a/Tweaks/Potion/PotionLength.cs b/Tweaks/Potion/PotionLength.cs new file mode 100644 index 0000000..a89b1a4 --- /dev/null +++ b/Tweaks/Potion/PotionLength.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; +using Terraria; + +namespace tMx.Tweaks.Potion +{ + internal class PotionLength : GlobalItem + { + public override void OnConsumeItem(Item item, Player player) + { + tMxConfigs config = ModContent.GetInstance(); + if (item.potion) + { + + } + } + } +} diff --git a/build.txt b/build.txt new file mode 100644 index 0000000..6b5cf80 --- /dev/null +++ b/build.txt @@ -0,0 +1,3 @@ +displayName = tMx +author = mikx +version = 0.2.0 \ No newline at end of file diff --git a/description.txt b/description.txt new file mode 100644 index 0000000..7529ca2 --- /dev/null +++ b/description.txt @@ -0,0 +1 @@ +tMx Server Official Mod \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..5cd3990 Binary files /dev/null and b/icon.png differ diff --git a/tMx.cs b/tMx.cs new file mode 100644 index 0000000..e8f4977 --- /dev/null +++ b/tMx.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; + +namespace tMx +{ + // Please read https://github.com/tModLoader/tModLoader/wiki/Basic-tModLoader-Modding-Guide#mod-skeleton-contents for more information about the various files in a mod. + public class tMx : Mod + { + + } +} diff --git a/tMx.csproj b/tMx.csproj new file mode 100644 index 0000000..1125d81 --- /dev/null +++ b/tMx.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tMx.sln b/tMx.sln new file mode 100644 index 0000000..b071b49 --- /dev/null +++ b/tMx.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35707.178 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tMx", "tMx.csproj", "{3A853CE7-F5D2-49BC-AD7E-2DBD49701C8B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3A853CE7-F5D2-49BC-AD7E-2DBD49701C8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3A853CE7-F5D2-49BC-AD7E-2DBD49701C8B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A853CE7-F5D2-49BC-AD7E-2DBD49701C8B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3A853CE7-F5D2-49BC-AD7E-2DBD49701C8B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tMxConfigs.cs b/tMxConfigs.cs new file mode 100644 index 0000000..abbcc64 --- /dev/null +++ b/tMxConfigs.cs @@ -0,0 +1,24 @@ +using System.ComponentModel; +using Terraria.ModLoader.Config; + +namespace tMx +{ + public class tMxConfigs : ModConfig + { + [Header("Tweaks")] + + [Label("No Potions Delay")] + [Tooltip("No delay between healing/mana potions use. Debuff = Off")] + [DefaultValue(false)] + public bool NoPotionDelay; + + [Header("Mechanics")] + + [Label("Protect item(s) from pig.")] + [Tooltip("The clean command will not delete researched item(s) present in your piggy bank.")] + [DefaultValue(false)] + public bool CleanResearchedPiggyProtect; + + public override ConfigScope Mode => (ConfigScope)0; + } +} \ No newline at end of file