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

Patcom patrol attack flanks #2901

Open
wants to merge 6 commits into
base: unstable
Choose a base branch
from

Conversation

MeltedPixel
Copy link

@MeltedPixel MeltedPixel commented Aug 7, 2023

What type of PR is this.

  1. Bug
  2. Change
  3. Enhancement

What have you changed and why?

Information:
Adds in flank attacks for Patrol Attack behavior.

Please specify which Issue this PR Resolves.

N/A

Please verify the following and ensure all checks are completed.

  1. Have you loaded the mission in LAN host?
  2. Have you loaded the mission on a dedicated server?

Is further testing or are further changes required?

  1. No
  2. Yes (Please provide further detail below.)

How can the changes be tested?

Steps:
Load into Mission.
Watch units move around.


Notes:

@MeltedPixel MeltedPixel added Change A change to existing functionality Enhancement New feature or request labels Aug 7, 2023
@MeltedPixel MeltedPixel added this to the 3.4 milestone Aug 7, 2023
Copy link

@jaj22 jaj22 left a comment

Choose a reason for hiding this comment

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

First-pass review.

_flankPosition = [(_position select 0) + (sin (random 360)) * (random 100 + 100), (_position select 1) + (cos (random 360)) * (random 100 + 100), 0];
} else {
// Selects random from _bestPositions, array contains x number of defined sources in selectBestPlaces
private _randomPosition = selectRandom _bestPositions;
Copy link

Choose a reason for hiding this comment

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

Shouldn't this be selectRandomWeighted? Otherwise you're throwing away a lot of info from selectBestPlaces.

Maybe that's intentional and you're doing something more like "select random place without bodies in it".


// If no position is found, we create a random one.
if (_bestPositions isEqualTo []) then {
_flankPosition = [(_position select 0) + (sin (random 360)) * (random 100 + 100), (_position select 1) + (cos (random 360)) * (random 100 + 100), 0];
Copy link

Choose a reason for hiding this comment

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

getPos [random 360, 100 + random 100] ?

// We check to see if the waypoint is still active after 3 minutes. If waypoint isn't complete the unit is likely stuck.
if (_group getVariable "PATCOM_WaypointTime" < serverTime) exitWith {
// Return home
[_group, _groupHomePosition, "MOVE", "PATCOM_PATROL_DEFEND", -1, _patrolParams # 1] call A3A_fnc_patrolCreateWaypoint;
Copy link

Choose a reason for hiding this comment

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

Aren't you better off giving a random waypoint to a stuck group? Otherwise they might stay stuck forever because they can't find a path to home. Maybe questionable if the home waypoint is guaranteed safe.

Copy link
Author

Choose a reason for hiding this comment

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

Home waypoint is their initial spawn point so should always be considered "safe".

@@ -65,7 +65,7 @@ if (_group getVariable "PATCOM_WaypointTime" < serverTime) exitWith {
};

// Check for current waypoints and make sure they are type MOVE for patrol
if (currentWaypoint _group == count waypoints _group || waypointType [_group, currentWaypoint _group] != "MOVE") then {
if ((waypointType [_group, currentWaypoint _group] != "MOVE") || ((waypointName [_group, currentWaypoint _group]) != "PATCOM_PATROL_AREA")) then {
Copy link

Choose a reason for hiding this comment

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

Is the first check required?

// Set Waypoint Name
private _waypointName = "PATROL_ATTACK_DIRECT";

if !((waypointName [_group, currentWaypoint _group]) in _attackWaypointNames) then {
Copy link

Choose a reason for hiding this comment

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

This seems to be a do-nothing case for all three attack types. Any reason not to move these checks after the static-arming and exitWith there?

private _finalWaypoint = _group addwaypoint [_enemyPosition, 0, 2, _waypointName];
_finalWaypoint setWaypointType "MOVE";
[_group, (_finalWaypoint select 1)] setWaypointCompletionRadius 50;
deleteWaypoint [_group, 3];
Copy link

Choose a reason for hiding this comment

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

What's the logic with the waypoint deletion here? Feels like you're creating a lot more waypoints than you're deleting, overall.

@MeltedPixel MeltedPixel added the Don't merge This needs to be touched before being merged label Aug 20, 2023
@Bob-Murphy Bob-Murphy modified the milestones: 3.4, Not organized yet Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Change A change to existing functionality Don't merge This needs to be touched before being merged Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants