thunderscript-client
v1.2.1
Published
Typescript client for War Thunder's Localhost api
Downloads
5
Readme
thunderscript-client
War Thunder Localhost Client library. Returns data hosted at the locally available api when running the War Thunder game.s
Installation
The project is available on npm. To install the package run the following command:
yarn add thunderscript-client
Usage
The package provides a client to interact with the War Thunder Localhost API. The client is a wrapper around the API and provides a more user-friendly interface.
import { thunderClient } from './thunder-client';
thunderClient().then(async (client) => {
const state = await client.getState();
console.log(state);
});
{
"valid": true,
"aileron, %": -0,
"elevator, %": -7,
"rudder, %": 2,
"flaps, %": 0,
"gear, %": 0,
"airbrake, %": 0,
"H, m": 5194,
"TAS, km/h": 1544,
"IAS, km/h": 1185,
"M": 1.34,
"AoA, deg": -0.8,
"AoS, deg": 0.1,
"Ny": 1.34,
"Vy, m/s": 80.3,
"Wx, deg/s": 0,
"Mfuel, kg": 3341,
"Mfuel0, kg": 9400,
"throttle 1, %": 110,
"power 1, hp": 0,
"RPM 1": 8350,
"manifold pressure 1, atm": 1,
"oil temp 1, C": 92,
"thrust 1, kgs": 16535,
"efficiency 1, %": 0,
"throttle 2, %": 110,
"power 2, hp": 0,
"RPM 2": 8350,
"manifold pressure 2, atm": 1,
"oil temp 2, C": 92,
"thrust 2, kgs": 16535,
"efficiency 2, %": 0
}
Development
The Project uses Yarn as a package manager. To install the dependencies run the following command:
yarn install
Development
API code is generated using openapi-typescript. This relies on the OpenAPI 3.0 specification. The specification is located in the src/openapi/war-thunder-localhost.yaml
file.
Build
Builds the project by generating the API code and then compiling the typescript code.
yarn build
Testing
Open War Thunder and start a test flight (I used the su-27) and then run the following command:
yarn test