mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2149 from jokoho48/codeCleanupHuntIR
Code cleanup of HuntIR module
This commit is contained in:
commit
f1d41731fb
@ -7,13 +7,13 @@
|
||||
* 0: HuntIR <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_huntIR);
|
||||
params ["_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;
|
||||
@ -82,19 +83,19 @@ GVAR(no_cams) sort true;
|
||||
};
|
||||
};
|
||||
} forEach GVAR(no_cams);
|
||||
|
||||
|
||||
GVAR(cur_cam) = 0 max GVAR(cur_cam) min ((count GVAR(no_cams)) - 1);
|
||||
if (count GVAR(no_cams) > 0) then {
|
||||
GVAR(huntIR) = GVAR(no_cams) select GVAR(cur_cam);
|
||||
};
|
||||
|
||||
|
||||
GVAR(pos) = getPosVisual GVAR(huntIR);
|
||||
|
||||
|
||||
if ((!dialog) || (count GVAR(no_cams) == 0) || ((GVAR(pos) select 2) <= 20)) exitWith {
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
|
||||
|
||||
GVAR(stop) = true;
|
||||
|
||||
|
||||
GVAR(pphandle) ppEffectEnable true;
|
||||
ppEffectDestroy GVAR(pphandle);
|
||||
|
||||
@ -108,7 +109,7 @@ GVAR(no_cams) sort true;
|
||||
deleteVehicle GVAR(logic);
|
||||
if (player != ACE_player) then {
|
||||
player remoteControl ACE_player;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
switch (GVAR(ZOOM)) do {
|
||||
@ -131,7 +132,7 @@ GVAR(no_cams) sort true;
|
||||
};
|
||||
|
||||
private ["_cam_coord_y", "_cam_coord_x", "_cam_time", "_cam_pos"];
|
||||
|
||||
|
||||
GVAR(logic) setPosATL (GVAR(pos) vectorAdd [0, 0, -5]);
|
||||
GVAR(logic) setDir GVAR(ROTATE);
|
||||
GVAR(logic) setVectorUp [0.0001, 0.0001, 1];
|
||||
|
@ -13,19 +13,19 @@
|
||||
* 6: projectile - Object of the projectile that was shot <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#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 {};
|
||||
//If it's not spinning (hit ground), bail:
|
||||
@ -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";
|
||||
|
@ -4,10 +4,10 @@
|
||||
* HuntIR monitor system
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -35,21 +35,21 @@ createDialog "ace_huntir_cam_dialog_off";
|
||||
GVAR(connectionDelay) = 5;
|
||||
GVAR(state) = "searching";
|
||||
GVAR(message) = [];
|
||||
GVAR(messageSearching) = toArray "Searching.....";
|
||||
GVAR(messageSearching) = toArray "Searching.....";
|
||||
GVAR(messageConnecting) = toArray "Connecting.....";
|
||||
[{
|
||||
//Close monitor if we no longer have item:
|
||||
if ((!([ACE_player, "ACE_HuntIR_monitor"] call EFUNC(common,hasItem))) && {!isNull (uiNameSpace getVariable ["ace_huntir_monitor", displayNull])}) then {
|
||||
closeDialog 0;
|
||||
};
|
||||
|
||||
|
||||
private ["_elapsedTime", "_nearestHuntIRs"];
|
||||
_elapsedTime = ACE_time - GVAR(startTime);
|
||||
_nearestHuntIRs = ACE_player nearEntities ["ACE_HuntIR", HUNTIR_MAX_TRANSMISSION_RANGE];
|
||||
|
||||
|
||||
if ((!dialog) || GVAR(done)) exitWith {
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
|
||||
|
||||
if (dialog && GVAR(state) == "connected") then {
|
||||
[_nearestHuntIRs select 0] call FUNC(cam);
|
||||
} else {
|
||||
|
@ -4,10 +4,10 @@
|
||||
* HuntIR monitor compass
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -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,16 +51,17 @@ _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"];
|
||||
_dir = getDir GVAR(cam); // direction player;
|
||||
|
||||
|
||||
_x1 = __CENTER_X - (__RADIUS * sin(_dir));
|
||||
_y1 = __CENTER_Y - (__RADIUS * cos(_dir));
|
||||
_pos = [[_x1, _y1], _dir] call _fnc_correctIt;
|
||||
@ -84,5 +85,5 @@ HUNTIR_CAM_ROSE_LAYER_ID cutRsc ["ace_huntir_cam_rose", "PLAIN"];
|
||||
_pos = [[_x1, _y1], _dir] call _fnc_correctIt;
|
||||
__CHAR_E ctrlSetPosition [_pos select 0, _pos select 1, __WIDTH, __HEIGHT];
|
||||
__CHAR_E ctrlCommit 0;
|
||||
|
||||
|
||||
}, 0.01, [_fnc_correctIt]] call CBA_fnc_addPerFrameHandler;
|
||||
|
Loading…
Reference in New Issue
Block a user