mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
feat: Add Factorio support (#527)
* Update eco protocol to include player names and fixed problems when using eco webinterface behind a proxy * changelog + readability * Typo * Typo * Added Factorio * wrong comment * CHANGELOG
This commit is contained in:
parent
3416e8c21a
commit
2338b82307
5 changed files with 37 additions and 1 deletions
25
protocols/factorio.js
Normal file
25
protocols/factorio.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import Core from './core.js'
|
||||
|
||||
export default class factorio extends Core {
|
||||
async run (state) {
|
||||
if (!this.options.port) this.options.port = 34197
|
||||
|
||||
// Don't use the tcp ping probing
|
||||
this.usedTcp = true
|
||||
|
||||
const request = await this.request({
|
||||
url: `https://multiplayer.factorio.com/get-game-details/${this.options.address}:${this.options.port}`,
|
||||
responseType: 'json'
|
||||
})
|
||||
|
||||
const serverInfo = request
|
||||
|
||||
state.name = serverInfo.name
|
||||
state.password = serverInfo.has_password
|
||||
state.numplayers = serverInfo.players?.length || 0 // players is undefined if there are no players
|
||||
state.maxplayers = serverInfo.max_players
|
||||
state.players = serverInfo.players?.map(player => ({ name: player, raw: {} })) || []
|
||||
|
||||
state.raw = serverInfo
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import doom3 from './doom3.js'
|
|||
import eco from './eco.js'
|
||||
import eldewrito from './eldewrito.js'
|
||||
import epic from './epic.js'
|
||||
import factorio from './factorio.js'
|
||||
import ffow from './ffow.js'
|
||||
import fivem from './fivem.js'
|
||||
import gamespy1 from './gamespy1.js'
|
||||
|
|
@ -55,7 +56,7 @@ import dayz from './dayz.js'
|
|||
import theisleevrima from './theisleevrima.js'
|
||||
|
||||
export {
|
||||
armagetron, ase, asa, assettocorsa, battlefield, buildandshoot, cs2d, discord, doom3, eco, epic, ffow, fivem, gamespy1,
|
||||
armagetron, ase, asa, assettocorsa, battlefield, buildandshoot, cs2d, discord, doom3, eco, epic, factorio, ffow, fivem, gamespy1,
|
||||
gamespy2, gamespy3, geneshift, goldsrc, hexen2, jc2mp, kspdmp, mafia2mp, mafia2online, minecraft,
|
||||
minecraftbedrock, minecraftvanilla, mumble, mumbleping, nadeo, openttd, palworld, quake1, quake2, quake3, rfactor, samp,
|
||||
savage2, starmade, starsiege, teamspeak2, teamspeak3, terraria, tribes1, tribes1master, unreal2, ut3, valve,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue