BasicallyIAmFox / AltLibrary

1 stars 2 forks source link

Suggestion: hook which runs when a tile is converted from a biome #9

Open Tyfyter opened 1 year ago

Tyfyter commented 1 year ago

GetAltBlock is run before a tile is converted to its biome, but there isn't a hook run on the biome the block is being converted from, I believe such a hook would be significantly beneficial.

BasicallyIAmFox commented 1 year ago

Not exactly sure how it would be beneficial. Any examples how mods could use such hook?

Tyfyter commented 1 year ago

For example: a biome which tries to convert its blocks back to it after some time.

Tyfyter commented 1 year ago

or for that matter, reacting with something like an enemy spawn or projectile

BasicallyIAmFox commented 1 year ago

For spreading, there's Convert method in (iirc) ALConvert class

Tyfyter commented 1 year ago

The convert method is not a hook, nor is it even used when converting tiles from what I recall.

BasicallyIAmFox commented 1 year ago

first example clearly is spreading

Tyfyter commented 1 year ago

and unless I missed a method call while going through the source of AltLibrary.Core.ALConvert.Convert that example is impossible without using monomod to detour AltLibrary like the others because there is no built-in way to run code when a tile is converted from a biome regardless of which biome it's converted to