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

API - Add Function to set Channels on all Radios a Player is carrying #1302

Merged
merged 18 commits into from
Jan 27, 2025

Conversation

mrschick
Copy link
Contributor

@mrschick mrschick commented Nov 19, 2023

When merged this pull request will:

  • Add an API function setupRadios that allows easy setup of channels on all radios a unit is carrying;

As per the function's description, it would allow setting the channels on all radios a unit has via a single function invocation in its init field (only if restricted to run locally via if (this isEqualTo player) then {}; or similar) or initPlayerLocal.sqf:

_success = [ ["ACRE_PRC343", [2,3]], ["ACRE_PRC152", 3], ["ACRE_PRC77", [31,15]] ] call acre_api_fnc_setupRadios;
// Will set PRC343 to Ch2 Blk3, PRC152 to Ch3 and PRC77 to 31.15 MHz

_success = [ ["ACRE_PRC343", 6], ["ACRE_PRC152", 2], ["ACRE_PRC152", 3] ] call acre_api_fnc_setupRadios;
// Will set PRC343 to Ch6 Blk1, the first PRC152 to Ch2 and the second PRC152 to Ch3

_success = [ ["ACRE_SEM52SL", 8], ["ACRE_SEM70", [34,075]] ] call acre_api_fnc_setupRadios;
// Will set SEM52SL to Ch8 and SEM70 to 34.075 MHz

To-Do:

  • API Function;
  • Compatibility with PRC-343 channels and blocks;
  • Compatibility with PRC-148/152/117F and BF-888S single channels;
  • Compatibility with PRC-77 MHz.KHz frequency setting;
  • Compatibility with SEM52SL presets and SEM70 frequencies;
  • Documentation;
  • Add radio setup to 3DEN Object Attributes;
  • Compatibility with the WIP Wireless Set No38 frequency settings Better handled after PR is merged;

@mrschick
Copy link
Contributor Author

I believe this is good to go now.

@mrschick mrschick marked this pull request as ready for review November 27, 2023 22:58
@jonpas jonpas added this to the 2.13.0 milestone Jun 13, 2024
@jonpas jonpas requested a review from Mike-MF July 2, 2024 18:45
@Mike-MF
Copy link
Collaborator

Mike-MF commented Jul 3, 2024

Needs to be updated from master to test.

@mrschick
Copy link
Contributor Author

mrschick commented Jul 4, 2024

Needs to be updated from master to test.

Done.

@mrschick mrschick closed this Jul 4, 2024
@mrschick
Copy link
Contributor Author

mrschick commented Jul 4, 2024

Fat-fingered my mouse and closed this by accident...

@mrschick mrschick reopened this Jul 4, 2024
Copy link
Contributor

@Timi007 Timi007 left a comment

Choose a reason for hiding this comment

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

Great PR! I have some improvements to the German translation.

addons/sys_radio/stringtable.xml Outdated Show resolved Hide resolved
addons/sys_radio/stringtable.xml Outdated Show resolved Hide resolved
addons/api/fnc_setupRadios.sqf Outdated Show resolved Hide resolved
mrschick and others added 2 commits January 16, 2025 17:07
@Mike-MF
Copy link
Collaborator

Mike-MF commented Jan 22, 2025

Got around to testing this.
Using this in initPlayerLocal.sqf
_success = [ ["ACRE_PRC343", [2,3]], ["ACRE_PRC152", 3], ["ACRE_PRC77", [31,15]] ] call acre_api_fnc_setupRadios;

On a unit with those 3 radios added to a backpack via Ace arsenal always comes back false.

15:17:50 [ACRE] (api) WARNING: Attempted to import radio setup [["ACRE_PRC343",[2,3]],["ACRE_PRC152",3],["ACRE_PRC77",[31,15]]], aborting due to no radios carried

But, if you run it in debug after loading in, it works just fine.

@mrschick
Copy link
Contributor Author

mrschick commented Jan 23, 2025

It's probably because it doesn't wait for [] call acre_api_fnc_isInitialized to be true and ends up running before radios are initialized, I always added a waitUntil before the function call when using it in initPlayerLocal.sqf.
But for usability it would be better to let the function use a waitUntilAndExecute internally, like the Rack API does.

@mrschick
Copy link
Contributor Author

This should do it.

addons/sys_radio/stringtable.xml Outdated Show resolved Hide resolved
Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
@jonpas jonpas merged commit 090abc6 into IDI-Systems:master Jan 27, 2025
3 checks passed
@mrschick mrschick deleted the feature/api-setupRadios branch January 27, 2025 13:04
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.

6 participants