]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - src/node.h
3c622e2d579668c206841ca780112e43d89b0cd6
[dragonblocks_alpha.git] / src / node.h
1 #ifndef _NODE_H_
2 #define _NODE_H_
3
4 #include <stdbool.h>
5 #include <stddef.h>
6 #include "types.h"
7
8 typedef enum {
9         NODE_UNKNOWN,       // Used for unknown nodes received from server (caused by outdated clients)
10         NODE_AIR,
11         NODE_GRASS,
12         NODE_DIRT,
13         NODE_STONE,
14         NODE_SNOW,
15         NODE_OAK_WOOD,
16         NODE_OAK_LEAVES,
17         NODE_PINE_WOOD,
18         NODE_PINE_LEAVES,
19         NODE_PALM_WOOD,
20         NODE_PALM_LEAVES,
21         NODE_SAND,
22         NODE_WATER,
23         NODE_LAVA,
24         NODE_VULCANO_STONE,
25         NODE_UNLOADED,      // Used for nodes in unloaded chunks
26 } NodeType;
27
28 struct TerrainNode;
29
30 typedef struct {
31         bool solid;
32         size_t data_size;
33         unsigned long dig_class;
34         struct {
35                 void (*create)(struct TerrainNode *node);
36                 void (*delete)(struct TerrainNode *node);
37                 void (*serialize)(Blob *buffer, void *data);
38                 void (*deserialize)(Blob *buffer, void *data);
39         } callbacks;
40 } NodeDef;
41
42 extern NodeDef node_defs[];
43
44 #endif