add motd image

This commit is contained in:
Skull 2023-01-03 07:52:29 +03:00
parent 8185fd550c
commit bdc18c1d2c

View File

@ -0,0 +1,37 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "materials.hpp"
#include "game/game.hpp"
#include <utils/http.hpp>
namespace motd
{
class component final : public component_interface
{
public:
void post_load() override
{
std::thread([]
{
auto data = utils::http::get_data("https://h1.gg/data/motd.png");
if (data.has_value())
{
materials::add("motd_image", data.value().buffer);
}
}).detach();
}
void post_unpack() override
{
if (game::environment::is_sp())
{
return;
}
}
};
}
REGISTER_COMPONENT(motd::component)