ACE3/addons/markers/functions/fnc_setMarkerNetwork.sqf

62 lines
1.7 KiB
Plaintext
Raw Normal View History

2015-03-28 01:51:30 +00:00
/*
* Author: commy2
* Sets newly placed marker
* Handles the QGVAR(setMarkerNetwork) event.
*
* Arguments:
* 0: Markername <STRING>
* 1: Marker Data <ARRAY>
*
* Return Value:
* Nothing
*
* Example:
* [[],[],dummyLogic] call ace_markers_fnc_setMarkerJIP;
*
* Public: No
*/
2015-01-18 16:17:06 +00:00
#include "script_component.hpp"
2015-03-28 01:51:30 +00:00
private ["_config"];
2015-01-18 16:17:06 +00:00
2015-03-28 01:51:30 +00:00
PARAMS_2(_marker,_data);
EXPLODE_4_PVT(_data,_markerClassname,_colorClassname,_markerPos,_markerDir);
2015-01-18 16:17:06 +00:00
2015-03-28 01:51:30 +00:00
_config = (configfile >> "CfgMarkers") >> _markerClassname;
if (!isClass _config) then {
2015-03-28 01:51:30 +00:00
WARNING("CfgMarker not found, changed to milDot");
_config == (configFile >> "CfgMarkers" >> "MilDot");
};
_marker setMarkerTypeLocal (configName _config);
2015-01-18 16:17:06 +00:00
2015-03-28 01:51:30 +00:00
_config = (configfile >> "CfgMarkerColors") >> _colorClassname;
if (!isClass _config) then {
2015-03-28 01:51:30 +00:00
WARNING("CfgMarkerColors not found, changed to Default");
_config == (configFile >> "CfgMarkerColors" >> "Default");
};
2015-01-18 16:17:06 +00:00
_marker setMarkerColorLocal configName _config;
2015-03-28 01:51:30 +00:00
_marker setMarkerPosLocal _markerPos;
_marker setMarkerDirLocal _markerDir;
2015-01-18 16:17:06 +00:00
// save properties on server machine for JIP, marker editing ready
if (isMultiplayer && {isServer}) then {
2015-03-28 01:51:30 +00:00
private ["_allMapMarkers", "_allMapMarkersProperties", "_index"];
2015-01-18 16:17:06 +00:00
2015-03-28 04:19:03 +00:00
_allMapMarkers = GETGVAR(allMapMarkers,[]);
_allMapMarkersProperties = GETGVAR(allMapMarkersProperties,[]);
2015-01-18 16:17:06 +00:00
2015-03-28 01:51:30 +00:00
_index = _allMapMarkers find _marker;
2015-01-18 16:17:06 +00:00
2015-03-28 01:51:30 +00:00
if (_index == -1) then {
_allMapMarkers pushBack _marker;
_allMapMarkersProperties pushBack _data;
} else {
_allMapMarkers set [_index, _marker];
_allMapMarkersProperties set [_index, _data];
};
2015-01-18 16:17:06 +00:00
2015-03-28 01:51:30 +00:00
GVAR(allMapMarkers) = _allMapMarkers;
GVAR(allMapMarkersProperties) = _allMapMarkersProperties;
2015-01-18 16:17:06 +00:00
};