Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Line Of Sight check for wire cutter helper #3930

Merged
merged 1 commit into from
Jun 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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