Replace spectator respawn changes with a template

Hacking the BI respawn framework to support a spectator setting was intrusive and limiting. Instead of using a setting, I've opted to introduce a new respawn template that can be used within BI's respawn framework. The benefits of this approach are:
- Compatibility isn't a concern, that responsibility is shifted onto mission designers.
- Mission designers can use the functionality of the BI framework alongside the spectator system (combining templates, using different templates for different sides, etc.).
- If a custom respawn framework is used, then this doesn't change anything. Custom frameworks are still fully supported via the public functions provided.
- Remains simple to set up, just requires a description.ext edit
This commit is contained in:
SilentSpike 2015-08-04 22:11:34 +01:00
parent 7e9500f2ca
commit 1b12d37284
17 changed files with 52 additions and 726 deletions

View File

@ -1,8 +1,4 @@
class ACE_Settings {
class GVAR(onDeath) {
typeName = "BOOL";
value = 0;
};
class GVAR(filterUnits) {
typeName = "SCALAR";
value = 1;

View File

@ -9,12 +9,6 @@ class CfgVehicles {
isGlobal = 1;
author = ECSTRING(common,ACETeam);
class Arguments {
class systemEnable {
displayName = CSTRING(system_DisplayName);
description = CSTRING(system_Description);
typeName = "BOOL";
defaultValue = 0;
};
class unitsFilter {
displayName = CSTRING(units_DisplayName);
description = CSTRING(units_Description);

View File

@ -2,14 +2,6 @@
ADDON = false;
PREP(bi_respawnBase);
PREP(bi_respawnCounter);
PREP(bi_respawnEndMission);
PREP(bi_respawnInstant);
PREP(bi_respawnNone);
PREP(bi_respawnSeagull);
PREP(bi_respawnSpectator);
PREP(bi_respawnWave);
PREP(cacheUnitInfo);
PREP(cycleCamera);
PREP(handleCamera);
@ -20,6 +12,7 @@ PREP(handleMouse);
PREP(handleToolbar);
PREP(handleUnits);
PREP(moduleSpectatorSettings);
PREP(respawnTemplate);
PREP(setCameraAttributes);
PREP(setSpectator);
PREP(stageSpectator);
@ -35,6 +28,7 @@ GVAR(availableModes) = [0,1,2];
GVAR(availableSides) = [west,east,resistance,civilian];
GVAR(availableVisions) = [-2,-1,0,1];
GVAR(camAgent) = objNull;
GVAR(camMode) = 0;
GVAR(camPan) = 0;
GVAR(camPos) = ATLtoASL [worldSize * 0.5, worldSize * 0.5, 20];

View File

@ -18,36 +18,8 @@ class CfgPatches {
#include "ui\interface.hpp"
class CfgRespawnTemplates {
class None {
onPlayerKilled = QFUNC(bi_respawnNone);
};
class Spectator {
onPlayerKilled = QFUNC(bi_respawnSpectator);
onPlayerRespawn = QFUNC(bi_respawnSpectator);
};
class Instant {
onPlayerKilled = QFUNC(bi_respawnInstant);
onPlayerRespawn = QFUNC(bi_respawnInstant);
};
class Base {
onPlayerKilled = QFUNC(bi_respawnBase);
onPlayerRespawn = QFUNC(bi_respawnBase);
};
class EndMission
{
onPlayerKilled = QFUNC(bi_respawnEndMission);
onPlayerRespawn = QFUNC(bi_respawnEndMission);
};
class Seagull {
onPlayerRespawn = QFUNC(bi_respawnSeagull);
};
class Wave
{
onPlayerKilled = QFUNC(bi_respawnWave);
onPlayerRespawn = QFUNC(bi_respawnWave);
};
class Counter {
onPlayerKilled = QFUNC(bi_respawnCounter);
onPlayerRespawn = QFUNC(bi_respawnCounter);
class ADDON {
onPlayerKilled = QFUNC(respawnTemplate);
onPlayerRespawn = QFUNC(respawnTemplate);
};
};

View File

@ -1,35 +0,0 @@
/*
* Author: Bohemia Interactive
* Part of the BI respawn framework
* Handles base respawn type (respawn on marker)
* Edited to support ace_spectator integration
*
* Arguments:
* 0: Corpse/New Unit <OBJECT>
* 1: Killer/Old Unit <OBJECT>
* 2: Respawn Type <NUMBER>
* 3: Respawn Delay <NUMBER>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
if !(GVAR(onDeath)) exitWith {};
params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]]];
if (alive _unit) then {
[_unit,false] call FUNC(setSpectator);
} else {
private ["_vision","_pos"];
if (isNull _killer) then {_killer = _unit};
_vision = [-2,-1] select (sunOrMoon < 1);
_pos = (getPosATL _unit) vectorAdd [0,0,5];
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
[_unit] call FUNC(setSpectator);
};

View File

@ -1,35 +0,0 @@
/*
* Author: Bohemia Interactive (Karel Moricky)
* Part of the BI respawn framework
* Handles the respawn timer display
* Edited to disable counter when spectator is opened
*
* Arguments:
* 0: Corpse/New Unit <OBJECT>
* 1: Killer/Old Unit <OBJECT>
* 2: Respawn Type <NUMBER>
* 3: Respawn Delay <NUMBER>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
_player = [_this,0,objNull,[objnull]] call bis_fnc_param;
_respawnDelay = [_this,3,0,[0]] call bis_fnc_param;
if (!isplayer _player && !isnull _player && _respawnDelay > 0) exitwith {["Attempting to use the function on AI unit %1, can be used only on players."] call bis_fnc_error;};
//--- Engine-triggered respawn
_layer = "BIS_fnc_respawnCounter" call bis_fnc_rscLayer;
if (!alive _player) then {
if (GVAR(onDeath) || (playerrespawntime < 1)) exitwith {};
_layer cutrsc ["RscRespawnCounter","plain"];
} else {
_layer cuttext ["","plain"];
};

View File

@ -1,62 +0,0 @@
/*
* Author: Bohemia Interactive (Karel Moricky)
* Part of the BI respawn framework
* Ends the mission when all players are dead
* Edited to support ace_spectator integration
*
* Arguments:
* 0: Corpse/New Unit <OBJECT>
* 1: Killer/Old Unit <OBJECT>
* 2: Respawn Type <NUMBER>
* 3: Respawn Delay <NUMBER>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]]];
private ["_vision","_pos"];
if (isNull _killer) then {_killer = _unit};
_vision = [-2,-1] select (sunOrMoon < 1);
_pos = (getPosATL _unit) vectorAdd [0,0,5];
if (ismultiplayer) then {
_respawnType = 0 call bis_fnc_missionRespawnType;
if (_respawnType in [0,1,4,5]) then {
//--- No more respawn slots
if ({isplayer _x && alive _x} count playableunits == 0) then {
[["endDeath",false],"bis_fnc_endmission"] call bis_fnc_mp;
} else {
if (GVAR(onDeath) && (_respawnType in [0,1])) then {
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
[_unit] call FUNC(setSpectator);
};
};
//--- Don't end the script to prevent premature mission end
waituntil {false};
} else {
if (!alive _unit) then {
//--- No more respawn tickets
if ([] call bis_fnc_respawntickets == 0 && {isplayer _x} count playableunits == 0) then {
[["endDeath",false],"bis_fnc_endmission"] call bis_fnc_mp;
} else {
if (GVAR(onDeath)) then {
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
[_unit] call FUNC(setSpectator);
};
};
} else {
[_unit,false] call FUNC(setSpectator);
};
};
};

View File

@ -1,35 +0,0 @@
/*
* Author: Bohemia Interactive
* Part of the BI respawn framework
* Handles instant respawn type (respawn at position of death)
* Edited to support ace_spectator integration
*
* Arguments:
* 0: Corpse/New Unit <OBJECT>
* 1: Killer/Old Unit <OBJECT>
* 2: Respawn Type <NUMBER>
* 3: Respawn Delay <NUMBER>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
if !(GVAR(onDeath)) exitWith {};
params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]]];
if (alive _unit) then {
[_unit,false] call FUNC(setSpectator);
} else {
private ["_vision","_pos"];
if (isNull _killer) then {_killer = _unit};
_vision = [-2,-1] select (sunOrMoon < 1);
_pos = (getPosATL _unit) vectorAdd [0,0,5];
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
[_unit] call FUNC(setSpectator);
};

View File

@ -1,293 +0,0 @@
/*
* Author: Bohemia Interactive (Karel Moricky)
* Part of the BI respawn framework
* Shows death screen for respawn type "None"
* Edited to support ace_spectator integration
*
* Arguments:
* 0: Corpse <OBJECT>
* 1: Killer <OBJECT>
* 2: Respawn Type <NUMBER>
* 3: Respawn Delay <NUMBER>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
private ["_soundvolume","_musicvolume"];
#define BI_CONTROL (_display displayctrl _n)
#include "script_component.hpp"
disableserialization;
_player = _this select 0;
_killer = _this select 1;
if (isnull _killer) then {_killer = _player};
_musicvolume = musicvolume;
_soundvolume = soundvolume; //MUF-TODO: check if this is done before sound is faded in fn_feedbackMain.fsm
_start = isnil "bis_fnc_respawnNone_start";
if (_start) then {
bis_fnc_respawnNone_start = [daytime,time / 3600];
//3.5 fadesound 0; //MUF-commented
sleep 2;
if (alive player) exitwith {};
cutText ["","BLACK OUT",1];
sleep 1.5;
BIS_fnc_feedback_allowPP = false; //MUF-switch health PP off
//(["HealthPP_black"] call bis_fnc_rscLayer) cutText ["","BLACK IN",1];//MUF-black in (remove black screen that was launched in FSM PP)
if (ismultiplayer) then {
if (GVAR(onDeath)) then {
private ["_vision","_pos"];
_vision = [-2,-1] select (sunOrMoon < 1);
_pos = (getPosATL _player) vectorAdd [0,0,5];
[2,_killer,_vision,_pos,getDir _player] call FUNC(setCameraAttributes);
[_player] call FUNC(setSpectator);
} else {
(finddisplay 46) createdisplay "RscDisplayMissionEnd";
};
} else {enableenddialog};
};
if (alive player) exitwith {
[player,false] call FUNC(setSpectator);
cuttext ["","plain"];
}; //--- Terminate when player manages to switch do different unit already
if (GVAR(onDeath)) exitWith {};
waituntil {!isnull (finddisplay 58)};
_display = finddisplay 58;
//--- Black fade in
_n = 1060;
BI_CONTROL ctrlsetfade 1;
if (_start) then {
//--- Play ambient radio
setacctime 1;
0 fademusic 0;
4 fademusic 0.8;
playmusic format ['RadioAmbient%1',ceil random 1/*30*/];
_musicEH = addMusicEventHandler ["MusicStop",{[] spawn {playmusic format ['RadioAmbient%1',ceil random 1/*30*/];};}];
uinamespace setvariable ["bis_fnc_respawnNone_musicEH",_musicEH];
_display displayaddeventhandler ["unload","removeMusicEventHandler ['MusicStop',uinamespace getvariable ['bis_fnc_respawnNone_musicEH',-1]];"];
BI_CONTROL ctrlcommit 4;
} else {
BI_CONTROL ctrlcommit 0;
};
cuttext ["","plain"];
//--- HUD
_n = 5800;
BI_CONTROL ctrlsettext gettext (configfile >> "cfgingameui" >> "cursor" >> "select");
BI_CONTROL ctrlsetposition [-10,-10,safezoneH * 0.07 * 3/4,safezoneH * 0.07];
BI_CONTROL ctrlsettextcolor [1,1,1,1];
BI_CONTROL ctrlcommit 0;
//--- SITREP (ToDO: Localize)
_sitrep = "SITREP||";
if (name _player != "Error: No unit") then {
_sitrep = _sitrep + "KIA: %4. %5|";
};
_sitrep = _sitrep + "TOD: %2 [%3]|LOC: %6 \ %7";
if (_killer != _player) then {
_sitrep = _sitrep + "||ENY: %8";
if (currentweapon _killer != "") then {
_sitrep = _sitrep + "|ENW: %9</t>"
};
};
_sitrep = format [
_sitrep,
1 * safezoneH,
[bis_fnc_respawnNone_start select 0,"HH:MM:SS"] call bis_fnc_timetostring,
[bis_fnc_respawnNone_start select 1,"HH:MM:SS"] call bis_fnc_timetostring,
toupper localize format ["STR_SHORT_%1",rank _player],
toupper name _player,
mapGridPosition _player,
toupper worldname,
toupper ((configfile >> "cfgvehicles" >> typeof _killer) call bis_fnc_displayname),
toupper ((configfile >> "cfgweapons" >> currentweapon _killer) call bis_fnc_displayname)
];
_n = 11000;
_bcgPos = ctrlposition BI_CONTROL;
_n = 5858;
//BI_CONTROL ctrlsetposition [_bcgPos select 0,safezoneY + ((_bcgPos select 0) - safezoneX) * 4/3,safezoneW - 2 * (_bcgPos select 2),safezoneH / 2];
BI_CONTROL ctrlsetposition [(((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX),
((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY),
safezoneW - 2 * (_bcgPos select 2),
safezoneH / 2];
BI_CONTROL ctrlcommit 0;
[BI_CONTROL,_sitrep] spawn {
scriptname "bis_fnc_respawnNone: SITREP";
disableserialization;
_control = _this select 0;
_sitrepArray = toarray (_this select 1);
{_sitrepArray set [_foreachindex,tostring [_x]]} foreach _sitrepArray;
_sitrep = "";
//_sitrepFormat = "<t align='left' font='EtelkaMonospacePro' shadow='1' size='" + str safezoneH + "'>%1</t>";
_sitrepFormat = "<t align='left' font='EtelkaMonospacePro' shadow='1'>%1</t>";
sleep 1;
for "_i" from 0 to (count _sitrepArray - 1) do {
_letter = _sitrepArray select _i;
_delay = if (_letter == "|") then {_letter = "<br />"; 1} else {0.01};
_sitrep = _sitrep + _letter;
_control ctrlsetstructuredtext parsetext format [_sitrepFormat,_sitrep + "_"];
//playsound ["IncomingChallenge",true];
sleep _delay;
if (isnull _control) exitwith {};
};
_control ctrlsetstructuredtext parsetext format [_sitrepFormat,_sitrep];
};
//--- Create UAV camera
_camera = "camera" camcreate position player;
_camera cameraeffect ["internal","back"];
_camera campreparefov 0.4;
_camera campreparetarget _killer;
showcinemaborder false;
//--- Set PP effects
_saturation = 0.0 + random 0.3;
_ppColor = ppEffectCreate ["ColorCorrections", 1999];
_ppColor ppEffectEnable true;
_ppColor ppEffectAdjust [1, 1, 0, [1, 1, 1, 0], [1 - _saturation, 1 - _saturation, 1 - _saturation, _saturation], [1, 0.25, 0, 1.0]];
_ppColor ppEffectCommit 0;
_ppGrain = ppEffectCreate ["filmGrain", 2012];
_ppGrain ppEffectEnable true;
_ppGrain ppEffectAdjust [random 0.2, 1, 1, 0, 1];
_ppGrain ppEffectCommit 0;
//--- Camera update executed every frame
bis_fnc_respawnNone_player = _player;
bis_fnc_respawnNone_killer = _killer;
bis_fnc_respawnNone_camera = _camera;
bis_fnc_respawnNone_loop = {
scriptname "bis_fnc_respawnNone: camera";
_display = _this select 0;
_player = bis_fnc_respawnNone_player;
_killer = bis_fnc_respawnNone_killer;
_camera = bis_fnc_respawnNone_camera;
_sin = 20 * sin (time * 7);
_killerPos = [
(visiblepositionasl _killer select 0),
(visiblepositionasl _killer select 1) + (_sin),
(visiblepositionasl _killer select 2) + (_sin)
];
_dirToKiller = if (_killer == _player) then {
direction _player;
} else {
([_player,_killerPos] call bis_fnc_dirto) + _sin;
};
_pos = [
visiblepositionasl _player,
-20,
_dirToKiller
] call bis_fnc_relpos;
_pos set [2,((_pos select 2) + 7) max (getterrainheightasl _pos + 7)];
//--- Pitch
_heightCamera = getterrainheightasl _pos;
_heightKiller = getterrainheightasl _killerPos;
_height = _heightCamera - _heightKiller;
_dis = _killerPos distance _pos;
_angle = (asin (_height/_dis));
_camera setdir _dirtokiller;
[_camera,-_angle,_sin] call bis_fnc_setpitchbank;
_camera setposasl _pos;
//--- HUD
_n = 5800;
_hudPos = (worldtoscreen position _player);
if (count _hudPos > 0) then {
_hudPosW = ctrlposition BI_CONTROL select 2;
_hudPosH = ctrlposition BI_CONTROL select 3;
_hudPos = [
(_hudPos select 0) - _hudPosW / 2,
(_hudPos select 1) - _hudPosH / 2,
_hudPosW,
_hudPosH
];
BI_CONTROL ctrlsetposition _hudPos;
BI_CONTROL ctrlcommit 0;
};
};
bis_fnc_respawnNone_keydown = {
_key = _this select 1;
if (_key in (actionkeys 'nightvision') || _key < 0) then {
bis_fnc_respawnNone_vision = bis_fnc_respawnNone_vision + 1;
_vision = bis_fnc_respawnNone_vision % 4;
switch (_vision) do {
case 0: {
camusenvg false;
call compile 'false SetCamUseTi 0';
};
case 1: {
camusenvg true;
call compile 'false SetCamUseTi 0';
};
case 2: {
camusenvg false;
call compile 'true SetCamUseTi 0';
};
case 3: {
camusenvg false;
call compile 'true SetCamUseTi 1';
};
};
};
};
//bis_fnc_respawnNone_vision = (1 + floor random 3) % 4; //--- Random vision (not NVG)
bis_fnc_respawnNone_vision = -1;
if (sunormoon < 1) then {bis_fnc_respawnNone_vision = 0;};
[-1,-1] call bis_fnc_respawnNone_keydown;
_display displayaddeventhandler ["mousemoving","_this call bis_fnc_respawnNone_loop"];
_display displayaddeventhandler ["mouseholding","_this call bis_fnc_respawnNone_loop"];
_display displayaddeventhandler ["keydown","_this call bis_fnc_respawnNone_keydown"];
//--- Team Switch display opened
waituntil {isnull _display};
_displayTeamSwitch = finddisplay 632;
//--- Team Switch display closed - cleanup and restart the view
waituntil {isnull _displayTeamSwitch};
_camera cameraeffect ["terminate","back"];
camdestroy _camera;
bis_fnc_respawnNone_player = nil;
bis_fnc_respawnNone_killer = nil;
bis_fnc_respawnNone_camera = nil;
bis_fnc_respawnNone_loop = nil;
ppeffectdestroy _ppColor;
ppeffectdestroy _ppGrain;
if (!alive player) exitwith {_this call bis_fnc_respawnNone;};
//--- Resurrection!
BIS_fnc_feedback_allowPP = true;
0 fadesound _soundvolume;
0 fademusic _musicvolume;
playmusic "";
bis_fnc_respawnNone_start = nil;

View File

@ -1,101 +0,0 @@
/*
* Author: Bohemia Interactive
* Part of the BI respawn framework
* Correctly handles seagull respawn (not used by default)
* Edited to support ace_spectator integration
*
* Arguments:
* 0: Corpse/New Unit <OBJECT>
* 1: Killer/Old Unit <OBJECT>
* 2: Respawn Type <NUMBER>
* 3: Respawn Delay <NUMBER>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
_seagull = _this select 0;
_player = _this select 1;
_this call bis_fnc_log;
if (!isplayer _player && !isplayer _seagull) exitwith {["Attempting to use the function on AI unit %1, can be used only on players."] call bis_fnc_error;};
waituntil {missionnamespace getvariable ["BIS_fnc_feedback_allowDeathScreen",true]};
BIS_fnc_feedback_allowPP = false;
//(["HealthPP_black"] call bis_fnc_rscLayer) cutText ["","BLACK IN",8];
if (GVAR(onDeath)) exitWith {
private ["_vision","_pos"];
if (isNull _player) then {_player = _seagull};
_vision = [-2,-1] select (sunOrMoon < 1);
_pos = (getPosATL _player) vectorAdd [0,0,5];
[_seagull,QGVAR(isSeagull)] call EFUNC(common,hideUnit);
[2,_player,_vision,_pos,getDir _seagull] call FUNC(setCameraAttributes);
[_seagull] call FUNC(setSpectator);
};
_camera = "camera" camCreate [(position _player select 0)-0.75, (position _player select 1)-0.75,(position _player select 2) + 0.5];
_camera cameraEffect ["internal","back"];
_camera camSetFOV 0.800;
_camera camCommit 0;
waituntil {camCommitted _camera};
0 fadeMusic 0.5;
playMusic "Track06_Abandoned_Battlespace";
_camera camSetTarget vehicle _player;
_camera camSetRelPos [-0.82,-3.12,3.38];
_camera camSetFOV 0.800;
_camera camCommit 7;
sleep 1;
_preload = _player spawn {waitUntil {(preloadCamera getPos _this) && (2 preloadObject _this)}};
sleep 5;
waituntil {camCommitted _camera};
_camera camSetRelPos [1.17,-21.71,2.07];
_camera camSetFOV 0.400;
_camera camCommit 10;
sleep 2;
terminate _preload;
sleep 3;
_preload = _player spawn {waitUntil {(preloadCamera getPos _this) && (3 preloadObject _this)}};
waituntil {camCommitted _camera};
_camera camSetTarget vehicle _player;
_camera camSetRelPos [5.80,1.29,5.07];
_camera camSetFOV 0.300;
_camera camCommit 7;
sleep 2;
terminate _preload;
_preload = _seagull spawn {waitUntil {(preloadCamera getPos _this) && (4 preloadObject _this)}};
waituntil {camCommitted _camera};
_camera camSetRelPos [2.71,19.55,12.94];
_camera camSetFOV 0.700;
_camera camCommit 2;
waituntil {camCommitted _camera};
_camera camSetTarget _seagull;
_camera camSetRelPos [-6.66,18.99,2.59];
_camera camSetFOV 0.700;
_camera camCommit 3;
waituntil {camCommitted _camera};
3 fadeMusic 0;
_camera camSetRelPos [1.17,-21.71,-1.07];
_camera camSetFOV 0.300;
_camera camCommit 3;
waituntil {camCommitted _camera};
terminate _preload;
_seagull switchCamera "EXTERNAL";
_seagull cameraEffect ["terminate","back"];
camDestroy _camera;

View File

@ -1,59 +0,0 @@
/*
* Author: Bohemia Interactive
* Part of the BI respawn framework
* Opens BI spectator interface (default used by seagull respawn)
* Edited to support ace_spectator integration
*
* Arguments:
* 0: Corpse/New Unit <OBJECT>
* 1: Killer/Old Unit <OBJECT>
* 2: Respawn Type <NUMBER>
* 3: Respawn Delay <NUMBER>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_respawn",-1,[0]]];
private ["_vision","_pos"];
if (isNull _killer) then {_killer = _unit};
_vision = [-2,-1] select (sunOrMoon < 1);
_pos = (getPosATL _unit) vectorAdd [0,0,5];
_layer = "BIS_fnc_respawnSpectator" call bis_fnc_rscLayer;
if (!alive _unit) then {
if (GVAR(onDeath)) then {
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
[_unit] call FUNC(setSpectator);
} else {
_layer cutrsc ["RscSpectator","plain"];
};
} else {
if (_respawn == 1) then {
//--- Open
waituntil {missionnamespace getvariable ["BIS_fnc_feedback_allowDeathScreen",true]};
BIS_fnc_feedback_allowPP = false;
//(["HealthPP_black"] call bis_fnc_rscLayer) cutText ["","BLACK IN",1];
if (GVAR(onDeath)) then {
[_unit,QGVAR(isSeagull)] call EFUNC(common,hideUnit);
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
[_unit] call FUNC(setSpectator);
} else {
_layer cutrsc ["RscSpectator","plain"];
};
} else {
if (GVAR(onDeath)) then {
[_unit,false] call FUNC(setSpectator);
};
//--- Close
_layer cuttext ["","plain"];
};
};

View File

@ -1,43 +0,0 @@
/*
* Author: Bohemia Interactive
* Part of the BI respawn framework
* Handles wave respawning system
* Edited to support ace_spectator integration
*
* Arguments:
* 0: Corpse/New Unit <OBJECT>
* 1: Killer/Old Unit <OBJECT>
* 2: Respawn Type <NUMBER>
* 3: Respawn Delay <NUMBER>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_respawn",0,[0]], ["_respawnDelay",0,[0]]];
if (!isplayer _unit && !isnull _unit) exitwith {["Attempting to use the function on AI unit %1, can be used only on players."] call bis_fnc_error;};
if (!alive _unit) then {
//--- Set the time only when it was not modified already
if (_respawnDelay != 0 && _respawnDelay == playerrespawntime) then {
setplayerrespawntime (_respawnDelay + _respawnDelay - (servertime % _respawnDelay));
if !(GVAR(onDeath)) exitWith {};
private ["_vision","_pos"];
if (isNull _killer) then {_killer = _unit};
_vision = [-2,-1] select (sunOrMoon < 1);
_pos = (getPosATL _unit) vectorAdd [0,0,5];
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
[_unit] call FUNC(setSpectator);
};
} else {
setplayerrespawntime _respawndelay;
[_unit,false] call FUNC(setSpectator);
};

View File

@ -43,7 +43,7 @@ switch (toLower _mode) do {
// Close map
openMap [false,false];
// Close any BI layers/effects
// Disable BI damage effects and remove counter layer
BIS_fnc_feedback_allowPP = false;
("BIS_fnc_respawnCounter" call BIS_fnc_rscLayer) cutText ["","plain"];
@ -80,9 +80,8 @@ switch (toLower _mode) do {
// Return to player view
_unit switchCamera "internal";
// Re-enable any BI effects
// Re-enable BI damage effects
BIS_fnc_feedback_allowPP = true;
BIS_fnc_respawnNone_start = nil;
// Cleanup camera variables
GVAR(camera) = nil;

View File

@ -19,7 +19,6 @@ params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {};
[_logic, QGVAR(onDeath), "systemEnable"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(filterUnits), "unitsFilter"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(filterSides), "sidesFilter"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(restrictModes), "cameraModes"] call EFUNC(common,readSettingFromModule);

View File

@ -0,0 +1,39 @@
/*
* Author: SilentSpike
* The ace_spectator respawn template, handles killed + respawn
* Can be used via BI's respawn framework, see:
* https://community.bistudio.com/wiki/Arma_3_Respawn
*
* Arguments:
* 0: Corpse/New Unit <OBJECT>
* 1: Killer/Old Unit <OBJECT>
* 2: Respawn Type <NUMBER>
* 3: Respawn Delay <NUMBER>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_respawn",0,[0]], ["_respawnDelay",0,[0]]];
private ["_vision","_pos"];
if (isNull _killer) then {_killer = _unit};
_vision = [-2,-1] select (sunOrMoon < 1);
_pos = (getPosATL _unit) vectorAdd [0,0,5];
if (alive _unit) then {
if (_respawn == 1) then {
[_unit,QGVAR(isSeagull)] call EFUNC(common,hideUnit);
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
[_unit] call FUNC(setSpectator);
} else {
[_unit,false] call FUNC(setSpectator);
};
} else {
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
[_unit] call FUNC(setSpectator);
};

View File

@ -53,8 +53,12 @@ if (_newMode == 0) then { // Free
GVAR(camera) camSetFov -(linearConversion [0.01,2,GVAR(camZoom),-2,-0.01,true]);
GVAR(camera) camCommit 0;
// Switch to camera to stop AI group chat
ACE_Player switchCamera "internal";
// Agent is switched to in free cam to hide death table and prevent AI chat
if (isNull GVAR(camAgent)) then {
GVAR(camAgent) = createAgent ["VirtualMan_F",markerPos QGVAR(respawn),[],0,""];
};
GVAR(camAgent) switchCamera "internal";
clearRadio;
// If new vision isn't available then keep current (unless current also isn't)

View File

@ -9,14 +9,6 @@
<English>Configure how the spectator system will operate by default.</English>
<Polish>Skonfiguruj domyślne ustawienia obserwatora.</Polish>
</Key>
<Key ID="STR_ACE_Spectator_system_DisplayName">
<English>Spectate on death</English>
<Polish>Obserwator po śmierci</Polish>
</Key>
<Key ID="STR_ACE_Spectator_system_Description">
<English>Enables spectator upon death.</English>
<Polish>Włącz obserwatora po śmierci</Polish>
</Key>
<Key ID="STR_ACE_Spectator_units_DisplayName">
<English>Unit filter</English>
<Polish>Filtr jednostek</Polish>