**REPORTED** Crimson Pigron cannot enter water

This is Many

Retinazer
Steam or GOG
Steam
Single Player/Multiplayer
Both
Operating System
Mac Other
Terraria Version
1.4.4.9
Controls Used
Keyboard/Mouse
Recently I was adapting Demon Eye AI and found this mistake.
There's a code that makes eyes (who are not Pigrons) unable to enter water.
Screenshot 2024-05-04 at 13.48.20.png


but 172 is an ID of Rune Wizard!! Crimson Pigron is ID 180

I even tested this in my world because I thought my decompiler was wrong and found that Crimson Pigron actually couldn't enter the water.
Screenshot_2024-05-04_at_13.45.10.png


Small bug that no one found since 1.2 huh
 
This is interesting, because considering that Terraria uses constants for its entity types, the original source should look like wet && type != NPCID.PigronCorruption && type != NPCID.PigronHallow && type != NPCID.RuneWizard. So, either the author of this code thought that the Rune Wizard uses ai 2, or they used the actual numbers there... truly one of the code snippets I have ever seen
 
This is interesting, because considering that Terraria uses constants for its entity types, the original source should look like wet && type != NPCID.PigronCorruption && type != NPCID.PigronHallow && type != NPCID.RuneWizard. So, either the author of this code thought that the Rune Wizard uses ai 2, or they used the actual numbers there... truly one of the code snippets I have ever seen
NPCID is unused in terraria, it would be seen if NPCID is used even through decompiled code. Either numbers are used, so they just write type == 170, 171 and 172, but 172 is not crimson Pigron
 
NPCID is unused in terraria, it would be seen if NPCID is used even through decompiled code.
It only appears unused because it only contains constant fields, which always get inlined during compilation. There are a few things which use straight numbers, like ai styles, but the rest is present as constants in ID classes. They also always get updated when new content gets added.
See for yourself in SharpLab: even the debug IL has it inlined with no visible reference.
 
It only appears unused because it only contains constant fields, which always get inlined during compilation. There are a few things which use straight numbers, like ai styles, but the rest is present as constants in ID classes. They also always get updated when new content gets added.
See for yourself in SharpLab: even the debug IL has it inlined with no visible reference.
ah alr, so maybe in that AI style they was using numbers
 
Back
Top Bottom