-
Notifications
You must be signed in to change notification settings - Fork 149
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
Update fnc_headDir #390
Update fnc_headDir #390
Conversation
Updated the function with new commands Cleaned old code
_azimuth = (_vector select 0) atan2 (_vector select 1); | ||
_azimuth = [_azimuth] call CBA_fnc_simplifyAngle; | ||
}; | ||
|
||
_dif = _angle - _azimuth; | ||
private _diff = -_azimuth; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks much cleaner, but what happened to _angle
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the relative angle code to lines 76-78:
https://github.com/654wak654/CBA_A3/blob/patch-1/addons/common/fnc_headDir.sqf#L76-L78
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roger
Add type checking for first param Use fnc_currentUnit instead of player Fix ASL positions Bring back ability to calculate offset from anything
|
||
if (!isNull _offsetObject) then { | ||
ADD(_diff,_unit getDir ([_offsetObject] call CBA_fnc_getPos)); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this error if _offsetobject
is a marker (STRING)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could work:
["_offsetObject", ""]
later on:
if !(_offsetObject isEqualTo "") then {
Update: It does work.
@@ -75,8 +75,8 @@ if (_unit != call CBA_fnc_currentUnit) then { | |||
|
|||
private _diff = -_azimuth; | |||
|
|||
if (!isNull _offsetObject) then { | |||
ADD(_diff,_unit getDir ([_offsetObject] call CBA_fnc_getPos)); | |||
if !(_offset isEqualTo "") then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but now it no longer works for markers at all, or am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you supply any other string than an empty string, it will return true:
!("base_marker" isEqualTo "")
will return true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. I read it as isEqualType
When merged this PR will: