mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
ffaa195fe5
* Fixed headers to work with silentspike python script * Fixed rest of the files * Fixed ace-team
47 lines
1.4 KiB
Plaintext
47 lines
1.4 KiB
Plaintext
/*
|
|
* 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>
|
|
*
|
|
* Example:
|
|
* [bob, kevin, 3, 6] call ace_spectator_fnc_respawnTemplate
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_respawn",0,[0]], ["_respawnDelay",0,[0]]];
|
|
|
|
// Some environment information can be used for the initial camera attributes
|
|
if (isNull _killer) then {_killer = _unit};
|
|
private _vision = [-2,-1] select (sunOrMoon < 1);
|
|
private _pos = (getPosATL _unit) vectorAdd [0,0,5];
|
|
|
|
// Enter/exit spectator based on the respawn type and whether killed/respawned
|
|
if (alive _unit) then {
|
|
if (_respawn == 1) then {
|
|
[_unit] call FUNC(stageSpectator);
|
|
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
|
|
[true] call FUNC(setSpectator);
|
|
} else {
|
|
[false] call FUNC(setSpectator);
|
|
};
|
|
} else {
|
|
// Negligible respawn delay can result in entering spectator after respawn
|
|
if (playerRespawnTime <= 1) exitWith {};
|
|
|
|
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
|
|
[true] call FUNC(setSpectator);
|
|
};
|