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

Add marker created server event / log function #98

Open
DeliciousJaffa opened this issue Jul 10, 2024 · 1 comment
Open

Add marker created server event / log function #98

DeliciousJaffa opened this issue Jul 10, 2024 · 1 comment
Labels
feature request There aren't enough bugs yet, please add more

Comments

@DeliciousJaffa
Copy link

Is your feature request related to a problem? Please describe.
As you cannot hover over and see who created a METIS Marker, It would be useful to be able to retroactively find who created what markers.

Describe the solution you'd like
A CBA server event emitted by clients when a marker is created, with ideally a built in logging function that could be enabled by CBA settings.

Describe alternatives you've considered
Looping over the metis map markers - would have to determine when edited, which are new, etc

Additional context
N/A

@DeliciousJaffa DeliciousJaffa added the feature request There aren't enough bugs yet, please add more label Jul 10, 2024
@Timi007
Copy link
Member

Timi007 commented Jul 12, 2024

You should be able to do this with the MarkerCreated eventhandler as well as mts_markers_fnc_isMtsMarker and mts_markers_fnc_getPlayerUID.

Something like this (not tested it):

seen_mts_markers = [];
addMissionEventHandler ["MarkerCreated", {
    params ["_marker", "_channelNumber", "_owner", "_local"];

    if (([_marker] call mts_markers_fnc_isMtsMarker) isNotEqualTo 1) exitWith {};

    private _namePrefix = (_marker splitString "_") select 0;

    // When a mts marker is created, multiple vanilla markers are created,
    // we only want to handle the event once.
    if (_namePrefix in seen_mts_markers) exitWith {};
    seen_mts_markers pushBack _namePrefix;

    // Maybe _owner is useful here? Or:
    private _playerUID = [_namePrefix] call mts_markers_fnc_getPlayerUID;
    private _unit = _playerUID call BIS_fnc_getUnitByUID;
}];

But yeah, I think CBA events would be convenient in the future.

I don't understand what you mean by "built in logging function"? What should be logged? Where should it be logged to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request There aren't enough bugs yet, please add more
Projects
None yet
Development

No branches or pull requests

2 participants