ACE3/addons/captives/functions/fnc_handleLocal.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

65 lines
2.4 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: esteldunedain
* Called when a unit switched locality
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Is local <BOOL>
*
* Return Value:
* None
*
* Example:
* [bob, true] call ACE_captives_fnc_handleLocal
*
* Public: No
*/
params ["_unit", "_local"];
// Make sure that if the unit is captive or surrendered it has a AnimChanged EH running ONLY on the machine that owns it
if (_local) then {
// If the unit is handcuffed
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
// If the unit already has an AnimChanged EH here then there's nothing to do either
if (_unit getVariable [QGVAR(handcuffAnimEHID), -1] != -1) exitWith {};
// Otherwise, restart the AnimChanged EH in the new machine
private _animChangedEHID = _unit addEventHandler ["AnimChanged", {call FUNC(handleAnimChangedHandcuffed)}];
TRACE_2("Adding animChangedEH",_unit,_animChangedEHID);
_unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID];
};
// If the unit is surrendering
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
// If the unit already has an AnimChanged EH here then there's nothing to do either
if (_unit getVariable [QGVAR(surrenderAnimEHID), -1] != -1) exitWith {};
// Otherwise, restart the AnimChanged EH in the new machine
private _animChangedEHID = _unit addEventHandler ["AnimChanged", {call FUNC(handleAnimChangedSurrendered)}];
TRACE_2("Adding animChangedEH",_unit,_animChangedEHID);
_unit setVariable [QGVAR(surrenderAnimEHID), _animChangedEHID];
};
} else {
private _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];
if (_animChangedEHID != -1) then {
// If the unit had a AnimChanged EH for handcuffing in the old machine then remove it
TRACE_1("Removing animChanged EH",_animChangedEHID);
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
_unit setVariable [QGVAR(handcuffAnimEHID), -1];
};
_animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];
if (_animChangedEHID != -1) then {
// If the unit had a AnimChanged EH for handcuffing in the old machine then remove it
TRACE_1("Removing animChanged EH",_animChangedEHID);
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
_unit setVariable [QGVAR(surrenderAnimEHID), -1];
};
};