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

External radios #214

Merged
merged 39 commits into from
Mar 27, 2017
Merged

External radios #214

merged 39 commits into from
Mar 27, 2017

Conversation

TheMagnetar
Copy link
Member

@TheMagnetar TheMagnetar commented Feb 15, 2017

When merged this pull request will:

  • Implement actions to use external radios.
  • Similar approach to vehicleracks (hence snippers as an author as well)

This is a first implementation of external radios. It works in the following way (I am looking at you oh mighty bug) and it requires ace_interaction in order to work.

For infantry units:

  • As a unit you have to share a radio (self interaction) in order for other units to have access to it. If the unit is captive or dead, all radios are automatically available.
  • An external unit can then "take the headset" (external interaction) and start using the radio (end user). The owner of the radio looses all possibility to transmit through the radio or access it through self interaction until it is given back. Since it still resides in inventory, it is still possible to open it (see limitations).
  • As an end user you can transmit, open, change the channel, volume, etc. as long as you are within 2m of the owner or you are on the same vehicle. Radio is labelled as "AN/PRC 152 ("name_of_the_owner") in self interaction.
  • The end user can give the radio back (external interaction) "return headset" or give it to another player "give headset"
  • No other player can take control of external radios while they are being used.
  • As a unit, you can always give the headset to any other unit.
  • All radios allow giving/taking the headset.

For vehicles:

  • No longer applies (functionality in vehicle racks).

Limitations:

  • At the moment all radios have this functionality. Maybe we could limit it to 148, 152 and 117F.
  • The owner of the radio cannot hear the transmission despite having the radio in the inventory. Ideally it would be good to be able to transmit/receive as well, but not at the same time: radios have headsets and/or external microphones/speakers that can be attached. The transmitting label should be displayed for the owner if the end user is transmitting as well and viceversa.
  • This implementation requires ACE3 to work (ace interaction). It is often the case that ACRE is run together with ACE but...
  • Radios directly on the ground cannot be accessed. Any ideas on how could this be implemented?

@jonpas jonpas added this to the 2.5.0 milestone Feb 15, 2017
@Sniperhid Sniperhid self-requested a review February 15, 2017 21:10
@jonpas
Copy link
Member

jonpas commented Feb 15, 2017

At the moment all radios have this functionality. Maybe we could limit it to 148, 152 and 117F.

Yeah, we should limit them based on what connectors they have available I guess. 343 has no external headset after all (I think).

This implementation requires ACE3 to work (ace interaction). It is often the case that ACRE is run together with ACE but...

That's completely fine. One thing that should be done is simply checking isClass (configFile >> "CfgPatches" >> "ace_interact_menu", if not then the system simply won't work as you can't interact with it. It's how vehicle racks are (or will) be done as well. Actually by just not having interactions (which are config-based anyways) it should not error without ACE3 either, so that's all fine. (This is ACrE after all 😆 )

@Charlie-Bayne
Copy link

Ref. 343 - There are two variants. One has an I/O port for the user headset, whilst the commander variant has a cable that comes out of the bottom and goes into the manpack, like a passthrough so that they only have to wear one headset, and push the prestle on the relevant radio to transmit.

For our purposes though, I am sure removing the pass headset from the 343 would be sensible...

Copy link
Member

@Sniperhid Sniperhid left a comment

Choose a reason for hiding this comment

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

As-side from the initial code comments:

  • I would like to see this not work for radios inside vehicle inventories - It saves a few complications not handling this case (initializing radios/accounting for vehicle racks later).
  • 'Retrieve Radio' - I think should become 'Unshare Radio' particularly as it seems more precise (specially if a person isn't using the radio - maybe it should be retrieve if someone else is using the radio).
  • This NEEDS multiplayer testing as there's potential for several kinks throughout.

};

private _idx = _pttAssign find _radio;
_txt = localize LSTRING(bindMultiPushToTalk);;
Copy link
Member

Choose a reason for hiding this comment

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

double ;;

