Visually hide laser targets.

This commit is contained in:
jaynus 2015-04-12 14:03:15 -07:00
parent 2e83e56a73
commit 2317a3c988
5 changed files with 70 additions and 15 deletions

View File

@ -2,13 +2,32 @@ class CfgVehicles {
class All;
class LaserTarget: All {
// LaserTargets are not visual unless in the visual spectrum
model = "";
threat[] = {0,0,0};
// @TODO: Changing the model and simulation hides it, but THEN IT DOESNT SPAWN WTF!?
model = "\A3\Weapons_F\empty.p3d";
simulation = "nvmarker";
nvTarget = 1;
//simulation = "laserTarget";
//threat[] = {0,0,0};
class EventHandlers {
init = QUOTE(_this call FUNC(laser_init));
};
diffuse[] = {0,0,0};
ambient[] = {0,0,0};
brightness = 0;
name = "pozicni blik";
drawLight = 0;
drawLightSize = 0;
drawLightCenterSize = 0;
activeLight = 0;
blinking = 0;
dayLight = 0;
onlyInNvg = 0;
useFlare = 0;
};
// Visual laserTarget override
class ACE_LaserTarget_Visual : LaserTarget {
model = "\A3\Weapons_f\laserTgt.p3d";
//model = "\A3\Weapons_f\laserTgt.p3d";
};
};

View File

@ -20,7 +20,7 @@ PREP(handleLaserOff);
PREP(drawVisibleLaserTargets);
PREP(laser_init);
PREP(vanillaLaserSeekerHandler);
PREP(laserTargetPFH);
ACE_LASERS = [];

View File

@ -1,20 +1,25 @@
#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
private["_args", "_laserTarget"];
//TRACE_1("enter", _this);
_args = _this select 0;
_laserTarget = _args select 0;
_shooter = _args select 1;
_uuid = _args select 2;
if(isNull _laserTarget || !alive player) exitWith {
if(isNull _laserTarget || !alive _shooter) exitWith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
REM(ACE_LASERS, _laserTarget);
};
_end = diag_tickTime;
// Remove laseron
[_uuid] call FUNC(laserOff);
};
#ifdef DEBUG_MODE_FULL
// Iconize the location of the actual laserTarget
_pos = [_laserTarget] call FUNC(getPosASL);
_pos = getPosASL _laserTarget;
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\select_target_ca.paa", [1,0,0,1], (ASLtoATL _pos), 0.75, 0.75, 0, "", 0.5, 0.025, "TahomaB"];
{

View File

@ -1,15 +1,18 @@
#define DEBUG_MODE_FULL
#include "script_component.hpp"
PARAMS_1(_laserTarget);
TRACE_1("enter", _this);
PARAMS_1(_laserTarget);
// Add the target to the global targets array
// Everyone tracks them
// Add the laser localized to the laser array, and give it the default localized code
PUSH(ACE_LASERS, _laserTarget);
// Check the vehicle, otherwise use the default
_laserTarget setVariable ["ACE_LASER_CODE", ACE_DEFAULT_LASER_CODE, false];
_laserTarget setVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE, false];
_laserTarget setVariable [QGVAR(beamSpread), ACE_DEFAULT_LASER_BEAMSPREAD, false];
_laserTarget setVariable [QGVAR(waveLength), ACE_DEFAULT_LASER_WAVELENGTH, false];
// Clean the lasers of any null objects while we are here
REM(ACE_LASERS, objNull);
@ -18,9 +21,11 @@ if(!(local _laserTarget)) exitWith { };
// The target is local, so its on this client
if(!isDedicated) then {
_laserTarget setVariable [QGVAR(owner), ACE_player, true];
// @TODO: Get ownership variables and set them on the vehicle
[FUNC(laserTargetPFH), 0, [_laserTarget, ACE_player]] call cba_fnc_addPerFrameHandler;
_uuid = [(vehicle ACE_player), ACE_player, QFUNC(vanillaLaserSeekerHandler), ACE_DEFAULT_LASER_WAVELENGTH, ACE_DEFAULT_LASER_CODE, ACE_DEFAULT_LASER_BEAMSPREAD] call FUNC(laserOn);
_laserTarget setVariable [QGVAR(uuid), _uuid, false];
[FUNC(laserTargetPFH), 1, [_laserTarget, ACE_player, _uuid]] call cba_fnc_addPerFrameHandler;
} else {
// server side ownership of laser
_laserTarget setVariable [QGVAR(owner), nil, true];

View File

@ -0,0 +1,26 @@
/*
* Author: jaynus
* Handler function for laser network code.
*
* Argument:
* 0: Emitter
* 1: Owner
*
* Return value:
* [position, direction]
*/
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
private["_emitter", "_owner", "_gunnerInfo", "_turretInfo", "_povPos", "_povDir"];
_emmiter = _this select 0;
_owner = _this select 1;
// Not in a vehicle....
// @TODO: handle lasering from turrets
if( (vehicle _owner) == _owner && alive _owner ) exitWith {
[(eyePos _owner), (eyeDirection _owner)]
};
[-1,-1]