tModLoader Research from 1.4 in Terraria 1.3.5

(If there is a way) how would one change the hotkey? I don't use a full 84 key keyboard so I can't use the "Add" key.
 
(If there is a way) how would one change the hotkey? I don't use a full 84 key keyboard so I can't use the "Add" key.
There's a choice for it in the Options, under Controls. Just scroll down until you see the mod's name and change it to whatever you prefer.
 
I'm trying to make this so it's not super OP for normal play, and also not cost an unreasonable amount of items, but I'm running into an issue where it's impossible to do something like set blocks at 5000 and weapons at 10 due to blocks being divided by the exception value instead of multiplied. If possible it'd be great if it could be made so the flat research cost can just be set in the exception options instead of multiplied/divided. Or a fine alternative would be to make the exception value work the same for everything and go up to 100000 (1=0.01, 10=0.1, 100=1. 1000=10, etc).
 
started experiencing a crash after a few hours in-game when right-clicking on any item Nevermind, tmodloader update seems to have fixed issue
11/10/2020 10:33:55 PM
System.InvalidOperationException: Begin cannot be called again until End has been successfully called.
at Microsoft.Xna.Framework.Graphics.SpriteBatch.Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix)
at Terraria.Main.RenderBlack()
at Terraria.Main.RenderTiles()
at Terraria.Main.DoDraw(GameTime gameTime)
at Terraria.Main.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DrawFrame()
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Terraria.Program.LaunchGame_()
 
Last edited:
is there a way to turn off crafting from the researched menu? it clutters the crafting menu. for example, if I don't have slime in my inventory, I shouldn't have slime recipes in the crafting menu. Just a suggestion if it doesn't exist already!
 
is there a way to turn off crafting from the researched menu? it clutters the crafting menu. for example, if I don't have slime in my inventory, I shouldn't have slime recipes in the crafting menu. Just a suggestion if it doesn't exist already!
It's an option in the config
 
Could you add an option to make all researched items worth nothing?

It wouldn't make it impossible to have infinite money but combined with automatically researching craftables it would require active effort to have infinite money and that's easy to avoid in singleplayer


Also I would say a lot of the features you've added so far are very nice and I would use this mod over the 1.4 vanilla feature
So please consider reworking this into a plugin on the 1.4 system when that rolls around
The problem with making these items worth nothing is that reforging gets kinda broken. I could easily set their value to 0, but given that researching infinite money is as easy as getting one silver coin, split it into 100 copper and research that, I find it difficult to "balance" the values of the items.
If you have the self control to not research money, trashing instead of selling obtained items should not be so hard.
One option would make money harder to research, such as requiring 100 Platinum, or 10000 gold, 1000000 silver and 100000000 copper to research money. It's a stopgap measure, but I could implement an option for it and other currencies.

Also, the plan is, when 1.4 rolls around, this mod will be "abandoned" and a new mod to 1.4 will be made to add the features into their research system. I already submitted some hooks to the new 1.4 tMod to try and place these features into the original research system, but have yet to have time to finish polishing them up for aproval.
Another big ask but I think it would mesh well, since you develop both this and Rare Item Swap...
could you make it (an option) so that when you research swap parts, it automatically researches all the things you can swap with those parts?

Mainly this would mean you don't have to go through each item in the shop until you have enough to research.
A cross effect could be that the parts now show as infinite (or no count display) instead of having a count associated with them in the parts bank.

But also in combination with making researched items have no gold value, this would make it so you can't sell items you produce from the swap using researched parts.

Similar systems could also be added for shop items should one ever research Vanquisher Medal or Defender's Medal etc but this would be harder to do. If you wanted to do this then I would suggest doing it in tandem whenever you are adding each mod currency support to Rare Item Swap.
After the next update to Rare Item Swap (adding Calamity support, now testing it), the next step is implementing a ModCall system to get existing parts, allowing other mods to add new items, and allowing anyone to retrieve the available swaps given a list of part tags. The idea is that, after implementing it, "the auto-research item swaps with infinite parts" option in this mod would be added. As an option, because it would introduce a lot of clutter and lag.