if (!(_radio in ACRE_ACTIVE_EXTERNAL_RADIOS)) then {
_action = ["acre_share_radio", localize LSTRING(shareRadio), "", {[(_this select 2) select 0, true] call EFUNC(sys_external,allowExternalUse)}, {!([(_this select 2) select 0] call EFUNC(sys_external,isRadioShared))}, {}, _params] call ace_interact_menu_fnc_createAction;
_actions pushBack [_action, [], _target];
_action = ["acre_retrieve_radio", localize LSTRING(retrieveRadio), "", {[(_this select 2) select 0, false] call EFUNC(sys_external,allowExternalUse)}, {[(_this select 2) select 0] call EFUNC(sys_external,isRadioShared)}, {}, _params] call ace_interact_menu_fnc_createAction;
Copy link
Member

Choose a reason for hiding this comment

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

I think changing the terminology from retrieve radio to unshare radio would be more accurcate


private _isShared = [_radioId] call FUNC(isRadioShared);

private ["_isUsedExternally", "_owner", "_user"];
Copy link
Member

Choose a reason for hiding this comment

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

This should be mixed into the below lines
i.e. private _isUsedExternally = false;

_user = nil;

if (_isShared) then {
private _isUsedExternally = [_radioId] call FUNC(isExternalRadioUsed);
Copy link
Member

Choose a reason for hiding this comment

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

using private here creates a new local variable in this private scope.

if (_isShared) then {
private _isUsedExternally = [_radioId] call FUNC(isExternalRadioUsed);
if (_isUsedExternally) then {
private _owner = [_radioId] call FUNC(getExternalRadioOwner);
Copy link
Member

Choose a reason for hiding this comment

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

using private here creates a new local variable in this private scope.

private _isUsedExternally = [_radioId] call FUNC(isExternalRadioUsed);
if (_isUsedExternally) then {
private _owner = [_radioId] call FUNC(getExternalRadioOwner);
private _user = [_radioId] call FUNC(getExternalRadioUser);
Copy link
Member

Choose a reason for hiding this comment

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

using private here creates a new local variable in this private scope.

// Add the radio to the player
ACRE_ACTIVE_EXTERNAL_RADIOS pushBackUnique _radioId;

player sideChat format ["Start using %1", _radioId];
Copy link
Member

Choose a reason for hiding this comment

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

I think systemChat should be used over player sideChat.


ACRE_ACTIVE_EXTERNAL_RADIOS = ACRE_ACTIVE_EXTERNAL_RADIOS - [_radioId];
[1] call EFUNC(sys_list,cycleRadios); // Change active radio
player sideChat format ["Stop using %1", _radioId];
Copy link
Member

Choose a reason for hiding this comment

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

I think systemChat should be used over player sideChat.

@TheMagnetar
Copy link
Member Author

PR changes as requested by @Sniperhid

  • Radios inside vehicle inventories cannot be accessed.
  • Use of systemchat (debug only)
  • "Retrieve radio" -> "Unshare radio"

@jonpas
Copy link
Member

jonpas commented Feb 23, 2017

At the moment all radios have this functionality. Maybe we could limit it to 148, 152 and 117F.

Add a config value for it. acre_canShare maybe.

statement = "true";
insertChildren = QUOTE(_this call FUNC(listChildrenActions));
priority = 0.1;
icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\call_ca.paa";
Copy link
Member

@jonpas jonpas Feb 25, 2017

Choose a reason for hiding this comment

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

Can use ICON_RADIO_CALL macro now, since #239.

Copy link
Member Author

@TheMagnetar TheMagnetar Feb 25, 2017

Choose a reason for hiding this comment

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

yes. I will update this accordingly. And also I will substitute systemchat by hints.
On a side note, the changes here are also ported to the implementation of external radios using hashes instead of storing information on radioData. We can decide later which implementation is better.

@@ -24,4 +24,4 @@ params ["_radioID", "_owner", "_endUser"];
// Add the radio to the player
ACRE_ACTIVE_EXTERNAL_RADIOS pushBackUnique _radioId;

systemChat format ["Start using %1", _radioId];
[format ["Start using %1", _radioId];] call EFUNC(sys_core,displayNotification);
Copy link
Member

Choose a reason for hiding this comment

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

No semi-colon in there.

*
* Arguments:
* 0: Infantry unit <OBJECT>
*
* Return Value:
* False
* <BOOL>
Copy link
Member

Choose a reason for hiding this comment

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

Bool what?

if (acre_player == [_radio] call FUNC(getExternalRadioOwner)) then {
_playerOwnsRadio = true;
};
private _playerOwnsRadio = (acre_player == [_radio] call FUNC(getExternalRadioOwner));
Copy link
Member

Choose a reason for hiding this comment

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

No outer parenthesis, it's just a simple boolean.

Copy link
Member Author

Choose a reason for hiding this comment

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

jonpas 3 days ago:
L24-L27 as: private _playerOwnsRadio = (acre_player == [_radio] call FUNC(getExternalRadioOwner));

That's why ;)

Copy link
Member

Choose a reason for hiding this comment

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

But you know better, I am just a scrub making you change things. 😆

Copy link
Member

@jonpas jonpas left a comment

Choose a reason for hiding this comment

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

Note: doc page needs to be added to sidebar.

@@ -0,0 +1,9 @@
---
title: External radios
Copy link
Member

Choose a reason for hiding this comment

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

External Radios

@@ -22,6 +22,15 @@ if (alive acre_player) then {
private _weapons = [acre_player] call EFUNC(sys_core,getGear);
_radioList = _weapons select {_x call EFUNC(sys_radio,isUniqueRadio)};

// Remove those radios that are being actively used by other players.
Copy link
Member

Choose a reason for hiding this comment

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

No final dot.

class CAManBase: Man {
class ACE_Actions {
class ACE_MainActions {
class ACRE_Interact {
Copy link
Member

Choose a reason for hiding this comment

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

Should be ACRE_Interact_External or something unique to the action - future proof.

};
};

PRELOAD_ADDONS;
Copy link
Member

Choose a reason for hiding this comment

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

Necessary?

@@ -0,0 +1,21 @@
/*
* Author: ACRE2Team
* Mark a radio in order to enable/disable to be used by other units (external use)
Copy link
Member

Choose a reason for hiding this comment

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

Missing final dot.

@@ -0,0 +1,26 @@
/*
* Author: ACRE2Team
* Check if a given action is available for a specific radio and unit
Copy link
Member

Choose a reason for hiding this comment

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

Missing final dot.

@@ -0,0 +1,24 @@
/*
* Author: ACRE2Team
* Check if a given action is available for a specific radio external radio
Copy link
Member

Choose a reason for hiding this comment

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

Missing final dot.


if (vehicle acre_player != acre_player) exitWith {false};

true
Copy link
Member

Choose a reason for hiding this comment

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

Entire thing as one direct return if.

@@ -0,0 +1,32 @@
/*
* Author: ACRE2Team
* Start using an external radio
Copy link
Member

Choose a reason for hiding this comment

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

Missing final dot.

/*
* Author: ACRE2Team
* Stop using an external radio, either returning it to the owner or giving it to another player. If target
* is skipped, a default action to return to the owner is taken
Copy link
Member

Choose a reason for hiding this comment

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

Missing final dot.

*
* Arguments:
* 0: Unique radio identity <STRING>
* 1: New end user/original owner <OBJECT>(Optional)
Copy link
Member

Choose a reason for hiding this comment

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

... <OBJECT> (default: objNull)
It's not actually optional per params though.

private _externalRadiosInUse = _radioList select {_x call EFUNC(sys_external,isExternalRadioUsed)};
_radioList = _radioList - _externalRadiosInUse;
// Remove those radios that are being actively used by other players
_radioList = _radioList select {!(_x call EFUNC(sys_external,isExternalRadioUsed))};
Copy link
Member

Choose a reason for hiding this comment

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

This could be merged with L23 and form:

_radioList = _weapons select {_x call EFUNC(sys_radio,isUniqueRadio) && {!(_x call EFUNC(sys_external,isExternalRadioUsed))}};

for faster iteration (from 2n to n).

@jonpas jonpas merged commit 44958c8 into IDI-Systems:master Mar 27, 2017
jonpas pushed a commit that referenced this pull request Apr 1, 2017
* Use code block for mods list in issue template

* Hide radio self-interaction node if no radio in inventory

* Introduce Variable to deactivated distance-based muting (#228)

* Order radio ear left/right correctly

* Cleanup and macros (#230)

* Delete unused traces

* QEFUNC Macro

* Moved all opening braces on same line

* Removed spaced after classes

* Spaces and Indentation

* More spaces

* Fix direct speech page vehicle attenuation link

* Add Custom Signal Processing wiki page to sidebar, Cleanup sidebar config

* Use ACE3 notification if available instead of hint (#239)

* Add displayNotification function

* Fix log

* Pass functions 'by reference' to BI evenEHs

* acre_api_fnc_setCustomSignalFunc - reset fix (#227)

* fixes the possibility to reset the function to default behavior

* wrong term

* lowercase if

* Update documentation

* Use of ICON_RADIO_CALL in ace_interact

* Fix ctrSetEventHandler. Back to Quotes as in #241 (#243)

Fix ctrlSetEventHandler - back to quotes as in #241

* Fixes the antenna direction calculation (#233)

* Improve mod listing on issue template

* Update easylogging++ to v9.94.1 (#246)

* Update easylogging++ to v9.94.1, Bandaid prevent default log file from creation

* Include easylogging++.cc in CMake, Change max file size to 1 MB

* Hotfix muting variable (#248)

* Fix duplicate ID handling (#251)

* Fix acre failing initialise due to a race condition (#240)

* Documentation -- Function Headers -- sys_prc343 (#110)

* Changed function example calls

* Headers 1

* Completed headers. Missing arguments

* Improvements on Doc

* Review changes

* v2.4.0.943 - Build 37

* Use CBA Namespaces

* 4nec2 Antenna Calculation (#244)

- Switches Antenna Calculation from MMANA-GAL to 4NEC2 (Closes #201)
- Converts all existing antenna data files to 4NEC2 ones
- Adds additional antennas for e.g SEM52 (Closes #29) 
- Introduces a new script to convert 4NEC2 output files to ACRE's `*.aba` file

* SEM70 (#199)

Adds a new radio: SEM70, a manpack radio used by German Armed Forces.

It comes with an UI, rendered in 3D like all other ACRE2 radios. Model and textures created by Raspu (https://github.com/Raspu86).  
Additionally it is the first radio featuring an automatic channel selection. Details will follow in the documentation.

* Fixes

* Fix duplicate mounted radios in racks

* Infantry Phone (#224)

* External intercom

* Handle dead units using the intercom

* Some requested changes

* Lunch break fixes

* Changes all references of external Intercom to Infantry Phone

* DOC: Infantry telephone

* Macroize interactions, Fix missing string

* Add actions dynamically, Add support for custom position/selection

* Improve things

* Add vanilla Tanks and Tracker APCs custom positions, Disable debug

* Fix in vehicle checks

* Revert some changes from previous commit

* Moved to sys_intercom

* Call functionality implemented

* Fix the spalling of own name

* Fixes of example calls

* Fix headers, Use clientInit postInit

* Move intercom/infantry phone config to vehicle root class

* Changed true/false to 1/0 in configs

* Cleanup configs, Don't attach init EH if ACE3 disabled

* Add vehicle intercom and infantry phone documentation

* Use ACE3 notifications, Cleanup minor things

* Added ringing description

* Add additional line regarding ringing position in framework doc

* Use displayNotification

* Fix issue

* Fix stupidity...

* Fix displayNotification

* Add infantry phone connected message

* PhoneCall fixes

* Remove of duplicate private

* Prevent destroyed vehicle beeping and infantry phone interaction

* Stop infantry phone from beeping if no crew members are aboard

* Doc and lazy evaluation

* HCs are kind of important

* No need for code in code

* Redefined infantry phone position for compatibility with other mods

* Fix: sound in all clients

* Fixed intercom

* remoteExecCall to CBA_fnc_globalEvent

* Privatising

* inline functions though, yuck

* Updated documentation

* Fix SEM70 (#257)

- Frequency default (stupid)
- PBOPrefix was ooold
- Disable Debugging

* Use CBA Namespaces

* v2.4.0.944 - Build 38

* Update Documentation Theme (#253)

* Add url to branching image, Put --incremental guideline as optional

* Update Jekyll Documentation Theme to 06dc9e0e257e014d1ccf9de158e76a61d74f84e6

* Remove redundant tooltips files, Fix search

* Use url from file location by default for images

* Renamed settings variables (#259)

* Teamspeak channel switching functionality (#225)

* Initial commit for channel move functionality

* Changes as per previous review

* Request changes and improvements

* Fixed incorrect use of EGVAR

* Requested changes. Normalised name to TS3 and normalised formatting.

* Improved name search utilising Levenshtein distance

* Whitespace

* Requested changes

* Whitespaceroni

* Requested changes

* Removed comment from pipe timeout

* Use display XEH instead of PFH

* Add missing checks in display XEH

* Removes extra include causing make error (#261)

* Removes extra include causing make error

* There was another one as well...

* Use custom namespace for Fast Hashes (#267)

* Use custom location with invalid drawStyle for fast hashes to improve performance

* Fully move hashes to sys_core

* Move the rest of fast hashes to sys_core, Fix crash in PREP

* Prefix global fast hash variables

* Remove redundant code

* Fix missing renames

* Move all fast hash stuff to main

* Create menu hashes before using them

* Return Menu hashes to working location

* Cleanup 117f and 152 menus compilation (don't run in preStart)

* Use custom namespace for Fast Hashes (#267)

* Use custom location with invalid drawStyle for fast hashes to improve performance

* Fully move hashes to sys_core

* Move the rest of fast hashes to sys_core, Fix crash in PREP

* Prefix global fast hash variables

* Remove redundant code

* Fix missing renames

* Move all fast hash stuff to main

* Create menu hashes before using them

* Return Menu hashes to working location

* Cleanup 117f and 152 menus compilation (don't run in preStart)

* v2.4.0.945 - Build 39

* v2.4.0.946 - Build 6

* Actually increment patch version

* v2.4.1.947 - Build 7

* Polish translation. (#268)

Polish translation

* Box with radios (#265)

* Box with radios

* Requested changes

* Added forgotten displayName

* Added box to units[] in CfgPatches

* Rename tag, lower amount of radios, more small radios than big radios

* Clean-up and document to sys_io (#249)

* Some improvements to sys_io

* Improve mentions of the extension.

* Improve comments

* Added SEM70 to main readme (#270)

* External radios (#214)

* First implementation of external radios

* Fixes, vehicles added and tweaked availability of ace actions

* Fixes

* Fixes and remove debug

* Fixes and improvements

* Fixed vehicles

* Updated german translations

* Improved ace interaction actions

* Fixed Doc

* Prevent the use of an external radio if it is already in use

* PR  requested changes

* Additional fixes

* Moved ace_interaction related functions to sys_external

* Update notifications and use of icon macro

* Removed extra semicolons

* Hide entry if no radios are shared externally

* Allow players to give the radio headsets to other units

* Radio owner awareness

* Requested changes

* Requested changes and documentation

* Adding new page to sidebar

* Fix doc entry in side-bar

* Fixes

* Removed tabs at the end of line

* Set external radio as active and improve messages

* Fixed display messages

* Prevent action from showing if distance is too large

* Requested changes

* Tabs tabs tabs. those hateful tabs

* Forgetful magnetar

* Forgetful magnetar. Part 2.

* Further optimisations

* Intercom overhaul and passenger intercom (#255)

* External intercom

* Handle dead units using the intercom

* Some requested changes

* Lunch break fixes

* Changes all references of external Intercom to Infantry Phone

* DOC: Infantry telephone

* Macroize interactions, Fix missing string

* Add actions dynamically, Add support for custom position/selection

* Improve things

* Add vanilla Tanks and Tracker APCs custom positions, Disable debug

* Fix in vehicle checks

* Revert some changes from previous commit

* Moved to sys_intercom

* Call functionality implemented

* Fix the spalling of own name

* Fixes of example calls

* Fix headers, Use clientInit postInit

* Move intercom/infantry phone config to vehicle root class

* Changed true/false to 1/0 in configs

* Cleanup configs, Don't attach init EH if ACE3 disabled

* Add vehicle intercom and infantry phone documentation

* Use ACE3 notifications, Cleanup minor things

* Added ringing description

* Add additional line regarding ringing position in framework doc

* Use displayNotification

* Fix issue

* Fix stupidity...

* Fix displayNotification

* Add infantry phone connected message

* PhoneCall fixes

* Remove of duplicate private

* Prevent destroyed vehicle beeping and infantry phone interaction

* Stop infantry phone from beeping if no crew members are aboard

* Doc and lazy evaluation

* HCs are kind of important

* No need for code in code

* Redefined infantry phone position for compatibility with other mods

* First implementation

* Fix: sound in all clients

* Fixed intercom

* Fixes for passenger intercom

* cba_fnc_globalEvent instead of remoteExecCall

* Requested changes

* Requested changes II

* Intercom overhaul and passenger intercom

* CBA settings and network optimisations

* Fixed: prevent from connecting to passenger intercom when the phone is ringing

* Fixes and corner cases

* BLUFOR vehicles

* Fixed attenuation checks

* Helicopters, SDVs and VTOLS

* Added hook for custom actions on Inf. phone change status

* Documentation formatting issues

* Update Documentation

* Don't use negation

* Fixes + doc

* Remove debug comment

* Requested changes

* Removed fnc_intercomActions.sqf since it was no longer needed

* Optimisations and noApiFunctions for debugging purposes

* Improve config inheritance, Check event type

* Passenger to Pax, Add note

* Shorten Inf Phone strings

* Formatting of ace actions and removal of switch intercom message

* v2.4.1.948 - Build 40

* Fix Vehicle Intercom Framework documentation page

* Formatting

* TS3 channel switching documentation (#272)

* Added TS3 channel switching documentation

* Few grammar changes

* Changes

* Hash be gone

* Empty lines

* Russian translation (#278)

* no message

* PAX translations.

* Power fixes and request changes
@jonpas jonpas modified the milestones: 2.5.0, 2.6.0 Sep 7, 2017
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.

4 participants