Skip to content

Commit

Permalink
Fix facility is like vehicle (#6478)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dystopian authored and PabstMirror committed Aug 6, 2018
1 parent fd583bc commit d3a53dd
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions addons/repair/functions/fnc_isInRepairFacility.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,22 @@ TRACE_1("params",_object);
private _position = getPosASL _object;
private _isInBuilding = false;

private _objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position select 2)], _object modelToWorldVisual [0, 0, (_position select 2) +10], _object]);
{
if (_x getVariable ["ACE_isRepairFacility", getNumber (configFile >> "CfgVehicles" >> typeOf _x >> QGVAR(canRepair))] > 0) exitWith {
private _checkObject = {
if (
_x getVariable ["ACE_isRepairFacility", getNumber (configFile >> "CfgVehicles" >> typeOf _x >> QGVAR(canRepair))] > 0
&& {!(_x isKindOf "AllVehicles")} // check if it's not repair vehicle
&& {alive _x}
) exitWith {
_isInBuilding = true;
};
} forEach _objects;

if (!_isInBuilding) then {
_objects = position _object nearObjects 7.5;
{
if (_x getVariable ["ACE_isRepairFacility", getNumber (configFile >> "CfgVehicles" >> typeOf _x >> QGVAR(canRepair))] > 0) exitWith {
_isInBuilding = true;
};
} forEach _objects;
};
_isInBuilding;

private _objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position select 2)], _object modelToWorldVisual [0, 0, (_position select 2) +10], _object]);
_checkObject forEach _objects;

if (_isInBuilding) exitWith {true};

_objects = position _object nearObjects 7.5;
_checkObject forEach _objects;

_isInBuilding

0 comments on commit d3a53dd

Please sign in to comment.