From c3f22c6854cfc6a0d57c7c8f542eda1562322517 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sat, 21 Dec 2024 13:11:23 +0300 Subject: [PATCH] rename --- src/content/ContentPack.hpp | 4 ++-- src/items/ItemDef.hpp | 4 ++-- src/logic/scripting/scripting.cpp | 28 ++++++++++++++-------------- src/logic/scripting/scripting.hpp | 12 ++++++------ src/objects/Entities.cpp | 2 +- src/objects/Entities.hpp | 6 +++--- src/voxels/Block.hpp | 4 ++-- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/content/ContentPack.hpp b/src/content/ContentPack.hpp index a3b40211..53d8a6e9 100644 --- a/src/content/ContentPack.hpp +++ b/src/content/ContentPack.hpp @@ -95,7 +95,7 @@ struct ContentPackStats { } }; -struct world_funcs_set { +struct WorldFuncsSet { bool onblockplaced : 1; bool onblockreplaced : 1; bool onblockbroken : 1; @@ -108,7 +108,7 @@ class ContentPackRuntime { ContentPackStats stats {}; scriptenv env; public: - world_funcs_set worldfuncsset {}; + WorldFuncsSet worldfuncsset {}; ContentPackRuntime(ContentPack info, scriptenv env); ~ContentPackRuntime(); diff --git a/src/items/ItemDef.hpp b/src/items/ItemDef.hpp index 7a2ef8d1..f6d61208 100644 --- a/src/items/ItemDef.hpp +++ b/src/items/ItemDef.hpp @@ -6,7 +6,7 @@ #include "data/dv.hpp" #include "typedefs.hpp" -struct item_funcs_set { +struct ItemFuncsSet { bool init : 1; bool on_use : 1; bool on_use_on_block : 1; @@ -43,7 +43,7 @@ struct ItemDef { struct { itemid_t id; blockid_t placingBlock; - item_funcs_set funcsset {}; + ItemFuncsSet funcsset {}; bool emissive = false; } rt {}; diff --git a/src/logic/scripting/scripting.cpp b/src/logic/scripting/scripting.cpp index 1732a88a..d330eebf 100644 --- a/src/logic/scripting/scripting.cpp +++ b/src/logic/scripting/scripting.cpp @@ -599,7 +599,7 @@ static void process_entity_callback( static void process_entity_callback( const Entity& entity, const std::string& name, - bool entity_funcs_set::*flag, + bool EntityFuncsSet::*flag, std::function args ) { const auto& script = entity.getScripting(); @@ -612,7 +612,7 @@ static void process_entity_callback( void scripting::on_entity_despawn(const Entity& entity) { process_entity_callback( - entity, "on_despawn", &entity_funcs_set::on_despawn, nullptr + entity, "on_despawn", &EntityFuncsSet::on_despawn, nullptr ); auto L = lua::get_main_state(); lua::get_from(L, "stdcomp", "remove_Entity", true); @@ -624,20 +624,20 @@ void scripting::on_entity_grounded(const Entity& entity, float force) { process_entity_callback( entity, "on_grounded", - &entity_funcs_set::on_grounded, + &EntityFuncsSet::on_grounded, [force](auto L) { return lua::pushnumber(L, force); } ); } void scripting::on_entity_fall(const Entity& entity) { process_entity_callback( - entity, "on_fall", &entity_funcs_set::on_fall, nullptr + entity, "on_fall", &EntityFuncsSet::on_fall, nullptr ); } void scripting::on_entity_save(const Entity& entity) { process_entity_callback( - entity, "on_save", &entity_funcs_set::on_save, nullptr + entity, "on_save", &EntityFuncsSet::on_save, nullptr ); } @@ -647,7 +647,7 @@ void scripting::on_sensor_enter( process_entity_callback( entity, "on_sensor_enter", - &entity_funcs_set::on_sensor_enter, + &EntityFuncsSet::on_sensor_enter, [index, oid](auto L) { lua::pushinteger(L, index); lua::pushinteger(L, oid); @@ -662,7 +662,7 @@ void scripting::on_sensor_exit( process_entity_callback( entity, "on_sensor_exit", - &entity_funcs_set::on_sensor_exit, + &EntityFuncsSet::on_sensor_exit, [index, oid](auto L) { lua::pushinteger(L, index); lua::pushinteger(L, oid); @@ -675,7 +675,7 @@ void scripting::on_aim_on(const Entity& entity, Player* player) { process_entity_callback( entity, "on_aim_on", - &entity_funcs_set::on_aim_on, + &EntityFuncsSet::on_aim_on, [player](auto L) { return lua::pushinteger(L, player->getId()); } ); } @@ -684,7 +684,7 @@ void scripting::on_aim_off(const Entity& entity, Player* player) { process_entity_callback( entity, "on_aim_off", - &entity_funcs_set::on_aim_off, + &EntityFuncsSet::on_aim_off, [player](auto L) { return lua::pushinteger(L, player->getId()); } ); } @@ -695,7 +695,7 @@ void scripting::on_attacked( process_entity_callback( entity, "on_attacked", - &entity_funcs_set::on_attacked, + &EntityFuncsSet::on_attacked, [player, attacker](auto L) { lua::pushinteger(L, attacker); lua::pushinteger(L, player->getId()); @@ -708,7 +708,7 @@ void scripting::on_entity_used(const Entity& entity, Player* player) { process_entity_callback( entity, "on_used", - &entity_funcs_set::on_used, + &EntityFuncsSet::on_used, [player](auto L) { return lua::pushinteger(L, player->getId()); } ); } @@ -796,7 +796,7 @@ void scripting::load_content_script( const std::string& prefix, const fs::path& file, const std::string& fileName, - block_funcs_set& funcsset + BlockFuncsSet& funcsset ) { int env = *senv; lua::pop(lua::get_main_state(), load_script(env, "block", file, fileName)); @@ -819,7 +819,7 @@ void scripting::load_content_script( const std::string& prefix, const fs::path& file, const std::string& fileName, - item_funcs_set& funcsset + ItemFuncsSet& funcsset ) { int env = *senv; lua::pop(lua::get_main_state(), load_script(env, "item", file, fileName)); @@ -846,7 +846,7 @@ void scripting::load_world_script( const std::string& prefix, const fs::path& file, const std::string& fileName, - world_funcs_set& funcsset + WorldFuncsSet& funcsset ) { int env = *senv; lua::pop(lua::get_main_state(), load_script(env, "world", file, fileName)); diff --git a/src/logic/scripting/scripting.hpp b/src/logic/scripting/scripting.hpp index 4ccba2cb..6bb31355 100644 --- a/src/logic/scripting/scripting.hpp +++ b/src/logic/scripting/scripting.hpp @@ -21,9 +21,9 @@ class Player; struct ItemDef; class Inventory; class UiDocument; -struct block_funcs_set; -struct item_funcs_set; -struct world_funcs_set; +struct BlockFuncsSet; +struct ItemFuncsSet; +struct WorldFuncsSet; struct UserComponent; struct uidocscript; class BlocksController; @@ -141,7 +141,7 @@ namespace scripting { const std::string& prefix, const std::filesystem::path& file, const std::string& fileName, - block_funcs_set& funcsset + BlockFuncsSet& funcsset ); /// @brief Load script associated with an Item @@ -155,7 +155,7 @@ namespace scripting { const std::string& prefix, const std::filesystem::path& file, const std::string& fileName, - item_funcs_set& funcsset + ItemFuncsSet& funcsset ); /// @brief Load component script @@ -184,7 +184,7 @@ namespace scripting { const std::string& packid, const std::filesystem::path& file, const std::string& fileName, - world_funcs_set& funcsset + WorldFuncsSet& funcsset ); /// @brief Load script associated with an UiDocument diff --git a/src/objects/Entities.cpp b/src/objects/Entities.cpp index 1a27243f..e047fdd4 100644 --- a/src/objects/Entities.cpp +++ b/src/objects/Entities.cpp @@ -162,7 +162,7 @@ entityid_t Entities::spawn( for (auto& componentName : def.components) { auto component = std::make_unique( - componentName, entity_funcs_set {}, nullptr + componentName, EntityFuncsSet {}, nullptr ); scripting.components.emplace_back(std::move(component)); } diff --git a/src/objects/Entities.hpp b/src/objects/Entities.hpp index 0026d15e..0c93ae74 100644 --- a/src/objects/Entities.hpp +++ b/src/objects/Entities.hpp @@ -14,7 +14,7 @@ #include #include -struct entity_funcs_set { +struct EntityFuncsSet { bool init; bool on_despawn; bool on_grounded; @@ -77,11 +77,11 @@ struct Rigidbody { struct UserComponent { std::string name; - entity_funcs_set funcsset; + EntityFuncsSet funcsset; scriptenv env; UserComponent( - const std::string& name, entity_funcs_set funcsset, scriptenv env + const std::string& name, EntityFuncsSet funcsset, scriptenv env ) : name(name), funcsset(funcsset), env(env) { } diff --git a/src/voxels/Block.hpp b/src/voxels/Block.hpp index eb232e8d..8ea11bee 100644 --- a/src/voxels/Block.hpp +++ b/src/voxels/Block.hpp @@ -34,7 +34,7 @@ inline constexpr size_t MAX_USER_BLOCK_FIELDS_SIZE = 240; inline std::string DEFAULT_MATERIAL = "base:stone"; -struct block_funcs_set { +struct BlockFuncsSet { bool init : 1; bool update : 1; bool onplaced : 1; @@ -241,7 +241,7 @@ public: std::vector hitboxes[BlockRotProfile::MAX_COUNT]; /// @brief set of block callbacks flags - block_funcs_set funcsset {}; + BlockFuncsSet funcsset {}; /// @brief picking item integer id itemid_t pickingItem = 0;