Zepha/src/game/def/BlockDef.h

56 lines
1.0 KiB
C
Raw Normal View History

#pragma once
#include <string>
2020-08-13 00:55:18 -07:00
#include "ItemDef.h"
2020-08-13 00:55:18 -07:00
#include "lua/Lua.h"
#include "util/Util.h"
#include "game/def/mesh/BlockModel.h"
#include "game/def/mesh/SelectionBox.h"
/**
* Represents a block definition, defined by Lua.
* Contains all the necessary information about a block.
*/
class BlockDef : public ItemDef {
public:
enum class Callback {
CONSTRUCT, AFTER_CONSTRUCT,
DESTRUCT, AFTER_DESTRUCT,
PLACE, PLACE_CLIENT,
AFTER_PLACE, AFTER_PLACE_CLIENT,
BREAK, BREAK_CLIENT,
AFTER_BREAK, AFTER_BREAK_CLIENT,
INTERACT, INTERACT_CLIENT,
HIT, HIT_CLIENT
};
2021-09-03 14:22:58 -07:00
BlockDef() : ItemDef(ItemDef::Type::BLOCK) {};
2020-11-08 22:57:34 -08:00
void createModel();
bool hasInteraction();
BlockModel model;
BlockModel farModel;
bool culls = true;
bool solid = true;
bool lightPropagates = false;
int health = 0;
int defense = 0;
glm::ivec3 lightSource{};
std::vector<SelectionBox> sBoxes{};
std::vector<SelectionBox> cBoxes{};
std::unordered_map<Callback, sol::protected_function, Util::EnumClassHash> callbacks {};
};