Tree events to update camUnit

This commit is contained in:
SilentSpike 2015-07-16 17:01:04 +01:00
parent 549d53d919
commit e3c9e52fdd
3 changed files with 50 additions and 2 deletions

View File

@ -160,6 +160,8 @@ class GVAR(overlay) {
};
multiselectEnabled = 0;
maxHistoryDelay = 1;
onTreeDblClick = QUOTE([ARR_2('onTreeDblClick',_this)] call FUNC(handleInterface));
onTreeSelChanged = QUOTE([ARR_2('onTreeSelChanged',_this)] call FUNC(handleInterface));
};
class spectatorMap: RscMapControl {
idc = IDC_MAP;

View File

@ -1,3 +1,19 @@
/*
* Author: SilentSpike
* Handles camera manipulation according to input
*
* Arguments:
* None <NIL>
*
* Return Value:
* None <NIL>
*
* Example:
* [ace_spectator_fnc_handleCamera, 0] call CBA_fnc_addPerFrameHandler;
*
* Public: No
*/
#include "script_component.hpp"
// Kill PFH when display is closed
@ -43,7 +59,12 @@ switch (GVAR(camMode)) do {
[GVAR(camera), GVAR(camTilt), GVAR(camBank)] call BIS_fnc_setPitchBank;
};
case 1: { // Internal
if !(alive GVAR(camUnit)) then {
// Update view when state of unit changes
if !(
(alive GVAR(camUnit)) &&
{vehicle GVAR(camUnit) == GVAR(camUnit)} &&
{GVAR(camUnit) in GVAR(unitList)}
) then {
call FUNC(updateView);
};
};

View File

@ -235,7 +235,6 @@ switch (toLower _mode) do {
_show = !ctrlShown _map;
_map ctrlShow _show;
_map mapCenterOnCamera _show;
//[_show] call FUNC(handleMap);
};
case 57: { // Spacebar
@ -281,4 +280,30 @@ switch (toLower _mode) do {
true
};
// Tree events
case "ontreedblclick": {
if (GVAR(camMode) != 0) then {
private ["_sel","_netID"];
_sel = _args select 1;
// Ensure a unit was selected
if (count _sel == 2) then {
_netID = (_args select 0) tvData _sel;
GVAR(camUnit) = objectFromNetId _netID;
};
};
call FUNC(updateView);
};
case "ontreeselchanged": {
if (GVAR(camMode) == 0) then {
private ["_sel","_netID"];
_sel = _args select 1;
// Ensure a unit was selected
if (count _sel == 2) then {
_netID = (_args select 0) tvData _sel;
GVAR(camUnit) = objectFromNetId _netID;
};
};
};
};