Moved getTurretDirection to common.

Tweak creation of action (fucking actions?!) :( :( :(
This commit is contained in:
jaynus 2015-04-02 10:05:50 -07:00
parent c83e602028
commit 596854a264
5 changed files with 44 additions and 23 deletions

View File

@ -92,6 +92,7 @@ PREP(getTurretIndex);
PREP(getTurrets);
PREP(getTurretsFFV);
PREP(getTurretsOther);
PREP(getTurretDirection);
PREP(getUavControlPosition);
PREP(getVehicleCargo);
PREP(getVehicleCodriver);

View File

@ -0,0 +1,37 @@
/*
* Author: jaynus
*
* Get the absolute turret direction for FOV/PIP turret.
*
* Argument:
* 0: Vehicle (Object)
* 1: Turret Position
*
* Return value:
* [position, direction]
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_vehicle,_position);
private ["_turrets", "_turret", "_config", "_turret", "_povPos", "_povDir", "_gunBeginPos", "_gunEndPos", "_pov"];
_turret = [_vehicle, _position] call CBA_fnc_getTurret;
_pov = getText (_turret >> "memoryPointGunnerOptics");
_gunBeg = getText (_turret >> "gunBeg");
_gunEnd = getText (_turret >> "gunEnd");
TRACE_3("", _pov, _gunBeg, _gunEnd);
// Pull the PIP pov or barrel direction, depending on how the model is set up
_povPos = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition _pov ) );
_povDir = [0,0,0];
if(_pov == "pip0_pos") then {
_pipDir = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition "pip0_dir" ) );
_povDir = [_povPos, _pipDir] call BIS_fnc_vectorDiff;
} else {
_gunBeginPos = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition _gunBeg ) );
_gunEndPos = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition _gunEnd ) );
_povDir = [_gunEndPos, _gunBeginPos] call BIS_fnc_vectorDiff;
};
[_povPos, _povDir]

View File

@ -13,7 +13,7 @@ class Extended_PostInit_EventHandlers {
class Extended_GetIn_EventHandlers {
class B_Heli_Attack_01_F {
class ADDON {
getIn = QUOTE(_this call FUNC(onGetin));
clientGetIn = QUOTE(_this call FUNC(onGetIn));
};
};
};
@ -21,7 +21,7 @@ class Extended_GetIn_EventHandlers {
class Extended_GetOut_EventHandlers {
class B_Heli_Attack_01_F {
class ADDON {
getOut = QUOTE(_this call FUNC(onGetout));
clientGetOut = QUOTE(_this call FUNC(onGetOut));
};
};
};

View File

@ -33,26 +33,9 @@ FUNC(laserHudDesignatePFH) = {
// Retrieve the gunner and turret memory point information
_gunnerInfo = [_vehicle, _weapon] call CBA_fnc_getFirer;
_turret = [_vehicle, _gunnerInfo select 1] call CBA_fnc_getTurret;
_pov = getText (_turret >> "memoryPointGunnerOptics");
_gunBeg = getText (_turret >> "gunBeg");
_gunEnd = getText (_turret >> "gunEnd");
TRACE_3("", _pov, _gunBeg, _gunEnd);
// Pull the PIP pov or barrel direction, depending on how the model is set up
_povPos = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition _pov ) );
_povDir = [0,0,0];
if(_pov == "pip0_pos") then {
_pipDir = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition "pip0_dir" ) );
_povDir = [_povPos, _pipDir] call BIS_fnc_vectorDiff;
} else {
_gunBeginPos = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition _gunBeg ) );
_gunEndPos = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition _gunEnd ) );
_povDir = [_gunEndPos, _gunBeginPos] call BIS_fnc_vectorDiff;
};
TRACE_4("", _povDir, _povPos, _gunBeginPos, _gunEndPos);
_turretInfo = [_vehicle, _gunnerInfo select 1] call EFUNC(common,getTurretDirection);
_povPos = _turretInfo select 0;
_povDir = _turretInfo select 1;
_result = [_povPos, _povDir] call EFUNC(laser,shootCone);

View File

@ -1,4 +1,4 @@
#define DEBUG_MODE_FULL
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
// TODO: we should do this differently eventually
private["_onActionId", "_offActionId"];