Skip to content

Commit

Permalink
Implement new reinforcement system
Browse files Browse the repository at this point in the history
  • Loading branch information
James Kingsley committed Jun 23, 2016
1 parent b9cdc32 commit 478a6db
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 23 deletions.
43 changes: 27 additions & 16 deletions ARCMF.VR/f/arc/reinforcements/fn_rejoinMission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
* Public: Yes
*/

if (!(call ARC_fnc_isRespawnEnabled) && !ARC_reinforcements) exitWith {};

hint "Rejoining Mission";
params [
["_setPos", true],
["_applyLoadout", true],
["_execEH", true]
];

private ["_unit","_newGrp","_className","_newUnit"];

Expand Down Expand Up @@ -47,14 +49,16 @@ waitUntil {player == _newUnit};
// Set name, position and turns off safe mode, then deletes old unit
_newUnit setName ARC_cam_preCamName;

if ((getNumber (missionConfigFile >> "Header" >> "sandbox")) == 1) then {
_startPos = [(call ARC_fnc_getStartingPos), 20] call CBA_fnc_randPos;
_newUnit setPos _startPos;
} else {
if (isNil "ARC_reinforcementPosition") then {
_newUnit setPos ARC_cam_preCamPos;
if (_setPos) then {
if ((getNumber (missionConfigFile >> "Header" >> "sandbox")) == 1) then {
_startPos = [(call ARC_fnc_getStartingPos), 20] call CBA_fnc_randPos;
_newUnit setPos _startPos;
} else {
_newUnit setPos ARC_reinforcementPosition;
if (isNil "ARC_reinforcementPosition") then {
_newUnit setPos ARC_cam_preCamPos;
} else {
_newUnit setPos ARC_reinforcementPosition;
};
};
};

Expand All @@ -63,11 +67,13 @@ _newUnit hideObjectGlobal false;
deleteVehicle _unit;

// Apply loadout
if ((getNumber (missionConfigFile >> "Header" >> "sandbox")) == 1) then {
this = _newUnit;
call compile ARC_cam_preCamLoadout;
} else {
["r", _newUnit] call f_fnc_assignGear;
if (_applyLoadout) then {
if ((getNumber (missionConfigFile >> "Header" >> "sandbox")) == 1) then {
this = _newUnit;
call compile ARC_cam_preCamLoadout;
} else {
["r", _newUnit] call f_fnc_assignGear;
};
};

// Shutdown spectator
Expand All @@ -84,4 +90,9 @@ call compile preprocessFileLineNumbers "briefing.sqf";
call compile preprocessFileLineNumbers "f\briefing\f_orbatNotes.sqf";

// Execute onSpectatorRespawn script
[_newUnit, ARC_cam_preCamPos, ARC_cam_preCamLoadout] execVM "onSpectatorRespawn.sqf";
if (_execEH) then {
[_newUnit, ARC_cam_preCamPos, ARC_cam_preCamLoadout] execVM "onSpectatorRespawn.sqf";
};

mars_arcomm_reinforcementUnits pushBackUnique player;
publicVariable "mars_arcomm_reinforcementUnits";
7 changes: 7 additions & 0 deletions ARCMF.VR/f/arc/reinforcements/variables.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*if (isNil "ARC_reinforcements") then {
ARC_reinforcements = false;
};*/

if (isNil "ARC_reinforcements_joinArray") then {
ARC_reinforcements_joinArray = [];
};
10 changes: 8 additions & 2 deletions ARCMF.VR/f/spect/fn_CamInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ _this spawn {
["_forced", false]
];

ARC_isSpectating = true;
ARC_cam_preCamGroup = group player;
ARC_cam_preCamSide = playerSide;
ARC_cam_preCamName = name player;
ARC_cam_preCamPos = getPos player;
ARC_cam_preCamLoadout = [player, "init", false] call BIS_fnc_exportInventory;

if (isNil "ARC_reinforcements_joinArray") then {
ARC_reinforcements_joinArray = [];
};

if (isNil "f_cam_isJIP") then {f_cam_isJIP = false};
if (isNull _unit) then {_unit = cameraOn; f_cam_isJIP = true};
Expand Down Expand Up @@ -43,6 +48,7 @@ _this spawn {
_newUnit setPos [0,0,5];
selectPlayer _newUnit;
waitUntil {player == _newUnit};
player setVariable ["ARC_cam_preCamSide", ARC_cam_preCamSide, true];
deleteVehicle _unit;
f_cam_VirtualCreated = true;
};
Expand Down Expand Up @@ -191,7 +197,7 @@ _this spawn {
_w = _w + _btnWidth;
} forEach f_cam_menuControls;

if (!(call ARC_fnc_isRespawnEnabled) || !ARC_reinforcements) then {
/*if (!(call ARC_fnc_isRespawnEnabled) || !ARC_reinforcements) then {
((findDisplay 9228) displayCtrl 5532) ctrlSetTooltip "Not available";
} else {
((findDisplay 9228) displayCtrl 5532) ctrlSetTooltip "Rejoin the mission";
Expand All @@ -206,7 +212,7 @@ _this spawn {
} else {
((findDisplay 9228) displayCtrl 5532) ctrlSetTooltip "Not available";
};
};
};*/

f_cam_helptext = "<t align='left'><t color='#FFFFFF'><t size='1.5'>Camera</t><br />Hold Right-Click to pan the camera<br />Use the Scroll-Wheel or Numpad +/- to zoom in and out<br />Use Ctrl + Right-Click to change FOV zoom<br />Press Space to toggle freecam<br /><br /><t size='1.5'>Interface</t><br />Press H to toggle the help window<br />Press M to toggle between no map, minimap and full size map<br />Press T to toggle tracers on the map<br />Press I to toggle tags</t></t>";

Expand Down
3 changes: 2 additions & 1 deletion ARCMF.VR/f/spect/fn_ForceExit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ hintSilent "Spectator system has been forcefully closed";
_x removeEventHandler ["fired", _var];
};
false
} count (allunits + vehicles);
} count (allunits + vehicles);
ARC_isSpectating = false;
5 changes: 4 additions & 1 deletion ARCMF.VR/f/spect/fn_HandleMenu.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ switch (_button) do {
}
};
case 4: { // Rejoin mission Button
[] call ARC_fnc_rejoinMission;
ARC_reinforcements_joinArray pushBackUnique player;
publicVariable "ARC_reinforcements_joinArray";
hint "Waiting for admin to trigger reinforcement wave.";
// [] call ARC_fnc_rejoinMission;
};
case 5: { // 3D Tracers
// 0="Off", 1="Players", 2="AI", 3="Both"
Expand Down
6 changes: 3 additions & 3 deletions ARCMF.VR/init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ enableSentences false;
#include "f\safeStart\f_safeStart.sqf"

// Reinforcements
if (isNil "ARC_reinforcements") then {
ARC_reinforcements = false;
};
#include "f\arc\reinforcements\variables.sqf"

// Adversarial Mode
if (isNil "ARC_adversarialMode") then {
ARC_adversarialMode = false;
};

ARC_isSpectating = false;

// Radio Systems Support
#include "f\radios\acre2\acre2_init.sqf"

Expand Down

0 comments on commit 478a6db

Please sign in to comment.