ACE3/addons/markers/functions/fnc_setMarkerNetwork.sqf
jonpas 742626ff1a
General - Relative script_component.hpp includes (#9378)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-12 20:58:10 +02:00

64 lines
1.7 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: commy2
* Sets newly placed marker
* Handles the QGVAR(setMarkerNetwork) event.
*
* Arguments:
* 0: Markername <STRING>
* 1: Marker Data <ARRAY>
*
* Return Value:
* None
*
* Example:
* [[],[],dummyLogic] call ace_markers_fnc_setMarkerNetwork;
*
* Public: No
*/
params ["_marker", "_data"];
TRACE_2("params",_marker,_data);
_data params ["_markerClassname", "_colorClassname", "_pos", "_dir", "_scale"];
private _config = configfile >> "CfgMarkers" >> _markerClassname;
if (!isClass _config) then {
WARNING("CfgMarker not found, changed to milDot");
_config = configFile >> "CfgMarkers" >> "MilDot";
};
_marker setMarkerTypeLocal configName _config;
_config = configfile >> "CfgMarkerColors" >> _colorClassname;
if (!isClass _config) then {
WARNING("CfgMarkerColors not found, changed to Default");
_config = configFile >> "CfgMarkerColors" >> "Default";
};
_marker setMarkerColorLocal configName _config;
_marker setMarkerPosLocal _pos;
_marker setMarkerDirLocal _dir;
_marker setMarkerSizeLocal [_scale, _scale];
// save properties on server machine for JIP, marker editing ready
if (isMultiplayer && {isServer}) then {
private _allMapMarkers = GETGVAR(allMapMarkers,[]);
private _allMapMarkersProperties = GETGVAR(allMapMarkersProperties,[]);
private _index = _allMapMarkers find _marker;
if (_index == -1) then {
_allMapMarkers pushBack _marker;
_allMapMarkersProperties pushBack _data;
} else {
_allMapMarkers set [_index, _marker];
_allMapMarkersProperties set [_index, _data];
};
GVAR(allMapMarkers) = _allMapMarkers;
GVAR(allMapMarkersProperties) = _allMapMarkersProperties;
};