ACE3/addons/hearing/functions/fnc_explosionNear.sqf

34 lines
828 B
Plaintext
Raw Normal View History

/*
2015-06-13 15:16:18 +00:00
* Author: KoffeinFlummi, commy2, Ruthberg
* Handles deafness due to explosions going off near the player.
*
* Arguments:
2015-03-15 21:40:47 +00:00
* 0: vehicle - Object the event handler is assigned to (player) <OBJECT>
* 1: damage - Damage inflicted to the object <NUMBER>
*
* Return Value:
2015-03-15 21:40:47 +00:00
* None
*
* Example:
* [clientExplosionEvent] call ace_hearing_fnc_explosionNear
*
* Public: No
*/
2015-01-14 01:41:53 +00:00
#include "script_component.hpp"
// Only run if combat deafness is enabled
if (!GVAR(EnableCombatDeafness)) exitWith {};
2015-07-11 02:01:32 +00:00
2015-08-13 21:42:20 +00:00
params ["_unit", "_damage"];
2015-08-30 06:47:40 +00:00
if (_unit != ACE_player) exitWith {};
TRACE_2("explosion near player",_unit,_damage);
2015-06-13 15:16:18 +00:00
private ["_strength"];
2015-08-30 06:47:40 +00:00
_strength = (0 max _damage) * 30;
if (_strength < 0.01) exitWith {};
// Call inmediately, as it will get pick up later anyway by the update thread
2016-02-16 18:58:42 +00:00
[_strength] call FUNC(earRinging);