Skip to content

Commit

Permalink
Merge pull request #4242 from MagistrumT-T/dig-now-unusable-ramp-fix
Browse files Browse the repository at this point in the history
Make `dig-now` remove ramps for all dig modes.
  • Loading branch information
myk002 authored Feb 2, 2024
2 parents fd20fdc + 5d0fe6f commit 92087ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Template for new versions:
## New Features

## Fixes
- `dig-now`: now properly changes newly exposed areas to light/outside when digging around the surface.
- `dig-now`: now properly removes ramps rendered unusable by digging and changes newly exposed areas to light/outside when digging around the surface.
## Misc Improvements

## Documentation
Expand Down
12 changes: 11 additions & 1 deletion plugins/dig-now.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,11 @@ static void clean_ramp(MapExtras::MapCache &map, const DFCoord &pos) {
if (is_wall(map, DFCoord(pos.x-1, pos.y, pos.z)) ||
is_wall(map, DFCoord(pos.x+1, pos.y, pos.z)) ||
is_wall(map, DFCoord(pos.x, pos.y-1, pos.z)) ||
is_wall(map, DFCoord(pos.x, pos.y+1, pos.z)))
is_wall(map, DFCoord(pos.x, pos.y+1, pos.z)) ||
is_wall(map, DFCoord(pos.x-1, pos.y-1, pos.z)) ||
is_wall(map, DFCoord(pos.x-1, pos.y+1, pos.z)) ||
is_wall(map, DFCoord(pos.x+1, pos.y-1, pos.z)) ||
is_wall(map, DFCoord(pos.x+1, pos.y+1, pos.z)))
return;

remove_ramp_top(map, DFCoord(pos.x, pos.y, pos.z+1));
Expand All @@ -359,6 +363,10 @@ static void clean_ramps(MapExtras::MapCache &map, const DFCoord &pos) {
clean_ramp(map, DFCoord(pos.x+1, pos.y, pos.z));
clean_ramp(map, DFCoord(pos.x, pos.y-1, pos.z));
clean_ramp(map, DFCoord(pos.x, pos.y+1, pos.z));
clean_ramp(map, DFCoord(pos.x-1, pos.y-1, pos.z));
clean_ramp(map, DFCoord(pos.x-1, pos.y+1, pos.z));
clean_ramp(map, DFCoord(pos.x+1, pos.y-1, pos.z));
clean_ramp(map, DFCoord(pos.x+1, pos.y+1, pos.z));
}

// destroys any colonies located at pos
Expand Down Expand Up @@ -489,6 +497,7 @@ static bool dig_tile(color_ostream &out, MapExtras::MapCache &map,
if (td_below == df::tile_dig_designation::Default) {
dig_tile(out, map, pos_below, td_below, dug_tiles);
}
clean_ramps(map, pos);
propagate_vertical_flags(map, pos);
return true;
}
Expand Down Expand Up @@ -552,6 +561,7 @@ static bool dig_tile(color_ostream &out, MapExtras::MapCache &map,
TRACE(general).print("dig_tile: digging the designation tile at (" COORD ")\n",COORDARGS(pos));
dig_type(map, pos, target_type);

clean_ramps(map, pos);
return true;
}

Expand Down

0 comments on commit 92087ab

Please sign in to comment.