diff options
| author | untodesu <kirill@untode.su> | 2025-03-15 16:22:09 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-03-15 16:22:09 +0500 |
| commit | 3bf42c6ff3805a0d42bbc661794a95ff31bedc26 (patch) | |
| tree | 05049955847504808d6bed2bb7b155f8b03807bb /game/server/status.cc | |
| parent | 02294547dcde0d4ad76e229106702261e9f10a51 (diff) | |
| download | voxelius-3bf42c6ff3805a0d42bbc661794a95ff31bedc26.tar.bz2 voxelius-3bf42c6ff3805a0d42bbc661794a95ff31bedc26.zip | |
Add whatever I was working on for the last month
Diffstat (limited to 'game/server/status.cc')
| -rw-r--r-- | game/server/status.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/game/server/status.cc b/game/server/status.cc new file mode 100644 index 0000000..0b8660b --- /dev/null +++ b/game/server/status.cc @@ -0,0 +1,26 @@ +#include "server/pch.hh" +#include "server/status.hh" + +#include "core/config.hh" + +#include "shared/protocol.hh" +#include "shared/splash.hh" + +#include "server/globals.hh" +#include "server/sessions.hh" + +static void on_status_request_packet(const protocol::StatusRequest &packet) +{ + spdlog::info("STATUS REQUEST"); + protocol::StatusResponse response; + response.version = protocol::VERSION; + response.max_players = sessions::max_players.get_value(); + response.num_players = sessions::num_players; + response.motd = splash::get(); + protocol::send(packet.peer, protocol::encode(response)); +} + +void status::init(void) +{ + globals::dispatcher.sink<protocol::StatusRequest>().connect<&on_status_request_packet>(); +} |
