Skip to content

flleeppyy/ss13-websocket-server-poc

Repository files navigation

SS13 Websocket Server POC

This is a proof of concept for my websocket client PR, showing the various things you can do with the feature, such as getting shocked when you're tased by security because you were a dumb fucking clown.

Picutre of Tgui chat settings in the Experimental tab, showing Websocket client, server, and controls (which have force reconnect and force disconnect)

What's here?

what

Yeah, you're reading it right.

The important parts here besides the configs, are the phrases. The Buttplug.io integration has more phrases than the PiShock one.

The script listens to the messages coming from the websocket client, and parses the HTML for each chat message so it can be ran through the phrase parser.

Here's a few payloads that tgchat typically sends.

  • { type: 'chat/updateMessageCount', payload: { adminchat: 1 } }
  • { type: 'ping/reply', payload: { index: 7 } }
  • { type: 'ping/soft', payload: { afk: 318 } }
  • { type: 'ping/soft', payload: { afk: 358 } }
  • { type: 'ping/soft', payload: { afk: 398 } }
  • { type: 'ping/soft', payload: { afk: 438 } }
  {
    type: 'chat/message',
    payload: '{"sequence":2305,"content":{"type":"adminlog","html":"<span class=\\"admin\\"><span class=\\"prefix\\">ADMIN LOG:</span> <span class=\\"message\\">Storyteller failed to pick an event for track of Roleset.</span></span>"}}'
  }
  {
    type: 'chat/message',
    payload: `{"sequence":2304,"content":{"html":"<span class='emote'><b>Bepsi Bepington</b> coughs!</span>"}}`
  }
  {
    type: 'chat/message',
    payload: `{"sequence":2302,"content":{"html":"<span class='deadsay'><b>Shuttle Loan</b><span class='linkify'> has just been randomly triggered!</span></span>"}}`
  }
  {
    type: 'chat/message',
    payload: `{"sequence":2303,"content":{"html":"<div class='chat_alert_default'><span class='announcement_header'><span class='major_announcement_title'>Central Command Update</span><span class='subheader_announcement_text'>CentCom Spacepizza Division</span></span><span class='major_announcement_text'>Cargo: It looks like a neighbouring station accidentally delivered their pizza to you instead.</span></div>"}}`
  }

This repo will not be fully fleshed out, nor officially supported but if I'm bored enough, I'll help you.. or if you pay me ;3

I wanna run all of them at the same time because I'm a masochistic idiot!

ok lol

  1. Run pnpm install --recursive in the root of the repo
  2. Configure the services you want to run
    1. Configure pishock
  3. Copy config.all.example.json to config.all.json and add/remove the ones you want (there's only two right now)
  4. Run pnpm run --recursive build
  5. Then run pnpm run all to finally run all services at once. Then connect your client to the websocket port that it's listening on.

You can also run WS_PORT=8080 pnpm run all to start with a different websocket port.

Cool it's running now, what now?

Open SS13, go to the settings menu and find the Experimental tab change the server to localhost:8094 (or whatever address you're hosting this on, for example 192.168.1.83:8095), and click "Force Reconnect".

In the logs, the program should show a new client has connected, and all messages coming from the chatbox, will be parsed through:

Known servers that support the websocket client

SS13 servers wanting to add the websocket client to their server should follow this PR, or simply send all message packages it receives in a similar format to how TGUI sends messages: Monkestation/Monkestation2.0#5744

TODO:

  • Add support for custom phrases in a JSON file or something

About

have you ever wanted ss13 to affect you in real life?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published