ACE3/addons/movement/functions/fnc_canClimb.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

73 lines
2.6 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: commy2
* Tests the the player can climb.
*
* Arguments:
* 0: The Unit (usually the player) <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player] call ace_movement_fnc_canClimb
*
* Public: No
*/
params ["_unit"];
private _pos = getPosASL _unit;
private _dir = getDir _unit;
_dir = [sin _dir, cos _dir, 0];
private _checkPos0beg = _pos vectorAdd [0, 0, 0.9];
private _checkPos0end = _checkPos0beg vectorAdd (_dir vectorMultiply 1.3);
private _checkPos1beg = _pos vectorAdd [0, 0, 1.75];
private _checkPos1end = _checkPos1beg vectorAdd (_dir vectorMultiply 1.3);
private _checkPos2beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 2.0];
private _checkPos2end = _checkPos2beg vectorAdd (_dir vectorMultiply 1.3);
private _checkPos3beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 2.0];
private _checkPos3end = _checkPos3beg vectorAdd (_dir vectorMultiply 1.3);
private _checkPos4beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 1.5];
private _checkPos4end = _checkPos4beg vectorAdd (_dir vectorMultiply 1.3);
private _checkPos5beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 1.5];
private _checkPos5end = _checkPos5beg vectorAdd (_dir vectorMultiply 1.3);
#ifdef DEBUG_MODE_FULL
[{
params ["_args", "_idPFH"];
if (diag_tickTime > (_args select 0) + 5) exitWith {
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
drawLine3D [ASLToATL (_args select 1), ASLToATL (_args select 2), [0,1,0,1]];
drawLine3D [ASLToATL (_args select 3), ASLToATL (_args select 4), [1,0,0,1]];
drawLine3D [ASLToATL (_args select 5), ASLToATL (_args select 6), [1,0.5,0.5,1]];
drawLine3D [ASLToATL (_args select 7), ASLToATL (_args select 8), [1,0.5,0.5,1]];
drawLine3D [ASLToATL (_args select 9), ASLToATL (_args select 10), [1,0.5,0.5,1]];
drawLine3D [ASLToATL (_args select 11), ASLToATL (_args select 12), [1,0.5,0.5,1]];
}, 0, [ diag_tickTime,
_checkPos0beg, _checkPos0end,
_checkPos1beg, _checkPos1end,
_checkPos2beg, _checkPos2end,
_checkPos3beg, _checkPos3end,
_checkPos4beg, _checkPos4end,
_checkPos5beg, _checkPos5end
]] call CBA_fnc_addPerFrameHandler;
#endif
lineIntersects [_checkPos0beg, _checkPos0end]
&& {!(lineIntersects [_checkPos1beg, _checkPos1end])}
&& {!(lineIntersects [_checkPos2beg, _checkPos2end])}
&& {!(lineIntersects [_checkPos3beg, _checkPos3end])}
&& {!(lineIntersects [_checkPos4beg, _checkPos4end])}
&& {!(lineIntersects [_checkPos5beg, _checkPos5end])}