Skip to content

Commit

Permalink
v1.1.2 Add a config + setting for disabling the chat autofill feature
Browse files Browse the repository at this point in the history
  • Loading branch information
direwolf420 committed Mar 2, 2021
1 parent 053b7de commit fa4e46b
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 3 deletions.
18 changes: 18 additions & 0 deletions Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.ComponentModel;
using Terraria.ModLoader;
using Terraria.ModLoader.Config;

namespace PetRenamer
{
public class Config : ModConfig
{
public override ConfigScope Mode => ConfigScope.ClientSide;

public static Config Instance => ModContent.GetInstance<Config>();

[Tooltip("If chat should autofill the command automatically when a pet item is selected")]
[Label("Enable Chat Autofill")]
[DefaultValue(true)]
public bool EnableChatAutofill;
}
}
7 changes: 6 additions & 1 deletion PRPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ private void SetTypeAndNameOfCurrentEquippedPetInSlot(int slot, ref int type, re

private void Autocomplete()
{
if (!Config.Instance.EnableChatAutofill)
{
return;
}

if (Main.drawingPlayerChat &&
(OpenedChatWithMouseItem || MouseItemChangedToPetItem))
{
Expand All @@ -101,7 +106,7 @@ private void Autocomplete()
}
}

prevItemType = Main.mouseItem.type;
prevItemType = Main.mouseItem?.type ?? 0;
}
}
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Credits:

Changelog:

v1.1.2: Add a config + setting for disabling the chat autofill feature

v1.1.1.2: Fix rare bug with mouseovering a pet in multiplayer

v1.1.1.1: When opening the UI and the mouse item slots in, the text field now auto-focuses
Expand Down
3 changes: 2 additions & 1 deletion UI/RenamePetUI/RenamePetUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public override void OnInitialize()
HAlign = 0.5f,
ValidItemFunc = item => item.IsAir || PetRenamer.IsPetItem(item)
};
itemSlot.OnEmptyMouseover += (timer) => {
itemSlot.OnEmptyMouseover += (timer) =>
{
Main.hoverItemName = "Place a pet summoning item here";
if (timer > 60)
{
Expand Down
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
author = direwolf420
version = 1.1.1.2
version = 1.1.2
displayName = PetRenamer
homepage = https://forums.terraria.org/index.php?threads/pet-renamer-allows-you-to-name-your-pets.79293/
hideCode = true
Expand Down
2 changes: 2 additions & 0 deletions description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ For instructions on both, visit the homepage

Changelog:

v1.1.2: Add a config + setting for disabling the chat autofill feature

v1.1.1.2: Fix rare bug with mouseovering a pet in multiplayer

v1.1.1.1: When opening the UI and the mouse item slots in, the text field now auto-focuses
Expand Down

0 comments on commit fa4e46b

Please sign in to comment.