-
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
ProjectileTracking - Stop tracking stationary objects #985
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,10 @@ params ["_args", "_handle"]; | |
_args params ["_projectile", "_index", "_initialProjectileData"]; | ||
|
||
if (!isNull _projectile) then { | ||
private _speed = vectorMagnitude velocity _projectile; | ||
if (_speed < 0.1) then { // If projectile is slowed down, stop tracking after this run | ||
[_handle] call CBA_fnc_removePerFrameHandler; | ||
}; | ||
|
||
private _data = []; | ||
private _bulletData = []; | ||
|
@@ -39,13 +43,9 @@ if (!isNull _projectile) then { | |
} else { | ||
_bulletData = [_initialProjectileData]; | ||
_data = [_handle, _bulletData]; | ||
GVAR(projectileData) set [_index, _data]; | ||
}; | ||
|
||
_bulletData pushBack [(getPos _projectile), vectorMagnitude (velocity _projectile)]; | ||
|
||
_data set [1, _bulletData]; | ||
|
||
GVAR(projectileData) set [_index, _data]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here? outside of the if block? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are not needed, because only commands that modify the array are used. Previously the function set a sub array, and a sub sub array to exactly what they were before. |
||
_bulletData pushBack [(getPos _projectile), _speed]; | ||
|
||
} else { | ||
[_handle] call CBA_fnc_removePerFrameHandler; | ||
|
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.
did you delete this line intentional?
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.
either way
_bulletData
is going to already be set in_data