ACE3/addons/markers/functions/fnc_setMarkerNetwork.sqf
frankplow 6843a221ad
Markers - Add scale slider (#8059)
Co-authored-by: commy2 <commy-2@gmx.de>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: jonpas <jonpas33@gmail.com>
2021-04-21 22:36:08 +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;
};