
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
node-openttd-admin
Advanced tools
A Node.js Library for connecting to Openttd's admin interface.
A Node.js Library for connecting to Openttd's admin interface.
This module can be seen as an update to yorickvP/node-ottdadmin, however its completely rewritten to be a bit more tidy and standard, as well as working on more recent versions of node. I have kept the interface reasonably similar, however, its not a drop-in replacement.
var ottd = require("node-openttd-admin"),
ottdConnection = new ottd.connection();
ottdConnection.connect("myserver.com", 3977);
ottdConnection.on('connect', function(){
ottdConnection.authenticate("MyBot", "MyPass");
});
ottdConnection.on('welcome', function(data){
ottdConnection.send_rcon("say \"hello world\"");
ottdConnection.close();
});
Examples can be found in the examples/
folder
Function Name | Description | parameters |
---|---|---|
authenticate | Send and authentication request - this must be performed within 10 seconds of the server connecting | username - name of the client (can be null for a default) password - server admin password |
send_rcon | Send an rcon command | command - command to execute on the server |
send_chat | Send a chat message | action - an action from enums.Actions desttype - a destination from enums.DestTypes id - TODO: Lookup msg - message body |
send_update_frequency | Set a new update frequency | type - type of update (enums.UpdateTypes ) frequency - frequency of update (enums.UpdateFrequencies ) |
send_ping | Send a ping request | int32 - 32bit integer that will be returned with pong |
Event Name | Description | Options |
---|---|---|
connect | Called when the tcp connection to the server is connected | none |
authenticate | Called when successfully authenticated. welcome is more useful for connection however | version - I have no idea TODO: Lookup |
welcome | Called when the server sends its "welcome packet", which contains info about the server | name - name of the server version - sematic version of the server. ie- 1.4.0-beta2 dedicated - 0 or 1 depending on whether the server is running as a dedicated servermap - data about the map (seed , landscape , startdate , mapheight , mapwidth ) |
newgame | fired when a new game starts | none |
shutdown | fired when a new game ends | none |
date | fired when information about the date is received | date - the current date |
clientjoin | fired when a client joins | id - id of joining client |
clientinfo | Fired when information about the client is received | id - id of the clientip - ip address of the clientname - username of the clientlang - language idjoindate - date the player joined the gamecompany - id of the company that the player is in |
clientupdate | Fired when an update from a client is received | id - id of the clientip - ip address of the clientname - username of the clientlang - language idjoindate - date the player joined the gamecompany - id of the company that the player is in |
clientquit | fired when a client quits | id - id of the client |
clienterror | Fired when a client has an error | id - id of the clienterr - error |
companyinfo | Fired when info about a company is received | id - company id name - company name manager - company manager colour - company primary colour protected - whether the company is password protected startyear - year of inaugaration isai - whether the company is ai or a human player |
companyupdate | Fired when an update happens to a company | id - company id name - company name manager - company manager colour - company primary colour protected - whether the company is password protected shares - who owns the 4 shares, this is an object with elements 1, 2, 3 and 4. |
companyremove | Fired when a company is deleted | id - company idreason - reason for deletion (enums.CompanyRemoveReasons ) |
companyeconomy | fired on receiving information about the company's performance | id - company id money - money of the company loan - amount the company has borrowed income - income lastquarter - value, performance and cargo delivered (cargo) of the last quarter prevquarter - the same, but for the quarter before. |
companystats | Fired on receiving information about the assets of a company | vehicles - number of trains, lorries, busses, planes and ships that the company owns stations - number of stations of each type that the company owns |
chat | Fired on receiving a chat message | action - what action is included in the message (enums.Actions )desttype - where the message is aimed at (enums.DestTypes ) id - message id message - message bodymoney - amount of money sent if action is GIVE_MONEY |
rcon | Fired on receiving the output of an rcon command | colour - what colour the message is displayed in output - output of the rcon |
rconend | Fired on receiving the end of an rcon command | command - the command that was sent to rcon |
console | Fired on receiving output | origin - origin of the output output - body of the output |
pong | Fired on receiving ping reply | int - integer passed to send_pong |
There are several enums provided,these are taken almost directly from yorickvP/node-ottdadmin.
This is just a list of them. Rather than listing all the entries here, please see enums.js
FAQs
A Node.js Library for connecting to Openttd's admin interface.
The npm package node-openttd-admin receives a total of 12 weekly downloads. As such, node-openttd-admin popularity was classified as not popular.
We found that node-openttd-admin 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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.