migrate blocks interaction (scripting) to global chunks storage (WIP)

This commit is contained in:
MihailRis
2024-12-13 05:54:41 +03:00
parent 53cc8d3c7b
commit e0b3425eff
16 changed files with 227 additions and 144 deletions
+6 -5
View File
@@ -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);
};