2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-02 09:04:53 +00:00
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Weapon <STRING>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
*ace_player addEventHandler ["Fired", {[_this select 0, _this select 1] call ace_goggles_fnc_dustHandler;}];
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-18 21:50:45 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-19 08:34:49 +00:00
|
|
|
private ["_bullets", "_position", "_surface", "_found", "_weapon", "_cloudType", "_unit"];
|
|
|
|
EXPLODE_2_PVT(_this,_unit,_weapon);
|
|
|
|
if (_unit != ace_player) exitWith {true};
|
2015-01-11 16:42:31 +00:00
|
|
|
_cloudType = "";
|
|
|
|
|
2015-01-19 08:34:49 +00:00
|
|
|
if (rain > 0.1) exitWith {true};
|
|
|
|
if ((stance _unit) != "PRONE") exitWith {true};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (isClass(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "FirstEffect")) then {
|
|
|
|
_cloudType = getText(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "FirstEffect" >> "effectName");
|
|
|
|
} else {
|
|
|
|
if (isClass(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "effect1")) then {
|
|
|
|
_cloudType = getText(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "effect1" >> "effectName");
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_cloudType == "") exitWith {true};
|
|
|
|
|
2015-01-19 08:34:49 +00:00
|
|
|
_position = getPosATL _unit;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (surfaceIsWater _position) exitWith {};
|
|
|
|
if ((_position select 2) > 0.2) exitWith {};
|
|
|
|
|
|
|
|
_surface = surfaceType _position;
|
|
|
|
_surface = ([_surface, "#"] call CBA_fnc_split) select 1;
|
|
|
|
_found = false;
|
|
|
|
|
|
|
|
_found = getNumber (ConfigFile >> "CfgSurfaces" >> _surface >> "dust") >= 0.1;
|
|
|
|
|
|
|
|
if (!_found) exitWith {};
|
|
|
|
|
|
|
|
_bullets = GETDUSTT(DBULLETS);
|
|
|
|
|
2015-01-18 22:57:39 +00:00
|
|
|
if ((diag_tickTime - GETDUSTT(DTIME)) > 1) then {
|
2015-01-11 16:42:31 +00:00
|
|
|
_bullets = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
_bullets = _bullets + 1;
|
|
|
|
SETDUST(DBULLETS,_bullets);
|
2015-01-18 22:57:39 +00:00
|
|
|
SETDUST(DTIME,diag_tickTime);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (GETDUSTT(DAMOUNT) < 2) then {
|
|
|
|
private "_bulletsRequired";
|
|
|
|
_bulletsRequired = 100;
|
2015-01-18 19:43:51 +00:00
|
|
|
if (isNumber (ConfigFile >> _cloudType >> "ACE_Goggles_BulletCount")) then {
|
|
|
|
_bulletsRequired = getNumber (ConfigFile >> _cloudType >> "ACE_Goggles_BulletCount");
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (_bulletsRequired <= _bullets) then {
|
|
|
|
SETDUST(DACTIVE,true);
|
2015-01-18 21:50:45 +00:00
|
|
|
call FUNC(applyDust);
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
true
|