mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Visually hide laser targets.
This commit is contained in:
parent
2e83e56a73
commit
2317a3c988
@ -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";
|
||||
};
|
||||
};
|
@ -20,7 +20,7 @@ PREP(handleLaserOff);
|
||||
PREP(drawVisibleLaserTargets);
|
||||
|
||||
PREP(laser_init);
|
||||
|
||||
PREP(vanillaLaserSeekerHandler);
|
||||
PREP(laserTargetPFH);
|
||||
|
||||
ACE_LASERS = [];
|
||||
|
@ -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);
|
||||
|
||||
// Remove laseron
|
||||
[_uuid] call FUNC(laserOff);
|
||||
};
|
||||
|
||||
_end = diag_tickTime;
|
||||
|
||||
#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"];
|
||||
|
||||
{
|
||||
|
@ -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];
|
||||
|
||||
[FUNC(laserTargetPFH), 0, [_laserTarget, ACE_player]] call cba_fnc_addPerFrameHandler;
|
||||
// @TODO: Get ownership variables and set them on the vehicle
|
||||
|
||||
_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];
|
||||
|
26
addons/laser/functions/fnc_vanillaLaserSeekerHandler.sqf
Normal file
26
addons/laser/functions/fnc_vanillaLaserSeekerHandler.sqf
Normal 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]
|
Loading…
Reference in New Issue
Block a user