format: reformat project

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov
2024-08-03 19:53:48 +03:00
committed by Pugemon
parent 736cd175d5
commit bbf33e8e4d
202 changed files with 7389 additions and 5609 deletions
+56 -36
View File
@@ -1,17 +1,16 @@
#ifndef LOGIC_SCRIPTING_SCRIPTING_HPP_
#define LOGIC_SCRIPTING_SCRIPTING_HPP_
#include "../../data/dynamic.hpp"
#include "../../typedefs.hpp"
#include "../../delegates.hpp"
#include "scripting_functional.hpp"
#include <vector>
#include <string>
#include <memory>
#include <filesystem>
#include <glm/glm.hpp>
#include <memory>
#include <string>
#include <vector>
#include "../../data/dynamic.hpp"
#include "../../delegates.hpp"
#include "../../typedefs.hpp"
#include "scripting_functional.hpp"
namespace fs = std::filesystem;
@@ -45,12 +44,16 @@ namespace scripting {
void initialize(Engine* engine);
bool register_event(int env, const std::string& name, const std::string& id);
bool register_event(
int env, const std::string& name, const std::string& id
);
int get_values_on_stack();
scriptenv get_root_environment();
scriptenv create_pack_environment(const ContentPack& pack);
scriptenv create_doc_environment(const scriptenv& parent, const std::string& name);
scriptenv create_doc_environment(
const scriptenv& parent, const std::string& name
);
void process_post_runnables();
@@ -61,26 +64,36 @@ namespace scripting {
void on_blocks_tick(const Block* block, int tps);
void update_block(const Block* block, int x, int y, int z);
void random_update_block(const Block* block, int x, int y, int z);
void on_block_placed(Player* player, const Block* block, int x, int y, int z);
void on_block_broken(Player* player, const Block* block, int x, int y, int z);
void on_block_placed(
Player* player, const Block* block, int x, int y, int z
);
void on_block_broken(
Player* player, const Block* block, int x, int y, int z
);
bool on_block_interact(Player* player, const Block* block, glm::ivec3 pos);
/// @brief Called on RMB click with the item selected
/// @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
/// @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, glm::ivec3 ipos, glm::ivec3 normal);
bool on_item_use_on_block(
Player* player, const ItemDef* item, glm::ivec3 ipos, glm::ivec3 normal
);
/// @brief Called on LMB click on block with the item selected
/// @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);
bool on_item_break_block(
Player* player, const ItemDef* item, int x, int y, int z
);
dynamic::Value get_component_value(const scriptenv& env, const std::string& name);
dynamic::Value get_component_value(
const scriptenv& env, const std::string& name
);
void on_entity_spawn(
const EntityDef& def,
entityid_t eid,
entityid_t eid,
const std::vector<std::unique_ptr<UserComponent>>& components,
dynamic::Map_sptr args,
dynamic::Map_sptr saved
@@ -99,10 +112,7 @@ namespace scripting {
void on_entity_used(const Entity& entity, Player* player);
/// @brief Called on UI view show
void on_ui_open(
UiDocument* layout,
std::vector<dynamic::Value> args
);
void on_ui_open(UiDocument* layout, std::vector<dynamic::Value> args);
void on_ui_progress(UiDocument* layout, int workDone, int totalWork);
@@ -115,10 +125,11 @@ namespace scripting {
/// @param file item script file
/// @param funcsset block callbacks set
void load_block_script(
const scriptenv& env,
const scriptenv& env,
const std::string& prefix,
const fs::path& file,
block_funcs_set& funcsset);
block_funcs_set& funcsset
);
/// @brief Load script associated with an Item
/// @param env environment
@@ -128,28 +139,37 @@ namespace scripting {
void load_item_script(
const scriptenv& env,
const std::string& prefix,
const fs::path& file,
item_funcs_set& funcsset);
const fs::path& file,
item_funcs_set& funcsset
);
void load_entity_component(
const std::string& name,
const fs::path& file);
/// @brief Load package-specific world script
void load_entity_component(const std::string& name, const fs::path& file);
/// @brief Load package-specific world script
/// @param env environment
/// @param packid content-pack id
/// @param file script file path
void load_world_script(const scriptenv& env, const std::string& packid, const fs::path& file, world_funcs_set& funcsset);
void load_world_script(
const scriptenv& env,
const std::string& packid,
const fs::path& file,
world_funcs_set& funcsset
);
/// @brief Load script associated with an UiDocument
/// @param env environment
/// @param prefix pack id
/// @param file item script file
/// @param script document script info
void load_layout_script(const scriptenv& env, const std::string& prefix, const fs::path& file, uidocscript& script);
void load_layout_script(
const scriptenv& env,
const std::string& prefix,
const fs::path& file,
uidocscript& script
);
/// @brief Finalize lua state. Using scripting after will lead to Lua panic
void close();
}
#endif // LOGIC_SCRIPTING_SCRIPTING_HPP_
#endif // LOGIC_SCRIPTING_SCRIPTING_HPP_