Skip to content

Commit

Permalink
Handle locked doors (#5345)
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror authored and jonpas committed Jul 10, 2017
1 parent 6acd61a commit 01c1727
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions addons/interaction/functions/fnc_openDoor.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,25 @@
private _info = [MACRO_DOOR_REACH_DISTANCE] call FUNC(getDoor);

_info params ["_house", "_door"];
TRACE_2("openDoor",_house,_door);

if (isNull _house) exitWith {};

private _getDoorAnimations = [_house, _door] call FUNC(getDoorAnimations);

_getDoorAnimations params ["_animations", "_lockedVariable"];
_getDoorAnimations params ["_animations"];

if (_animations isEqualTo []) exitWith {};

private _lockedVariable = format ["bis_disabled_%1", _door];

//Check if the door can be locked aka have locked variable, otherwhise cant lock it
if (!(isNil (_lockedVariable select 0))) then {
if ((_house animationPhase (_animations select 0) <= 0) && {_house getVariable [_lockedVariable select 0, 0] == 1}) exitWith {
_lockedVariable set [0, _house];
_lockedVariable call BIS_fnc_LockedDoorOpen;
if ((_house animationPhase (_animations select 0) <= 0) && {_house getVariable [_lockedVariable, 0] == 1}) exitWith {
private _lockedAnimation = format ["%1_locked_source", _door];
TRACE_3("locked",_house,_lockedAnimation,isClass (configfile >> "CfgVehicles" >> (typeOf _house) >> "AnimationSources" >> _lockedAnimation));
if (isClass (configfile >> "CfgVehicles" >> (typeOf _house) >> "AnimationSources" >> _lockedAnimation)) then {
// from: a3\structures_f\scripts\fn_door.sqf: - wiggles the door handle (A3 buildings)
_house animateSource [_lockedAnimation, (1 - (_house animationSourcePhase _lockedAnimation))];
};
};

Expand Down

0 comments on commit 01c1727

Please sign in to comment.