vmangos / core

Progressive Vanilla Core aimed at all versions from 1.2 to 1.12
GNU General Public License v2.0
667 stars 480 forks source link

🐛 [Bug] The bot bodies remain on the ground after death. #1826

Open gajet5 opened 1 year ago

gajet5 commented 1 year ago

🐛 Bug report

If the bot dies and is not resurrected, and the player leaves the group. In this case, the bot's body will lie down until the server is restarted.

Expected behavior

The bot's body disappears when the player leaves the group.

Steps to reproduce

  1. Add bot in groupe
  2. .die - execute a command on the bot
  3. leave the group
  4. Profit

Version & Environment

Client Version: 1.12.1.5875

Commit Hash: No

OS Client: Win 11 OS Server: Ubuntu

Crashlog

Screen

https://prnt.sc/Od54raAgH0PM

mserajnik commented 5 months ago

I can replicate this issue.

I did some basic debugging and I can at least confirm that the requestRemoval flag gets set when the player leaves the party (or the bot is removed from the party) while the bot is dead and this code gets executed correctly: https://github.com/vmangos/core/blob/b5d1c07474e5eec7ae1993f7c01e2eb44b318b58/src/game/PlayerBots/PlayerBotMgr.cpp#L236-L253

So the issue can be narrowed down a bit, but needs further investigation why the corpse doesn't despawn. I initially thought that maybe some condition causes the above code not to run, but that is not the case.

mserajnik commented 4 months ago

Reviving the bot automatically before requesting removal works: https://github.com/mserajnik/vmangos-core/commit/dfc343d5a4222c086c95df1692c72b23434fb04a?diff=unified&w=1

https://github.com/vmangos/core/assets/80664890/1008fb74-7de9-4280-a513-6519a6669ea2

However, this feels quite hacky and there's probably a much better solution that doesn't involve reviving the bot.

gajet5 commented 4 months ago

It looks good. I'll check it on my server.

The best solution would be to switch to the status of "spirit", after that the bones will remain on the ground, and then make a request for removal.

gajet5 commented 4 months ago

https://github.com/gajet5/core/commit/13588fe22ddea8654b998ef7abb649be3f99620d

I see it like that. BUT! we need to check if there will be a lot of noise from the bones, maybe they should be refuse.