ACE3/addons/arsenal/missions/Arsenal.VR/XEH_postInit.sqf

116 lines
3.3 KiB
Plaintext
Raw Normal View History

2017-12-22 14:09:06 +00:00
#include "script_component.hpp"
2017-12-22 20:41:13 +00:00
#include "\z\ace\addons\arsenal\defines.hpp"
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
2017-12-22 14:09:06 +00:00
enableSaving [false, false];
2017-12-22 18:44:31 +00:00
cba_diagnostic_projectileMaxLines = 10;
2017-12-22 14:09:06 +00:00
[QGVAR(displayOpened), {
private _player = player;
// player pose
[{
switch (true) do {
case (primaryWeapon _this != ""): {
2017-12-22 18:44:31 +00:00
_this switchMove "amovpercmstpslowwrfldnon";
2017-12-22 14:09:06 +00:00
};
case (handgunWeapon _this != ""): {
2017-12-22 18:44:31 +00:00
_this switchMove "amovpercmstpslowwpstdnon";
2017-12-22 14:09:06 +00:00
};
default {
2017-12-22 18:44:31 +00:00
_this switchMove "amovpercmstpsnonwnondnon";
2017-12-22 14:09:06 +00:00
};
};
}, _player] call CBA_fnc_execNextFrame;
// hide everything except the player
{
_x enableSimulation false;
_x hideObject true;
2017-12-22 18:44:31 +00:00
} forEach (allMissionObjects "" - [_player]);
2017-12-22 14:09:06 +00:00
if ((_player getVariable ["cba_projectile_firedEhId", -1]) != -1) then {
_player call CBA_fnc_removeUnitTrackProjectiles;
};
2017-12-22 14:09:06 +00:00
_player setFatigue 0;
2017-12-22 20:41:13 +00:00
// Esc to close mission
{
private _display = findDisplay IDD_ace_arsenal;
_display displayAddEventHandler ["KeyDown", {
params ["_display", "_key", "_shift"];
if (_key isEqualTo DIK_ESCAPE && {!_shift}) then {
[_display] spawn {
disableSerialization;
params ["_display"];
private _return = [
localize "str_sure",
2017-12-22 20:54:55 +00:00
localize "str_a3_rscdisplaymain_buttonexit",
true, true,
2017-12-22 20:41:13 +00:00
_display, false, true
] call BIS_fnc_GUImessage;
if (_return) then {
2017-12-24 19:07:33 +00:00
profileNamespace setVariable [QGVAR(missionLastLoadout), getUnitLoadout player];
2017-12-22 20:41:13 +00:00
_display closeDisplay 2;
findDisplay 46 closeDisplay 0;
};
};
true
};
}];
2017-12-24 19:41:13 +00:00
private _buttonClose = _display displayCtrl IDC_menuBarClose;
_buttonClose ctrlSetText localize "str_a3_rscdisplayarsenal_buttonok";
2017-12-22 20:41:13 +00:00
} call CBA_fnc_execNextFrame;
2017-12-22 14:09:06 +00:00
}] call CBA_fnc_addEventHandler;
[QGVAR(displayClosed), {
private _player = player;
// unhide everthing
{
_x enableSimulation true;
_x hideObject false;
2017-12-22 18:44:31 +00:00
} forEach allMissionObjects "";
2017-12-22 14:09:06 +00:00
// update VR unit gear
{
private _unit = _x;
removeVest _unit;
_unit addVest vest _player;
removeBackpack _unit;
_unit addBackpack backpack _player;
removeHeadgear _unit;
_unit addHeadgear headgear _player;
removeGoggles _unit;
_unit addGoggles goggles _player;
removeAllWeapons _unit;
_unit addWeapon primaryWeapon _player;
{
_unit addPrimaryWeaponItem _x;
} forEach primaryWeaponItems _player;
_unit addWeapon secondaryWeapon _player;
{
_unit addSecondaryWeaponItem _x;
} forEach secondaryWeaponItems _player;
_unit addWeapon handgunWeapon _player;
{
_unit addHandgunItem _x;
} forEach handgunItems _player;
} forEach (entities [["B_Soldier_VR_F", "O_Soldier_VR_F", "I_Soldier_VR_F"], [], true]);
_player call CBA_fnc_addUnitTrackProjectiles;
}] call CBA_fnc_addEventHandler;