Self designation lockdown and cleanup

This commit is contained in:
jaynus 2015-04-07 09:05:19 -07:00
parent f973505746
commit 6deff125ce
2 changed files with 22 additions and 4 deletions

View File

@ -1,5 +1,10 @@
#include "script_component.hpp"
if( (count _this) > 2) then {
EXPLODE_3_PVT((_this select 0),_vehicle,_shooter,_laserTarget);
_vehicle setVariable[QGVAR(currentTarget), [], true];
};
if(isNil QGVAR(laser)) exitWith {
false
};
@ -17,4 +22,6 @@ deleteVehicle GVAR(laser);
GVAR(laser) = nil;
GVAR(laserActive) = false;
true

View File

@ -35,10 +35,10 @@ FUNC(laserHudDesignatePFH) = {
TRACE_1("", _args);
if(!alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(laserActive) ) exitWith {
[] call FUNC(laserHudDesignateOff);
[_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff);
};
if(!([ACE_player] call FUNC(unitTurretHasDesignator)) ) exitWith {
[] call FUNC(laserHudDesignateOff);
[_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff);
};
// Retrieve the gunner and turret memory point information
@ -47,6 +47,17 @@ FUNC(laserHudDesignatePFH) = {
_povPos = _turretInfo select 0;
_povDir = _turretInfo select 1;
_targetInfo = _vehicle getVariable[QGVAR(currentTarget), [] ];
if( (count _targetInfo) > 0) then {
if(_laserTarget != (_targetInfo select 0) ) then {
_targetInfo = []
};
};
if( (count _targetInfo) < 1) then {
_targetInfo = [_laserTarget, 1001]; // TODO: set laser code
_vehicle setVariable[QGVAR(currentTarget), _targetInfo, true];
_laserTarget setVariable[QGVAR(owner), _vehicle, true];
};
_result = [_povPos, _povDir] call EFUNC(laser,shootCone);
@ -96,11 +107,11 @@ private "_handle";
if(isNil QGVAR(laser)) then {
_laserTarget = "LaserTargetW" createVehicle (getpos player);
_laserTarget = "LaserTargetW" createVehicle (getpos ACE_player);
GVAR(laserActive) = true;
_handle = [FUNC(laserHudDesignatePFH), 0.1, [_laserTarget, player]] call cba_fnc_addPerFrameHandler;
_handle = [FUNC(laserHudDesignatePFH), 0.1, [_laserTarget, ACE_player]] call cba_fnc_addPerFrameHandler;
_laserTarget setVariable ["ACE_PFH_HANDLE", _handle, false];
GVAR(laser) = _laserTarget;