Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Scoppio
Copy link
Collaborator

@Scoppio Scoppio commented Feb 21, 2025

What it does?

Adds functionality for bot to follow waypoints, you may add one waypoint, multiple waypoints forming a path, etc.

Screenshot 2025-02-21 at 00 50 06

This PR adds this functionality, adds it to the bot chat commands and to the left map menu in the left click (of course, GM can command all bots). The command is specific for individual units, but there is one action that clear all waypoints.

Screenshot 2025-02-21 at 00 56 53 Screenshot 2025-02-21 at 00 58 51

Code QL complaining

I am willfully ignoring all the CodeQL errors on the ChatProcessor because as soon as this PR is merged I will start a PR that refactors the chat processor

@Scoppio Scoppio self-assigned this Feb 21, 2025
@Scoppio Scoppio added the Princess/AI Issues or PR that relate to the current Bot AI label Feb 21, 2025
@codecov
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.04%. Comparing base (a0fc096) to head (1cc15a2).
Report is 45 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6589      +/-   ##
============================================
- Coverage     29.05%   29.04%   -0.02%     
- Complexity    15171    15180       +9     
============================================
  Files          2837     2837              
  Lines        279215   279411     +196     
  Branches      49150    49188      +38     
============================================
+ Hits          81129    81145      +16     
- Misses       192749   192886     +137     
- Partials       5337     5380      +43     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


List<Coords> waypoints = new ArrayList<>();

for (int i = 1; i < arguments.length; i++) {

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am willingly ignoring all the CodeQL errors on the ChatProcessor because as soon as this PR is merged I will start a PR that refactors the chat processor

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case we'd probably say "willfully", as in with full knowledge of the consequences and due to one's own decisions (with the implied connotation of "pridefully", "arrogantly"), as opposed to "willingly" 😄

Copy link
Collaborator Author

@Scoppio Scoppio Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As weird as it may be, the phrase I wrote makes sense in my mother tongue LOL

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my assumption ^_^


var splitPosition = hex.length() / 2;

int x = Integer.parseInt(hex.substring(0, splitPosition)) - 1;

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
var splitPosition = hex.length() / 2;

int x = Integer.parseInt(hex.substring(0, splitPosition)) - 1;
int y = Integer.parseInt(hex.substring(splitPosition)) - 1;

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
princess.getEntitiesOwned().stream().filter(entity -> entity.getId() == unitID).findFirst().ifPresent(entity -> {
var waypoint = princess.getUnitBehaviorTracker().removeHeadWaypoint(entity);
if (waypoint.isPresent()) {
var message = "Waypoint " + waypoint.get() + " removed from unit " + unitID;

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
Copy link
Collaborator

@Sleet01 Sleet01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Sleet01 Sleet01 merged commit 74425f3 into MegaMek:master Feb 22, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Princess/AI Issues or PR that relate to the current Bot AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants