ACE3/addons/spectator/functions/fnc_setCameraAttributes.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

98 lines
2.3 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: SilentSpike
* Sets the spectator camera attributes as desired. Local effect.
* All values are optional and default to no change.
*
* Arguments:
* 0: Camera mode <NUMBER>
* - 0: Free
* - 1: First Person
* - 2: Follow
* 1: Camera focus <OBJECT or BOOL>
* 2: Camera vision <NUMBER>
* - -2: Normal
* - -1: Night vision
* - 0: Thermal white hot
* - 1: Thermal black hot
* - ...
* 3: Camera position (ATL) <ARRAY>
* 4: Camera direction (0 - 360) <NUMBER>
*
* Notes:
* - If camera mode is not free and camera has no focus, random will be used
* - To remove any current camera focus in free cam, use objNull
* - To select a random camera focus, use a boolean
*
* Return Value:
* None
*
* Example:
* [1, objNull] call ace_spectator_fnc_setCameraAttributes
*
* Public: Yes
*/
params [
["_mode",nil,[0]],
["_focus",nil,[objNull,true]],
["_vision",nil,[0]],
["_position",nil,[[]],3],
["_direction",nil,[0]]
];
// Apply if camera exists
if !(isNil QGVAR(camera)) then {
// These functions are smart and handle unavailable inputs
if !(isNil "_focus") then {
[_focus] call FUNC(setFocus);
};
if !(isNil "_mode") then {
// If mode not free and no focus, find focus
if ((_mode != MODE_FREE) && {isNull GVAR(camFocus)}) then {
[true] call FUNC(setFocus);
};
[_mode] call FUNC(cam_setCameraMode);
};
if !(isNil "_vision") then {
[_vision] call FUNC(cam_setVisionMode);
};
if !(isNil "_position") then {
GVAR(camera) setPosATL _position;
};
if !(isNil "_direction") then {
GVAR(camera) setDir _direction;
};
} else {
if !(isNil "_focus") then {
// If there are no entities this becomes nil, handled on camera startup
if (_focus isEqualType true) then {
_focus = ([] call FUNC(getTargetEntities)) select 0;
};
GVAR(camFocus) = _focus;
};
if !(isNil "_mode") then {
GVAR(camMode) = _mode;
};
if !(isNil "_vision") then {
GVAR(camVision) = _vision;
};
// GVARs exits purely for pre-setting of these attributes
if !(isNil "_position") then {
GVAR(camPos) = ATLtoASL _position;
};
if !(isNil "_direction") then {
GVAR(camDir) = _direction;
};
};