Code Cleanup laser Self Designate Module.

This commit is contained in:
jokoho48 2015-08-15 23:53:04 +02:00
parent 508c6de2cb
commit bcec28e4b5
5 changed files with 49 additions and 54 deletions

View File

@ -3,28 +3,21 @@
* Handler function for laser network code. * Handler function for laser network code.
* *
* Argument: * Argument:
* 0: Emitter * 0: Emitter <OBJECT>
* 1: Owner
* *
* Return value: * Return Value:
* [position, direction] * 0: position <POSTION>
* 1: direction <ARRAY>
*
* Public: No
*/ */
//findLaserSource.sqf
//#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
private["_emmiter", "_owner", "_gunnerInfo", "_turretInfo", "_povPos", "_povDir"]; private["_gunnerInfo", "_turretInfo"];
params ["_emmiter"];
_emmiter = _this select 0;
_owner = _this select 1;
_gunnerInfo = [_emmiter, (currentWeapon _emmiter)] call CBA_fnc_getFirer; _gunnerInfo = [_emmiter, (currentWeapon _emmiter)] call CBA_fnc_getFirer;
_turretInfo = [_emmiter, _gunnerInfo select 1] call EFUNC(common,getTurretDirection); _turretInfo = [_emmiter, _gunnerInfo select 1] call EFUNC(common,getTurretDirection);
_povPos = _turretInfo select 0; _turretInfo params [["_povPos", -1], ["_povDir", -1]];
_povDir = _turretInfo select 1;
if(!isNil "_povPos" && !isNil "_povDir") exitWith { [_povPos, _povDir]
[_povPos, _povDir]
};
[-1,-1]

View File

@ -2,15 +2,17 @@
* Author: esteldunedain * Author: esteldunedain
* Initializes the actions for turning on/off the laser for vehicles that have them * Initializes the actions for turning on/off the laser for vehicles that have them
* *
* Argument: * Arguments:
* 0: Vehicle <OBJECT> * 0: Vehicle <OBJECT>
* *
* Return value: * Return Value:
* NONE. * None
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
EXPLODE_1_PVT(_this,_vehicle); params ["_vehicle"];
// Add action to class if it is not already done // Add action to class if it is not already done
private ["_type", "_initializedClasses"]; private ["_type", "_initializedClasses"];

View File

@ -7,14 +7,13 @@
* 1: LaserUUID, the UUID of the laser returned by EFUNC(laser,laserOn) * 1: LaserUUID, the UUID of the laser returned by EFUNC(laser,laserOn)
* 2: Local laser target, unused. * 2: Local laser target, unused.
* *
* Return value: * Return Value:
* true * True <BOOL>
*/ */
#include "script_component.hpp" #include "script_component.hpp"
if( (count _this) > 2) then { if( (count _this) > 2) then {
EXPLODE_3_PVT(_this,_shooter,_laserUuid,_localLaserTarget); params ["", "_laserUuid"];
[_laserUuid] call EFUNC(laser,laserOff); [_laserUuid] call EFUNC(laser,laserOff);
// @TODO: Nou gets to field all tickets about missing lasers. // @TODO: Nou gets to field all tickets about missing lasers.
//deleteVehicle _localLaserTarget; //deleteVehicle _localLaserTarget;

View File

@ -3,12 +3,14 @@
* Turns on laser self designation from this vehicle based on the turret. * Turns on laser self designation from this vehicle based on the turret.
* There are no arguments, because it is all strictly based on the users vehicle. * There are no arguments, because it is all strictly based on the users vehicle.
* *
* Argument: * Arguments:
* None
* *
* Return value: * Return Value:
* N/A * None
*
* Public: No
*/ */
//#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
TRACE_1("enter", _this); TRACE_1("enter", _this);
@ -17,10 +19,8 @@ TRACE_1("enter", _this);
FUNC(laserHudDesignatePFH) = { FUNC(laserHudDesignatePFH) = {
private["_strongestResultPos", "_args", "_localLaserTarget", "_laserResultPosition", "_laserResult", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turretInfo", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"]; private["_strongestResultPos", "_args", "_localLaserTarget", "_laserResultPosition", "_laserResult", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turretInfo", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"];
_args = _this select 0; params ["_args"];
_args params ["_shooter", "_localLaserTarget"];
_shooter = _args select 0;
_localLaserTarget = _args select 2;
_vehicle = vehicle _shooter; _vehicle = vehicle _shooter;
TRACE_1("", _args); TRACE_1("", _args);
@ -88,4 +88,3 @@ if(!GVAR(active)) then {
[] call FUNC(laserHudDesignateOff); [] call FUNC(laserHudDesignateOff);
[] call FUNC(laserHudDesignateOn); [] call FUNC(laserHudDesignateOn);
}; };

View File

@ -2,15 +2,17 @@
* Author: esteldunedain * Author: esteldunedain
* Checks if the turret occupied by the given unit has a laser designator * Checks if the turret occupied by the given unit has a laser designator
* *
* Argument: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* *
* Return value: * Return Value:
* Has designator? <BOOL> * Has designator? <BOOL>
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
EXPLODE_1_PVT(_this,_unit); params ["_unit"];
// Get the player turret path // Get the player turret path
private ["_turret","_config","_turretConfig"]; private ["_turret","_config","_turretConfig"];