migrate blocks interaction (scripting) to global chunks storage (WIP)
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user