Needs Testing

This commit is contained in:
PabstMirror 2015-01-16 17:13:26 -06:00
parent 687c7e98aa
commit 89654a42d2
8 changed files with 67 additions and 25 deletions

View File

@ -10,7 +10,7 @@ class CfgVehicles {
class ACE_MapTools {
displayName = "$STR_ACE_Map_MapTools_Menu";
condition = "(call ACE_Map_fnc_canUseMapTools) || (call ACE_Map_fnc_canUseMapGPS)";
condition = QUOTE(call FUNC(canUseMapTools) || {call FUNC(canUseMapGPS)});
statement = "";
exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"};
showDisabled = 0;
@ -20,8 +20,8 @@ class CfgVehicles {
class ACE_MapToolsHide {
displayName = "$STR_ACE_Map_MapToolsHide";
condition = "(call ACE_Map_fnc_canUseMapTools) && {ACE_Map_mapTool_Shown > 0}";
statement = "ACE_Map_mapTool_Shown = 0; [] call ACE_Map_fnc_updateMapToolMarkers";
condition = QUOTE(call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0});
statement = QUOTE(GVAR(mapTool_Shown) = 0; [] call FUNC(updateMapToolMarkers));
exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"};
showDisabled = 1;
priority = 5;
@ -29,8 +29,8 @@ class CfgVehicles {
};
class ACE_MapToolsShowNormal {
displayName = "$STR_ACE_Map_MapToolsShowNormal";
condition = "(call ACE_Map_fnc_canUseMapTools) && {ACE_Map_mapTool_Shown != 1}";
statement = "ACE_Map_mapTool_Shown = 1; [] call ACE_Map_fnc_updateMapToolMarkers";
condition = QUOTE(call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 1});
statement = QUOTE(GVAR(mapTool_Shown) = 1; [] call FUNC(updateMapToolMarkers));
exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"};
showDisabled = 1;
priority = 4;
@ -38,8 +38,8 @@ class CfgVehicles {
};
class ACE_MapToolsShowSmall {
displayName = "$STR_ACE_Map_MapToolsShowSmall";
condition = "(call ACE_Map_fnc_canUseMapTools) && {ACE_Map_mapTool_Shown != 2}";
statement = "ACE_Map_mapTool_Shown = 2; [] call ACE_Map_fnc_updateMapToolMarkers";
condition = QUOTE(call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 2});
statement = QUOTE(GVAR(mapTool_Shown) = 2; [] call FUNC(updateMapToolMarkers));
exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"};
showDisabled = 1;
priority = 3;
@ -47,8 +47,8 @@ class CfgVehicles {
};
class ACE_MapToolsAlignNorth {
displayName = "$STR_ACE_Map_MapToolsAlignNorth";
condition = "(call ACE_Map_fnc_canUseMapTools) && {ACE_Map_mapTool_Shown != 0}";
statement = "ACE_Map_angle = 0; [] call ACE_Map_fnc_updateMapToolMarkers";
condition = QUOTE(call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0});
statement = QUOTE(GVAR(mapTool_angle) = 0; [] call FUNC(updateMapToolMarkers));
exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"};
showDisabled = 1;
priority = 2;
@ -56,8 +56,8 @@ class CfgVehicles {
};
class ACE_MapToolsAlignCompass {
displayName = "$STR_ACE_Map_MapToolsAlignCompass";
condition = "(call ACE_Map_fnc_canUseMapTools) && {ACE_Map_mapTool_Shown != 0} && {(""ItemCompass"" in assigneditems ACE_player) || {""ItemGPS"" in assigneditems ACE_player}}";
statement = "ACE_Map_angle = getDir player; [] call ACE_Map_fnc_updateMapToolMarkers";
condition = QUOTE(call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0} && {('ItemCompass' in assigneditems ACE_player) || {'ItemCompass' in assigneditems ACE_player}});
statement = QUOTE(GVAR(mapTool_angle) = getDir ACE_player; [] call FUNC(updateMapToolMarkers));
exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"};
showDisabled = 1;
priority = 1;
@ -65,8 +65,8 @@ class CfgVehicles {
};
class ACE_MapGpsShow {
displayName = "$STR_ACE_Map_MapGpsShow";
condition = "(call ACE_Map_fnc_canUseMapGPS) && {!ACE_Map_mapGpsShow}";
statement = "ACE_Map_mapGpsShow = true; [ACE_Map_mapGpsShow] call ACE_Map_fnc_openMapGps";
condition = QUOTE(call FUNC(canUseMapGPS) && {!GVAR(mapGpsShow)});
statement = QUOTE(GVAR(mapGpsShow) = true; [GVAR(mapGpsShow)] call FUNC(openMapGps));
exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"};
showDisabled = 0;
priority = 0;
@ -74,8 +74,8 @@ class CfgVehicles {
};
class ACE_MapGpsHide {
displayName = "$STR_ACE_Map_MapGpsHide";
condition = "(call ACE_Map_fnc_canUseMapGPS) && ACE_Map_mapGpsShow";
statement = "ACE_Map_mapGpsShow = false; [ACE_Map_mapGpsShow] call ACE_Map_fnc_openMapGps";
condition = QUOTE(call FUNC(canUseMapGPS) && {GVAR(mapGpsShow)});
statement = QUOTE(GVAR(mapGpsShow) = false; [GVAR(mapGpsShow)] call FUNC(openMapGps));
exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"};
showDisabled = 0;
priority = 0;
@ -87,8 +87,8 @@ class CfgVehicles {
class ACE_Actions {
class ACE_CopyMap {
displayName = "$STR_ACE_Map_CopyMap";
condition = "isPlayer ACE_Interaction_Target && {""ItemMap"" in assigneditems ACE_player} && {""ACE_MapTools"" in items ACE_player} && {""ItemMap"" in assignedItems ACE_Interaction_Target}";
statement = "[player, ""ACE_Map_fnc_sendMapMarkers"", ACE_Interaction_Target] call ACE_Core_fnc_execRemoteFnc";
condition = QUOTE([_target] call EFUNC(common,isPlayer) && {'ItemMap' in assigneditems _player} && {'ACE_MapTools' in items _player} && {'ItemMap' in assignedItems _target});
statement = QUOTE([ARR_2(_player,_target)] call FUNC(copyMapStart));
showDisabled = 0;
priority = -1;
};

View File

@ -8,7 +8,9 @@ PREP(cancelDrawing);
PREP(canDraw);
PREP(canUseMapTools);
PREP(canUseMapGPS);
PREP(copyMapMarkers);
PREP(copyMapReceiveMarkers);
PREP(copyMapRemoteSend);
PREP(copyMapStart);
PREP(handleKeyDown);
PREP(handleMouseButton);
PREP(handleMouseMove);
@ -18,6 +20,12 @@ PREP(mapStateUpdater);
PREP(openMapGps);
PREP(openMapGpsUpdate);
PREP(removeLineMarker);
PREP(sendMapMarkers);
PREP(updateMapToolMarkers);
PREP(updateLineMarker);
//Add Event Handlers:
["drawing_removeLineMarker", FUNC(removeLineMarker) ] call EFUNC(common,addEventHandler);
["drawing_addLineMarker", FUNC(addLineMarker) ] call EFUNC(common,addEventHandler);
["drawing_requestMarkers", FUNC(copyMapRemoteSend) ] call EFUNC(common,addEventHandler);
["drawing_sendbackMarkers", FUNC(copyMapReceiveMarkers) ] call EFUNC(common,addEventHandler);

View File

@ -15,6 +15,8 @@
#include "script_component.hpp"
systemChat "new global marker";
_name = _this select 0;
_startPos = _this select 1;
_difPos = (_this select 2) vectorDiff _startPos ;

View File

@ -1,7 +1,7 @@
/*
* Author: CAA-Picard
*
* Copy markers to mapd
* Copy recieved markers to map
*
* Argument:
* 0: Array of markers to copy (Array)
@ -12,11 +12,11 @@
#include "script_component.hpp"
_lineMarkers = _this;
PARAMS_1(_lineMarkers);
{
_marker = _x;
//Add marker if we don't already have it
if (({(_x select 0) == (_marker select 0)} count GVAR(drawing_lineMarkers)) == 0) then {
_marker call FUNC(addLineMarker);
};

View File

@ -12,4 +12,6 @@
#include "script_component.hpp"
[GVAR(drawing_lineMarkers), QFUNC(copyMapMarkers), _this] call EFUNC(common,execRemoteFnc);
PARAMS_1(_requester);
["drawing_sendbackMarkers", _requester, [GVAR(drawing_lineMarkers)]] call EFUNC(common,targetEvent);

View File

@ -0,0 +1,23 @@
/*
* Author: CAA-Picard
*
* Send request to remote player
*
* Argument:
* 0: Player (Unit)
* 0: Target player (Unit)
*
* Code Chain:
* START: copyMapStart: triggers event drawing_requestMarkers on remote
* handeled by: copyMapRemoteSend: triggers event "drawing_sendbackMarkers" on origin
* handeled by: copyMapReceiveMarkers
*
* Return value:
* Return
*/
#include "script_component.hpp"
PARAMS_1(_player,_target);
["drawing_requestMarkers", _target, [_player]] call EFUNC(common,targetEvent);

View File

@ -60,8 +60,11 @@ if (_code == DIK_DELETE) exitWith {
if (_lambdaLong >= 0 && _lambdaLong <= _magDiffVector && _lambdaTrasAbs <= 5) exitWith {
// Delete the line marker
if (GVAR(drawing_syncMarkers)) then {
[[_x select 0], QFUNC(removeLineMarker), 2] call EFUNC(common,execRemoteFnc);
// [[_x select 0], QFUNC(removeLineMarker), 2] call EFUNC(common,execRemoteFnc);
systemChat "global";
["drawing_removeLineMarker", [_x select 0]] call ace_common_fnc_globalEvent;
} else {
systemChat "local";
deleteMarkerLocal (_x select 0);
GVAR(drawing_lineMarkers) = GVAR(drawing_lineMarkers) - [_x];
};

View File

@ -25,6 +25,7 @@ _ctrlKey = _params select 5;
_altKey = _params select 6;
_handled = false;
// If it's not a left button event, exit
if (_button != 0) exitWith {};
@ -48,11 +49,14 @@ if (_dir == 1) exitWith {
if (GVAR(drawing_isDrawing)) exitWith {
// Already drawing -> Add tempLineMarker to permanent list
if (GVAR(drawing_syncMarkers)) then {
systemChat "global";
deleteMarkerLocal (GVAR(drawing_tempLineMarker) select 0);
[GVAR(drawing_tempLineMarker), "FUNC(addLineMarker)", 2] call EFUNC(common,execRemoteFnc);
// [GVAR(drawing_tempLineMarker), "FUNC(addLineMarker)", 2] call EFUNC(common,execRemoteFnc);
["drawing_addLineMarker", GVAR(drawing_tempLineMarker)] call EFUNC(common,globalEvent);
// Log who drew on the briefing screen
(text format ["[ACE] Server: Player %1 drew on the briefing screen", name player]) call EFUNC(common,serverLog);
} else {
systemChat "local";
GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker);
GVAR(drawing_lineMarkers) pushBack (+GVAR(drawing_tempLineMarker));
};