Skip to content

Commit

Permalink
Merge pull request #3930 from acemod/wireCuttersLOS
Browse files Browse the repository at this point in the history
Fix Line Of Sight check for wire cutter helper
  • Loading branch information
thojkooi authored Jun 16, 2016
2 parents fc24147 + 2bcc82c commit eedb406
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions addons/logistics_wirecutter/functions/fnc_interactEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,22 @@ TRACE_1("Starting wire-cut action PFEH",_interactionType);
[_player, _attachedFence] call FUNC(cutDownFence);
};
_fncCondition = {
params ["", "_player", "_attachedFence"];
params ["_helper", "_player", "_attachedFence"];
if (!([_player, _attachedFence, []] call EFUNC(common,canInteractWith))) exitWith {false};
((!isNull _attachedFence) && {(damage _attachedFence) < 1} && {("ACE_wirecutter" in (items _player))})
((!isNull _attachedFence) && {(damage _attachedFence) < 1} && {("ACE_wirecutter" in (items _player))} && {
//Custom LOS check for fence
private _headPos = ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot");
((!(lineIntersects [AGLtoASL _headPos, AGLtoASL (_helper modelToWorldVisual [0,0,1.25]), _attachedFence, ACE_player])) ||
{!(lineIntersects [AGLtoASL _headPos, getPosASL _attachedFence, _attachedFence, ACE_player])})
})
};

{
if (!(_x in _fencesHelped)) then {
if ([_x] call FUNC(isFence)) then {
_fencesHelped pushBack _x;
_helper = "ACE_LogicDummy" createVehicleLocal (getpos _x);
_action = [QGVAR(helperCutFence), (localize LSTRING(CutFence)), QPATHTOF(ui\wirecutter_ca.paa), _fncStatement, _fncCondition, {}, _x, {[0,0,0]}, 5.5] call EFUNC(interact_menu,createAction);
_action = [QGVAR(helperCutFence), (localize LSTRING(CutFence)), QPATHTOF(ui\wirecutter_ca.paa), _fncStatement, _fncCondition, {}, _x, {[0,0,0]}, 5.5, [false, false, false, false, true]] call EFUNC(interact_menu,createAction);
[_helper, 0, [],_action] call EFUNC(interact_menu,addActionToObject);
_helper setPosASL ((getPosASL _x) vectorAdd [0,0,1.25]);
_addedHelpers pushBack _helper;
Expand Down

0 comments on commit eedb406

Please sign in to comment.