mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 11:31:49 +00:00
implement player ticks in headless mode & prevent on_player_tick call if player chunk does not exists
This commit is contained in:
parent
8e7dfe3e0b
commit
1cd85b6f77
9 changed files with 70 additions and 41 deletions
|
|
@ -15,21 +15,22 @@ class WorldGenerator;
|
|||
class ChunksController {
|
||||
private:
|
||||
Level& level;
|
||||
uint padding;
|
||||
std::unique_ptr<WorldGenerator> generator;
|
||||
|
||||
/// @brief Process one chunk: load it or calculate lights for it
|
||||
bool loadVisible(const Player& player) const;
|
||||
bool loadVisible(const Player& player, uint padding) const;
|
||||
bool buildLights(const Player& player, const std::shared_ptr<Chunk>& chunk) const;
|
||||
void createChunk(const Player& player, int x, int y) const;
|
||||
public:
|
||||
std::unique_ptr<Lighting> lighting;
|
||||
|
||||
ChunksController(Level& level, uint padding);
|
||||
ChunksController(Level& level);
|
||||
~ChunksController();
|
||||
|
||||
/// @param maxDuration milliseconds reserved for chunks loading
|
||||
void update(int64_t maxDuration, int loadDistance, Player& player) const;
|
||||
void update(
|
||||
int64_t maxDuration, int loadDistance, uint padding, Player& player
|
||||
) const;
|
||||
|
||||
const WorldGenerator* getGenerator() const {
|
||||
return generator.get();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue