mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cleanup and fixes
This commit is contained in:
parent
1f603cc814
commit
6cc05038ff
@ -14,12 +14,10 @@
|
||||
|
||||
params ["_side", "_key"];
|
||||
|
||||
private ["_variableName", "_keys"];
|
||||
private _variableName = format[QGVAR(%1_encryptionKey), _side];
|
||||
private _keys = missionNamespace getvariable [_variableName, []];
|
||||
|
||||
_variableName = format[QGVAR(%1_encryptionKey), _side];
|
||||
_keys = missionNamespace getvariable [_variableName, []];
|
||||
if !(_key in _keys) then {
|
||||
_keys pushback _key;
|
||||
missionNamespace setvariable [_variableName, _keys];
|
||||
publicVariable "_variableName";
|
||||
missionNamespace setvariable [_variableName, _keys, true];
|
||||
};
|
||||
|
@ -17,12 +17,12 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_fromId", "_toId", "_message"];
|
||||
params ["_deviceId", "_otherDeviceId", "_message"];
|
||||
|
||||
private _messagesListKey = [_deviceId, _otherDeviceId] call FUNC(chatMessage_getId);
|
||||
|
||||
private _timeStamp = format["00:00"];
|
||||
private _messageId = [] call FUNC(generateEncryptionKey); // some random key TODO improve or implement some unique Id generator
|
||||
private _constructedMessage = [_messageId, _timestamp, _message, _fromId];
|
||||
private _constructedMessage = [_messageId, _timestamp, _message, _deviceId];
|
||||
|
||||
[_messagesListKey, _constructedMessage] call FUNC(syncedArrayPushback);
|
||||
|
@ -19,4 +19,4 @@ if !(local _unit) exitwith {};
|
||||
|
||||
{
|
||||
[_unit, _x] call FUNC(checkItem);
|
||||
}foreach items _unit;
|
||||
} foreach items _unit;
|
||||
|
@ -16,8 +16,6 @@
|
||||
|
||||
params ["_unit", "_item"];
|
||||
|
||||
private ["_magazine", "_previousMags", "_newMagName", "_newMags", "_magID"];
|
||||
|
||||
if !(local _unit) exitwith {};
|
||||
|
||||
if (isText (configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType)) && {getText(configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType)) != ""}) then {
|
||||
@ -27,19 +25,19 @@ if (isText (configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType)) && {getTex
|
||||
systemChat format["%1 BFT enabled item %2", _unit, _item];
|
||||
diag_log format["%1 BFT enabled item %2", _unit, _item];
|
||||
|
||||
_magazine = getText (configFile >> "CfgWeapons" >> _item >> QGVAR(magazineItem));
|
||||
private _magazine = getText (configFile >> "CfgWeapons" >> _item >> QGVAR(magazineItem));
|
||||
if (_magazine != "") then {
|
||||
systemChat format["%1 replacing by %2", _item, _magazine];
|
||||
diag_log format["%1 replacing by %2", _item, _magazine];
|
||||
|
||||
_unit removeItem _item;
|
||||
_previousMags = magazinesDetail _unit;
|
||||
private _previousMags = magazinesDetail _unit;
|
||||
_unit addMagazine _magazine;
|
||||
_newMags = (magazinesDetail _unit) - _previousMags;
|
||||
private _newMags = (magazinesDetail _unit) - _previousMags;
|
||||
if ((count _newMags) == 0) exitWith {ERROR("failed to add magazine (inventory full?)");};
|
||||
_newMagName = _newMags select 0;
|
||||
private _newMagName = _newMags select 0;
|
||||
|
||||
_magID = [_newMagName] call FUNC(getMagazineID);
|
||||
private _magID = [_newMagName] call FUNC(getMagazineID);
|
||||
systemChat format["%1 id %2", _item, _magID];
|
||||
diag_log format["%1 id %2", _item, _magID];
|
||||
|
||||
|
@ -19,8 +19,7 @@ params ["_groupID"];
|
||||
|
||||
if (count _this < 3) exitwith {}; // What is the 3rd parameter?
|
||||
|
||||
private ["_found"];
|
||||
_found = false;
|
||||
private _found = false;
|
||||
{
|
||||
if (_x select 0 == _groupID) exitwith {_found = true;};
|
||||
} forEach GVAR(orbatElements);
|
||||
|
@ -13,15 +13,14 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private [ "_deviceID", "_owner","_deviceClass", "_encryptionKeys", "_access", "_typeIconPath", "_sizeIconPath", "_callsign","_groupID", "_position", "_direction", "_refreshRate", "_viewModes", "_color", "_state"];
|
||||
_deviceID = D_GET_ID(_this);
|
||||
_owner = D_GET_OWNER(_this);
|
||||
_deviceClass = D_GET_CLASSNAME(_this);
|
||||
_refreshRate = D_GET_REFRESH_RATE_TX(_this);
|
||||
_viewModes = D_GET_DEVICEMODES(_this);
|
||||
private _deviceID = D_GET_ID(_this);
|
||||
private _owner = D_GET_OWNER(_this);
|
||||
private _deviceClass = D_GET_CLASSNAME(_this);
|
||||
private _refreshRate = D_GET_REFRESH_RATE_TX(_this);
|
||||
private _viewModes = D_GET_DEVICEMODES(_this);
|
||||
|
||||
_encryptionKeys = D_GET_ENCRYPTION(_this);
|
||||
_state = D_GET_DEVICE_STATE(_this);
|
||||
private _encryptionKeys = D_GET_ENCRYPTION(_this);
|
||||
private _state = D_GET_DEVICE_STATE(_this);
|
||||
/*_access = true;
|
||||
{
|
||||
if (_x in _encryptionKeys) exitwith {_access = true; };
|
||||
@ -29,14 +28,14 @@ _state = D_GET_DEVICE_STATE(_this);
|
||||
|
||||
if !(_access) exitwith {[]};*/
|
||||
|
||||
_typeIconPath = [D_GET_SIDE(_this), D_GET_TYPE(_this)] call FUNC(getTypeIcon);
|
||||
_sizeIconPath = [D_GET_SIDE(_this), D_GET_SIZE(_this)] call FUNC(getSizeIcon);
|
||||
_callsign = D_GET_CALLSIGN(_this);
|
||||
_groupID = D_GET_GROUP_ID(_this);
|
||||
private _typeIconPath = [D_GET_SIDE(_this), D_GET_TYPE(_this)] call FUNC(getTypeIcon);
|
||||
private _sizeIconPath = [D_GET_SIDE(_this), D_GET_SIZE(_this)] call FUNC(getSizeIcon);
|
||||
private _callsign = D_GET_CALLSIGN(_this);
|
||||
private _groupID = D_GET_GROUP_ID(_this);
|
||||
|
||||
_position = getPosASL vehicle _owner;
|
||||
_direction = direction vehicle _owner;
|
||||
_color = [_groupID] call FUNC(getGroupColor);
|
||||
private _position = getPosASL vehicle _owner;
|
||||
private _direction = direction vehicle _owner;
|
||||
private _color = [_groupID] call FUNC(getGroupColor);
|
||||
|
||||
if (_callsign == "" && {_owner isKindOf "CAManBase"}) then {
|
||||
_callsign = groupId group _owner;
|
||||
|
@ -16,13 +16,4 @@
|
||||
|
||||
params ["_keySetOne", "_keySetTwo"];
|
||||
|
||||
private ["_return"];
|
||||
// ToDo: replace with arrayIntersect when available
|
||||
// count (_keySetOne arrayIntersect _keySetTwo) > 0
|
||||
|
||||
_return = false;
|
||||
{
|
||||
if (_x in _keySetTwo) exitWith { _return = true; };
|
||||
} forEach _keySetOne;
|
||||
|
||||
_return
|
||||
count (_keySetOne arrayIntersect _keySetTwo) > 0
|
||||
|
@ -12,8 +12,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_newKeyArray"];
|
||||
_newKeyArray = [];
|
||||
private _newKeyArray = [];
|
||||
|
||||
for "_i" from 1 to 15 /* step +1 */ do {
|
||||
_newKeyArray pushback (48 + floor(random(74)));
|
||||
|
@ -15,19 +15,15 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_deviceConfigs","_allReportingModes","_deviceReportingModes"];
|
||||
private _deviceConfigs = "true" configClasses (configFile >> "ACE_BFT" >> "Devices");
|
||||
|
||||
_deviceConfigs = "true" configClasses (configFile >> "ACE_BFT" >> "Devices");
|
||||
|
||||
_allReportingModes = [];
|
||||
private _allReportingModes = [];
|
||||
{
|
||||
if (isClass _x) then {
|
||||
if (isArray (_x >> "reportingModes")) then {
|
||||
_deviceReportingModes = getArray (_x >> "reportingModes");
|
||||
// only append what isn't there already
|
||||
_allReportingModes append (_deviceReportingModes - _allReportingModes);
|
||||
};
|
||||
}
|
||||
if (isClass _x && {isArray (_x >> "reportingModes")}) then {
|
||||
private _deviceReportingModes = getArray (_x >> "reportingModes");
|
||||
// only append what isn't there already
|
||||
_allReportingModes append (_deviceReportingModes - _allReportingModes);
|
||||
};
|
||||
} forEach _deviceConfigs;
|
||||
|
||||
_allReportingModes
|
||||
_allReportingModes
|
||||
|
@ -15,8 +15,7 @@
|
||||
|
||||
params ["_deviceID"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [];
|
||||
private _data = [];
|
||||
{
|
||||
if (_x select 0 == _deviceID) exitWith {
|
||||
_data = _x; // GVAR(deviceData) select _foreachIndex;
|
||||
|
@ -20,4 +20,4 @@ if (typeName _side == "OBJECT") then {
|
||||
_side = str side _side;
|
||||
};
|
||||
|
||||
(missionNamespace getvariable [format[QGVAR(%1_encryptionKey), _side], [""]])
|
||||
(missionNamespace getvariable [format[QGVAR(%1_encryptionKey), _side], [""]])
|
||||
|
@ -15,10 +15,9 @@
|
||||
|
||||
params ["_groupID"];
|
||||
|
||||
private ["_data", "_found", "_color"];
|
||||
_data = [_groupID] call FUNC(getGroupData);
|
||||
_found = false;
|
||||
_color = GVAR(colorWest);
|
||||
private _data = [_groupID] call FUNC(getGroupData);
|
||||
private _found = false;
|
||||
private _color = GVAR(colorWest);
|
||||
|
||||
while {!_found} do {
|
||||
if (_groupID < 0) exitWith {};
|
||||
|
@ -15,8 +15,7 @@
|
||||
|
||||
params ["_groupID"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_groupID, "", -1/*parent group ID*/];
|
||||
private _data = [_groupID, "", -1/*parent group ID*/];
|
||||
{
|
||||
if (_x select 0 == _groupID) exitWith {
|
||||
_data = _x;
|
||||
|
@ -19,61 +19,61 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_deviceData","_deviceOwner","_interfaces","_interface","_deviceType","_vehicleInterfaces","_assignedVehicleRole","_roleIndex","_roleName","_whereAvailable","_found"];
|
||||
params ["_deviceID", "_unit"];
|
||||
|
||||
_deviceData = [_deviceID] call EFUNC(bft,getDeviceData);
|
||||
_deviceOwner = D_GET_OWNER(_deviceData);
|
||||
private _deviceData = [_deviceID] call EFUNC(bft,getDeviceData);
|
||||
private _deviceOwner = D_GET_OWNER(_deviceData);
|
||||
|
||||
_interfaces = [];
|
||||
private _interfaces = [];
|
||||
|
||||
if (_deviceOwner isKindOf "ParachuteBase" || _deviceOwner isKindOf "CAManBase") then {
|
||||
if (_deviceOwner isKindOf "ParachuteBase" || {_deviceOwner isKindOf "CAManBase"}) then {
|
||||
// personal device
|
||||
_deviceType = D_GET_DEVICETYPE(_deviceData);
|
||||
private _deviceType = D_GET_DEVICETYPE(_deviceData);
|
||||
if (isText (configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "interface")) then {
|
||||
_interface = getText (configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "interface");
|
||||
private _interface = getText (configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "interface");
|
||||
if (_interface != "") then {
|
||||
_interfaces pushBack _interface;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
// vehicle device
|
||||
_vehicleInterfaces = _deviceOwner getvariable [QGVAR(vehicleInterfaces), getArray (configFile >> "CfgVehicles" >> typeOf _deviceOwner >> QGVAR(vehicleInterfaces))];
|
||||
|
||||
private _vehicleInterfaces = _deviceOwner getvariable [QGVAR(vehicleInterfaces), getArray (configFile >> "CfgVehicles" >> typeOf _deviceOwner >> QGVAR(vehicleInterfaces))];
|
||||
|
||||
// bail if there are no interfaces defined
|
||||
if (isNil "_vehicleInterfaces" || {_vehicleInterfaces isEqualTo []}) exitWith {};
|
||||
|
||||
_assignedVehicleRole = assignedVehicleRole _unit;
|
||||
|
||||
|
||||
private _assignedVehicleRole = assignedVehicleRole _unit;
|
||||
|
||||
// bail if unit is not in a vehicle
|
||||
if (_assignedVehicleRole isEqualTo []) exitWith {};
|
||||
|
||||
_roleName = _assignedVehicleRole select 0;
|
||||
_roleIndex = call {
|
||||
|
||||
private _roleName = _assignedVehicleRole select 0;
|
||||
private _roleIndex = call {
|
||||
if (_roleName == "Cargo") exitWith {_deviceOwner getCargoIndex _unit};
|
||||
if (_roleName == "Turret") exitWith {_assignedVehicleRole select 1 select 0};
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
{
|
||||
switch (typeName _x) do {
|
||||
case "STRING": {_interfaces pushBack _x};
|
||||
|
||||
|
||||
case "ARRAY": {
|
||||
// whereAvailable test
|
||||
_interface = _x select 0;
|
||||
_whereAvailable = _x select 1;
|
||||
private _interface = _x select 0;
|
||||
private _whereAvailable = _x select 1;
|
||||
{
|
||||
_found = switch (typeName _x) do {
|
||||
private _found = false;
|
||||
|
||||
switch (typeName _x) do {
|
||||
case "STRING": {
|
||||
if (_x == _roleName) then {true};
|
||||
if (_x == _roleName) then {_found = true};
|
||||
};
|
||||
case "ARRAY": {
|
||||
if ((_x select 0) == _roleName && _roleIndex in (_x select 1)) then {true};
|
||||
if ((_x select 0) == _roleName && _roleIndex in (_x select 1)) then {_found = true};
|
||||
};
|
||||
default {false};
|
||||
};
|
||||
|
||||
|
||||
if (_found) exitWith {_interfaces pushBack _interface};
|
||||
} forEach _whereAvailable;
|
||||
};
|
||||
@ -81,4 +81,4 @@ if (_deviceOwner isKindOf "ParachuteBase" || _deviceOwner isKindOf "CAManBase")
|
||||
} forEach _vehicleInterfaces;
|
||||
};
|
||||
|
||||
_interfaces
|
||||
_interfaces
|
||||
|
@ -15,12 +15,11 @@
|
||||
|
||||
params ["_detailsEntry"];
|
||||
|
||||
private ["_index", "_value", "_id"];
|
||||
_index = _detailsEntry find "[";
|
||||
_id = "";
|
||||
private _index = _detailsEntry find "[";
|
||||
private _id = "";
|
||||
|
||||
if (_index > 0) then {
|
||||
_value = toArray _detailsEntry;
|
||||
private _value = toArray _detailsEntry;
|
||||
_value deleteRange [0, _index];
|
||||
_id = toString _value;
|
||||
};
|
||||
|
@ -16,8 +16,7 @@
|
||||
params ["_owner"];
|
||||
|
||||
// Or use OBJECT getvariable [QGVAR(ownedDevices), []]; ?
|
||||
private ["_ids"];
|
||||
_ids = [];
|
||||
private _ids = [];
|
||||
|
||||
{
|
||||
if ((_x select 5) == _owner) then {
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_currentDevices"];
|
||||
// [_magID, [_deviceSide, _deviceEncryptionKeys], _assignableInformation, _app, -1, _owner]
|
||||
diag_log format["added to deviceData: %1", _this];
|
||||
GVAR(deviceData) pushback _this;
|
||||
@ -27,7 +26,7 @@ systemChat format["handleAddDeviceData: %1", _this];
|
||||
diag_log format["handleAddDeviceData: %1", _this];
|
||||
|
||||
if (local (_this select 5)) then {
|
||||
_currentDevices = (_this select 5) getvariable [QGVAR(ownedDevices), []];
|
||||
private _currentDevices = (_this select 5) getvariable [QGVAR(ownedDevices), []];
|
||||
if !((_this select 0) in _currentDevices) then {
|
||||
_currentDevices pushback (_this select 0);
|
||||
(_this select 5) setvariable [QGVAR(ownedDevices), _currentDevices, true];
|
||||
|
@ -13,10 +13,9 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
{
|
||||
private ["_groupID","_color"];
|
||||
_groupID = (_x select 6) select 0;
|
||||
private _groupID = (_x select 6) select 0;
|
||||
if (_groupID >= 0) then {
|
||||
_color = [_groupID] call FUNC(getGroupColor);
|
||||
private _color = [_groupID] call FUNC(getGroupColor);
|
||||
(_x select 6) set [1, _color];
|
||||
};
|
||||
} foreach GVAR(availableDevices);
|
||||
} foreach GVAR(availableDevices);
|
||||
|
@ -12,9 +12,9 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_data", "_deviceID", "_displayData", "_encryptionKeys", "_deviceModes"];
|
||||
_data = _this select 0;
|
||||
_deviceID = D_GET_ID(_data);
|
||||
params ["_data"];
|
||||
|
||||
private _deviceID = D_GET_ID(_data);
|
||||
diag_log format["hanldeDeviceDataChanged for: %1", _deviceID];
|
||||
|
||||
if (isNull D_GET_OWNER(_data)) exitwith { // doesn't have an owner anymore, remove.
|
||||
@ -28,8 +28,8 @@ if (isNull D_GET_OWNER(_data)) exitwith { // doesn't have an owner anymore, remo
|
||||
} foreach GVAR(availableDevices);
|
||||
};
|
||||
};
|
||||
_encryptionKeys = D_GET_ENCRYPTION(_data);
|
||||
_deviceModes = D_GET_DEVICEMODES(_data);
|
||||
private _encryptionKeys = D_GET_ENCRYPTION(_data);
|
||||
private _deviceModes = D_GET_DEVICEMODES(_data);
|
||||
|
||||
if (_this select 1) then { // add new
|
||||
if !([_encryptionKeys, GVAR(registeredEncyptionKeys)] call FUNC(encryptionKeyMatch)) exitwith {
|
||||
@ -40,7 +40,7 @@ if (_this select 1) then { // add new
|
||||
}; // if the encryption key is not know, the device is not available
|
||||
if (!(D_GET_OWNER(_data) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_data) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_data)) && alive D_GET_OWNER(_data)}) exitwith {};
|
||||
if (D_GET_DEVICE_STATE_VALUE(_data) in [STATE_OFFLINE, STATE_DESTROYED]) exitwith {};
|
||||
_displayData = _data call FUNC(deviceDataToMapData);
|
||||
private _displayData = _data call FUNC(deviceDataToMapData);
|
||||
if (count _displayData > 0) then {
|
||||
GVAR(availableDevices) pushback _displayData;
|
||||
};
|
||||
@ -59,7 +59,7 @@ if (_this select 1) then { // add new
|
||||
// GVAR(availableDevices) deleteAt _forEachIndex; // no longer a match, so we remove it from available devices
|
||||
//};
|
||||
// we don't know what info has changed, so we just replace it completely.
|
||||
_displayData = _data call FUNC(deviceDataToMapData);
|
||||
private _displayData = _data call FUNC(deviceDataToMapData);
|
||||
GVAR(availableDevices) set [_forEachIndex, _displayData];
|
||||
};
|
||||
} foreach GVAR(availableDevices);
|
||||
|
@ -12,12 +12,10 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_deviceID","_refreshRateRX","_deviceData"];
|
||||
|
||||
// by default, consider the device not having a receiver
|
||||
_refreshRateRX = -1;
|
||||
_deviceID = _this select 0;
|
||||
_deviceData = [_deviceID] call FUNC(getDeviceData);
|
||||
private _refreshRateRX = -1;
|
||||
private _deviceID = _this select 0;
|
||||
private _deviceData = [_deviceID] call FUNC(getDeviceData);
|
||||
GVAR(currentOpenedDevice) = _deviceData;
|
||||
if !(_deviceData isEqualTo []) then {
|
||||
_refreshRateRX = D_GET_REFRESH_RATE_RX(_deviceData);
|
||||
|
@ -16,11 +16,8 @@ params ["_object", "_turnedOn"];
|
||||
|
||||
// clear out any device in available devices that is owned by the object.
|
||||
// We do this for both engine on and engine off to avoid any duplicates
|
||||
private ["_device","_i"];
|
||||
|
||||
|
||||
for "_i" from (count GVAR(availableDevices) - 1) to 0 step -1 do {
|
||||
_device = GVAR(availableDevices) select _i;
|
||||
private _device = GVAR(availableDevices) select _i;
|
||||
if (AD_GET_DEVICE_STATE_VALUE(_device) isEqualTo STATE_NORMAL) then {
|
||||
if (AD_GET_OWNER(_device) == _object) then {
|
||||
GVAR(availableDevices) deleteAt _i;
|
||||
@ -30,9 +27,8 @@ for "_i" from (count GVAR(availableDevices) - 1) to 0 step -1 do {
|
||||
};
|
||||
|
||||
if (_turnedOn) then {
|
||||
private ["_deviceData", "_encryptionKeys", "_deviceModes", "_displayData"];
|
||||
{
|
||||
_deviceData = [_x] call FUNC(getDeviceData);
|
||||
private _deviceData = [_x] call FUNC(getDeviceData);
|
||||
if (!(_deviceData isEqualTo [])) then {
|
||||
if !(isNull D_GET_OWNER(_deviceData)) then {
|
||||
if (D_GET_DEVICE_STATE_VALUE(_deviceData) isEqualTo STATE_OFFLINE) then {
|
||||
@ -41,25 +37,24 @@ if (_turnedOn) then {
|
||||
};
|
||||
|
||||
if !(D_GET_DEVICE_STATE_VALUE(_deviceData) isEqualTo STATE_NORMAL) exitwith {}; // means we didn't remove it
|
||||
_encryptionKeys = D_GET_ENCRYPTION(_deviceData);
|
||||
private _encryptionKeys = D_GET_ENCRYPTION(_deviceData);
|
||||
if !([_encryptionKeys, GVAR(registeredEncyptionKeys)] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_deviceModes = D_GET_DEVICEMODES(_deviceData);
|
||||
private _deviceModes = D_GET_DEVICEMODES(_deviceData);
|
||||
if !([_deviceModes, GVAR(registeredViewModes)] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_displayData = _deviceData call FUNC(deviceDataToMapData);
|
||||
private _displayData = _deviceData call FUNC(deviceDataToMapData);
|
||||
if (count _displayData > 0) then {
|
||||
GVAR(availableDevices) pushback _displayData;
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach (_object getvariable [QGVAR(ownedDevices), []]);
|
||||
} foreach (_object getvariable [QGVAR(ownedDevices), []]);
|
||||
} else {
|
||||
if (!alive _object) exitwith {};
|
||||
|
||||
private ["_deviceData", "_encryptionKeys", "_deviceModes", "_displayData"];
|
||||
|
||||
{
|
||||
_deviceData = [_x] call FUNC(getDeviceData);
|
||||
private _deviceData = [_x] call FUNC(getDeviceData);
|
||||
if (!(_deviceData isEqualTo [])) then {
|
||||
if !(isNull D_GET_OWNER(_deviceData)) then {
|
||||
if (D_GET_DEVICE_STATE_VALUE(_deviceData) isEqualTo STATE_NORMAL) then {
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
params ["_owner", "_item", "_magazine", "_magID", ["_initialState", STATE_NORMAL]];
|
||||
|
||||
private ["_deviceType", "_deviceSide", "_refreshRate", "_deviceEncryptionKeys", "_assignableInformation", "_app", "_deviceInformation", "_exists", "_deviceModes", "_defaultValues", "_elementCallsign", "_elementSize", "_elementType", "_groupID"];
|
||||
|
||||
/*
|
||||
Device ID
|
||||
Side ID/encyrption ID
|
||||
@ -35,7 +33,7 @@ private ["_deviceType", "_deviceSide", "_refreshRate", "_deviceEncryptionKeys",
|
||||
systemChat format["handleItemCreated: %1", _this];
|
||||
diag_log format["handleItemCreated: entry args: %1", _this];
|
||||
|
||||
_exists = false;
|
||||
private _exists = false;
|
||||
{
|
||||
if (_magID == (_x select 0)) exitwith {_exists = true};
|
||||
} forEach GVAR(deviceData);
|
||||
@ -43,11 +41,11 @@ if (_exists) exitwith {
|
||||
diag_log format["handleItemCreated: Already exists: %1", _magID];
|
||||
};
|
||||
|
||||
_deviceType = if (_magazine != "") then { getText(configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType)) } else { _item };
|
||||
_deviceSide = getText(configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "deviceSide");
|
||||
_deviceModes = getArray(configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "reportingModes");
|
||||
private _deviceType = if (_magazine != "") then { getText(configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType)) } else { _item };
|
||||
private _deviceSide = getText(configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "deviceSide");
|
||||
private _deviceModes = getArray(configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "reportingModes");
|
||||
|
||||
_defaultValues = [];
|
||||
private _defaultValues = [];
|
||||
// if this is a vehicle device, see if the default information is present on the vehicle
|
||||
if !(isNull _owner || {_owner isKindOf "ParachuteBase" || _owner isKindOf "CAManBase"}) then {
|
||||
if (isArray (configFile >> "CfgVehicles" >> typeOf _owner >> QGVAR(defaultInformation))) then {
|
||||
@ -59,18 +57,18 @@ if (_defaultValues isEqualTo []) then {
|
||||
_defaultValues = getArray (configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "defaultInformation");
|
||||
};
|
||||
|
||||
_refreshRate = getArray(configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "refreshRate");
|
||||
private _refreshRate = getArray(configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "refreshRate");
|
||||
|
||||
_deviceEncryptionKeys = [_deviceSide] call FUNC(getEncryptionKey); // getting the default encryption keys for this side
|
||||
private _deviceEncryptionKeys = [_deviceSide] call FUNC(getEncryptionKey); // getting the default encryption keys for this side
|
||||
|
||||
_elementType = _owner getvariable format[QGVAR(elementType_%1),_item];
|
||||
_elementSize = _owner getvariable format[QGVAR(elementSize_%1),_item];
|
||||
_elementCallsign = _owner getvariable format[QGVAR(elementCallsign_%1),_item];
|
||||
_groupID = _owner getvariable format[QGVAR(groupID_%1),_item];
|
||||
private _elementType = _owner getvariable format[QGVAR(elementType_%1),_item];
|
||||
private _elementSize = _owner getvariable format[QGVAR(elementSize_%1),_item];
|
||||
private _elementCallsign = _owner getvariable format[QGVAR(elementCallsign_%1),_item];
|
||||
private _groupID = _owner getvariable format[QGVAR(groupID_%1),_item];
|
||||
|
||||
|
||||
// format: [elementType, elementSize, elementCallsign, orbatElementID]
|
||||
_assignableInformation = _owner getvariable [format[QGVAR(assignableInformation_%1),_item], _defaultValues];
|
||||
private _assignableInformation = _owner getvariable [format[QGVAR(assignableInformation_%1),_item], _defaultValues];
|
||||
|
||||
if (!isnil "_elementType") then {
|
||||
_assignableInformation set [0, _elementType];
|
||||
@ -87,10 +85,10 @@ if (!isnil "_groupID") then {
|
||||
};
|
||||
|
||||
// format: app ID, app data
|
||||
_app = [-1, []];
|
||||
private _app = [-1, []];
|
||||
|
||||
// format: device ID, deviceSide [side, encryptionKeys], deviceInformation [elementType, elementSize, callsign, orbatID], appInformation [appID, appData], timeLoggedIn, owner, item, deviceType, _refreshRate [TX, RX], _deviceModes, deviceState]
|
||||
_deviceInformation = [_magID, [_deviceSide, _deviceEncryptionKeys], _assignableInformation, _app, -1, _owner, _item, _deviceType, _refreshRate, _deviceModes, [_initialState]];
|
||||
private _deviceInformation = [_magID, [_deviceSide, _deviceEncryptionKeys], _assignableInformation, _app, -1, _owner, _item, _deviceType, _refreshRate, _deviceModes, [_initialState]];
|
||||
|
||||
diag_log format["Prep raising bft_addDeviceData _deviceInformation with: %1", _deviceInformation];
|
||||
[{
|
||||
|
@ -12,9 +12,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_add","_newEncryptionKeys"];
|
||||
_newEncryptionKeys = _this select 0;
|
||||
_add = _this select 1;
|
||||
params ["_newEncryptionKeys", "_add"];
|
||||
|
||||
// if _add is nil, rebuild list from scratch
|
||||
if (isNil "_add") then {
|
||||
@ -27,30 +25,26 @@ if (isNil "_add") then {
|
||||
if (count _newEncryptionKeys == 0) exitWith {};
|
||||
|
||||
if (_add) then {
|
||||
private ["_deviceModes","_encryptionKeys","_displayData"];
|
||||
|
||||
// Adding a new key isn't nice. Now we got to add new shit and loop through the massive data collection. yay?
|
||||
{
|
||||
if !(isNull D_GET_OWNER(_x)) then {
|
||||
if (!(D_GET_OWNER(_x) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_x) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_x)) && alive D_GET_OWNER(_data)}) exitwith {};
|
||||
if (D_GET_DEVICE_STATE_VALUE(_x) in [STATE_OFFLINE, STATE_DESTROYED]) exitwith {};
|
||||
_encryptionKeys = D_GET_ENCRYPTION(_x);
|
||||
private _encryptionKeys = D_GET_ENCRYPTION(_x);
|
||||
if !([_encryptionKeys, _newEncryptionKeys] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_deviceModes = D_GET_DEVICEMODES(_x);
|
||||
private _deviceModes = D_GET_DEVICEMODES(_x);
|
||||
if !([_deviceModes, GVAR(registeredViewModes)] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_displayData = _x call FUNC(deviceDataToMapData);
|
||||
private _displayData = _x call FUNC(deviceDataToMapData);
|
||||
if (count _displayData > 0) then {
|
||||
GVAR(availableDevices) pushback _displayData;
|
||||
};
|
||||
};
|
||||
} foreach GVAR(deviceData);
|
||||
} else { // if we remove one, we only have to check the already available devices
|
||||
private ["_device","_i"];
|
||||
|
||||
for "_i" from (count GVAR(availableDevices) - 1) to 0 step -1 do {
|
||||
_device = GVAR(availableDevices) select _i;
|
||||
private _device = GVAR(availableDevices) select _i;
|
||||
if !([AD_GET_ENCRYPTION(_device), GVAR(registeredEncyptionKeys)] call FUNC(encryptionKeyMatch)) then {
|
||||
GVAR(availableDevices) deleteAt _i;
|
||||
_i = _i - 1;
|
||||
|
@ -12,9 +12,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_add","_viewModes"];
|
||||
_viewModes = _this select 0;
|
||||
_add = _this select 1;
|
||||
params ["_viewModes", "_add"];
|
||||
|
||||
// if _add is nil, rebuild list from scratch
|
||||
if (isNil "_add") then {
|
||||
@ -27,19 +25,17 @@ if (isNil "_add") then {
|
||||
if (count _viewModes == 0) exitWith {};
|
||||
|
||||
if (_add) then {
|
||||
private ["_deviceModes","_encryptionKeys","_displayData"];
|
||||
|
||||
{
|
||||
if !(isNull D_GET_OWNER(_x)) then {
|
||||
if (!(D_GET_OWNER(_x) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_x) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_x)) && alive D_GET_OWNER(_data)}) exitwith {};
|
||||
if (D_GET_DEVICE_STATE_VALUE(_x) in [STATE_OFFLINE, STATE_DESTROYED]) exitwith {};
|
||||
_deviceModes = D_GET_DEVICEMODES(_x);
|
||||
private _deviceModes = D_GET_DEVICEMODES(_x);
|
||||
if !([_deviceModes, _viewModes] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_encryptionKeys = D_GET_ENCRYPTION(_x);
|
||||
private _encryptionKeys = D_GET_ENCRYPTION(_x);
|
||||
if !([_encryptionKeys, GVAR(registeredEncyptionKeys)] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_displayData = _x call FUNC(deviceDataToMapData);
|
||||
private _displayData = _x call FUNC(deviceDataToMapData);
|
||||
if (count _displayData > 0) then {
|
||||
GVAR(availableDevices) pushback _displayData;
|
||||
};
|
||||
|
@ -29,9 +29,8 @@ diag_log format["handleRequestAllData: Request from Origin: %1", _origin];
|
||||
|
||||
{
|
||||
diag_log format["handleRequestAllData: Add synced array variable: %1", _x];
|
||||
private ["_varName", "_variable"];
|
||||
_varName = _x;
|
||||
_variable = missionNamespace getvariable [_varName, []];
|
||||
private _varName = _x;
|
||||
private _variable = missionNamespace getvariable [_varName, []];
|
||||
|
||||
{
|
||||
diag_log format["handleRequestAllData: Add synced array variable (%1) value: %2", _varName, _x];
|
||||
|
@ -17,15 +17,13 @@
|
||||
|
||||
params ["_varName", "_elementID"];
|
||||
|
||||
private ["_variable"];
|
||||
_variable = missionNamespace getvariable [_varName, []];
|
||||
private _variable = missionNamespace getvariable [_varName, []];
|
||||
|
||||
{
|
||||
if ((_x select 0) isEqualTo _elementID) exitwith {
|
||||
systemChat format["handleSyncedArrayDelete deleting- %1", _x];
|
||||
diag_log format["handleSyncedArrayDelete deleting- %1", _x];
|
||||
private ["_removedElement"];
|
||||
_removedElement = _variable deleteAt _foreachIndex;
|
||||
private _removedElement = _variable deleteAt _foreachIndex;
|
||||
["bft_syncedArrayChanged", [2, _removedElement]] call CBA_fnc_localEvent;
|
||||
|
||||
};
|
||||
|
@ -16,12 +16,10 @@
|
||||
|
||||
params ["_varName", "_data"];
|
||||
|
||||
private ["_variable"];
|
||||
|
||||
systemChat format["handleSyncedArrayPushback: %1", _this];
|
||||
diag_log format["handleSyncedArrayPushback: %1", _this];
|
||||
|
||||
_variable = missionNamespace getvariable [_varName, []];
|
||||
private _variable = missionNamespace getvariable [_varName, []];
|
||||
_variable pushback _data;
|
||||
missionNamespace setvariable [_varName, _variable];
|
||||
|
||||
@ -30,8 +28,6 @@ missionNamespace setvariable [_varName, _variable];
|
||||
systemChat format["handleSyncedArrayPushback %1 - %2", _varName, _variable];
|
||||
diag_log format["handleSyncedArrayPushback %1 - %2", _varName, _variable];
|
||||
|
||||
if (isServer) then {
|
||||
if !(_varName in GVAR(syncedArrayVariables)) then {
|
||||
GVAR(syncedArrayVariables) pushback _varName;
|
||||
};
|
||||
if (isServer && {!(_varName in GVAR(syncedArrayVariables))}) then {
|
||||
GVAR(syncedArrayVariables) pushback _varName;
|
||||
};
|
||||
|
@ -18,15 +18,13 @@
|
||||
|
||||
params ["_varName", "_data"];
|
||||
|
||||
private ["_elementID", "_variable", "_compareID"];
|
||||
|
||||
systemChat format["handleSyncedArrayUpdate - %1", _this];
|
||||
diag_log format["handleSyncedArrayUpdate - %1", _this];
|
||||
|
||||
_elementID = if (typeName _data == "ARRAY") then {_data select 0} else {_data};
|
||||
_variable = missionNamespace getvariable [_varName, []];
|
||||
private _elementID = if (typeName _data == "ARRAY") then {_data select 0} else {_data};
|
||||
private _variable = missionNamespace getvariable [_varName, []];
|
||||
{
|
||||
_compareID = if (typeName _x == "ARRAY") then {_x select 0} else {_x};
|
||||
private _compareID = if (typeName _x == "ARRAY") then {_x select 0} else {_x};
|
||||
if (_compareID isEqualTo _elementID) exitwith {
|
||||
_variable set[_forEachIndex, _data];
|
||||
["bft_syncedArrayChanged", [1, _data, _x]] call CBA_fnc_localEvent;
|
||||
|
@ -16,8 +16,7 @@
|
||||
|
||||
params ["_deviceID", "_newData"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
_data set [3, _newData];
|
||||
|
||||
// ["bft_deviceDataChanged", [_data, false]] call CBA_fnc_localEvent;
|
||||
|
@ -16,9 +16,8 @@
|
||||
|
||||
params ["_deviceID", "_callsign"];
|
||||
|
||||
private ["_data", "_deviceAssignableInfo"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
_deviceAssignableInfo = _data select 2;
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _deviceAssignableInfo = _data select 2;
|
||||
_deviceAssignableInfo set [2, _callsign];
|
||||
|
||||
["bft_deviceDataChanged", [_data, false]] call CBA_fnc_localEvent;
|
||||
|
@ -16,9 +16,8 @@
|
||||
|
||||
params ["_deviceID", "_elementType"];
|
||||
|
||||
private ["_data", "_assignableInformation"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
_assignableInformation = _data select 2;
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _assignableInformation = _data select 2;
|
||||
_assignableInformation set [0, _elementType select 0];
|
||||
_assignableInformation set [1, _elementType select 1];
|
||||
|
||||
|
@ -16,9 +16,8 @@
|
||||
|
||||
params ["_deviceID", "_groupID"];
|
||||
|
||||
private ["_data", "_previousGroup"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
_previousGroup = _data select 2;
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _previousGroup = _data select 2;
|
||||
_previousGroup set [3, _groupID];
|
||||
|
||||
["bft_deviceDataChanged", [_data, false]] call CBA_fnc_localEvent;
|
||||
|
@ -16,9 +16,8 @@
|
||||
|
||||
params ["_deviceID", "_keys"];
|
||||
|
||||
private ["_data", "_encryption"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
_encryption = _data select 1;
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _encryption = _data select 1;
|
||||
_encryption set [1, _keys];
|
||||
|
||||
["bft_deviceDataChanged", [_data, false]] call CBA_fnc_localEvent;
|
||||
|
@ -16,13 +16,11 @@
|
||||
|
||||
params ["_deviceID", "_newOwner"];
|
||||
|
||||
private ["_data", "_newData", "_previousOwner", "_currentDevices"];
|
||||
|
||||
systemChat format["handleUpdateDeviceOwner: %1", _this];
|
||||
diag_log format["handleUpdateDeviceOwner: %1", _this];
|
||||
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
_previousOwner = _data select 5;
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _previousOwner = _data select 5;
|
||||
_data set [5, _newOwner];
|
||||
|
||||
["bft_deviceDataChanged", [_data, isNull _previousOwner]] call CBA_fnc_localEvent;
|
||||
@ -30,12 +28,12 @@ _data set [5, _newOwner];
|
||||
systemChat format["handleUpdateDeviceOwner - setting new owner from %1 to %2", _previousOwner, _newOwner];
|
||||
diag_log format["handleUpdateDeviceOwner - setting new owner from %1 to %2", _previousOwner, _newOwner];
|
||||
|
||||
_newData = [_deviceID] call FUNC(getDeviceData);
|
||||
private _newData = [_deviceID] call FUNC(getDeviceData);
|
||||
systemChat format["handleUpdateDeviceOwner - validate new owner - %1", (_newData select 5) == _newOwner];
|
||||
diag_log format["handleUpdateDeviceOwner - validate new owner - %1", (_newData select 5) == _newOwner];
|
||||
|
||||
if (!isNull _newOwner && {local _newOwner}) then {
|
||||
_currentDevices = _newOwner getvariable [QGVAR(ownedDevices), []];
|
||||
private _currentDevices = _newOwner getvariable [QGVAR(ownedDevices), []];
|
||||
if !(_deviceID in _currentDevices) then {
|
||||
_currentDevices pushback _deviceID;
|
||||
_newOwner setvariable [QGVAR(ownedDevices), _currentDevices, true];
|
||||
@ -47,7 +45,7 @@ if (!isNull _newOwner && {local _newOwner}) then {
|
||||
};
|
||||
if (!isNull _previousOwner && {local _previousOwner}) then {
|
||||
diag_log format["handleUpdateDeviceOwner - removing device (%1) from owner %2 ", _deviceId, _previousOwner];
|
||||
_currentDevices = _previousOwner getvariable [QGVAR(ownedDevices), []];
|
||||
private _currentDevices = _previousOwner getvariable [QGVAR(ownedDevices), []];
|
||||
if (_deviceID in _currentDevices) then {
|
||||
_currentDevices = _currentDevices - [_deviceID];
|
||||
_previousOwner setvariable [QGVAR(ownedDevices), _currentDevices, true];
|
||||
|
@ -12,10 +12,9 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_data"];
|
||||
params ["_deviceId"];
|
||||
|
||||
_data = [_deviceId] call FUNC(getDeviceData);
|
||||
private _data = [_deviceId] call FUNC(getDeviceData);
|
||||
|
||||
systemChat format["handleVehicleDeviceKilled: %1 ", _deviceId];
|
||||
diag_log format["handleVehicleDeviceKilled: %1 DATA: %2", _deviceId, _data];
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
params ["_unit", "_deviceID"];
|
||||
|
||||
private ["_ownedIDs"];
|
||||
_ownedIDs = _unit getvariable [QGVAR(ownedDevices), []];
|
||||
private _ownedIDs = _unit getvariable [QGVAR(ownedDevices), []];
|
||||
|
||||
(_deviceID in _ownedIDs)
|
||||
|
@ -13,13 +13,13 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_owner", "_deviceOwner", "_device"];
|
||||
params ["_deviceData"];
|
||||
_owner = D_GET_OWNER(_deviceData);
|
||||
|
||||
private _owner = D_GET_OWNER(_deviceData);
|
||||
|
||||
for "_i" from (count GVAR(availableDevices) - 1) to 0 step -1 do {
|
||||
_device = GVAR(availableDevices) select _i;
|
||||
_deviceOwner = AD_GET_OWNER(_device);
|
||||
private _device = GVAR(availableDevices) select _i;
|
||||
private _deviceOwner = AD_GET_OWNER(_device);
|
||||
if (_owner == _deviceOwner) then {
|
||||
GVAR(availableDevices) deleteAt _i;
|
||||
_i = _i - 1;
|
||||
|
@ -16,8 +16,7 @@
|
||||
|
||||
params ["_deviceID", "_deviceData"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data == 0) exitwith {};
|
||||
if (_deviceData isEqualTo (_data select 3)) exitwith {};
|
||||
|
@ -16,8 +16,7 @@
|
||||
|
||||
params ["_deviceID", "_callsign"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data < 3) exitwith {};
|
||||
if (count (_data select 2) < 3) exitwith {};
|
||||
|
@ -16,8 +16,7 @@
|
||||
|
||||
params ["_deviceID", "_elementType"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data < 3) exitwith {};
|
||||
if (count (_data select 2) < 2) exitwith {};
|
||||
|
@ -16,8 +16,7 @@
|
||||
|
||||
params ["_deviceID", "_groupID"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data < 3) exitwith {};
|
||||
if (count (_data select 2) < 4) exitwith {};
|
||||
|
@ -16,8 +16,7 @@
|
||||
|
||||
params ["_deviceID", "_keys"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data < 2) exitwith {};
|
||||
if (count (_data select 1) < 2) exitwith {};
|
||||
|
@ -16,8 +16,7 @@
|
||||
|
||||
params ["_deviceID", "_newOwner"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
private _data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data < 6) exitwith {};
|
||||
if (_newOwner isEqualTo (_data select 5)) exitwith {};
|
||||
|
@ -15,9 +15,8 @@
|
||||
|
||||
params ["_varName"];
|
||||
|
||||
private ["_variable", "_nextID"];
|
||||
_variable = missionNamespace getvariable [_varName, []];
|
||||
_nextID = 0;
|
||||
private _variable = missionNamespace getvariable [_varName, []];
|
||||
private _nextID = 0;
|
||||
|
||||
if (count _variable > 0) then {
|
||||
_nextID = ((_variable select (count _variable - 1)) select 0) + 1;
|
||||
|
@ -25,8 +25,7 @@ if (isNil "_add") then {
|
||||
["bft_registeredEncryptionKeysChanged", [_keys,nil]] call CBA_fnc_localEvent;
|
||||
};
|
||||
} else {
|
||||
private ["_changed"];
|
||||
_changed = false;
|
||||
private _changed = false;
|
||||
|
||||
if (_add) then {
|
||||
// figure out the real difference
|
||||
|
@ -25,8 +25,7 @@ if (isNil "_add") then {
|
||||
["bft_registeredModeChanged", [_modes,nil]] call CBA_fnc_localEvent;
|
||||
};
|
||||
} else {
|
||||
private ["_changed"];
|
||||
_changed = false;
|
||||
private _changed = false;
|
||||
|
||||
if (_add) then {
|
||||
// figure out the real difference
|
||||
@ -43,6 +42,7 @@ if (isNil "_add") then {
|
||||
_changed = true;
|
||||
};
|
||||
};
|
||||
|
||||
if (_changed) then {
|
||||
["bft_registeredModeChanged", [_modes,_add]] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
@ -15,19 +15,17 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
private ["_magazine", "_data", "_magID", "_unMatchedDevices", "_ownedDevices", "_matchedIDs"];
|
||||
|
||||
if !(local _unit) exitwith {};
|
||||
|
||||
{
|
||||
[_unit, _x] call FUNC(checkItem);
|
||||
} forEach items _unit;
|
||||
|
||||
_ownedDevices = _unit getvariable [QGVAR(ownedDevices), []];
|
||||
_matchedIDs = [];
|
||||
private _ownedDevices = _unit getvariable [QGVAR(ownedDevices), []];
|
||||
private _matchedIDs = [];
|
||||
{
|
||||
_magID = [_x] call FUNC(getMagazineID);
|
||||
_data = [_magID] call FUNC(getDeviceData);
|
||||
private _magID = [_x] call FUNC(getMagazineID);
|
||||
private _data = [_magID] call FUNC(getDeviceData);
|
||||
if (count _data > 0) then {
|
||||
if !(_magID in _ownedDevices) then {
|
||||
systemChat format["validate - new picked up ID: %1 %2", _unit, _magID];
|
||||
@ -37,7 +35,7 @@ _matchedIDs = [];
|
||||
_matchedIDs pushback _magID;
|
||||
} else {
|
||||
if (!(_magId in GVAR(pendingIdAssignmentList))) then {
|
||||
_magazine = (magazines _unit) select _forEachIndex;
|
||||
private _magazine = (magazines _unit) select _forEachIndex;
|
||||
if (getText (configFile >> "CfgMagazines" >> _magazine >> QGVAR(type)) != "") then {
|
||||
["bft_itemCreated", [_unit, getText (configFile >> "CfgMagazines" >> _magazine >> QGVAR(type)), _magazine, _magID]] call CBA_fnc_serverEvent;
|
||||
};
|
||||
@ -45,7 +43,7 @@ _matchedIDs = [];
|
||||
};
|
||||
}foreach (magazinesDetail _unit);
|
||||
|
||||
_unMatchedDevices = _ownedDevices - _matchedIDs;
|
||||
private _unMatchedDevices = _ownedDevices - _matchedIDs;
|
||||
{
|
||||
systemChat format["validate - no longer has ID: %1 %2", _unit, _x];
|
||||
diag_log format["validate - no longer has ID: %1 %2", _unit, _x];
|
||||
|
@ -20,8 +20,7 @@ diag_log format["VehicleInit: %1",_this];
|
||||
|
||||
if !(isServer) exitwith {};
|
||||
|
||||
private ["_device"];
|
||||
_device = _vehicle getvariable [QGVAR(vehicleDevice), getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(vehicleDevice))];
|
||||
private _device = _vehicle getvariable [QGVAR(vehicleDevice), getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(vehicleDevice))];
|
||||
|
||||
systemChat format["VehicleInit devices: %1",_device];
|
||||
diag_log format["VehicleInit devices: %1",_device];
|
||||
|
@ -77,7 +77,7 @@ if (!alive _uav) exitWith {false};
|
||||
};
|
||||
_cam camSetFov 0.5; // set default zoom
|
||||
};
|
||||
0 = GVAR(UAVcams) pushBack [_uav,_renderTarget,_cam,_camPosMemPt,_camDirMemPt];
|
||||
GVAR(UAVcams) pushBack [_uav,_renderTarget,_cam,_camPosMemPt,_camDirMemPt];
|
||||
};
|
||||
} count _uavCams;
|
||||
|
||||
|
@ -20,10 +20,10 @@
|
||||
|
||||
params ["_interfaceID"];
|
||||
|
||||
private _brightness = [_interfaceID,"brightness"] call FUNC(getSettings);
|
||||
private _brightness = [_interfaceID, "brightness"] call FUNC(getSettings);
|
||||
_brightness = _brightness - 0.1;
|
||||
// make sure brightness is not larger than 0.5
|
||||
if (_brightness < 0.5) then {_brightness = 0.5};
|
||||
[_interfaceID,[["brightness",_brightness]]] call FUNC(setSettings);
|
||||
[_interfaceID, [["brightness",_brightness]]] call FUNC(setSettings);
|
||||
|
||||
true
|
||||
|
@ -39,15 +39,13 @@ private _backgroundPosition = ctrlPosition _backgroundCtrl;
|
||||
// get the original position of the background control
|
||||
private _backgroundConfigPosition = [];
|
||||
{
|
||||
if (isClass _x) then {
|
||||
if (isClass (_x >> _backgroundClassName)) exitWith {
|
||||
_backgroundConfigPosition = [
|
||||
getNumber (_x >> _backgroundClassName >> "x"),
|
||||
getNumber (_x >> _backgroundClassName >> "y"),
|
||||
getNumber (_x >> _backgroundClassName >> "w"),
|
||||
getNumber (_x >> _backgroundClassName >> "h")
|
||||
];
|
||||
};
|
||||
if (isClass _x && {isClass (_x >> _backgroundClassName)}) exitWith {
|
||||
_backgroundConfigPosition = [
|
||||
getNumber (_x >> _backgroundClassName >> "x"),
|
||||
getNumber (_x >> _backgroundClassName >> "y"),
|
||||
getNumber (_x >> _backgroundClassName >> "w"),
|
||||
getNumber (_x >> _backgroundClassName >> "h")
|
||||
];
|
||||
};
|
||||
} forEach _displayConfigContainers;
|
||||
|
||||
|
@ -74,7 +74,7 @@ GVAR(ifOpen) = [
|
||||
];
|
||||
|
||||
// Only register the GetOut event handler for vehicle displays
|
||||
if (_inVehicle && (_isDialog || _displayName in [QGVAR(TAD_dsp)])) then {
|
||||
if (_inVehicle && {_isDialog || _displayName in [QGVAR(TAD_dsp)]}) then {
|
||||
GVAR(ifOpen) set [9,
|
||||
_vehicle addEventHandler ["GetOut",{if (_this select 2 == ACE_player) then {[] call FUNC(ifClose)}}]
|
||||
];
|
||||
|
@ -70,12 +70,12 @@ if (_playerDeviceData isEqualTo [] && _vehicleDeviceData isEqualTo []) exitWith
|
||||
|
||||
// get interface for device
|
||||
private _playerDeviceInterface = if !(_playerDeviceData isEqualTo []) then {
|
||||
_interfaces = [_playerDeviceId,ACE_player] call EFUNC(bft,getInterfaces);
|
||||
private _interfaces = [_playerDeviceId,ACE_player] call EFUNC(bft,getInterfaces);
|
||||
// select the first device -- for now
|
||||
if (count _interfaces > 0) then {_interfaces select 0} else {""};
|
||||
} else {""};
|
||||
private _vehicleDeviceInterface = if !(_vehicleDeviceData isEqualTo []) then {
|
||||
_interfaces = [_vehicleDeviceId,ACE_player] call EFUNC(bft,getInterfaces);
|
||||
private _interfaces = [_vehicleDeviceId,ACE_player] call EFUNC(bft,getInterfaces);
|
||||
// select the first device -- for now
|
||||
if (count _interfaces > 0) then {_interfaces select 0} else {""};
|
||||
} else {""};
|
||||
|
@ -43,6 +43,6 @@ if (_return) then {
|
||||
if (_interfaces isEqualTo []) exitwith {};
|
||||
_interfaces params [ ["_interface", nil] ];
|
||||
|
||||
_interfaceDisplayName = getText (configFile >> "ACE_BFT" >> "Interfaces" >> _interface >> "dialogName");
|
||||
private _interfaceDisplayName = getText (configFile >> "ACE_BFT" >> "Interfaces" >> _interface >> "dialogName");
|
||||
[_deviceID, _interface, 0 /* main interface type */,_interfaceDisplayName, true /*Is Dialog*/, _player, _target] call FUNC(ifOpen);
|
||||
};
|
||||
|
@ -36,20 +36,17 @@ _displayConfigContainers = "true" configClasses _displayConfigContainers;
|
||||
if (isClass _x) then {
|
||||
private _displayConfigClasses = "true" configClasses _x;
|
||||
{
|
||||
if (isClass _x) then {
|
||||
// only move controls that have an IDC
|
||||
if (isNumber (_x >> "idc")) then {
|
||||
// only move controls that have a positive IDC
|
||||
private _idc = getNumber (_x >> "idc");
|
||||
if (_idc > 0) then {
|
||||
private _ctrl = _display displayCtrl _idc;
|
||||
private _ctrlPosition = ctrlPosition _ctrl;
|
||||
_ctrlPosition set [0, (_ctrlPosition select 0) + _xOffset];
|
||||
_ctrlPosition set [1, (_ctrlPosition select 1) + _yOffset];
|
||||
_ctrl ctrlSetPosition _ctrlPosition;
|
||||
_ctrl ctrlCommit 0;
|
||||
} else {diag_log str ["invalid IDC",_x]};
|
||||
} else {diag_log str ["missing IDC",_x]};
|
||||
if (isClass _x && {isNumber (_x >> "idc")}) then {
|
||||
// only move controls that have a positive IDC
|
||||
private _idc = getNumber (_x >> "idc");
|
||||
if (_idc > 0) then {
|
||||
private _ctrl = _display displayCtrl _idc;
|
||||
private _ctrlPosition = ctrlPosition _ctrl;
|
||||
_ctrlPosition set [0, (_ctrlPosition select 0) + _xOffset];
|
||||
_ctrlPosition set [1, (_ctrlPosition select 1) + _yOffset];
|
||||
_ctrl ctrlSetPosition _ctrlPosition;
|
||||
_ctrl ctrlCommit 0;
|
||||
} else {diag_log str ["invalid IDC",_x]};
|
||||
};
|
||||
} forEach _displayConfigClasses;
|
||||
};
|
||||
|
@ -28,8 +28,8 @@ private _deviceEncryptionKey = D_GET_ENCRYPTION(_deviceData);
|
||||
// compile a list of valid sides
|
||||
private _validSides = [];
|
||||
{
|
||||
if ([_deviceEncryptionKey,[_x] call EFUNC(bft,getEncryptionKey)] call EFUNC(bft,encryptionKeyMatch)) then {
|
||||
0 = _validSides pushBack _x;
|
||||
if ([_deviceEncryptionKey, [_x] call EFUNC(bft,getEncryptionKey)] call EFUNC(bft,encryptionKeyMatch)) then {
|
||||
_validSides pushBack _x;
|
||||
};
|
||||
} count ["WEST","EAST","GUER","CIV"];
|
||||
|
||||
@ -37,8 +37,8 @@ private _validSides = [];
|
||||
private _hcamList = [];
|
||||
{
|
||||
if (str side _x in _validSides) then {
|
||||
if ("ACE_HelmetCam" in items _x) then {
|
||||
0 = _hcamList pushBack _x;
|
||||
if ("ACE_HelmetCam" in (items _x)) then {
|
||||
_hcamList pushBack _x;
|
||||
};
|
||||
};
|
||||
} count allUnits;
|
||||
|
@ -37,7 +37,7 @@ GVAR(UAVlist) = [];
|
||||
// check if UAV has matching encryption key
|
||||
private _uavEncryption = D_GET_ENCRYPTION(_uavDeviceData);
|
||||
if ([_deviceEncryption,_uavEncryption] call EFUNC(BFT,encryptionKeyMatch)) then {
|
||||
0 = GVAR(UAVlist) pushBack [_uavDevice,_uavDeviceData];
|
||||
GVAR(UAVlist) pushBack [_uavDevice,_uavDeviceData];
|
||||
};
|
||||
};
|
||||
} count allUnitsUAV;
|
||||
|
Loading…
Reference in New Issue
Block a user