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

CBA_fnc_currentUnit report UAV entity when controlling UAV #1005

Merged
merged 6 commits into from
Nov 9, 2018

Conversation

commy2
Copy link
Contributor

@commy2 commy2 commented Oct 11, 2018

When merged this pull request will:

This is more complex than the original, and this is a function called every frame in ACE.

Thoughts?

@PabstMirror
Copy link
Contributor

This will have massive effects in ace because ace_player will be the uav robot
typeOf ace_player = "B_UAV_AI"
interaction menu, stamina, hearing... will all have problems with this
(e.g. can self interact and check the robot's pulse)

@PabstMirror
Copy link
Contributor

PabstMirror commented Oct 12, 2018

Maybe use ace's uav eh https://github.com/acemod/ACE3/blob/master/addons/common/XEH_postInit.sqf#L285-L327

and then we could set cba_controledUnit on either player change or uav change events
there would be no polling overhead
and addPlayeEH would check _data = currentVisionMode cba_controledUnit;

@commy2
Copy link
Contributor Author

commy2 commented Oct 12, 2018

Hmm, one alternative would be to only use the UAV entity to read the visionMode, and keep currentUnit the way it is. Then one could additionally add an event whenever the controlledUnit changes.

@commy2
Copy link
Contributor Author

commy2 commented Oct 12, 2018

I'm a bit hesitant to use PlayerViewChanged, because that worked out so bad the last time.

@dedmen
Copy link
Contributor

dedmen commented Oct 12, 2018

Is there any practical reason why we need this?
Ignoring that it breaks like... Most mods that use this?
TFAR/ACRE your radio will suddenly not work when you are controlling a UAV because the UAV doesn't have a Radio and your hearing/voice will suddenly be inside the UAV.
Don't know what ACE would do but I guess even worse.

Opposed to Zeus Remote Control. You aren't actually really inside the drone when you're controlling it. You are controlling it via a little tablet in your hand.

@commy2
Copy link
Contributor Author

commy2 commented Oct 12, 2018

True. The only reason one would the need the UAV entity is to read the night vision mode from. I'll change the PR to do that instead.

@commy2 commy2 added the WIP label Oct 12, 2018
@commy2 commy2 removed the WIP label Oct 12, 2018
@commy2
Copy link
Contributor Author

commy2 commented Oct 12, 2018

What about this?


GVAR(playerEHInfo) pushBack addMissionEventHandler ["EachFrame", {call FUNC(playerEH_EachFrame)}];
[QFUNC(playerEH_EachFrame), {
private _player = call CBA_fnc_currentUnit;
private _player = missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", player];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change still necessary? I mean.. I like the performance gain..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did it just to compensate for the loss due to this.

@commy2
Copy link
Contributor Author

commy2 commented Oct 16, 2018

Is it good?

if !(_data isEqualTo GVAR(oldUAVControl)) then {
GVAR(oldUAVControl) = _data;

private _role = _data param [(_data find _player) + 1, ""];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the wiki page wrong?
https://community.bistudio.com/wiki/UAVControl
_data should be 2 element array. find _player should always return 0.

Copy link
Contributor Author

@commy2 commy2 Oct 17, 2018

Choose a reason for hiding this comment

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

Is the wiki page wrong?

Always.

Drone with turret + driver/pilot looks like this:
[object1, "DRIVER", object2, "GUNNER"]
In MP, it can be controlled by multiple people. Therefore #0 is not necessarily the local player.

@PabstMirror
Copy link
Contributor

We could optimize for common case, which would be no UAV connected

_data = UAVControl getConnectedUAV player; 
if !(_data isEqualTo oldUAVControl) then {
0.0022 ms

if (!isNull getConnectedUAV player) then { // full code runs every time connected to UAV
0.0017 ms

https://github.com/CBATeam/CBA_A3/compare/currentUnit-UAV...uavPossibleOpti?expand=1
Not sure if worth it

@commy2
Copy link
Contributor Author

commy2 commented Nov 9, 2018

Don't think that's worth it.

Merge?

@commy2 commy2 removed the Help Wanted label Nov 9, 2018
@commy2 commy2 added this to the 3.9.1 milestone Nov 9, 2018
@commy2 commy2 merged commit 6a2ae6d into master Nov 9, 2018
@commy2 commy2 deleted the currentUnit-UAV branch November 9, 2018 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visionmode EH issue with drone, selecting night vision.
4 participants