I'm trying to make this so it's not super OP for normal play, and also not cost an unreasonable amount of items, but I'm running into an issue where it's impossible to do something like set blocks at 5000 and weapons at 10 due to blocks being divided by the exception value instead of multiplied. If possible it'd be great if it could be made so the flat research cost can just be set in the exception options instead of multiplied/divided. Or a fine alternative would be to make the exception value work the same for everything and go up to 100000 (1=0.01, 10=0.1, 100=1. 1000=10, etc).

This is already how the difficulty works. It literally multiplies the research value by [difficulty]/100, and then picks the ceiling of that. Making separate dificulties for different types of items (weapons, blocks, etc) would be a nightmare because of how many types there are (in the limit, all categories except "other" would have a multiplier). So this difficulty system is as "good" as it will get for a while. When categories are better defined (in the actual research system of 1.4) and modders are "forced" to add a research value to their items, a more specific type of difficulty multiplier would be possible.

Anyway, very small hotfix update to solve a problem with prefix storage, as well as a bug that made Quest-rarity currencies cost only 2 of the item.

V 1.8.3.1 Changelog
- Small patch to the Prefix storage, when in some cases it stored an int (or byte) instead of a byte array, causing exceptions.
- Fixed Currencies such as Vanquisher Medals from Thorium (which are Quest Rarity) being treated as quest items instead of currencies.
 
OK, new version is out, and contains:
- Cross compatibility with Rare Item Swap, allowing you to automatically research any purchaseable item by learning it's parts (off by default in config);
- ModCall support, for allowing Mod Developers to add their own values and categories to the Research menu.
- Team knowledge/research sharing - By setting a config option, players in the same team will auto-share its researched items, and from then on when one researches an item (even partially), both will recieve that knowledge (off by default in the config).

Both options are a bit heavy on the CPU, so even threaded, they may slow down weaker machines. Use at your own discretion.

ModCalls available, as you can find out by Mod Calling with no parameters (including function name):
Code:
Logger.Info("Mod call was Empty. This will display, in log, what functions are currently available. All function calls are case-insensitive, but arguments are not.");
                Logger.Info("Player arguments accept the Player object or the Player.whoAmI (position in the Main.player array)");
                Logger.Info("Item arguments take Item objects, ModItem object, the int Type of that item or the Item Tag of the item)");
                Logger.Info("Int values accept int or its string representation");

                Logger.Info("Functions available");
                Logger.Info(" - IsResearched (Player, Item) ");
                Logger.Info("Returns -1 if the item is irresearchable, 0 if it is totally researched or the number of items remaining before becoming fully researched.");
                Logger.Info(" - AddResearch (Player, Item, Int) ");
                Logger.Info("Adds Int to the researched amount of Item for the given Player. Send Int32.Max for fully research the item regardless of current amount. This will not research items considered unresearchable. Returns the research amount remaining after adding.");
                Logger.Info(" - SetDefaultMaxResearch (Item, Int) ");
                Logger.Info("Sets the default, starting value for the specified item's research needed. If this value is -1, makes it impossible to research, 0 makes this mod's algorithm decide, positive values are set as the amount needed.\n" +
                    "Note: This function does not alter the values outright. After finishing calling all the SetDefault* you need, call ResetTable.");
                Logger.Info(" - SetDefaultCategories (Item, List<string>) or SetDefaultCategories (Item, string ...) ");
                Logger.Info("Sets the default category to a custom value. This does not stop it from showing up in other categories, it's just a way to make custom categories for mods possible.\n" +
                    "Note: This function does not alter the values outright. After finishing calling all the SetDefault* you need, call ResetTable.");
                Logger.Info(" - ResetTable() ");
                Logger.Info("Resets the table, applying the new defaults that have been set. This function is required to apply the changes made by the two SetDefault functions. Use it at the end of all your Item Changes.");

V 1.9 Changelog
- Cross compatibility with Rare Item Swap
- Team research sharing
- Mod call support for mod cross-compatibility
 
Any idea what's causing this error? I'm trying to research dungeon bricks and bones, and whenever I research enough, it just freezes the game.

Code:
[14:27:23] [21/WARN] [tML]: Silently Caught Exception:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at ResearchFrom14.Common.UI.RecipePanel.recreateList() in ResearchFrom14\Common\UI\RecipePanel.cs:line 146
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
EDIT: Also, it probably shouldn't search for teammates if the option is off. Also, for some reason using the research sharing book causes a crash eventually, i think? it happens long enough after that i'm not sure, but there's no error message.
 
