diff --git a/addons/respawn/CfgEventHandlers.hpp b/addons/respawn/CfgEventHandlers.hpp index c4a50615d1..00b6f01cea 100644 --- a/addons/respawn/CfgEventHandlers.hpp +++ b/addons/respawn/CfgEventHandlers.hpp @@ -1,20 +1,75 @@ + 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 GVAR(HandleGear) { + class ADDON { killed = QUOTE(_this call FUNC(handleKilled)); }; }; }; + class Extended_Respawn_EventHandlers { class CAManBase { - class GVAR(HandleGear) { + class ADDON { respawn = QUOTE(_this call FUNC(handleRespawn)); }; }; }; + +class Extended_Init_EventHandlers { + class ACE_Rallypoint_West { + class ADDON { + 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 ADDON { + 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 ADDON { + 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 ADDON { + 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 ADDON { + 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 ADDON { + 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 + }; + }; +}; + +class Extended_InitPost_EventHandlers { + // auto assign rallypoint leader + class CAManBase { + class ADDON { + serverInit = QUOTE(_this call FUNC(handleInitPostServer)); + }; + }; +}; diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index f6b8fc64c2..384376b00c 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -1,6 +1,6 @@ class CfgVehicles { class Module_F; - class ACE_ModuleRespawn : Module_F { + class ACE_ModuleRespawn: Module_F { author = "$STR_ACE_Common_ACETeam"; category = "ACE"; displayName = "Respawn System"; @@ -8,20 +8,24 @@ class CfgVehicles { scope = 2; isGlobal = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_Respawn_ca.paa)); + class Arguments { class SavePreDeathGear { displayName = "Save Gear?"; description = "Respawn with the gear a soldier had just before his death?"; typeName = "BOOL"; + class values { class Yes { name = "Yes"; value = 1; }; class No { default = 1; name = "No"; value = 0; }; }; }; + class RemoveDeadBodiesDisconnected { displayName = "Remove bodies?"; description = "Remove player bodies after disconnect?"; typeName = "BOOL"; + class values { class Yes { default = 1; name = "Yes"; value = 1; }; class No { name = "No"; value = 0; }; @@ -30,7 +34,7 @@ class CfgVehicles { }; }; - class ACE_ModuleFriendlyFire : Module_F { + class ACE_ModuleFriendlyFire: Module_F { author = "$STR_ACE_Common_ACETeam"; category = "ACE"; displayName = "Friendly Fire Messages"; @@ -38,11 +42,11 @@ class CfgVehicles { scope = 2; isGlobal = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_FriendlyFire_ca.paa)); - class Arguments { - }; + + class Arguments {}; }; - class ACE_ModuleRallypoint : Module_F { + class ACE_ModuleRallypoint: Module_F { author = "$STR_ACE_Common_ACETeam"; category = "ACE"; displayName = "Rallypoint System"; @@ -50,174 +54,8 @@ class CfgVehicles { scope = 2; isGlobal = 1; icon = QUOTE(PATHTOF(UI\Icon_Module_Rallypoint_ca.paa)); - class Arguments { - }; - }; - // rallypoints - class FlagCarrier; - class Flag_NATO_F : FlagCarrier { - class ACE_Actions; - }; - - class Flag_CSAT_F : FlagCarrier { - class ACE_Actions; - }; - - class Flag_AAF_F : FlagCarrier { - class ACE_Actions; - }; - - // static - class ACE_Rallypoint_West : Flag_NATO_F { - author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint West Base"; - vehicleClass = QGVAR(Rallypoints); - - class EventHandlers { - init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint)); - }; - class ACE_Actions : ACE_Actions { - class ACE_MainActions { - distance = 5; - condition = "true"; - selection = ""; - class ACE_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = QUOTE(side group _player == west); - statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; - }; - }; - }; - }; - - class ACE_Rallypoint_East : Flag_CSAT_F { - author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint East Base"; - vehicleClass = QGVAR(Rallypoints); - - class EventHandlers { - init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint)); - }; - class ACE_Actions : ACE_Actions { - class ACE_MainActions { - distance = 5; - condition = "true"; - selection = ""; - class ACE_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = QUOTE(side group _player == east); - statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; - }; - }; - }; - }; - - class ACE_Rallypoint_Independent : Flag_AAF_F { - author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint Independent Base"; - vehicleClass = QGVAR(Rallypoints); - - class EventHandlers { - init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint)); - }; - class ACE_Actions : ACE_Actions { - class ACE_MainActions { - distance = 5; - condition = "true"; - selection = ""; - class ACE_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = QUOTE(side group _player == independent); - statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; - }; - }; - }; - }; - - // moveable - class ACE_RallypointExit_West : Flag_NATO_F { - author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint West"; - vehicleClass = QGVAR(Rallypoints); - - class EventHandlers { - init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint)); - }; - class ACE_Actions : ACE_Actions { - class ACE_MainActions { - distance = 5; - condition = "true"; - selection = ""; - class ACE_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = QUOTE(side group _player == west); - statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; - }; - }; - }; - }; - - class ACE_RallypointExit_East : Flag_CSAT_F { - author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint East"; - vehicleClass = QGVAR(Rallypoints); - - class EventHandlers { - init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint)); - }; - class ACE_Actions : ACE_Actions { - class ACE_MainActions { - distance = 5; - condition = "true"; - selection = ""; - class ACE_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = QUOTE(side group _player == east); - statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; - }; - }; - }; - }; - - class ACE_RallypointExit_Independent : Flag_AAF_F { - author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint Independent"; - vehicleClass = QGVAR(Rallypoints); - - class EventHandlers { - init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint)); - }; - class ACE_Actions : ACE_Actions { - class ACE_MainActions { - distance = 5; - condition = "true"; - selection = ""; - class ACE_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = QUOTE(side group _player == independent); - statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; - }; - }; - }; + class Arguments {}; }; // team leader @@ -233,4 +71,140 @@ class CfgVehicles { }; }; }; + + // rallypoints + class FlagCarrier; + class Flag_NATO_F: FlagCarrier { + class ACE_Actions; + }; + + class Flag_CSAT_F: FlagCarrier { + class ACE_Actions; + }; + + class Flag_AAF_F: FlagCarrier { + class ACE_Actions; + }; + + // static + class ACE_Rallypoint_West_Base: Flag_NATO_F { + XEH_ENABLED; + + author = "$STR_ACE_Common_ACETeam"; + displayName = "$STR_ACE_Respawn_RallypointWestBase"; + vehicleClass = QGVAR(Rallypoints); + + class ACE_Actions: ACE_Actions { + class ACE_Teleport { + displayName = "$STR_ACE_Respawn_TeleportedToRallypoint"; + distance = 4; + condition = QUOTE(side group _player == west); + statement = QUOTE([ARR_3(_player,side group _player,'ACE_Rallypoint_West')] call FUNC(teleportToRallypoint)); + position = "[0,0,-1]"; + showDisabled = 1; + priority = 1; + }; + }; + }; + + class ACE_Rallypoint_East_Base: Flag_CSAT_F { + XEH_ENABLED; + + author = "$STR_ACE_Common_ACETeam"; + displayName = "$STR_ACE_Respawn_RallypointEastBase"; + vehicleClass = QGVAR(Rallypoints); + + class ACE_Actions: ACE_Actions { + class ACE_Teleport { + displayName = "$STR_ACE_Respawn_TeleportedToRallypoint"; + distance = 4; + condition = QUOTE(side group _player == east); + statement = QUOTE([ARR_3(_player,side group _player,'ACE_Rallypoint_East')] call FUNC(teleportToRallypoint)); + position = "[0,0,-1]"; + showDisabled = 1; + priority = 1; + }; + }; + }; + + class ACE_Rallypoint_Independent_Base: Flag_AAF_F { + XEH_ENABLED; + + author = "$STR_ACE_Common_ACETeam"; + displayName = "$STR_ACE_Respawn_RallypointIndependentBase"; + vehicleClass = QGVAR(Rallypoints); + + class ACE_Actions: ACE_Actions { + class ACE_Teleport { + displayName = "$STR_ACE_Respawn_TeleportedToRallypoint"; + distance = 4; + condition = QUOTE(side group _player == independent); + statement = QUOTE([ARR_3(_player,side group _player,'ACE_Rallypoint_Independent')] call FUNC(teleportToRallypoint)); + position = "[0,0,-1]"; + showDisabled = 1; + priority = 1; + }; + }; + }; + + // moveable + class ACE_Rallypoint_West: Flag_NATO_F { + XEH_ENABLED; + + author = "$STR_ACE_Common_ACETeam"; + displayName = "$STR_ACE_Respawn_RallypointWest"; + vehicleClass = QGVAR(Rallypoints); + + class ACE_Actions: ACE_Actions { + class ACE_Teleport { + displayName = "$STR_ACE_Respawn_TeleportedToBase"; + distance = 4; + condition = QUOTE(side group _player == west); + statement = QUOTE([ARR_3(_player,side group _player,'ACE_Rallypoint_West_Base')] call FUNC(teleportToRallypoint)); + position = "[0,0,-1]"; + showDisabled = 1; + priority = 1; + }; + }; + }; + + class ACE_Rallypoint_East: Flag_CSAT_F { + XEH_ENABLED; + + author = "$STR_ACE_Common_ACETeam"; + displayName = "$STR_ACE_Respawn_RallypointEast"; + vehicleClass = QGVAR(Rallypoints); + + class ACE_Actions: ACE_Actions { + class ACE_Teleport { + displayName = "$STR_ACE_Respawn_TeleportedToBase"; + distance = 4; + condition = QUOTE(side group _player == east); + statement = QUOTE([ARR_3(_player,side group _player,'ACE_Rallypoint_East_Base')] call FUNC(teleportToRallypoint)); + position = "[0,0,-1]"; + showDisabled = 1; + priority = 1; + }; + }; + }; + + class ACE_Rallypoint_Independent: Flag_AAF_F { + XEH_ENABLED; + + author = "$STR_ACE_Common_ACETeam"; + displayName = "$STR_ACE_Respawn_RallypointIndependent"; + vehicleClass = QGVAR(Rallypoints); + + class ACE_Actions: ACE_Actions { + class ACE_Teleport { + displayName = "$STR_ACE_Respawn_TeleportedToBase"; + distance = 4; + condition = QUOTE(side group _player == independent); + statement = QUOTE([ARR_3(_player,side group _player,'ACE_Rallypoint_Independent_Base')] call FUNC(teleportToRallypoint)); + position = "[0,0,-1]"; + showDisabled = 1; + priority = 1; + }; + }; + }; }; diff --git a/addons/respawn/XEH_postInit.sqf b/addons/respawn/XEH_postInit.sqf new file mode 100644 index 0000000000..ada5765e86 --- /dev/null +++ b/addons/respawn/XEH_postInit.sqf @@ -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 diff --git a/addons/respawn/XEH_preInit.sqf b/addons/respawn/XEH_preInit.sqf index f57e1f3714..dd116f108c 100644 --- a/addons/respawn/XEH_preInit.sqf +++ b/addons/respawn/XEH_preInit.sqf @@ -4,7 +4,9 @@ ADDON = false; PREP(canMoveRallypoint); PREP(handleKilled); +PREP(handlePlayerChanged); PREP(handleRespawn); +PREP(handleInitPostServer); PREP(initRallypoint); PREP(module); PREP(moduleFriendlyFire); @@ -15,5 +17,6 @@ PREP(removeDisconnectedPlayer); PREP(restoreGear); PREP(showFriendlyFireMessage); PREP(teleportToRallypoint); +PREP(updateRallypoint); ADDON = true; diff --git a/addons/respawn/functions/fnc_handleInitPostServer.sqf b/addons/respawn/functions/fnc_handleInitPostServer.sqf new file mode 100644 index 0000000000..f8a0479717 --- /dev/null +++ b/addons/respawn/functions/fnc_handleInitPostServer.sqf @@ -0,0 +1,54 @@ +// by commy2 +// execute on server only! +#include "script_component.hpp" + +private "_unit"; + +_unit = _this select 0; + +private ["_group0", "_rallypoint"]; + +_group0 = group _unit; // _group is a reserved veriable and shouldn't be used + +_rallypoint = [ + objNull, + missionNamespace getVariable ["ACE_Rallypoint_West", objNull], + missionNamespace getVariable ["ACE_Rallypoint_East", objNull], + missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull] +] select ([west, east, independent] find side _group0) + 1; + +// exit if no moveable rallypoint is placed for that side +if (isNull _rallypoint) exitWith {}; + +// find leader +private "_leaderVarName"; +_leaderVarName = _group0 getVariable [QGVAR(leaderVarName), ""]; + +// exit if group already has a playable slot assigned as rallypoint leader +if (_leaderVarName != "") exitWith { + // assign JIP unit as rallypoint leader + if (str _unit == _leaderVarName) then { + _unit setVariable ["ACE_canMoveRallypoint", true, true]; + }; +}; + +// treat group leader +_unit = leader _group0; + +_leaderVarName = vehicleVarName _unit; + +if (_leaderVarName == "") then { + private "_leaderID"; + _leaderID = GETGVAR(NextLeaderID,0); + + _leaderVarName = format [QUOTE(ACE_Rallypoint_Leader_%1), _leaderID]; + + _unit setVehicleVarName _leaderVarName; + + GVAR(NextLeaderID) = _leaderID + 1; +}; + +// prevent group from getting multiple leaders; use this to assign rallypoint moving ability on JIP +_group0 setVariable [QGVAR(leaderVarName), _leaderVarName]; + +_unit setVariable ["ACE_canMoveRallypoint", true, true]; diff --git a/addons/respawn/functions/fnc_handlePlayerChanged.sqf b/addons/respawn/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..db699066bc --- /dev/null +++ b/addons/respawn/functions/fnc_handlePlayerChanged.sqf @@ -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; + }; +}; diff --git a/addons/respawn/functions/fnc_handleRespawn.sqf b/addons/respawn/functions/fnc_handleRespawn.sqf index a9fe3293ac..33a0ec09e5 100644 --- a/addons/respawn/functions/fnc_handleRespawn.sqf +++ b/addons/respawn/functions/fnc_handleRespawn.sqf @@ -25,3 +25,8 @@ _respawnedUnit = _this select 0; if (GVAR(SavePreDeathGear)) then { [_respawnedUnit, GVAR(unitGear)] call FUNC(restoreGear); }; + +// fix for setVariable public being lost on respawn for machines that JIP after the command was broadcasted +if (_respawnedUnit getVariable ["ACE_canMoveRallypoint", false]) then { + _respawnedUnit setVariable ["ACE_canMoveRallypoint", true, true]; +}; diff --git a/addons/respawn/functions/fnc_initRallypoint.sqf b/addons/respawn/functions/fnc_initRallypoint.sqf index cb4d55146f..44671b7c45 100644 --- a/addons/respawn/functions/fnc_initRallypoint.sqf +++ b/addons/respawn/functions/fnc_initRallypoint.sqf @@ -16,17 +16,58 @@ #include "script_component.hpp" -private ["_rallypoint", "_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 { + // 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]; + + // 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."; diff --git a/addons/respawn/functions/fnc_moveRallypoint.sqf b/addons/respawn/functions/fnc_moveRallypoint.sqf index dcd4810844..62d2742ef9 100644 --- a/addons/respawn/functions/fnc_moveRallypoint.sqf +++ b/addons/respawn/functions/fnc_moveRallypoint.sqf @@ -26,8 +26,8 @@ _this spawn { _rallypoint = [ objNull, missionNamespace getVariable ["ACE_Rallypoint_West", objNull], - missionNamespace getVariable ["ACE_RallypointExit_East", objNull], - missionNamespace getVariable ["ACE_RallypointExit_Independent", objNull] + missionNamespace getVariable ["ACE_Rallypoint_East", objNull], + missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull] ] select ([west, east, independent] find _side) + 1; if (isNull _rallypoint) exitWith {}; @@ -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]; - [localize "STR_ACE_Respawn_Deploy"] call EFUNC(common,displayTextStructured); + ["rallypointMoved", [_rallypoint, _side, _position]] call EFUNC(common,globalEvent); + + [localize "STR_ACE_Respawn_Deployed"] call EFUNC(common,displayTextStructured); }; diff --git a/addons/respawn/functions/fnc_restoreGear.sqf b/addons/respawn/functions/fnc_restoreGear.sqf index 18afba344b..5a00e3425c 100644 --- a/addons/respawn/functions/fnc_restoreGear.sqf +++ b/addons/respawn/functions/fnc_restoreGear.sqf @@ -76,6 +76,8 @@ if (_goggles != "") then { _unit addItemToVest _x; }forEach _vestitems; +private "_flagRemoveDummyBag"; +_flagRemoveDummyBag = false; if(format["%1", _backpack] != "") then { _unit addBackpack _backpack; @@ -87,6 +89,12 @@ if(format["%1", _backpack] != "") then { { _unit addItemToBackpack _x; } forEach _backpackitems; + +} else { + // dummy backpack to ensure mags being loaded + _unit addBackpack "B_Kitbag_Base"; + + _flagRemoveDummyBag = true; }; @@ -138,6 +146,12 @@ if (_handgunweapon != "") then { }; +// remove dummy bagpack +if (_flagRemoveDummyBag) then { + removeBackpack _unit; +}; + + _assignedItems = _assignedItems - [_binocular]; // items diff --git a/addons/respawn/functions/fnc_teleportToRallypoint.sqf b/addons/respawn/functions/fnc_teleportToRallypoint.sqf index 8d898441ee..82a1d68e05 100644 --- a/addons/respawn/functions/fnc_teleportToRallypoint.sqf +++ b/addons/respawn/functions/fnc_teleportToRallypoint.sqf @@ -18,30 +18,19 @@ #include "script_component.hpp" -private ["_unit", "_side", "_toBase", "_rallypoint"]; +private ["_unit", "_side", "_rallypoint", "_toBase"]; _unit = _this select 0; _side = _this select 1; -_toBase = _this select 2; +_rallypoint = _this select 2; // rallypoint names are defined in CfgVehicles.hpp -_rallypoint = ([ - [ - objNull, - missionNamespace getVariable ["ACE_RallypointExit_West", objNull], - missionNamespace getVariable ["ACE_RallypointExit_East", objNull], - missionNamespace getVariable ["ACE_RallypointExit_Independent", objNull] - ], - [ - objNull, - missionNamespace getVariable ["ACE_Rallypoint_West", objNull], - missionNamespace getVariable ["ACE_Rallypoint_East", objNull], - missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull] - ] -] select _toBase) select ([west, east, independent] find _side) + 1; +_toBase = _rallypoint find "_Base" != -1; + +_rallypoint = missionNamespace getVariable [_rallypoint, objNull], if (isNull _rallypoint) exitWith {}; -_unit setPosASL (getPosASL _rallypoint); +_unit setPosASL getPosASL _rallypoint; [[localize "STR_ACE_Respawn_TeleportedToRallypoint", localize "STR_ACE_Respawn_TeleportedToBase"] select _toBase] call EFUNC(common,displayTextStructured); diff --git a/addons/respawn/functions/fnc_updateRallypoint.sqf b/addons/respawn/functions/fnc_updateRallypoint.sqf new file mode 100644 index 0000000000..248955155a --- /dev/null +++ b/addons/respawn/functions/fnc_updateRallypoint.sqf @@ -0,0 +1,18 @@ +// by commy2 +#include "script_component.hpp" + +private ["_rallypoint", "_side", "_position"]; + +_rallypoint = _this select 0; +_side = _this select 1; +_position = _this select 2; + +if (!hasInterface) exitWith {}; + +private ["_marker", "_markerDate"]; + +_marker = _rallypoint getVariable [QGVAR(marker), ""]; +_markerDate = _rallypoint getVariable [QGVAR(markerDate), ""]; + +_marker setMarkerPosLocal _position; +_marker setMarkerTextLocal _markerDate; diff --git a/addons/respawn/stringtable.xml b/addons/respawn/stringtable.xml index 1220d87cae..af003b4c28 100644 --- a/addons/respawn/stringtable.xml +++ b/addons/respawn/stringtable.xml @@ -41,5 +41,29 @@ Odteleportován na rallypoint Gyülekezőpontra teleportálva + + Rallypoint West (Base) + Sammelpunkt West (Basis) + + + Rallypoint East (Base) + Sammelpunkt Ost (Basis) + + + Rallypoint Independent (Base) + Sammelpunkt Widerstand (Basis) + + + Rallypoint West + Sammelpunkt West + + + Rallypoint East + Sammelpunkt Ost + + + Rallypoint Independent + Sammelpunkt Widerstand +