فهرست منبع

Further Free Cell Fixes (Looters, Step Timer) (#9124)

- When looters lose their target on their final cell moved, they now properly search for a free cell
- Fixed another issue where unit_stop_walking_soon did not set to_x and to_y correctly
- Players no longer lose their attack command (step timer) whey they are forced to attack from an occupied cell
- Fixes #9123
- Follow-up to 0ff59d8
Playtester 2 ماه پیش
والد
کامیت
e3ff40b32d
1فایلهای تغییر یافته به همراه17 افزوده شده و 9 حذف شده
  1. 17 9
      src/map/unit.cpp

+ 17 - 9
src/map/unit.cpp

@@ -715,10 +715,14 @@ static TIMER_FUNC(unit_walktoxy_timer)
 	} else if(ud->state.running) { // Keep trying to run.
 		if (!(unit_run(bl, nullptr, SC_RUN) || unit_run(bl, sd, SC_WUGDASH)) )
 			ud->state.running = 0;
-	} else if (!ud->stepaction && ud->target_to) {
-		// Update target trajectory.
-		unit_update_chase(*bl, tick, true);
-	} else { // Stopped walking. Update to_x and to_y to current location [Skotlex]
+	} else {
+		if (!ud->stepaction && ud->target_to > 0) {
+			// Update target trajectory.
+			if(unit_update_chase(*bl, tick, true))
+				return 0;
+		}
+
+		// Stopped walking. Update to_x and to_y to current location
 		ud->to_x = bl->x;
 		ud->to_y = bl->y;
 
@@ -726,13 +730,17 @@ static TIMER_FUNC(unit_walktoxy_timer)
 			&& !ud->state.ignore_cell_stack_limit
 			&& battle_config.official_cell_stack_limit > 0
 			&& map_count_oncell(bl->m, x, y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) {
+
 			//Walked on occupied cell, call unit_walktoxy again
-			if(ud->steptimer != INVALID_TIMER) {
+			if(unit_walktoxy(bl, x, y, 8)) {
 				//Execute step timer on next step instead
-				delete_timer(ud->steptimer, unit_step_timer);
-				ud->steptimer = INVALID_TIMER;
+				if (ud->steptimer != INVALID_TIMER) {
+					//Execute step timer on next step instead
+					delete_timer(ud->steptimer, unit_step_timer);
+					ud->steptimer = INVALID_TIMER;
+				}
+				return 1;
 			}
-			return unit_walktoxy(bl, x, y, 8);
 		}
 	}
 
@@ -1542,7 +1550,7 @@ void unit_stop_walking_soon(struct block_list& bl)
 		path_remain = 2;
 	}
 	// Shorten walkpath
-	if (ud->walkpath.path_pos + path_remain < ud->walkpath.path_len) {
+	if (ud->walkpath.path_pos + path_remain <= ud->walkpath.path_len) {
 		ud->walkpath.path_len = ud->walkpath.path_pos + path_remain;
 		ud->to_x = ox;
 		ud->to_y = oy;