Hercules icon indicating copy to clipboard operation
Hercules copied to clipboard

Stop units from moving when dead

Open csnv opened this issue 2 years ago • 4 comments

Pull Request Prelude

Changes Proposed

Stop units from moving and, consequently, notifying the client when the unit is already dead and the server is going to send a notification to vanish such unit. Fixes mobs walking around or standing when killed.

This issue has been already discussed here https://github.com/HerculesWS/Hercules/issues/2109 with some insights, however, I think this patch is fine as this "move request" should never be done after death. Nonetheless and, as precaution, this check could be made against BL_MOB only, which uses a timer and it's the main reason this visual bug appears.

Issues addressed: https://github.com/HerculesWS/Hercules/issues/2047 https://github.com/HerculesWS/Hercules/issues/2109

csnv avatar Oct 11 '22 20:10 csnv

I think this likely doesn't fix all cases. Imagine the timer has already been created and while the timer hasn't triggered yet, the mob is marked dead, then the walking command is still send when timer triggers.

skyleo avatar Oct 11 '22 20:10 skyleo

I think this likely doesn't fix all cases. Imagine the timer has already been created and while the timer hasn't triggered yet, the mob is marked dead, then the walking command is still send when timer triggers.

That's exactly the case I am able to reproduce consistently and the dead condition check is included in the function that is called from the timer. Unless there's another walking command I'm unaware of, this should fix it.

csnv avatar Oct 11 '22 20:10 csnv

I think this likely doesn't fix all cases. Imagine the timer has already been created and while the timer hasn't triggered yet, the mob is marked dead, then the walking command is still send when timer triggers.

That's exactly the case I am able to reproduce consistently and the dead condition check is included in the function that is called from the timer. Unless there's another walking command I'm unaware of, this should fix it.

Probably need add also dead check in start of unit_walk_toxy_timer. After unit_walk_toxy_sub complete with error status from function unit_walk_toxy_timer can be sent packets related to mob. I think this is wrong.

4144 avatar Oct 11 '22 23:10 4144

Done, I've not been able to reproduce any more bugs before this last check, but it makes sense that we don't let things move around when they're already dead. I'll leave the check in unit_walk_toxy_sub too as it's called in some other functions.

csnv avatar Oct 12 '22 01:10 csnv