question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Proposal] CanBurnInLava hook rework

See original GitHub issue

Description

Currently in ItemLoader there exists the CanBurnInLava hook: public static bool CanBurnInLava(Item item). This is the place where it’s called:

if (owner == Main.myPlayer && type != 312 && type != 318 && type != 173 && type != 174 && type != 175 && type != 2701 && rare == 0 || ItemLoader.CanBurnInLava(this)

It returns false by default. Modders can override it and return true to force an item to burn in contact with lava, bar the vanilla exceptions above. Vanilla behavior is that items with a rarity of 0 (White) always burn bar the vanilla exceptions above. The hook is currently very limited in application scope: The only case where it makes sense to return true is if you want an item with higher than 0 rarity to burn. If a modder would want to prevent items from being burned regardless of rarity, this is not possible via this hook currently. A modder could instead “hack” the system and swap out the rarity in ItemLoader.Update, and change it back in ItemLoader.PostUpdate, but that’s not in the spirit of tml.

Proposal

Change the return type to bool?, similar to a bunch of other tml hooks, it would introduce new behavior:

  • defaults to null: not overriding means vanilla behavior
  • return true: force the item to burn regardless of any conditions
  • return false: force the item to never burn regardless of any conditions

The place where it’s called would have to be slightly changed to accomodate this.

What does this proposal attempt to solve or improve?

More control over which items burn and don’t without “hacking” the item rarity temporarily

Which (other) solutions should be considered?

It will require a change of the return type, so this isn’t sensible to do for current tml but for 1.4 tml.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
JavidPackcommented, Aug 5, 2020

I think a mod that attempts to force some items to burn should take precedence. A mod like that would be implementing some sort of game mode, whereas a mod attempting to force an item to not burn is just suggesting some attribute of the item in question.

0reactions
Fragstillercommented, Mar 8, 2021

This should probably be closed, since decent solution is merged now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hog Rework Idea Proposal : r/Overwatch
Turnable degree to reel a target after hooking them increased from 90° -> 180° (Effectively pulling the target all the way around behind...
Read more >
Terraria 1.4 Beta Milestone
A mod to make and play Terraria mods. Supports Terraria 1.4 (and earlier) installations - Terraria 1.4 Beta Milestone · tModLoader/tModLoader.
Read more >
Standalone - [1.3] tModLoader - A Modding API
It contains information on all the features, hooks, etc., in tModLoader, complete with descriptions on what everything is used for.
Read more >
Farmhand loader mounts
Farmhand loader mounts At The Repair Manual we provide quality Repair and ... CanBurnInLava hook, allows for enabling lava burning of specific items....
Read more >
Farmhand loader mounts
Proforge Giro / Farmhand Weld On Loader Bracket (Pair) 24. hoses hooked to ... Farmhand loader mounts At The Repair Manual we provide...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found