localized names for rallypoints, auto assign slot of group leader at the start of the mission as JIP persistant rallypoint mover slot

This commit is contained in:
commy2 2015-04-15 08:31:40 +02:00
parent 44fad81fe1
commit 6c4e50a98d
6 changed files with 99 additions and 6 deletions

View File

@ -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));
};
};
};

View File

@ -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 {

View File

@ -5,6 +5,7 @@ ADDON = false;
PREP(canMoveRallypoint);
PREP(handleKilled);
PREP(handleRespawn);
PREP(handleInitPostServer);
PREP(initRallypoint);
PREP(module);
PREP(moduleFriendlyFire);

View File

@ -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];

View File

@ -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];
};

View File

@ -37,5 +37,29 @@
<Polish>Przeteleportowano do punktu zbiórki</Polish>
<Czech>Odteleportován na rallypoint</Czech>
</Key>
<Key ID="STR_ACE_Respawn_RallypointWestBase">
<English>Rallypoint West (Base)</English>
<German>Sammelpunkt West (Basis)</German>
</Key>
<Key ID="STR_ACE_Respawn_RallypointEastBase">
<English>Rallypoint East (Base)</English>
<German>Sammelpunkt Ost (Basis)</German>
</Key>
<Key ID="STR_ACE_Respawn_RallypointIndependentBase">
<English>Rallypoint Independent (Base)</English>
<German>Sammelpunkt Widerstand (Basis)</German>
</Key>
<Key ID="STR_ACE_Respawn_RallypointWest">
<English>Rallypoint West</English>
<German>Sammelpunkt West</German>
</Key>
<Key ID="STR_ACE_Respawn_RallypointEast">
<English>Rallypoint East</English>
<German>Sammelpunkt Ost</German>
</Key>
<Key ID="STR_ACE_Respawn_RallypointIndependent">
<English>Rallypoint Independent</English>
<German>Sammelpunkt Widerstand</German>
</Key>
</Package>
</Project>