Last edited:
Any idea what's causing this error? I'm trying to research dungeon bricks and bones, and whenever I research enough, it just freezes the game.

Code:
[14:27:23] [21/WARN] [tML]: Silently Caught Exception:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at ResearchFrom14.Common.UI.RecipePanel.recreateList() in ResearchFrom14\Common\UI\RecipePanel.cs:line 146
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
EDIT: Also, it probably shouldn't search for teammates if the option is off. Also, for some reason using the research sharing book causes a crash eventually, i think? it happens long enough after that i'm not sure, but there's no error message.
This error is caused because I forgot to lock the access to "researchCache", which can be modified while the object display is refreshing. I'll add a lock and am going to test tomorrow to see if it's fixed.

As for the "Checking for teammates", its a debug message that is called when the check teammates function is called, before checking if the config allows it. It is not really searching for teammates with the option off.

As for the crashes, this mod is quite heavy on memory and CPU, when the research recipes is on, and more so if the Rare Item Swap compatibility is turned on. If you are experiencing random crashes after researching an item, it might be because these features threw terraria over the memory limit. Try TMod 64 bit if the problem presisits.
 
It seems like some of my items have gone missing. I have wood researched for instance, but I can't find it in the research page any more. I can't research it again, and it works like it's been researched, but I can't get the item. Something seems to have eaten all of my tiles and all of my platforms.

Edit: It looks like restarting tmod fixed it.
 
Last edited:
This error is caused because I forgot to lock the access to "researchCache", which can be modified while the object display is refreshing. I'll add a lock and am going to test tomorrow to see if it's fixed.

As for the "Checking for teammates", its a debug message that is called when the check teammates function is called, before checking if the config allows it. It is not really searching for teammates with the option off.

As for the crashes, this mod is quite heavy on memory and CPU, when the research recipes is on, and more so if the Rare Item Swap compatibility is turned on. If you are experiencing random crashes after researching an item, it might be because these features threw terraria over the memory limit. Try TMod 64 bit if the problem presisits.
I'm already using 64 bit and it's not crashing when i research something new, but freezing for an hour is a bit too long for me.

Edit: Just tried to use the research sharing book to remake my cache, and watched my task manager, and it seemed fine, right up until my cpu usage suddenly dropped close to zero, then maxed out for a moment, just as terraria shut down.

EDIT2: The update fixed both my issues.
 
Last edited:
Any idea what's causing this error? I'm trying to research dungeon bricks and bones, and whenever I research enough, it just freezes the game.

Code:
[14:27:23] [21/WARN] [tML]: Silently Caught Exception:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at ResearchFrom14.Common.UI.RecipePanel.recreateList() in ResearchFrom14\Common\UI\RecipePanel.cs:line 146
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
EDIT: Also, it probably shouldn't search for teammates if the option is off. Also, for some reason using the research sharing book causes a crash eventually, i think? it happens long enough after that i'm not sure, but there's no error message.
I'm already using 64 bit and it's not crashing when i research something new, but freezing for an hour is a bit too long for me.

Edit: Just tried to use the research sharing book to remake my cache, and watched my task manager, and it seemed fine, right up until my cpu usage suddenly dropped close to zero, then maxed out for a moment, just as terraria shut down.
OK, I released an update that should fix the Exception that appears there, just in case the problem was that. I tested it out with a character that had over 10000 items researched, learned new stuff, and the wait was no longer than 10 seconds for the all screen to show up, with no freezes. So, I'm going to need more info for fixing this freeze (and crash), if the update doesn't fix it. Could you post what mods you have on? and how many threads does your CPU have? Also, are you using "search for tooltips" on?

Also V1.9.0.1 Changelog
- Added Sync methods to accesses to research cache, as it is called from three different threads. Should fix some hangings.
- Removed some debug logs.
 
looks like i'll want to anyways, because something is causing it to freeze when i research fortress bricks from the QWERTY's mod, and i tested it in a world with just qwerty's, cheat sheet, and this mod, and it worked fine, so this is going to be fun. Here's my modpack, i guess. Search for tooltips off, and i don't know how to check for threads.

