add motd image
This commit is contained in:
parent
8185fd550c
commit
bdc18c1d2c
37
src/client/component/motd.cpp
Normal file
37
src/client/component/motd.cpp
Normal 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)
|
Loading…
Reference in New Issue
Block a user