items: on_use event
This commit is contained in:
@@ -30,7 +30,7 @@ namespace scripting {
|
||||
extern Level* level;
|
||||
extern BlocksController* blocks;
|
||||
|
||||
/* Lua environment wrapper for automatic deletion */
|
||||
/// @brief Lua environment wrapper for automatic deletion
|
||||
class Environment {
|
||||
int env;
|
||||
public:
|
||||
@@ -58,34 +58,51 @@ namespace scripting {
|
||||
void on_block_broken(Player* player, const Block* block, int x, int y, int z);
|
||||
bool on_block_interact(Player* player, const Block* block, int x, int y, int z);
|
||||
|
||||
/** Called on RMB click on block with the item selected
|
||||
@return true if prevents default action */
|
||||
/// @brief Called on RMB click with the item selected
|
||||
/// @return true if prevents default action
|
||||
bool on_item_use(Player* player, const ItemDef* item);
|
||||
|
||||
/// @brief Called on RMB click on block with the item selected
|
||||
/// @return true if prevents default action
|
||||
bool on_item_use_on_block(Player* player, const ItemDef* item, int x, int y, int z);
|
||||
/** Called on LMB click on block with the item selected
|
||||
@return true if prevents default action */
|
||||
|
||||
/// @brief Called on LMB click on block with the item selected
|
||||
/// @return true if prevents default action
|
||||
bool on_item_break_block(Player* player, const ItemDef* item, int x, int y, int z);
|
||||
|
||||
/** Called on UI view show */
|
||||
/// @brief Called on UI view show
|
||||
void on_ui_open(UiDocument* layout, Inventory* inventory, glm::ivec3 blockcoord);
|
||||
/** Called on UI view close*/
|
||||
|
||||
/// @brief Called on UI view close
|
||||
void on_ui_close(UiDocument* layout, Inventory* inventory);
|
||||
|
||||
/** Load script associated with a Block */
|
||||
/// @brief Load script associated with a Block
|
||||
/// @param env environment id
|
||||
/// @param prefix pack id
|
||||
/// @param file item script file
|
||||
/// @param funcsset block callbacks set
|
||||
void load_block_script(int env, std::string prefix, fs::path file, block_funcs_set& funcsset);
|
||||
/** Load script associated with an Item */
|
||||
void load_item_script(int env, std::string prefix, fs::path file, item_funcs_set& funcsset);
|
||||
|
||||
/**
|
||||
* Load package-specific world script
|
||||
* @param env environment id
|
||||
* @param packid content-pack id
|
||||
* @param file script file path
|
||||
*/
|
||||
/// @brief Load script associated with an Item
|
||||
/// @param env environment id
|
||||
/// @param prefix pack id
|
||||
/// @param file item script file
|
||||
/// @param funcsset item callbacks set
|
||||
void load_item_script(int env, std::string prefix, fs::path file, item_funcs_set& funcsset);
|
||||
|
||||
/// @brief Load package-specific world script
|
||||
/// @param env environment id
|
||||
/// @param packid content-pack id
|
||||
/// @param file script file path
|
||||
void load_world_script(int env, std::string packid, fs::path file);
|
||||
|
||||
/** Load script associated with an UiDocument */
|
||||
/// @brief Load script associated with an UiDocument
|
||||
/// @param env environment id
|
||||
/// @param prefix pack id
|
||||
/// @param file item script file
|
||||
/// @param script document script info
|
||||
void load_layout_script(int env, std::string prefix, fs::path file, uidocscript& script);
|
||||
|
||||
/** Finalize lua state. Using scripting after will lead to Lua panic */
|
||||
/// @brief Finalize lua state. Using scripting after will lead to Lua panic
|
||||
void close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user