Edit: Trying something stupid, let's see if researching it with researching craftables off, and then turning it back on and using the research sharing book works. Seems to not work? it doesn't crash or anything, it just is trying to rebuild the cache forever, from what i can tell. Log doesn't look very helpful either, as it doen't look like it has any warnings once i enter the world. Let it try rebuilding for an hour, and it just isn't doing anything that i can see so i guess something's bugged, but i have no idea where to look to find out.

Might want to make it so that rebuilding the cache doesn't continue when you exit the world.

Log doesn't look partically useful, because something's loading vanilla assets.

Alright, tried researching fortress bricks with a new character using my full modpack, and it researched, but didn't show in the research window? this is kinda weird.
 

Attachments

  • PackforBeginAnew.json
    1.8 KB · Views: 113
  • client.log
    591.4 KB · Views: 182
Last edited:
looks like i'll want to anyways, because something is causing it to freeze when i research fortress bricks from the QWERTY's mod, and i tested it in a world with just qwerty's, cheat sheet, and this mod, and it worked fine, so this is going to be fun. Here's my modpack, i guess. Search for tooltips off, and i don't know how to check for threads.

Edit: Trying something stupid, let's see if researching it with researching craftables off, and then turning it back on and using the research sharing book works. Seems to not work? it doesn't crash or anything, it just is trying to rebuild the cache forever, from what i can tell. Log doesn't look very helpful either, as it doen't look like it has any warnings once i enter the world. Let it try rebuilding for an hour, and it just isn't doing anything that i can see so i guess something's bugged, but i have no idea where to look to find out.

Might want to make it so that rebuilding the cache doesn't continue when you exit the world.

Log doesn't look partically useful, because something's loading vanilla assets.

Alright, tried researching fortress bricks with a new character using my full modpack, and it researched, but didn't show in the research window? this is kinda weird.
I went through the log, and found some interesting stuff, actually. I know why it's crashing, it's just not my mod, apparently.

The first part shows that Research tries to load all the cache even when no player is present, which it is not supposed to do. I never saw that bug before because I had another mod that crashed it before it reached that part, so we never can know what affects what... But that bug is fixed now, by not checking player adjacent blocks (crafting from researched stations) when no player is active.

I will upload just that fix, but I'm not confident will be enough to stop the crash. The problem is the (over) 4 million assets it's loading from vanilla terraria (vanilla terraria has about 5000-7000 assets). This will inevitably lead to an out of memory exception, but I don't have that bug myself. Unusacies does, however, and I think that, by tomorrow, I can compare his and your's mod list to find the culprit.

v1.9.0.2 Changelog
- Fixed bug where the player was being loaded before any player existed, causing a spew of errors for every tile researched.
 
I went through the log, and found some interesting stuff, actually. I know why it's crashing, it's just not my mod, apparently.

The first part shows that Research tries to load all the cache even when no player is present, which it is not supposed to do. I never saw that bug before because I had another mod that crashed it before it reached that part, so we never can know what affects what... But that bug is fixed now, by not checking player adjacent blocks (crafting from researched stations) when no player is active.

I will upload just that fix, but I'm not confident will be enough to stop the crash. The problem is the (over) 4 million assets it's loading from vanilla terraria (vanilla terraria has about 5000-7000 assets). This will inevitably lead to an out of memory exception, but I don't have that bug myself. Unusacies does, however, and I think that, by tomorrow, I can compare his and your's mod list to find the culprit.

v1.9.0.2 Changelog
- Fixed bug where the player was being loaded before any player existed, causing a spew of errors for every tile researched.
Oh, it's not crashing, it's just not doing anything, i have enough ram that it doesn't really matter unless i play for over 4 hours at a time, without restarting terraria.

Edit: Update seems to of worked! I am very glad these seem to of been fairly simple fixes.

Any idea if the cache continues to reload if the game is out of focus? it seems to be taking an strangely long time again.
 
Last edited:
Any idea if I should be worried about all these warnings?

Edit: I guess so, it just crashed again, while trying to rebuild my research cache.
 

Attachments

  • client.log
    327.3 KB · Views: 123
Last edited:
Back
Top Bottom