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

Rack - API and Usability Improvements #1334

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

mrschick
Copy link
Contributor

@mrschick mrschick commented Jul 25, 2024

When merged this pull request will:

  • Fix object variable acre_sys_rack_initialized not being a reliable indicator for whether the Racks are fully initialized and added to the vehicle. This seems to have been the main cause behind past Rack-API jankiness.
    Will close API manipulation of vehicle racks on dedicated servers (removeRackfromVehicle not functioning as expected) #1312.
  • Add API function acre_api_fnc_removeAllRacksFromVehicle:
    It removes all Racks from a Vehicle after handling the preceding initialization (if necessary).
  • Add API function acre_api_fnc_replaceRacksOnVehicle:
    It replaces all Config-defined Racks on a vehicle of a specific type with a given other type, while preserving other config properties like Name/Shortname, allowed/denied positions and Wired Intercom.
    Use case: for an old-school scenario, put just this function into your APC/Helicopters' Init fields in 3DEN to replace all of its default VRC-103 Racks with VRC-64s. Eliminates the need to initialize, delete all Racks and add new VRC-64s with a custom script.
  • Add documentation for new API functions.
  • Improve German and Italian translations of short "Dash", to reduce overflow in the rack/intercom info dialog.
  • Fix text wrapping of the rack/intercom info dialog in order to prevent content overflows.
    Will close Text goes out of interface #1311.
  • Improve handling of a player's connection to Racks when exiting and re-entering a vehicle:
    • Don't reset the custom PTT order of Rack Radios;
    • Automatically Re-"Use" Racks;
  • Fix Rack-mounted AN/PRC-77 interaction showing "Channel: 1" instead of frequency in MHz.

@mrschick
Copy link
Contributor Author

mrschick commented Aug 5, 2024

Preserving PTTs when re-entering vehicles works, so does re-using Racks, but the latter doesn't properly handle seat switching yet.

@mrschick
Copy link
Contributor Author

Managed to fix the vehicle info text overflowing, was caused by addons/sys_gui/RscTitles.hpp:53 multiplying Rsc width by 10, more than what would have been visible anyway, which prevented the native structured text wrapping from working properly.
I also reduced the divisor at addons/sys_gui/fnc_updateVehicleInfo.sqf:33 a bit to get some extra lower padding.

@mrschick
Copy link
Contributor Author

mrschick commented Aug 12, 2024

the latter doesn't properly handle seat switching yet

I thought a bit more about how the rack-reusing feature should work in relation to how seat switching influences Rack usage.
Currently, a used Rack remains used when switching seat, the RackPFH just stops using a given Rack if it is inaccessible from the (new) current seat.

My re-use implementation works as follows:
When starting to use a Rack, that state is stored in a local variable for the current seat. When entering the vehicle again, the variable for the selected seat is read and any racks in that array are re-used.
If the seat is switched within the vehicle, stopping usage of the Rack won't update its stored state for the seat it was added for, only for the one currently occupied.

In the end, I think that this implementation is ok, with storage per-seat being the best option, avoiding situations in which stopping usage from any seat would remove its stored state from every other seat.

@mrschick mrschick marked this pull request as ready for review August 12, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant