ACE3/addons/markers/functions/fnc_setMarkerNetwork.sqf

64 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:
2015-08-22 12:08:35 +00:00
* None
2015-03-28 01:51:30 +00:00
*
* 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-08-22 12:08:35 +00:00
params ["_marker", "_data"];
_data params ["_markerClassname", "_colorClassname", "_markerPos", "_markerDir"];
2015-08-23 19:25:41 +00:00
TRACE_2("params",_marker,_data);
2015-01-18 16:17:06 +00:00
2015-11-30 16:23:02 +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-11-30 16:23:02 +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
};