armory/Sources/armory/logicnode/SetVibrateNode.hx
E1e5en 1a34e202a7 Add Android Settings + LN Set Vibrate
1. For the new settings to fully function, you need to update the submodules so that this Pull Request (https://github.com/Kode/kincmake/pull/100) gets into armsdk. Extended settings via khafile.js.

2. Added Android Settings panel:
- invisible until the target platform android-hl is added to the list;
- inactive until the target platform android-hl is selected in the list.
Options:
- Orientation;
- Compile Version SDK - from 26 to 30, default 29;
- Minimal Version SDK - from 14 to 30, default 14;
- Target Version SDK - from 26 to 30, default 29;
- Permissions - a list of permissions. If I will duplicate entries in the list, then only unique entries will be included during export. By default, the list is empty;
- Android ABI Filters - a list of platforms to build for (arm64-v8a, armeabi-v7a, x86, x86_64). If I will duplicate entries in the list, then only unique entries will be included during export. By default, the list is empty. If the list is empty, then all platforms will be used (as before).

3. The enum (names of permissions) and the function have been added to the utils.py modules, which adds the specified value to the list of permissions. Feature added for ease of use from different locations (different logical nodes).

4. List of permissions:
- ACCESS_COARSE_LOCATION - Allows an app to access approximate location;
- ACCESS_NETWORK_STATE - Allows applications to access information about networks;
- ACCESS_FINE_LOCATION - Allows an app to access precise location;
- ACCESS_WIFI_STATE - Allows applications to access information about Wi-Fi network;
- BLUETOOTH - Allows applications to connect to paired bluetooth devices;
- BLUETOOTH_ADMIN - Allows applications to discover and pair bluetooth devices;
- CAMERA - Required to be able to access the camera device;
- EXPAND_STATUS_BAR - Allows an application to expand or collapse the status bar;
- FOREGROUND_SERVICE - Allows a regular application to use Service.startForeground;
- GET_ACCOUNTS - Allows access to the list of accounts in the Accounts Service;
- INTERNET - Allows applications to open network sockets';
- READ_EXTERNAL_STORAGE - Allows an application to read from external storage;
- VIBRATE - Allows access to the vibrator;
- WRITE_EXTERNAL_STORAGE - Allows an application to write to external storage.

5. Added logical node Set Vibrate:
Category: Native
Pulses the vibration hardware on the device for time in milliseconds, if such hardware exists.
Input parameters:
- Milliseconds - time in milliseconds (data type Int, default value 100).
When adding the logical node Set Vibrate, the permission is automatically added to the list, even if the target android-hl has not been added to the export list (using a function from utils.py).
2020-10-17 16:47:54 +03:00

17 lines
393 B
Haxe

// Pulses the vibration hardware on the device for time in milliseconds, if such hardware exists.
package armory.logicnode;
import kha.System;
class SetVibrateNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
if (inputs[1].get() > 0) System.vibrate(inputs[1].get());
runOutput(0);
}
}