server-beta
server-beta copied to clipboard
Fix NPC component cleanup
This PR solves #1160.
Problem
NPCs were not removed from the player pool during NPCComponent::free, causing a crash.
During shutdown, the NPC network is destroyed while NPCs remain in the player pool. Later, when textdraws are destroyed in OnGameModeExit, a "hide textdraw" packet is sent to each player—including NPCs. This causes a crash when the packet is tried to be sent through the already-destroyed NPC network.
Solution
Release all NPCs before destroying the component, ensuring they're removed from the player pool