2020-07-25 20:19:18 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "Subgame.h"
|
|
|
|
|
2021-06-21 22:09:35 -07:00
|
|
|
#include "util/Types.h"
|
2020-08-13 00:55:18 -07:00
|
|
|
#include "lua/ServerLuaParser.h"
|
|
|
|
#include "game/atlas/ServerBiomeAtlas.h"
|
|
|
|
#include "game/atlas/asset/AssetStorage.h"
|
|
|
|
#include "game/atlas/ServerDefinitionAtlas.h"
|
2020-07-25 20:19:18 -07:00
|
|
|
|
|
|
|
class ServerWorld;
|
2020-07-30 22:07:00 -07:00
|
|
|
class ServerClients;
|
2020-07-25 20:19:18 -07:00
|
|
|
|
2021-06-21 22:09:35 -07:00
|
|
|
/**
|
|
|
|
* Stores all subgame data for a server instance, including
|
|
|
|
* block & item definitions, the lua sandbox, assets, and textures.
|
|
|
|
*/
|
|
|
|
|
2020-07-25 20:19:18 -07:00
|
|
|
class ServerSubgame : public Subgame {
|
2021-06-21 22:09:35 -07:00
|
|
|
public:
|
|
|
|
|
|
|
|
ServerSubgame(const string& subgame, usize seed);
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2021-09-23 23:16:23 -07:00
|
|
|
~ServerSubgame() {};
|
2020-11-08 22:57:34 -08:00
|
|
|
|
|
|
|
void init(WorldPtr world);
|
|
|
|
|
2021-06-21 22:09:35 -07:00
|
|
|
void update(f64 delta);
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2021-06-21 22:09:35 -07:00
|
|
|
string subgamePath;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
|
|
|
ServerDefinitionAtlas& getDefs() override { return *defs; };
|
|
|
|
|
|
|
|
ServerBiomeAtlas& getBiomes() override { return *biomes; };
|
|
|
|
|
|
|
|
ServerLuaParser& getParser() override { return *lua; };
|
|
|
|
|
|
|
|
AssetStorage assets;
|
|
|
|
|
2021-06-21 22:09:35 -07:00
|
|
|
private:
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2021-06-21 22:09:35 -07:00
|
|
|
uptr<ServerLuaParser> lua;
|
|
|
|
uptr<ServerBiomeAtlas> biomes;
|
|
|
|
uptr<ServerDefinitionAtlas> defs;
|
2020-07-25 20:19:18 -07:00
|
|
|
};
|
|
|
|
|