- Steam or GOG
- Steam
- Single Player/Multiplayer
- Both
- Operating System
- Windows 10
- Terraria Version
- 1.4.2.3
- Controls Used
- Keyboard/Mouse
Hey Team,
I've been poking around in Terraria's code with ILSpy, learning specifics of various mechanics for a custom map that I've been working on. I was instructed to post my bug findings here. Hopefully this format works well for you.
Terraria.Projectile.GetFishingPondState():
Problem: while (Main.tile[i, num].liquid > 0 && !WorldGen.SolidTile(i, num) && num < Main.maxTilesY - 10)
Reason: Immediately inside this loop is numWaters++ followed by num++. This num++ needs to be moved to after the if statement that immediately follows it. Its current structure allows players to fish for water rewards from honey and lava pools that are 1 tile tall.
Terraria.NPC.AI(): aistyle == 27 (WoF)
Problem: while (num352 < 15 && num353 > Main.UnderworldLayer) and while (num352 < 15 && num353 < Main.maxTilesY - 10)
Reason: The [> Main.UnderworldLayer] and [< Main.maxTilesY - 10] should be swapped. It's currently always true, as it's written. Swapping the two would limit the WoF to 190 tiles tall, which I believe was intended. WoF is currently able to span the entire height of the world. Kinda strange being able to win the fight from the surface by attacking the upper eye.
Terraria.Liquid.SettleWaterAt():
Problem: if ((tile3.liquid != 0 && (!flag2 || num4 != 1)) || (tile3.nactive() && Main.tileSolid[tile3.type] && !Main.tileSolidTop[tile3.type]))
Reason: should not contain the || num4 != 1. This would help to drastically reduce load times for worlds with large horizontal lines of liquid. It unneccessarily checks tiles to the right, when it should be stopping immediately as it does with the left.
Minor:
Terraria.NPC.SpawnOnPlayer():
Problem: if ((Main.wallHouse[Main.tile[num20, num21].wall] && m < 999) || (Type == 50 && m < 500 && Main.tile[num21, num21].wall > 0))
Reason: Main.tile[num21, num21].wall should be [num20, num21]. Currently checking [y, y] instead of [x, y], potentially failing the first 500 attempts.
Multiple methods that result in a couple thousand useless checks performed each time an attempt is made to spawn an Underground Desert enemy.
I've been poking around in Terraria's code with ILSpy, learning specifics of various mechanics for a custom map that I've been working on. I was instructed to post my bug findings here. Hopefully this format works well for you.
Terraria.Projectile.GetFishingPondState():
Problem: while (Main.tile[i, num].liquid > 0 && !WorldGen.SolidTile(i, num) && num < Main.maxTilesY - 10)
Reason: Immediately inside this loop is numWaters++ followed by num++. This num++ needs to be moved to after the if statement that immediately follows it. Its current structure allows players to fish for water rewards from honey and lava pools that are 1 tile tall.
Terraria.NPC.AI(): aistyle == 27 (WoF)
Problem: while (num352 < 15 && num353 > Main.UnderworldLayer) and while (num352 < 15 && num353 < Main.maxTilesY - 10)
Reason: The [> Main.UnderworldLayer] and [< Main.maxTilesY - 10] should be swapped. It's currently always true, as it's written. Swapping the two would limit the WoF to 190 tiles tall, which I believe was intended. WoF is currently able to span the entire height of the world. Kinda strange being able to win the fight from the surface by attacking the upper eye.
Terraria.Liquid.SettleWaterAt():
Problem: if ((tile3.liquid != 0 && (!flag2 || num4 != 1)) || (tile3.nactive() && Main.tileSolid[tile3.type] && !Main.tileSolidTop[tile3.type]))
Reason: should not contain the || num4 != 1. This would help to drastically reduce load times for worlds with large horizontal lines of liquid. It unneccessarily checks tiles to the right, when it should be stopping immediately as it does with the left.
Minor:
Terraria.NPC.SpawnOnPlayer():
Problem: if ((Main.wallHouse[Main.tile[num20, num21].wall] && m < 999) || (Type == 50 && m < 500 && Main.tile[num21, num21].wall > 0))
Reason: Main.tile[num21, num21].wall should be [num20, num21]. Currently checking [y, y] instead of [x, y], potentially failing the first 500 attempts.
Multiple methods that result in a couple thousand useless checks performed each time an attempt is made to spawn an Underground Desert enemy.