2015-01-11 19:32:51 +00:00
|
|
|
// by commy2
|
2015-01-11 23:13:47 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 19:32:51 +00:00
|
|
|
|
|
|
|
private ["_info", "_house", "_door", "_animations", "_lockedVariable"];
|
|
|
|
|
2015-01-11 23:13:47 +00:00
|
|
|
_info = [2] call FUNC(getDoor);
|
2015-01-11 19:32:51 +00:00
|
|
|
|
|
|
|
_house = _info select 0;
|
|
|
|
_door = _info select 1;
|
|
|
|
|
|
|
|
if (isNull _house) exitWith {};
|
|
|
|
|
2015-01-11 23:13:47 +00:00
|
|
|
_animations = [_house, _door] call FUNC(getDoorAnimations);
|
2015-01-11 19:32:51 +00:00
|
|
|
|
|
|
|
_lockedVariable = _animations select 1;
|
|
|
|
_animations = _animations select 0;
|
|
|
|
|
|
|
|
if (count _animations == 0) exitWith {};
|
|
|
|
|
|
|
|
if (_house animationPhase (_animations select 0) <= 0 && {_house getVariable [_lockedVariable select 0, 0] == 1}) exitWith {
|
2015-04-06 16:22:43 +00:00
|
|
|
_lockedVariable set [0, _house];
|
|
|
|
_lockedVariable spawn compile preprocessFileLineNumbers "\A3\Structures_F\scripts\LockedDoor_open.sqf";
|
2015-01-11 19:32:51 +00:00
|
|
|
};
|
|
|
|
|
2015-01-11 23:13:47 +00:00
|
|
|
GVAR(isOpeningDoor) = true;
|
2015-01-12 04:20:02 +00:00
|
|
|
playSound "ACE_Sound_Click";
|
2015-01-11 19:32:51 +00:00
|
|
|
|
|
|
|
[_house, _animations] spawn {
|
2015-04-06 16:22:43 +00:00
|
|
|
_house = _this select 0;
|
|
|
|
_animations = _this select 1;
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-04-06 16:22:43 +00:00
|
|
|
_phase = _house animationPhase (_animations select 0);
|
|
|
|
_position = getPosASL ACE_player;
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-04-06 16:22:43 +00:00
|
|
|
_time = time + 0.2;
|
|
|
|
_usedMouseWheel = false;
|
|
|
|
waitUntil {
|
|
|
|
if (inputAction "PrevAction" > 0 || {inputAction "NextAction" > 0}) then {
|
|
|
|
_usedMouseWheel = true;
|
|
|
|
};
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-04-06 16:22:43 +00:00
|
|
|
_phase = _phase + (inputAction "PrevAction" / 12) min 1;
|
|
|
|
_phase = _phase - (inputAction "NextAction" / 12) max 0;
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-04-06 16:22:43 +00:00
|
|
|
{_house animate [_x, _phase]} forEach _animations;
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-04-06 16:22:43 +00:00
|
|
|
!GVAR(isOpeningDoor) || {getPosASL ACE_player distance _position > 1}
|
|
|
|
};
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-04-06 16:22:43 +00:00
|
|
|
if (!_usedMouseWheel && {time < _time} && {[ACE_player, objNull, []] call EFUNC(common,canInteractWith)}) then {
|
|
|
|
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-04-06 16:22:43 +00:00
|
|
|
{_house animate [_x, _phase]} forEach _animations;
|
|
|
|
};
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-04-06 16:22:43 +00:00
|
|
|
GVAR(isOpeningDoor) = false;
|
2015-01-11 19:32:51 +00:00
|
|
|
};
|