From f94b4befef50ef1c4c82c64ec762e19fc72161be Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 13 Apr 2015 13:04:23 +0200 Subject: [PATCH 1/9] initial commit --- addons/respawn/CfgVehicles.hpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index f6b8fc64c2..4b763074c2 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -69,7 +69,9 @@ class CfgVehicles { }; // static - class ACE_Rallypoint_West : Flag_NATO_F { + class ACE_Rallypoint_West: Flag_NATO_F { + XEH_ENABLED; + author = "$STR_ACE_Common_ACETeam"; displayName = "Rallypoint West Base"; vehicleClass = QGVAR(Rallypoints); @@ -94,7 +96,9 @@ class CfgVehicles { }; }; - class ACE_Rallypoint_East : Flag_CSAT_F { + class ACE_Rallypoint_East: Flag_CSAT_F { + XEH_ENABLED; + author = "$STR_ACE_Common_ACETeam"; displayName = "Rallypoint East Base"; vehicleClass = QGVAR(Rallypoints); @@ -119,7 +123,9 @@ class CfgVehicles { }; }; - class ACE_Rallypoint_Independent : Flag_AAF_F { + class ACE_Rallypoint_Independent: Flag_AAF_F { + XEH_ENABLED; + author = "$STR_ACE_Common_ACETeam"; displayName = "Rallypoint Independent Base"; vehicleClass = QGVAR(Rallypoints); @@ -145,7 +151,9 @@ class CfgVehicles { }; // moveable - class ACE_RallypointExit_West : Flag_NATO_F { + class ACE_RallypointExit_West: Flag_NATO_F { + XEH_ENABLED; + author = "$STR_ACE_Common_ACETeam"; displayName = "Rallypoint West"; vehicleClass = QGVAR(Rallypoints); @@ -170,7 +178,9 @@ class CfgVehicles { }; }; - class ACE_RallypointExit_East : Flag_CSAT_F { + class ACE_RallypointExit_East: Flag_CSAT_F { + XEH_ENABLED; + author = "$STR_ACE_Common_ACETeam"; displayName = "Rallypoint East"; vehicleClass = QGVAR(Rallypoints); @@ -195,7 +205,9 @@ class CfgVehicles { }; }; - class ACE_RallypointExit_Independent : Flag_AAF_F { + class ACE_RallypointExit_Independent: Flag_AAF_F { + XEH_ENABLED; + author = "$STR_ACE_Common_ACETeam"; displayName = "Rallypoint Independent"; vehicleClass = QGVAR(Rallypoints); From 4cdf61ab9eb0bfe89b8c40fb0da390c638229a57 Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 15 Apr 2015 01:50:58 +0200 Subject: [PATCH 2/9] fix misc issues with rallypoints --- addons/respawn/CfgEventHandlers.hpp | 43 ++- addons/respawn/CfgVehicles.hpp | 330 ++++++++---------- .../respawn/functions/fnc_moveRallypoint.sqf | 6 +- addons/respawn/functions/fnc_restoreGear.sqf | 14 + .../functions/fnc_teleportToRallypoint.sqf | 23 +- 5 files changed, 210 insertions(+), 206 deletions(-) diff --git a/addons/respawn/CfgEventHandlers.hpp b/addons/respawn/CfgEventHandlers.hpp index c4a50615d1..7b00950931 100644 --- a/addons/respawn/CfgEventHandlers.hpp +++ b/addons/respawn/CfgEventHandlers.hpp @@ -6,15 +6,54 @@ class Extended_PreInit_EventHandlers { 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'; _this call FUNC(initRallypoint)); + }; + }; + + class ACE_Rallypoint_East { + class ADDON { + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint)); + }; + }; + + class ACE_Rallypoint_Independent { + class ADDON { + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint)); + }; + }; + + class ACE_Rallypoint_West_Base { + class ADDON { + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint)); + }; + }; + + class ACE_Rallypoint_East_Base { + class ADDON { + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint)); + }; + }; + + class ACE_Rallypoint_Independent_Base { + class ADDON { + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint)); + }; + }; +}; diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index 4b763074c2..c8ca4f9216 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,186 +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 { - XEH_ENABLED; - - 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 { - XEH_ENABLED; - - 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 { - XEH_ENABLED; - - 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 { - XEH_ENABLED; - - 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 { - XEH_ENABLED; - - 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 { - XEH_ENABLED; - - 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 @@ -245,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 = "Rallypoint West Base"; + 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 = "Rallypoint East Base"; + 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 = "Rallypoint Independent Base"; + 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 = "Rallypoint West"; + 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 = "Rallypoint East"; + 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 = "Rallypoint Independent"; + 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/functions/fnc_moveRallypoint.sqf b/addons/respawn/functions/fnc_moveRallypoint.sqf index dcd4810844..d937363310 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 {}; @@ -50,5 +50,5 @@ _this spawn { _marker setMarkerTextLocal format ["%1:%2", [date select 3, 2, 0] call CBA_fnc_FORMATNumber, [date select 4, 2, 0] call CBA_fnc_FORMATNumber]; */ - [localize "STR_ACE_Respawn_Deploy"] call EFUNC(common,displayTextStructured); + [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); From 2940d1f83cc521b9f89835f57f263709f7dfe3b2 Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 15 Apr 2015 03:10:17 +0200 Subject: [PATCH 3/9] base rallypoints create a respawn marker if none is present in the mission --- addons/respawn/CfgEventHandlers.hpp | 14 ++++++++------ addons/respawn/functions/fnc_initRallypoint.sqf | 7 ++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/addons/respawn/CfgEventHandlers.hpp b/addons/respawn/CfgEventHandlers.hpp index 7b00950931..9ff7a2bae8 100644 --- a/addons/respawn/CfgEventHandlers.hpp +++ b/addons/respawn/CfgEventHandlers.hpp @@ -23,37 +23,39 @@ class Extended_Respawn_EventHandlers { class Extended_Init_EventHandlers { class ACE_Rallypoint_West { class ADDON { - init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint)); + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; [ARR_2(_this select 0,'')] call FUNC(initRallypoint)); }; }; class ACE_Rallypoint_East { class ADDON { - init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint)); + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; [ARR_2(_this select 0,'')] call FUNC(initRallypoint)); }; }; class ACE_Rallypoint_Independent { class ADDON { - init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint)); + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; [ARR_2(_this select 0,'')] call FUNC(initRallypoint)); }; }; class ACE_Rallypoint_West_Base { class ADDON { - init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint)); + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; [ARR_2(_this select 0,'respawn_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'; _this call FUNC(initRallypoint)); + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; [ARR_2(_this select 0,'respawn_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'; _this call FUNC(initRallypoint)); + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; [ARR_2(_this select 0,'respawn_guerrila')] call FUNC(initRallypoint)); }; }; + + //respawn_civilian }; diff --git a/addons/respawn/functions/fnc_initRallypoint.sqf b/addons/respawn/functions/fnc_initRallypoint.sqf index cb4d55146f..c266026e11 100644 --- a/addons/respawn/functions/fnc_initRallypoint.sqf +++ b/addons/respawn/functions/fnc_initRallypoint.sqf @@ -16,9 +16,10 @@ #include "script_component.hpp" -private ["_rallypoint", "_name"]; +private ["_rallypoint", "_respawnMarker", "_name"]; _rallypoint = _this select 0; +_respawnMarker = _this select 1; if (!local _rallypoint) exitWith {}; @@ -31,3 +32,7 @@ if (isNil _name) then { deleteVehicle _rallypoint; diag_log text "[ACE] Respawn: ERROR Multiple Rallypoints of same type."; }; + +if (isServer && {_respawnMarker != ""} && {!(_respawnMarker in allMapMarkers)}) then { + createMarker [_respawnMarker, _rallypoint]; +}; From 6c4e50a98de7a6186ef2d82c5ac0aa07b9e71359 Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 15 Apr 2015 08:31:40 +0200 Subject: [PATCH 4/9] localized names for rallypoints, auto assign slot of group leader at the start of the mission as JIP persistant rallypoint mover slot --- addons/respawn/CfgEventHandlers.hpp | 9 ++++ addons/respawn/CfgVehicles.hpp | 12 ++--- addons/respawn/XEH_preInit.sqf | 1 + .../functions/fnc_handleInitPostServer.sqf | 54 +++++++++++++++++++ .../respawn/functions/fnc_handleRespawn.sqf | 5 ++ addons/respawn/stringtable.xml | 24 +++++++++ 6 files changed, 99 insertions(+), 6 deletions(-) create mode 100644 addons/respawn/functions/fnc_handleInitPostServer.sqf diff --git a/addons/respawn/CfgEventHandlers.hpp b/addons/respawn/CfgEventHandlers.hpp index 9ff7a2bae8..6d7356a607 100644 --- a/addons/respawn/CfgEventHandlers.hpp +++ b/addons/respawn/CfgEventHandlers.hpp @@ -59,3 +59,12 @@ class Extended_Init_EventHandlers { //respawn_civilian }; + +// auto assign rallypoint leader +class Extended_InitPost_EventHandlers { + class CAManBase { + class ADDON { + init = QUOTE(_this call FUNC(handleInitPostServer)); + }; + }; +}; diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index c8ca4f9216..28e33c6b3e 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -91,7 +91,7 @@ class CfgVehicles { XEH_ENABLED; author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint West Base"; + displayName = "$STR_ACE_Respawn_RallypointWestBase"; vehicleClass = QGVAR(Rallypoints); class ACE_Actions: ACE_Actions { @@ -111,7 +111,7 @@ class CfgVehicles { XEH_ENABLED; author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint East Base"; + displayName = "$STR_ACE_Respawn_RallypointEastBase"; vehicleClass = QGVAR(Rallypoints); class ACE_Actions: ACE_Actions { @@ -131,7 +131,7 @@ class CfgVehicles { XEH_ENABLED; author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint Independent Base"; + displayName = "$STR_ACE_Respawn_RallypointIndependentBase"; vehicleClass = QGVAR(Rallypoints); class ACE_Actions: ACE_Actions { @@ -152,7 +152,7 @@ class CfgVehicles { XEH_ENABLED; author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint West"; + displayName = "STR_ACE_Respawn_RallypointWest"; vehicleClass = QGVAR(Rallypoints); class ACE_Actions: ACE_Actions { @@ -172,7 +172,7 @@ class CfgVehicles { XEH_ENABLED; author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint East"; + displayName = "STR_ACE_Respawn_RallypointEast"; vehicleClass = QGVAR(Rallypoints); class ACE_Actions: ACE_Actions { @@ -192,7 +192,7 @@ class CfgVehicles { XEH_ENABLED; author = "$STR_ACE_Common_ACETeam"; - displayName = "Rallypoint Independent"; + displayName = "STR_ACE_Respawn_RallypointIndependent"; vehicleClass = QGVAR(Rallypoints); class ACE_Actions: ACE_Actions { diff --git a/addons/respawn/XEH_preInit.sqf b/addons/respawn/XEH_preInit.sqf index f57e1f3714..8b3f309126 100644 --- a/addons/respawn/XEH_preInit.sqf +++ b/addons/respawn/XEH_preInit.sqf @@ -5,6 +5,7 @@ ADDON = false; PREP(canMoveRallypoint); PREP(handleKilled); PREP(handleRespawn); +PREP(handleInitPostServer); PREP(initRallypoint); PREP(module); PREP(moduleFriendlyFire); diff --git a/addons/respawn/functions/fnc_handleInitPostServer.sqf b/addons/respawn/functions/fnc_handleInitPostServer.sqf new file mode 100644 index 0000000000..c83354b24e --- /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 [QGVAR(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_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/stringtable.xml b/addons/respawn/stringtable.xml index 2aa4360275..958bc9b56f 100644 --- a/addons/respawn/stringtable.xml +++ b/addons/respawn/stringtable.xml @@ -37,5 +37,29 @@ Przeteleportowano do punktu zbiórki Odteleportován na rallypoint + + 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 + From 09289fbf48098ffe23ba0bde1065472d2ce814cc Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 15 Apr 2015 08:34:30 +0200 Subject: [PATCH 5/9] only on server though --- addons/respawn/CfgEventHandlers.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/respawn/CfgEventHandlers.hpp b/addons/respawn/CfgEventHandlers.hpp index 6d7356a607..58aa8995ee 100644 --- a/addons/respawn/CfgEventHandlers.hpp +++ b/addons/respawn/CfgEventHandlers.hpp @@ -64,7 +64,7 @@ class Extended_Init_EventHandlers { class Extended_InitPost_EventHandlers { class CAManBase { class ADDON { - init = QUOTE(_this call FUNC(handleInitPostServer)); + serverInit = QUOTE(_this call FUNC(handleInitPostServer)); }; }; }; From bf8f9b48182ddcc02c485bf1dad7cee1da407dd7 Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 15 Apr 2015 15:34:01 +0200 Subject: [PATCH 6/9] all I need is a $ --- addons/respawn/CfgVehicles.hpp | 6 +++--- addons/respawn/functions/fnc_handleInitPostServer.sqf | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index 28e33c6b3e..56d2058d2c 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -152,7 +152,7 @@ class CfgVehicles { XEH_ENABLED; author = "$STR_ACE_Common_ACETeam"; - displayName = "STR_ACE_Respawn_RallypointWest"; + displayName = "$STR_ACE_Respawn_RallypointWest"; vehicleClass = QGVAR(Rallypoints); class ACE_Actions: ACE_Actions { @@ -172,7 +172,7 @@ class CfgVehicles { XEH_ENABLED; author = "$STR_ACE_Common_ACETeam"; - displayName = "STR_ACE_Respawn_RallypointEast"; + displayName = "$STR_ACE_Respawn_RallypointEast"; vehicleClass = QGVAR(Rallypoints); class ACE_Actions: ACE_Actions { @@ -192,7 +192,7 @@ class CfgVehicles { XEH_ENABLED; author = "$STR_ACE_Common_ACETeam"; - displayName = "STR_ACE_Respawn_RallypointIndependent"; + displayName = "$STR_ACE_Respawn_RallypointIndependent"; vehicleClass = QGVAR(Rallypoints); class ACE_Actions: ACE_Actions { diff --git a/addons/respawn/functions/fnc_handleInitPostServer.sqf b/addons/respawn/functions/fnc_handleInitPostServer.sqf index c83354b24e..f8a0479717 100644 --- a/addons/respawn/functions/fnc_handleInitPostServer.sqf +++ b/addons/respawn/functions/fnc_handleInitPostServer.sqf @@ -41,7 +41,7 @@ if (_leaderVarName == "") then { private "_leaderID"; _leaderID = GETGVAR(NextLeaderID,0); - _leaderVarName = format [QGVAR(Rallypoint_Leader_%1), _leaderID]; + _leaderVarName = format [QUOTE(ACE_Rallypoint_Leader_%1), _leaderID]; _unit setVehicleVarName _leaderVarName; From 9c1b40f5a36bb20435a488ca343c25377b02134e Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 15 Apr 2015 16:40:20 +0200 Subject: [PATCH 7/9] preparing for improved positions of action points --- addons/respawn/CfgVehicles.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index 56d2058d2c..384376b00c 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -100,7 +100,7 @@ class CfgVehicles { 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}; + position = "[0,0,-1]"; showDisabled = 1; priority = 1; }; @@ -120,7 +120,7 @@ class CfgVehicles { 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}; + position = "[0,0,-1]"; showDisabled = 1; priority = 1; }; @@ -140,7 +140,7 @@ class CfgVehicles { 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}; + position = "[0,0,-1]"; showDisabled = 1; priority = 1; }; @@ -161,7 +161,7 @@ class CfgVehicles { 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}; + position = "[0,0,-1]"; showDisabled = 1; priority = 1; }; @@ -181,7 +181,7 @@ class CfgVehicles { 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}; + position = "[0,0,-1]"; showDisabled = 1; priority = 1; }; @@ -201,7 +201,7 @@ class CfgVehicles { 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}; + position = "[0,0,-1]"; showDisabled = 1; priority = 1; }; From 18be5276a9171e1b85b18a67240ea620eee05b0c Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 15 Apr 2015 19:18:42 +0200 Subject: [PATCH 8/9] rally point moved eh, markers at rallypoint positions --- addons/respawn/CfgEventHandlers.hpp | 7 +++ addons/respawn/XEH_postInit.sqf | 5 +++ addons/respawn/XEH_preInit.sqf | 2 + .../functions/fnc_handlePlayerChanged.sqf | 44 +++++++++++++++++++ .../respawn/functions/fnc_initRallypoint.sqf | 44 ++++++++++++++++--- .../respawn/functions/fnc_moveRallypoint.sqf | 8 ++-- .../functions/fnc_updateRallypoint.sqf | 17 +++++++ 7 files changed, 115 insertions(+), 12 deletions(-) create mode 100644 addons/respawn/XEH_postInit.sqf create mode 100644 addons/respawn/functions/fnc_handlePlayerChanged.sqf create mode 100644 addons/respawn/functions/fnc_updateRallypoint.sqf diff --git a/addons/respawn/CfgEventHandlers.hpp b/addons/respawn/CfgEventHandlers.hpp index 58aa8995ee..46ebd08657 100644 --- a/addons/respawn/CfgEventHandlers.hpp +++ b/addons/respawn/CfgEventHandlers.hpp @@ -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 { 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 8b3f309126..dd116f108c 100644 --- a/addons/respawn/XEH_preInit.sqf +++ b/addons/respawn/XEH_preInit.sqf @@ -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; 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_initRallypoint.sqf b/addons/respawn/functions/fnc_initRallypoint.sqf index c266026e11..81058614ed 100644 --- a/addons/respawn/functions/fnc_initRallypoint.sqf +++ b/addons/respawn/functions/fnc_initRallypoint.sqf @@ -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]; -}; diff --git a/addons/respawn/functions/fnc_moveRallypoint.sqf b/addons/respawn/functions/fnc_moveRallypoint.sqf index d937363310..2b008bf122 100644 --- a/addons/respawn/functions/fnc_moveRallypoint.sqf +++ b/addons/respawn/functions/fnc_moveRallypoint.sqf @@ -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); }; diff --git a/addons/respawn/functions/fnc_updateRallypoint.sqf b/addons/respawn/functions/fnc_updateRallypoint.sqf new file mode 100644 index 0000000000..2510a58a30 --- /dev/null +++ b/addons/respawn/functions/fnc_updateRallypoint.sqf @@ -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; From d68cc8f40e86e04996cc9977f677aca6e56fe0da Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 15 Apr 2015 20:50:03 +0200 Subject: [PATCH 9/9] sync rallypoint marker on jip --- addons/respawn/CfgEventHandlers.hpp | 16 +++++----- .../respawn/functions/fnc_initRallypoint.sqf | 30 +++++++++++-------- .../respawn/functions/fnc_moveRallypoint.sqf | 2 +- .../functions/fnc_updateRallypoint.sqf | 5 ++-- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/addons/respawn/CfgEventHandlers.hpp b/addons/respawn/CfgEventHandlers.hpp index 46ebd08657..00b6f01cea 100644 --- a/addons/respawn/CfgEventHandlers.hpp +++ b/addons/respawn/CfgEventHandlers.hpp @@ -30,45 +30,43 @@ class Extended_Respawn_EventHandlers { 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_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 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 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 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 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 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 { + // auto assign rallypoint leader class CAManBase { class ADDON { serverInit = QUOTE(_this call FUNC(handleInitPostServer)); diff --git a/addons/respawn/functions/fnc_initRallypoint.sqf b/addons/respawn/functions/fnc_initRallypoint.sqf index 81058614ed..44671b7c45 100644 --- a/addons/respawn/functions/fnc_initRallypoint.sqf +++ b/addons/respawn/functions/fnc_initRallypoint.sqf @@ -27,25 +27,31 @@ _name = typeOf _rallypoint; // init visible marker 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 - if (_marker in allMapMarkers) exitWith {}; + // exit if it already exist + if (_marker in allMapMarkers) exitWith {}; - _marker = createMarkerLocal [_marker, getPosASL _rallypoint]; - _type = ["selector_selectedFriendly", "selector_selectedEnemy"] select (_respawnMarker == ""); + _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 + _marker setMarkerTypeLocal _type; + _marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init - private "_markerDate"; - _markerDate = _rallypoint getVariable [QGVAR(markerDate), ""]; + private "_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 {}; diff --git a/addons/respawn/functions/fnc_moveRallypoint.sqf b/addons/respawn/functions/fnc_moveRallypoint.sqf index 2b008bf122..62d2742ef9 100644 --- a/addons/respawn/functions/fnc_moveRallypoint.sqf +++ b/addons/respawn/functions/fnc_moveRallypoint.sqf @@ -46,7 +46,7 @@ _this spawn { _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); }; diff --git a/addons/respawn/functions/fnc_updateRallypoint.sqf b/addons/respawn/functions/fnc_updateRallypoint.sqf index 2510a58a30..248955155a 100644 --- a/addons/respawn/functions/fnc_updateRallypoint.sqf +++ b/addons/respawn/functions/fnc_updateRallypoint.sqf @@ -1,10 +1,11 @@ // by commy2 #include "script_component.hpp" -private ["_rallypoint", "_side"]; +private ["_rallypoint", "_side", "_position"]; _rallypoint = _this select 0; _side = _this select 1; +_position = _this select 2; if (!hasInterface) exitWith {}; @@ -13,5 +14,5 @@ private ["_marker", "_markerDate"]; _marker = _rallypoint getVariable [QGVAR(marker), ""]; _markerDate = _rallypoint getVariable [QGVAR(markerDate), ""]; -_marker setMarkerPosLocal getPosASL _rallypoint; +_marker setMarkerPosLocal _position; _marker setMarkerTextLocal _markerDate;