Code cleanup of HuntIR module.

This commit is contained in:
jokoho48 2015-08-14 00:00:34 +02:00
parent 7c60375105
commit 0656418cd1
3 changed files with 25 additions and 22 deletions

View File

@ -13,7 +13,7 @@
*/
#include "script_component.hpp"
PARAMS_1(_huntIR);
parama ["_huntIR"];
GVAR(huntIR) = _huntIR;
GVAR(pos) = getPosVisual GVAR(huntIR);
@ -73,7 +73,8 @@ GVAR(no_cams) sort true;
if (((getPosVisual _x) select 2) > 20 && {!(_x in GVAR(no_cams))} && {_x getHitPointDamage "HitCamera" < 0.25}) then {
GVAR(no_cams) pushBack _x;
};
} forEach GVAR(nearHuntIRs);
true
} count GVAR(nearHuntIRs);
{
if (((getPosVisual _x) select 2) <= 20 || {!(_x in GVAR(nearHuntIRs))} || {_x getHitPointDamage "HitCamera" >= 0.25}) then {
GVAR(no_cams) deleteAt _forEachIndex;

View File

@ -19,12 +19,12 @@
*/
#include "script_component.hpp"
PARAMS_7(_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
if (_ammo != "F_HuntIR") exitWith {};
[{
PARAMS_1(_projectile);
params ["_projectile"];
//If null (deleted or hit water) exit:
if (isNull _projectile) exitWith {};
@ -33,15 +33,16 @@ if (_ammo != "F_HuntIR") exitWith {};
"ACE_HuntIR_Propell" createVehicle (getPosATL _projectile);
[{
PARAMS_1(_position);
private ["_huntir"];
params ["_position"];
_huntir = createVehicle ["ACE_HuntIR", _position, [], 0, "FLY"];
_huntir setPosATL _position;
_huntir setVariable [QGVAR(startTime), ACE_time, true];
[{
EXPLODE_1_PVT(_this select 0,_huntir);
params ["_args", "_idPFH"];
_args params ["_huntir"];
if (isNull _huntir) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
private ["_parachuteDamage", "_velocity"];
_parachuteDamage = _huntir getHitPointDamage "HitParachute";

View File

@ -32,7 +32,7 @@ disableSerialization;
private ["_fnc_correctIt"];
_fnc_correctIt = {
PARAMS_2(_pos,_dir);
params ["_pos", "_dir"];
if (_dir >= 270 || {_dir <= 90}) then {
_pos set [1, (_pos select 1) + __OFFSET_Y]
};
@ -51,11 +51,12 @@ _fnc_correctIt = {
HUNTIR_CAM_ROSE_LAYER_ID cutRsc ["ace_huntir_cam_rose", "PLAIN"];
[{
EXPLODE_1_PVT(_this select 0,_fnc_correctIt);
params ["_args", "_idPFH"];
_args params ["_fnc_correctIt"];
if (GVAR(stop)) exitWith {
HUNTIR_CAM_ROSE_LAYER_ID cutText ["", "PLAIN"];
[_this select 1] call CBA_fnc_removePerFrameHandler;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
private ["_dir", "_x1", "_y1", "_pos"];