Pryaxis / TSAPI

🛠🌳 The TShock Scaffold API enables developers to build plugins that hook directly into the Terraria game engine.
http://tshock.co/
GNU General Public License v3.0
109 stars 67 forks source link

Disappearing NPCs #8

Closed AndrioCelos closed 9 years ago

AndrioCelos commented 9 years ago

The following relates to Terraria API Server version 1.18.0.0, at commit https://github.com/NyxStudios/TerrariaAPI-Server/commit/c9252bee5dc95f94e705986bc3b2b69b0c5a0ab5, with no plugins (not even TShock).

Shortly after I started the server, I noticed that the mechanic's projectile was appearing at the wrong location. Then, some of my citizens mysteriously vanishing, specifically, the demolitionists, dryads and mechanics. At one point I even appeared to have two dryads, but that may have been due to the first dryad not having been removed from my client's memory yet.

Some investigation revealed that the citizens were being deleted because their AI crashed at the sight of a monster. The exception is as follows:

System.NullReferenceException: Object reference not set to an instance of an object.
    at Terraria.NPC.AI() line 9072
    at Terraria.NPC.UpdateNPC(int i) line 58752
    at Terraria.Main.Update() line 12579
    at Terraria.ProgramServer.InerStart(string[] args) line 194
    at Terraria.ProgramServer.Main(string[] args) line 207

The offending object seems to be set to either null or 8 just before the offending reference, neither of which can be cast to a float. This smells strongly of decompilation errors.

I also noticed that the citizens were not showing chat bubbles on the API server, but are on the vanilla server.

QuiCM commented 9 years ago

This is likely the reason for all NPC bugs (apart from backwards shooting?). Chat bubbles probably will not show as they were cut from the server with a lot of client code, however I can look into this further