Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added config option to keep direction for free cells #3242

Merged
merged 2 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions conf/map/battle/misc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ duel_only_on_same_map: false
official_cell_stack_limit: 1
custom_cell_stack_limit: 1

// Take into consideration the character's walking direction when searching for free cells?
// Set this to "true" to start searching for free cells in the same direction as the character came from
// Set this to "false" to always start searching from EAST (official behavior)
// Note: This setting also makes groups of mobs disperse in circular fashion instead of linear
keep_dir_free_cell: false

// Check occupied cells while walking? (Note 1)
check_occupied_cells: true

Expand Down
1 change: 1 addition & 0 deletions src/map/battle.c
Original file line number Diff line number Diff line change
Expand Up @@ -7573,6 +7573,7 @@ static const struct config_data_old battle_data[] = {
{ "official_cell_stack_limit", &battle_config.official_cell_stack_limit, 1, 0, 255, },
{ "custom_cell_stack_limit", &battle_config.custom_cell_stack_limit, 1, 1, 255, },
{ "dancing_weaponswitch_fix", &battle_config.dancing_weaponswitch_fix, 1, 0, 1, },
{ "keep_dir_free_cell", &battle_config.keep_dir_free_cell, 0, 0, 1, },
{ "check_occupied_cells", &battle_config.check_occupied_cells, 1, 0, 1, },

// eAthena additions
Expand Down
1 change: 1 addition & 0 deletions src/map/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ struct Battle_Config {
int bone_drop;
int buyer_name;
int dancing_weaponswitch_fix;
int keep_dir_free_cell;

// eAthena additions
int night_at_start; // added by [Yor]
Expand Down
9 changes: 7 additions & 2 deletions src/map/clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -11831,9 +11831,14 @@ static void clif_parse_WalkToXY(int fd, struct map_session_data *sd)
if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH])
return;

pc->delinvincibletimer(sd);
RFIFOPOS(fd, packet_db[RFIFOW(fd, 0)].pos[0], &x, &y, NULL);
csnv marked this conversation as resolved.
Show resolved Hide resolved

// Do not allow one cell move commands if the target cell is not free
if (battle_config.official_cell_stack_limit > 0
&& check_distance_blxy(&sd->bl, x, y, 1) && map->count_oncell(sd->bl.m, x, y, BL_CHAR | BL_NPC, 1))
return;

RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, NULL);
pc->delinvincibletimer(sd);

//Set last idle time... [Skotlex]
pc->update_idle_time(sd, BCIDLE_WALK);
Expand Down
2 changes: 1 addition & 1 deletion src/map/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ static int map_search_free_cell(struct block_list *src, int16 m, int16 *x, int16
*------------------------------------------*/
static bool map_closest_freecell(int16 m, const struct block_list *bl, int16 *x, int16 *y, int type, int flag)
{
enum unit_dir dir = UNIT_DIR_EAST;
enum unit_dir dir = battle_config.keep_dir_free_cell ? unit->getdir(bl) : UNIT_DIR_EAST;
int16 tx;
int16 ty;
int costrange = 10;
Expand Down
Loading