2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-08-04 21:11:34 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike
|
2017-08-12 13:25:48 +00:00
|
|
|
* The ace_spectator respawn template, compatible with types 1,2,3,4 & 5
|
|
|
|
*
|
|
|
|
* Handles killed and respawned events as per BI's respawn framework:
|
2015-08-04 21:11:34 +00:00
|
|
|
* 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:
|
2018-01-06 00:30:15 +00:00
|
|
|
* None
|
2015-08-04 21:11:34 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [bob, kevin, 3, 6] call ace_spectator_fnc_respawnTemplate
|
|
|
|
*
|
2015-08-04 21:11:34 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2017-08-12 13:25:48 +00:00
|
|
|
params [["_newCorpse",objNull,[objNull]], ["_oldKiller",objNull,[objNull]], ["_respawn",0,[0]], ["_respawnDelay",0,[0]]];
|
2017-11-04 16:03:51 +00:00
|
|
|
TRACE_4("respawnTemplate",_newCorpse,_oldKiller,_respawn,_respawnDelay);
|
2015-08-04 21:11:34 +00:00
|
|
|
|
2017-08-12 13:25:48 +00:00
|
|
|
// Compatibility handled via spectator display XEH
|
|
|
|
if (_respawn in [0,1,4,5]) exitWith {
|
|
|
|
// This only applies to respawn type 1 (BIRD/SPECTATOR)
|
|
|
|
// Remove the seagull (not actually the player, a CfgNonAIVehicles object)
|
|
|
|
if (typeOf _newCorpse == "seagull") then { deleteVehicle _newCorpse; };
|
|
|
|
};
|
2015-08-04 21:11:34 +00:00
|
|
|
|
2017-08-30 15:36:53 +00:00
|
|
|
// Virtual spectators should be ignored by the template (otherwise they break)
|
|
|
|
if (_newCorpse isKindOf QGVAR(virtual)) exitWith {};
|
|
|
|
|
2017-08-12 13:25:48 +00:00
|
|
|
// If player died while already in spectator, ignore
|
|
|
|
if (!GVAR(isSet) || {alive _newCorpse}) then {
|
2015-09-12 12:42:31 +00:00
|
|
|
// Negligible respawn delay can result in entering spectator after respawn
|
2017-08-12 13:25:48 +00:00
|
|
|
// So we just use this value rather than living state of the unit
|
|
|
|
[playerRespawnTime > 1] call FUNC(setSpectator);
|
2015-08-04 21:11:34 +00:00
|
|
|
};
|