mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
d3ce75daef
- Overhauls the spectator module entirely to share a similar UX to BI's "End Game Spectator" while maintaining some of the extended flexibility of ACE Spectator. - Simplifies spectator setup by reducing the number of settings. More advanced setup is still possible via the API functions provided.
49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
/*
|
|
* Author: Nelson Duarte, AACO, SilentSpike
|
|
* Function used to add projectiles to be drawn when a unit fires
|
|
*
|
|
* Arguments:
|
|
* Fired EH arguments
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* _unit addEventHandler ["Fired",{_this call ace_spectator_fnc_handleFired}]
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
params [
|
|
"_unit",
|
|
["_weapon", "", [""]],
|
|
"", // Muzzle
|
|
"", // Mode
|
|
"", // Ammo
|
|
"", // Magazine
|
|
["_projectile", objNull, [objNull]]
|
|
];
|
|
|
|
// Remove the EH when spectator is no longer active or unit is removed
|
|
if (isNil QGVAR(entitiesToDraw) || {!(_unit in GVAR(entitiesToDraw))}) exitWith {
|
|
//USES_VARIABLES ["_thisEventHandler"]
|
|
_unit removeEventHandler ["Fired", _thisEventHandler];
|
|
SETVAR(_unit,GVAR(firedEH),nil);
|
|
};
|
|
|
|
// Fire time used for unit icon highlighting
|
|
_unit setVariable [QGVAR(highlightTime), time + FIRE_HIGHLIGHT_TIME];
|
|
|
|
// Store projectiles / grenades for drawing
|
|
if (GVAR(drawProjectiles) && {!isNull _projectile}) then {
|
|
if (_weapon == "Throw") then {
|
|
if (count GVAR(grenadesToDraw) > MAX_GRENADES) then { GVAR(grenadesToDraw) deleteAt 0; };
|
|
GVAR(grenadesToDraw) pushBack _projectile;
|
|
} else {
|
|
if (count GVAR(projectilesToDraw) > MAX_PROJECTILES) then { GVAR(projectilesToDraw) deleteAt 0; };
|
|
GVAR(projectilesToDraw) pushBack [_projectile, [[getPosVisual _projectile, [1,0,0,0]]]];
|
|
};
|
|
};
|