mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
rally point moved eh, markers at rallypoint positions
This commit is contained in:
parent
9c1b40f5a3
commit
18be5276a9
@ -1,9 +1,16 @@
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Killed_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
|
5
addons/respawn/XEH_postInit.sqf
Normal file
5
addons/respawn/XEH_postInit.sqf
Normal file
@ -0,0 +1,5 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
["rallypointMoved", {_this call FUNC(updateRallypoint)}] call EFUNC(common,addEventhandler);
|
||||
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); // hide enemy rallypoint markers
|
@ -4,6 +4,7 @@ ADDON = false;
|
||||
|
||||
PREP(canMoveRallypoint);
|
||||
PREP(handleKilled);
|
||||
PREP(handlePlayerChanged);
|
||||
PREP(handleRespawn);
|
||||
PREP(handleInitPostServer);
|
||||
PREP(initRallypoint);
|
||||
@ -16,5 +17,6 @@ PREP(removeDisconnectedPlayer);
|
||||
PREP(restoreGear);
|
||||
PREP(showFriendlyFireMessage);
|
||||
PREP(teleportToRallypoint);
|
||||
PREP(updateRallypoint);
|
||||
|
||||
ADDON = true;
|
||||
|
44
addons/respawn/functions/fnc_handlePlayerChanged.sqf
Normal file
44
addons/respawn/functions/fnc_handlePlayerChanged.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_newUnit";
|
||||
|
||||
_newUnit = _this select 0;
|
||||
|
||||
switch (side group _newUnit) do {
|
||||
case (west): {
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
};
|
||||
|
||||
case (east): {
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
};
|
||||
|
||||
case (independent): {
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
|
||||
};
|
||||
|
||||
default {
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
|
||||
};
|
||||
};
|
@ -16,23 +16,53 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_rallypoint", "_respawnMarker", "_name"];
|
||||
private ["_rallypoint", "_respawnMarker", "_side"];
|
||||
|
||||
_rallypoint = _this select 0;
|
||||
_respawnMarker = _this select 1;
|
||||
_side = _this select 2;
|
||||
|
||||
if (!local _rallypoint) exitWith {};
|
||||
|
||||
private "_name";
|
||||
_name = typeOf _rallypoint;
|
||||
|
||||
// init visible marker
|
||||
if (hasInterface) then {
|
||||
private ["_marker", "_type"];
|
||||
|
||||
_marker = format ["ACE_Marker_%1", _name];
|
||||
|
||||
// exit if it already exist
|
||||
if (_marker in allMapMarkers) exitWith {};
|
||||
|
||||
_marker = createMarkerLocal [_marker, getPosASL _rallypoint];
|
||||
_type = ["selector_selectedFriendly", "selector_selectedEnemy"] select (_respawnMarker == "");
|
||||
|
||||
_marker setMarkerTypeLocal _type;
|
||||
_marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init
|
||||
|
||||
private "_markerDate";
|
||||
_markerDate = _rallypoint getVariable [QGVAR(markerDate), ""];
|
||||
|
||||
_marker setMarkerTextLocal _markerDate;
|
||||
|
||||
_rallypoint setVariable [QGVAR(marker), _marker];
|
||||
};
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
if (isNil _name) then {
|
||||
missionNamespace setVariable [_name, _rallypoint];
|
||||
publicVariable _name;
|
||||
|
||||
_rallypoint setVariable [QGVAR(side), _side, true];
|
||||
|
||||
if (_respawnMarker != "" && {!(_respawnMarker in allMapMarkers)}) then {
|
||||
createMarker [_respawnMarker, _rallypoint];
|
||||
};
|
||||
|
||||
["rallypointMoved", [_rallypoint, _side]] call EFUNC(common,globalEvent);
|
||||
|
||||
} else {
|
||||
deleteVehicle _rallypoint;
|
||||
diag_log text "[ACE] Respawn: ERROR Multiple Rallypoints of same type.";
|
||||
};
|
||||
|
||||
if (isServer && {_respawnMarker != ""} && {!(_respawnMarker in allMapMarkers)}) then {
|
||||
createMarker [_respawnMarker, _rallypoint];
|
||||
};
|
||||
|
@ -44,11 +44,9 @@ _this spawn {
|
||||
_rallypoint setPosATL _position;
|
||||
_unit reveal _rallypoint;
|
||||
|
||||
/*
|
||||
_marker = format ["AGM_RallyPoint_%1", _side];
|
||||
_marker setMarkerPos _position;
|
||||
_marker setMarkerTextLocal format ["%1:%2", [date select 3, 2, 0] call CBA_fnc_FORMATNumber, [date select 4, 2, 0] call CBA_fnc_FORMATNumber];
|
||||
*/
|
||||
_rallypoint setVariable [QGVAR(markerDate), format ["%1:%2", date select 3, date select 4], true];
|
||||
|
||||
["rallypointMoved", [_rallypoint, _side]] call EFUNC(common,globalEvent);
|
||||
|
||||
[localize "STR_ACE_Respawn_Deployed"] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
17
addons/respawn/functions/fnc_updateRallypoint.sqf
Normal file
17
addons/respawn/functions/fnc_updateRallypoint.sqf
Normal file
@ -0,0 +1,17 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_rallypoint", "_side"];
|
||||
|
||||
_rallypoint = _this select 0;
|
||||
_side = _this select 1;
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
private ["_marker", "_markerDate"];
|
||||
|
||||
_marker = _rallypoint getVariable [QGVAR(marker), ""];
|
||||
_markerDate = _rallypoint getVariable [QGVAR(markerDate), ""];
|
||||
|
||||
_marker setMarkerPosLocal getPosASL _rallypoint;
|
||||
_marker setMarkerTextLocal _markerDate;
|
Loading…
Reference in New Issue
Block a user