mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 21:11:50 +00:00
migrate blocks interaction (scripting) to global chunks storage (WIP)
This commit is contained in:
parent
53cc8d3c7b
commit
e0b3425eff
16 changed files with 228 additions and 145 deletions
|
|
@ -6,16 +6,17 @@
|
|||
|
||||
class Chunk;
|
||||
|
||||
enum lvl_event_type {
|
||||
enum LevelEventType {
|
||||
EVT_CHUNK_SHOWN,
|
||||
EVT_CHUNK_HIDDEN,
|
||||
};
|
||||
|
||||
using chunk_event_func = std::function<void(lvl_event_type, Chunk*)>;
|
||||
using ChunkEventFunc = std::function<void(LevelEventType, Chunk*)>;
|
||||
|
||||
class LevelEvents {
|
||||
std::unordered_map<lvl_event_type, std::vector<chunk_event_func>>
|
||||
std::unordered_map<LevelEventType, std::vector<ChunkEventFunc>>
|
||||
chunk_callbacks;
|
||||
public:
|
||||
void listen(lvl_event_type type, const chunk_event_func& func);
|
||||
void trigger(lvl_event_type type, Chunk* chunk);
|
||||
void listen(LevelEventType type, const ChunkEventFunc& func);
|
||||
void trigger(LevelEventType type, Chunk* chunk);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue