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

Use 2D distance to check whether team members have arrived destination #1487

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ This page lists all the individual contributions to the project by their author.
- Fix `LimboKill` not working reliably
- Allow using waypoints, area guard and attack move with aircraft
- Fix `Stop` command not working so well in some cases
- Use 2D distance instead of 3D to check whether in air team members have arrived destination
- **Ollerus**
- Build limit group enhancement
- Customizable rocker amplitude
Expand Down
2 changes: 1 addition & 1 deletion YRpp
Submodule YRpp updated 3 files
+1 −1 FootClass.h
+3 −0 ObjectClass.h
+3 −0 TechnoClass.h
1 change: 1 addition & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Aircraft no longer find airport twice and overlap.
- Aircraft no longer briefly pause in the air before returning.
- Aircraft with `AirportBound=no` continue moving forward.
- Now in air team members will use the 2D distance instead of the 3D distance to judge whether have reached the mission destination, so as to prevent the problem that the mission is stuck and cannot continue in some cases (such as when the jumpjet stops on the building).
- Unit `Speed` setting now accepts floating-point values. Internally parsed values are clamped down to maximum of 100, multiplied by 256 and divided by 100, the result (which at this point is converted to an integer) then clamped down to maximum of 255 giving effective internal speed value range of 0 to 255, e.g leptons traveled per game frame.
- Subterranean movement now benefits from speed multipliers from all sources such as veterancy, AttachEffect etc.

Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ Vanilla fixes:
- Follower vehicle index for preplaced vehicles in maps is now explicitly constrained to `[Units]` list in map files and is no longer thrown off by vehicles that could not be created or created vehicles having other vehicles as initial passengers (by Starkku)
- Drive/Jumpjet/Ship/Teleport locomotor did not power on when it is un-piggybacked bugfix (by tyuah8)
- Fix `Stop` command not working so well in some cases (by CrimRecya)
- Use 2D distance instead of 3D to check whether in air team members have arrived destination (by CrimRecya)
- Subterranean movement now benefits from speed multipliers from all sources such as veterancy, AttachEffect etc. (by Starkku)

Phobos fixes:
Expand Down
12 changes: 12 additions & 0 deletions src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,18 @@ DEFINE_HOOK(0x4C75DA, EventClass_RespondToEvent_Stop, 0x6)

#pragma endregion

#pragma region TeamCloseRangeFix

int __fastcall Check2DDistanceInsteadOf3D(ObjectClass* pSource, void* _, AbstractClass* pTarget)
{
return (pSource->IsInAir() && pSource->WhatAmI() != AbstractType::Aircraft) // Jumpjets or sth in the air
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason you omit AircraftClass? Also does all the in air stuff need to be considered like so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At present, it seems that aircrafts use their own mapcoords and the team destination's mapcoords to check.
During the previous test, it was found that if the aircraft uses this and needs to return to the airport with the script first, it will interrupt the remaining tasks for unknown reasons.

? (pSource->DistanceFrom(pTarget) * 2) // 2D distance (2x is the bonus to units in the air)
: pSource->DistanceFrom3D(pTarget); // 3D distance (vanilla)
}
DEFINE_JUMP(CALL, 0x6EBCC9, GET_OFFSET(Check2DDistanceInsteadOf3D));

#pragma endregion

// This shouldn't be here
// Author: tyuah8
DEFINE_HOOK_AGAIN(0x4AF94D, EndPiggyback_PowerOn, 0x7) // Drive
Expand Down
Loading