ACE3/addons/concertina_wire/functions/fnc_deploy.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

89 lines
2.8 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Rocko, Ruthberg
*
* Deploys the concertina wire
*
* Arguments:
* 0: wire coil <OBJECT>
* 1: unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [coil, bob] call ace_concertina_wire_fnc_deploy
*
* Public: No
*/
params ["_wirecoil", "_unit"];
private _wireNoGeo = "ACE_ConcertinaWireNoGeo" createVehicle [0,0,0];
{
_wireNoGeo animate [_x, 1];
} count WIRE_FAST;
GVAR(placer) = _unit;
private _dir = getDir _unit;
private _pos = getPosASL _unit;
private _wireNoGeoPos = _pos vectorAdd [1.1 * sin(_dir), 1.1 * cos(_dir), 0];
_wireNoGeo setDir _dir;
_wireNoGeo setPosASL _wireNoGeoPos;
deleteVehicle _wirecoil;
_unit setVariable [QGVAR(wireDeployed), false];
GVAR(deployPFH) = [{
params ["_args", "_idPFH"];
_args params ["_wireNoGeo", "_wireNoGeoPos", "_unit"];
private _posStart = (_wireNoGeo modelToWorldVisual (_wireNoGeo selectionPosition "start")) call EFUNC(common,positionToASL);
private _posEnd = (getPosASL _unit) vectorAdd (vectorDir _unit);
private _dirVect = _posStart vectorDiff _posEnd;
private _dir = _dirVect call CBA_fnc_vectDir;
private _range = vectorMagnitude _dirVect;
private _anim = 0 max (1 - (_range / 12));
if (!(alive _unit) || _range >= 12 || (_unit getVariable [QGVAR(wireDeployed), false])) exitWith {
private _wire = "ACE_ConcertinaWire" createvehicle [0, 0, 0];
{
_wire animate [_x, _anim];
} count WIRE_FAST;
[{
params ["_args", "_idPFH"];
_args params ["_wireNoGeo", "_wire", "_anim", "_dir", "_wireNoGeoPos"];
if (_wire animationPhase "wire_2" == _anim) then {
deleteVehicle _wireNoGeo;
_wire setDir _dir;
_wire setPosASL _wireNoGeoPos;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
}, 0, [_wireNoGeo, _wire, _anim, _dir, _wireNoGeoPos]] call CBA_fnc_addPerFrameHandler;
[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler);
[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
call EFUNC(interaction,hideMouseHint);
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
_wireNoGeo setDir _dir;
{
_wireNoGeo animate [_x, _anim];
} count WIRE_FAST;
}, 0, [_wireNoGeo, _wireNoGeoPos, _unit]] call CBA_fnc_addPerFrameHandler;
[localize "STR_ACE_ROLLWIRE", "", ""] call EFUNC(interaction,showMouseHint);
[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
GVAR(placer) setVariable [QGVAR(Deploy),
[GVAR(placer), "DefaultAction",
{GVAR(deployPFH) != -1},
{GVAR(placer) setVariable [QGVAR(wireDeployed), true]}
] call EFUNC(common,AddActionEventHandler)];