The online racing simulator
Node.js - Node InSim - InSim library with TypeScript support


Node InSim

Introducing Node InSim, an InSim library for Node.js with Typescript support.

At Sim Broadcasts, we are big advocates of the Web and open-source software. We wanted to develop a Node.js based InSim implementation to complement our own technology stack and to contribute something useful back to the community.

Node InSim is compatible with InSim version 9.

Installation

Install the node-insim NPM package in your Node.js application:

npm install --save node-insim

or if you use Yarn:

yarn add node-insim

Basic Usage

To connect to an LFS server, you must enter its hostname, a port and a short name for your application.

The InSim port must be configured in the LFS server settings. Also, make sure the public IP address from which your application is connecting is allowed to connect to the server InSim port.

Quote from Basic Node InSim Usage: github.com/simbroadcasts/node-insim :
import { InSim } from 'node-insim';

const inSim = new InSim();

inSim.connect({
Host: '127.0.0.1',
Port: 29999,
IName: 'Node InSim App',
});


Begin developing with Node InSim

To learn more, including how to send and receive packets with Node InSim, check out the Node InSim repository on GitHub.

GitHub | NPM | Node InSim - An open-source project by Sim Broadcasts

v0.10.0 - OutSim support
How did you run LFS on a macOS? can you make a guide? Big grin
#4 - gu3st
#7 - gu3st
Quote from mbutcher :As you know, I tried this on Apple silicon, and it didn't work so well with LFS. I'm going to try Dustin's suggestions above. Thumbs up

It'll be the same. I gave it a try thinking things improved but it's the same on my M1 Pro as before.

Annoyingly, you might get better perf in Parallels (VMWare doesn't yet support 3D). I tried it a year back but I don't have an active Parallels subscription now.
I tried the free trial, and yeah, it doesn't work.
LFS 0.7E preparation
Since the test patch D50 introduced a few InSim updates, I've prepared a pull request to implement them in Node InSim.

Main additions:

License property added to IS_NCI packet
IS_PLH packet which sets handicaps for individual players
TINY_PLH subtype of IS_TINY to request IS_PLH listing player handicaps
SMALL_LCL subtype of IS_SMALL - full control of lights including fog and extra lights
Example app using OutGauge with InSim buttons
New dashboard lights in DashLights enum of OutGaugePack

Full list of changes in the PR: https://github.com/simbroadcasts/node-insim/pull/28
Attached images
lfs_00001760.jpg
No matter what I did, I couldn't get it to work. Can you please explain step by step when you can?
Hello Flame CZE! After not being able to do it, I got angry and stopped dealing with these things, but I'm still curious. Can you write me a simple code that can turn on and off the lights of the car so that I can understand the basics? It can be with a button or a command.
You can control local car lights by sending an IS_SMALL packet with a SubT of SmallType.SMALL_LCL. For example, to turn the high beam on, you send this packet:

inSim.send(
new IS_SMALL({
SubT: SmallType.SMALL_LCL,
UVal: LocalCarLights.LIGHTS_HIGH,
}),
);

Handling commands is done by setting the command prefix character in the inSim.connect() method config and then listening for the IS_MSO packet.

I have created a demo application where you can type !lights on or !lights off to toggle the car's high beam. You can check the full source code at github.com/mkapal/node-insim-car-lights-example. The main program code is in index.ts. Feel free to clone the repository, follow the instructions in the README file and see if it works for you.
-
(Flame CZE) DELETED by Flame CZE : eh
4.2.1
Version 4.2.1 is out with the new IS_IPB packet introduced in LFS 0.7F.

Only plain IPv4 strings are supported for now, but if there's demand for more advanced conversion/parsing, feel free to give feedback.

The IP strings go through validation before the packet is sent. If it's not a valid IPv4, a RangeError will be thrown.

Set new IP bans:

inSim.send(
new IS_IPB({
BanIPs: ['1.2.3.4', '2.2.2.2', '5.5.5.255'],
}),
);

Request all IP bans:

inSim.send(
new IS_TINY({
ReqI: 1,
SubT: TinyType.TINY_IPB,
}),
);

inSim.on(PacketType.ISP_IPB, (packet) => {
console.log(packet.NumB); // 3
console.log(packet.BanIPs); // ['1.2.3.4', '2.2.2.2', '5.5.5.255']
});


FGED GREDG RDFGDR GSFDG