sync rallypoint marker on jip

This commit is contained in:
commy2 2015-04-15 20:50:03 +02:00
parent 18be5276a9
commit d68cc8f40e
4 changed files with 29 additions and 24 deletions

View File

@ -30,45 +30,43 @@ class Extended_Respawn_EventHandlers {
class Extended_Init_EventHandlers { class Extended_Init_EventHandlers {
class ACE_Rallypoint_West { class ACE_Rallypoint_West {
class ADDON { class ADDON {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; [ARR_2(_this select 0,'')] call FUNC(initRallypoint)); init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; [ARR_3(_this select 0,'',west)] call FUNC(initRallypoint));
}; };
}; };
class ACE_Rallypoint_East { class ACE_Rallypoint_East {
class ADDON { class ADDON {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; [ARR_2(_this select 0,'')] call FUNC(initRallypoint)); init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; [ARR_3(_this select 0,'',east)] call FUNC(initRallypoint));
}; };
}; };
class ACE_Rallypoint_Independent { class ACE_Rallypoint_Independent {
class ADDON { class ADDON {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; [ARR_2(_this select 0,'')] call FUNC(initRallypoint)); init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; [ARR_3(_this select 0,'',independent)] call FUNC(initRallypoint));
}; };
}; };
class ACE_Rallypoint_West_Base { class ACE_Rallypoint_West_Base {
class ADDON { class ADDON {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; [ARR_2(_this select 0,'respawn_west')] call FUNC(initRallypoint)); init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; [ARR_3(_this select 0,'respawn_west',west)] call FUNC(initRallypoint));
}; };
}; };
class ACE_Rallypoint_East_Base { class ACE_Rallypoint_East_Base {
class ADDON { class ADDON {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; [ARR_2(_this select 0,'respawn_east')] call FUNC(initRallypoint)); init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; [ARR_3(_this select 0,'respawn_east',east)] call FUNC(initRallypoint));
}; };
}; };
class ACE_Rallypoint_Independent_Base { class ACE_Rallypoint_Independent_Base {
class ADDON { class ADDON {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; [ARR_2(_this select 0,'respawn_guerrila')] call FUNC(initRallypoint)); init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; [ARR_3(_this select 0,'respawn_guerrila',independent)] call FUNC(initRallypoint)); //respawn_civilian
}; };
}; };
//respawn_civilian
}; };
// auto assign rallypoint leader
class Extended_InitPost_EventHandlers { class Extended_InitPost_EventHandlers {
// auto assign rallypoint leader
class CAManBase { class CAManBase {
class ADDON { class ADDON {
serverInit = QUOTE(_this call FUNC(handleInitPostServer)); serverInit = QUOTE(_this call FUNC(handleInitPostServer));

View File

@ -27,25 +27,31 @@ _name = typeOf _rallypoint;
// init visible marker // init visible marker
if (hasInterface) then { if (hasInterface) then {
private ["_marker", "_type"]; // fix init having wrong position, vars etc.
[_rallypoint, _respawnMarker, _side, _name] spawn {
_rallypoint = _this select 0;
_respawnMarker = _this select 1;
_side = _this select 2;
_name = _this select 3;
_marker = format ["ACE_Marker_%1", _name]; _marker = format ["ACE_Marker_%1", _name];
// exit if it already exist // exit if it already exist
if (_marker in allMapMarkers) exitWith {}; if (_marker in allMapMarkers) exitWith {};
_marker = createMarkerLocal [_marker, getPosASL _rallypoint]; _marker = createMarkerLocal [_marker, getPosASL _rallypoint];
_type = ["selector_selectedFriendly", "selector_selectedEnemy"] select (_respawnMarker == ""); _type = ["selector_selectedFriendly", "selector_selectedEnemy"] select (_respawnMarker == "");
_marker setMarkerTypeLocal _type; _marker setMarkerTypeLocal _type;
_marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init _marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init
private "_markerDate"; private "_markerDate";
_markerDate = _rallypoint getVariable [QGVAR(markerDate), ""]; _markerDate = _rallypoint getVariable [QGVAR(markerDate), ""];
_marker setMarkerTextLocal _markerDate; _marker setMarkerTextLocal _markerDate;
_rallypoint setVariable [QGVAR(marker), _marker]; _rallypoint setVariable [QGVAR(marker), _marker];
};
}; };
if (!isServer) exitWith {}; if (!isServer) exitWith {};

View File

@ -46,7 +46,7 @@ _this spawn {
_rallypoint setVariable [QGVAR(markerDate), format ["%1:%2", date select 3, date select 4], true]; _rallypoint setVariable [QGVAR(markerDate), format ["%1:%2", date select 3, date select 4], true];
["rallypointMoved", [_rallypoint, _side]] call EFUNC(common,globalEvent); ["rallypointMoved", [_rallypoint, _side, _position]] call EFUNC(common,globalEvent);
[localize "STR_ACE_Respawn_Deployed"] call EFUNC(common,displayTextStructured); [localize "STR_ACE_Respawn_Deployed"] call EFUNC(common,displayTextStructured);
}; };

View File

@ -1,10 +1,11 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
private ["_rallypoint", "_side"]; private ["_rallypoint", "_side", "_position"];
_rallypoint = _this select 0; _rallypoint = _this select 0;
_side = _this select 1; _side = _this select 1;
_position = _this select 2;
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
@ -13,5 +14,5 @@ private ["_marker", "_markerDate"];
_marker = _rallypoint getVariable [QGVAR(marker), ""]; _marker = _rallypoint getVariable [QGVAR(marker), ""];
_markerDate = _rallypoint getVariable [QGVAR(markerDate), ""]; _markerDate = _rallypoint getVariable [QGVAR(markerDate), ""];
_marker setMarkerPosLocal getPosASL _rallypoint; _marker setMarkerPosLocal _position;
_marker setMarkerTextLocal _markerDate; _marker setMarkerTextLocal _markerDate;