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

56 lines
1.8 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: SilentSpike
* Handles "compatibility" (i.e. override) for BI spectator respawn types 1, 4 & 5
*
* Called from the RscDisplayEGSpectator XEH
*
* Arguments:
* 0: RscDisplayEGSpectator <DISPLAY>
*
* Return Value:
* None
*
* Example:
* _this call ace_spectator_fnc_compat_spectatorBI
*
* Public: No
*/
private _respawn = getMissionConfigValue ["respawn",0];
if (_respawn isEqualType "") then { _respawn = ["","bird","","","group","side"] find (toLower _respawn); };
if !(_respawn in [1,4,5]) exitWith {};
// Remember to check for side specific templates
private _templates = getMissionConfigValue [["respawnTemplates",side group player] joinString "",getMissionConfigValue ["respawnTemplates",[]]];
if !(QUOTE(ADDON) in _templates) exitWith {};
// Kill BI spectator
["Terminate"] call BIS_fnc_EGSpectator;
// Start our spectator
[true] call FUNC(setSpectator);
// Delete the seagull that spawns (not actually the player, a CfgNonAIVehicles object)
// Respawn type 1 is handled in the template where seagull is passed as paremeter
if (_respawn in [4,5]) then {
// This could delete seagulls created by a wildlife module (a necessary evil)
// TODO: Try to find seagull position and delete more accurately with reduced radius
{ if (_x isKindOf "seagull") then {deleteVehicle _x;}; } forEach (nearestObjects [player, [], 250]);
};
// Switch to a virtual unit so draw3D continues to work
private _grp = createGroup [sideLogic, true];
private _virtual = _grp createUnit [QGVAR(virtual),[0,0,0],[],0,"NONE"];
// Prevent unit falling into water (compatibility for some addons)
_virtual enableSimulation false;
// Transfer assigned zeus if applicable
private _zeus = getAssignedCuratorLogic player;
if !(isNull _zeus) then {
[QGVAR(transferZeus), [_virtual,_zeus]] call CBA_fnc_serverEvent;
};
selectPlayer _virtual;