Fixed looters getting stuck (#6958)

- Fixes #6939
- Looters will now use complex pathing to find a way to an item they can see
- Monsters no longer stop when using NPC_EMOTION or NPC_EMOTION_ON
- Added a security check to prevent endless loops when easy pathing is used (no longer used by default)

Special thanks to @secretdataz.
This commit is contained in:
Playtester
2022-05-18 23:25:37 +02:00
committed by GitHub
parent 20d9fa6cc7
commit f5e75d28ec
2 changed files with 14 additions and 25 deletions

View File

@@ -531,6 +531,7 @@ static TIMER_FUNC(unit_walktoxy_timer)
map[bl->m].users > 0 &&
mobskill_use(md, tick, -1)) {
if (!(ud->skill_id == NPC_SELFDESTRUCTION && ud->skilltimer != INVALID_TIMER)
&& ud->skill_id != NPC_EMOTION && ud->skill_id != NPC_EMOTION_ON //NPC_EMOTION doesn't make the monster stop
&& md->state.skillstate != MSS_WALK) //Walk skills are supposed to be used while walking
{ // Skill used, abort walking
clif_fixpos(bl); // Fix position as walk has been cancelled.
@@ -855,6 +856,9 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, unsi
//Should walk on the same cell as target (for looters)
ud->to_x = tbl->x;
ud->to_y = tbl->y;
//Because of the change of target position the easy walkpath could fail
//Note: Easy walking is no longer used by default, but we keep this to prevent endless loops [Playtester]
flag &= ~1;
}
ud->state.walk_easy = flag&1;