Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
niod-core
Advanced tools
Readme
NIOD-core is a npm package that lets you connect to DCS World using a socket. Once connected, it offers a variety of functionalities :
This is a pretty low level package, mission makers should probably not use NIOD-core directly but a package that uses NIOD-core to get higher level functionalities. My plan is to make one in the near future.
A socket is created in the mission scripting environment, NIOD-core connects to it and sends / receives commands discribing events and functions.
The nodejs server stores callbacks linked to a callback id, this id is passed to the lua server which pass it back with the returned data. The dispatcher will then execute the right stored callback.
Here's a basic example
const { initNiod, getGroups, addEventHandler, COALITIONS, EVENTS } = require("niod-core");
initNiod().then(async () => {
// Log information on all the groups in the blue coalition
console.log(await getGroups(COALITIONS.BLUE));
// Log position of new added marks
addEventHandler(EVENTS.EventMarkAdded, (event) => {
console.log("A mark was added at position", event.pos);
})
});
Niod requires DCS to import some functionalities from LUA so it can create a socket and access the OS time API, you'll need to "unsanitize" it. To do so go into your DCS installation folder DCS World\Scripts\MissionScripting.lua
and edit these line.
do
sanitizeModule('os')
sanitizeModule('io')
sanitizeModule('lfs')
require = nil
loadlib = nil
end
to
do
--sanitizeModule('os')
sanitizeModule('io')
sanitizeModule('lfs')
--require = nil
loadlib = nil
end
Then you need to create a mission that loads the NIOD lua file found in the "script" folder.
And there you go ! You're all set, you can import niod in your project and start the server using
const { initNiod } = require("niod-core");
initNiod().then(() => {
// your mission code goes here
});
and start coding !
Niod is written in typescript, so the npm package is shipped with all the type declarations. Which means auto-completion depending on your code editor
You can find the complete docs here
Since there is a lot of documented functions you probably won't need, here are links to:
I'll be writing guides with examples, links will be down below
Thanks to Drex from Dynamic DCS for all the help on sockets, go check his server out
FAQs
NIOD is a JS API for DCS World, NIOD-core is the core lib of the NIOD ecosystem. It uses a socket to communicate with a LUA library
The npm package niod-core receives a total of 3 weekly downloads. As such, niod-core popularity was classified as not popular.
We found that niod-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.