2015-03-15 16:27:21 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
|
|
|
* Handles the inventory opening.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Container <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2016-04-24 16:26:13 +00:00
|
|
|
* None
|
2015-03-15 16:27:21 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, car] call ACE_VehicleLock_fnc_onOpenInventory;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-04 03:11:45 +00:00
|
|
|
params ["_unit", "_container"];
|
2015-08-07 18:24:47 +00:00
|
|
|
TRACE_2("params",_unit,_container);
|
2015-03-15 16:27:21 +00:00
|
|
|
|
|
|
|
//Only check for player:
|
2016-04-24 16:26:13 +00:00
|
|
|
if (_unit != ace_player) exitWith {};
|
2015-03-15 16:27:21 +00:00
|
|
|
|
|
|
|
if (GVAR(LockVehicleInventory) && //if setting not enabled
|
|
|
|
{(vehicle ace_player) == ace_player} && //Player dismounted
|
|
|
|
{(_container isKindOf "Car") || (_container isKindOf "Tank") || (_container isKindOf "Helicopter")} && //container is a lockable veh
|
|
|
|
{(locked _container) in [2,3]} && //Vehicle is locked
|
|
|
|
{!([ace_player, _container] call FUNC(hasKeyForVehicle))} //player doesn't have key
|
|
|
|
) then {
|
|
|
|
//Give feedback that vehicle is locked
|
|
|
|
playSound "ACE_Sound_Click";
|
2016-01-17 03:58:59 +00:00
|
|
|
|
2016-04-24 16:26:13 +00:00
|
|
|
//For compatibiltiy with ACRE, wait until the display is open, close it and then reopen the player's own inventory
|
|
|
|
//ref: http://gitlab.idi-systems.com/idi-systems/acre2-public/issues/70
|
2016-01-17 03:58:59 +00:00
|
|
|
[{
|
2016-04-24 16:26:13 +00:00
|
|
|
!isNull (findDisplay 602)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TRACE_1("car display open: closing", _this);
|
|
|
|
(findDisplay 602) closeDisplay 0;
|
|
|
|
[{
|
|
|
|
TRACE_1("Opening Player Inventory", _this);
|
|
|
|
ACE_player action ["Gear", objNull]
|
2016-05-22 13:27:24 +00:00
|
|
|
}, []] call CBA_fnc_execNextFrame;
|
2016-04-24 16:26:13 +00:00
|
|
|
},
|
2016-05-22 13:27:24 +00:00
|
|
|
[]] call CBA_fnc_waitUntilAndExecute;
|
2015-03-15 16:27:21 +00:00
|
|
|
};
|