ACE3/addons/markers/functions/fnc_setMarkerNetwork.sqf

63 lines
1.6 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-08-22 12:08:35 +00:00
params ["_marker", "_data"];
2015-08-23 19:25:41 +00:00
TRACE_2("params",_marker,_data);
2015-12-10 14:32:31 +00:00
_data params ["_markerClassname", "_colorClassname", "_pos", "_dir"];
2015-08-23 19:25:41 +00:00
2015-12-10 14:32:31 +00:00
private _config = configfile >> "CfgMarkers" >> _markerClassname;
2015-01-18 16:17:06 +00:00
if (!isClass _config) then {
2015-03-28 01:51:30 +00:00
WARNING("CfgMarker not found, changed to milDot");
2015-12-10 14:32:31 +00:00
_config = configFile >> "CfgMarkers" >> "MilDot";
};
2015-01-18 16:17:06 +00:00
2015-12-10 14:32:31 +00:00
_marker setMarkerTypeLocal configName _config;
_config = configfile >> "CfgMarkerColors" >> _colorClassname;
if (!isClass _config) then {
2015-03-28 01:51:30 +00:00
WARNING("CfgMarkerColors not found, changed to Default");
2015-12-10 14:32:31 +00:00
_config = configFile >> "CfgMarkerColors" >> "Default";
};
2015-12-10 14:32:31 +00:00
2015-01-18 16:17:06 +00:00
_marker setMarkerColorLocal configName _config;
2015-12-10 14:32:31 +00:00
_marker setMarkerPosLocal _pos;
_marker setMarkerDirLocal _dir;
2015-01-18 16:17:06 +00:00
// save properties on server machine for JIP, marker editing ready
if (isMultiplayer && {isServer}) then {
2015-12-10 14:32:31 +00:00
private _allMapMarkers = GETGVAR(allMapMarkers,[]);
private _allMapMarkersProperties = GETGVAR(allMapMarkersProperties,[]);
2015-01-18 16:17:06 +00:00
2015-12-10 14:32:31 +00:00
private _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
};