-
Notifications
You must be signed in to change notification settings - Fork 737
(Ready) Adds more laser functionality to aircraft #7509
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
Changes from all commits
da7614a
0a62877
f3aefd6
131e868
8aebb02
544f961
c5e7576
8eb8423
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,45 @@ | ||||||
#include "script_component.hpp" | ||||||
/* | ||||||
* Author: LorenLuke | ||||||
* Toggles laser point tracking when a laser is on, for tracking coordinates; | ||||||
* | ||||||
* Arguments: | ||||||
* 0: Vehicle <OBJECT> | ||||||
* | ||||||
* Return Value: | ||||||
* Nothing | ||||||
* | ||||||
* Example: | ||||||
* [vehicle player] call ace_laser_fnc_laserPointTrack | ||||||
* | ||||||
* Public: No | ||||||
*/ | ||||||
|
||||||
|
||||||
params ["_vehicle"]; | ||||||
|
||||||
GVAR(TrackerpfID) = [{ | ||||||
params ["_args", "_pfID"]; | ||||||
_args params ["_vehicle"]; | ||||||
if (!(hasPilotCamera _vehicle)) exitWith { | ||||||
[_pfID] call CBA_fnc_removePerFrameHandler; | ||||||
}; | ||||||
if (isNull(laserTarget _vehicle)) exitWith { | ||||||
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.
Suggested change
|
||||||
[_pfID] call CBA_fnc_removePerFrameHandler; | ||||||
}; | ||||||
if (!((getPilotCameraTarget _vehicle) select 0)) exitWith { | ||||||
}; | ||||||
if (isNull((getPilotCameraTarget _vehicle) select 2)) then { | ||||||
private _distance = ((getPilotCameraTarget _vehicle) select 1) distance getPosASL (laserTarget _vehicle); | ||||||
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. in the line above you didn't put parenthesis around getPilotCameraTarget, why do it here? |
||||||
if (_distance > 0.15) then { | ||||||
private _vehPos = getPosASL _vehicle; | ||||||
private _vectorToLaser = _vehPos vectorFromTo (getPosASL (laserTarget _vehicle)); | ||||||
private _vectorToSpot = _vehPos vectorFromTo ((getPilotCameraTarget _vehicle) select 1); | ||||||
if (acos(_vectorToLaser vectorCos _vectorToSpot) < 0.025) then { | ||||||
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.
Suggested change
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. You have me deleting extra spaces all around, why would there need to be one between acos and the parentheses (considering that my formatting is like a single-argument method)? |
||||||
_vehicle setPilotCameraTarget getPosASL (laserTarget _vehicle); | ||||||
}; | ||||||
}; | ||||||
}; | ||||||
}, 0, [_vehicle]] call CBA_fnc_addPerFrameHandler; | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: LorenLuke | ||
* Toggles the laser spot tracker for any enabled vehicle; | ||
* | ||
* Arguments: | ||
* 0: Vehicle <OBJECT> | ||
* | ||
* Return Value: | ||
* Nothing | ||
* | ||
* Example: | ||
* [vehicle player] call ace_laser_fnc_toggleLST | ||
* | ||
* Public: No | ||
*/ | ||
|
||
|
||
params ["_vehicle"]; | ||
|
||
if !(_vehicle getVariable [QGVAR(hasLaserSpotTracker), false]) exitWith {}; | ||
|
||
private _enabled = _vehicle getVariable [QGVAR(laserSpotTrackerOn), false]; | ||
_vehicle setVariable [QGVAR(laserSpotTrackerOn), ! _enabled]; | ||
|
||
private _LSTmessage = if (_vehicle getVariable [QGVAR(laserSpotTrackerOn), false]) then {localize LSTRING(LSTOn)} else {localize LSTRING(LSTOff)}; | ||
private _string = format ["%1<br/>", _LSTmessage]; | ||
private _laserCode = _vehicle getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE]; | ||
_string = format ["%1%2: %3<br/>",_string, localize LSTRING(laserCode), _laserCode]; | ||
[_string] call EFUNC(common,displayTextStructured); | ||
|
||
GVAR(TrackerpfID) = [{ | ||
params ["_args", "_pfID"]; | ||
_args params ["_vehicle"]; | ||
|
||
if (!(_vehicle getVariable [QGVAR(laserSpotTrackerOn), false]) || (!alive _vehicle)) exitWith { | ||
[_pfID] call CBA_fnc_removePerFrameHandler; | ||
}; | ||
|
||
private _pos = _vehicle modelToWorldWorld [0,0,0]; | ||
private _pilotCameraPos = getPilotCameraPosition _vehicle; | ||
private _pilotCameraRotation = getPilotCameraRotation _vehicle; | ||
private _laserCode = _vehicle getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; | ||
private _angle = 30; | ||
|
||
if ((getPilotCameraTarget _vehicle) select 0) then { | ||
_angle = 0.75; | ||
}; | ||
|
||
private _pilotCameraLookPos = [ | ||
sin(-deg(_pilotCameraRotation select 0)) * cos(-deg(_pilotCameraRotation select 1)), | ||
cos(-deg(_pilotCameraRotation select 0)) * cos(-deg(_pilotCameraRotation select 1)), | ||
sin(-deg(_pilotCameraRotation select 1)) | ||
]; | ||
|
||
private _pilotCameraVector = _pos vectorFromTo (_vehicle modelToWorldWorld _pilotCameraLookPos); | ||
private _laserSource = _vehicle modelToWorldWorld _pilotCameraPos; | ||
private _laserResult = [_laserSource, _pilotCameraVector, _angle, 5000, [ACE_DEFAULT_LASER_WAVELENGTH,ACE_DEFAULT_LASER_WAVELENGTH], _laserCode, _vehicle, _vehicle] call FUNC(seekerFindLaserSpot); | ||
private _foundTargetPos = _laserResult select 0; | ||
|
||
if ((getPilotCameraTarget _vehicle) select 0) then { | ||
private _distance = ((getPilotCameraTarget _vehicle) select 1) distance _foundTargetPos; | ||
if (_distance > 0.75) then { | ||
_vehicle setPilotCameraTarget _foundTargetPos; | ||
}; | ||
} else { | ||
_vehicle setPilotCameraTarget _foundTargetPos; | ||
}; | ||
}, 0, [_vehicle]] call CBA_fnc_addPerFrameHandler; |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -63,5 +63,11 @@ | |||||||
<Chinesesimp>雷射 - 循环切换雷射码 下</Chinesesimp> | ||||||||
<Chinese>雷射 - 循環切換雷射碼 下</Chinese> | ||||||||
</Key> | ||||||||
<Key ID="STR_ACE_Laser_LSTOn"> | ||||||||
<English>Laser Spot Tracker: On</English> | ||||||||
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. I'm sure there is already a vanilla translation for On/Off that could be reused here, and get rid of the mostly duplicate entries here. 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. Where would I find it? 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. either unpack and search the vanilla stringtables dta/languagecore.pbo or Meh... Can't find a "On" though 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. ACE3/addons/map/stringtable.xml Line 388 in 7cc168e
Here are On and Off, but I see the german translation for example wouldn't fit here as it doesn't mean "enabled/on" but more like "one" the number. 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. ACE3/addons/viewdistance/stringtable.xml Line 255 in d8f18c6
Same... ACE3/addons/microdagr/stringtable.xml Line 118 in 35e4c2a
same... did we just copy the same On/Off translations into multiple components? 🤔 |
||||||||
</Key> | ||||||||
<Key ID="STR_ACE_Laser_LSTOff"> | ||||||||
<English>Laser Spot Tracker: Off</English> | ||||||||
</Key> | ||||||||
</Package> | ||||||||
</Project> |
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.
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.
ehhhhhh... While that works within the scope of how things are currently, I want to keep the lines separate because of how the laser point system works for weird edge cases like the blackfish, which don't return a laserTarget.