[LuaEntityLoader|LuaMod|Registry] Error messages fixed.
This commit is contained in:
parent
40ac6e1032
commit
d0bd710f90
@ -126,7 +126,7 @@ entt::entity Registry::registerEntity(const std::string &stringID) {
|
||||
return entity;
|
||||
}
|
||||
else
|
||||
gkError() << "Redefinition of entity '" + stringID + "', keeping the first one";
|
||||
gkError() << "Registry Error: Redefinition of entity '" + stringID + "', keeping the first one";
|
||||
|
||||
return entt::null;
|
||||
}
|
||||
@ -139,7 +139,7 @@ const Block &Registry::getBlockFromStringID(const std::string &stringID) {
|
||||
if (stringID.empty()) return getBlock(0);
|
||||
auto it = m_blocksID.find(stringID);
|
||||
if (it == m_blocksID.end())
|
||||
throw EXCEPTION("Unknown block:", stringID);
|
||||
throw EXCEPTION("Registry Error: Unknown block:", stringID);
|
||||
return getBlock(it->second);
|
||||
}
|
||||
|
||||
@ -147,52 +147,52 @@ const Item &Registry::getItemFromStringID(const std::string &stringID) {
|
||||
if (stringID.empty()) return getItem(0);
|
||||
auto it = m_itemsID.find(stringID);
|
||||
if (it == m_itemsID.end())
|
||||
throw EXCEPTION("Unknown item:", stringID);
|
||||
throw EXCEPTION("Registry Error: Unknown item:", stringID);
|
||||
return getItem(it->second);
|
||||
}
|
||||
|
||||
const Sky &Registry::getSkyFromStringID(const std::string &stringID) {
|
||||
if (stringID.empty())
|
||||
throw EXCEPTION("Trying to get sky from empty string ID.");
|
||||
throw EXCEPTION("Registry Error: Trying to get sky from empty string ID.");
|
||||
|
||||
auto it = m_skiesID.find(stringID);
|
||||
if (it == m_skiesID.end())
|
||||
throw EXCEPTION("Unknown sky:", stringID);
|
||||
throw EXCEPTION("Registry Error: Unknown sky:", stringID);
|
||||
|
||||
return getSky(it->second);
|
||||
}
|
||||
|
||||
const Tree &Registry::getTreeFromStringID(const std::string &stringID) {
|
||||
if (stringID.empty())
|
||||
throw EXCEPTION("Trying to get tree from empty string ID.");
|
||||
throw EXCEPTION("Registry Error: Trying to get tree from empty string ID.");
|
||||
|
||||
auto it = m_treesID.find(stringID);
|
||||
if (it == m_treesID.end())
|
||||
throw EXCEPTION("Unknown tree:", stringID);
|
||||
throw EXCEPTION("Registry Error: Unknown tree:", stringID);
|
||||
|
||||
return getTree(it->second);
|
||||
}
|
||||
|
||||
const Biome &Registry::getBiomeFromStringID(const std::string &stringID) {
|
||||
if (stringID.empty())
|
||||
throw EXCEPTION("Trying to get biome from empty string ID.");
|
||||
throw EXCEPTION("Registry Error: Trying to get biome from empty string ID.");
|
||||
|
||||
auto it = m_biomesID.find(stringID);
|
||||
if (it == m_biomesID.end())
|
||||
throw EXCEPTION("Unknown biome:", stringID);
|
||||
throw EXCEPTION("Registry Error: Unknown biome:", stringID);
|
||||
|
||||
return getBiome(it->second);
|
||||
}
|
||||
|
||||
entt::entity Registry::getEntityFromStringID(const std::string &stringID) {
|
||||
if (stringID.empty()) {
|
||||
gkError() << "Failed to get entity from empty string ID";
|
||||
gkError() << "Registry Error: Failed to get entity from empty string ID";
|
||||
return entt::null;
|
||||
}
|
||||
|
||||
auto it = m_entities.find(stringID);
|
||||
if (it == m_entities.end()) {
|
||||
gkError() << "Failed to get entity '" + stringID + "': Not found";
|
||||
gkError() << ("Registry Error: Failed to get entity '" + stringID + "': Not found").c_str();
|
||||
return entt::null;
|
||||
}
|
||||
|
||||
|
@ -103,12 +103,12 @@ void LuaMod::despawnEntity(EntityWrapper &entity) {
|
||||
}
|
||||
else
|
||||
// FIXME: Maybe improve this message with the type of entity that caused the error
|
||||
gkError() << "In mod '" + m_id + "': Failed to despawn entity: Missing position and network components";
|
||||
gkError() << ("In mod '" + m_id + "': Failed to despawn entity: Missing position and network components").c_str();
|
||||
}
|
||||
|
||||
ItemStack LuaMod::giveItemStack(ServerPlayer &player, ItemStack *itemStack) {
|
||||
if (!itemStack) {
|
||||
gkError() << "In mod '" + m_id + "': Failed to add stack to player";
|
||||
gkError() << ("In mod '" + m_id + "': Failed to add stack to player").c_str();
|
||||
return ItemStack::Empty;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ void LuaEntityLoader::spawnEntity(const std::string &entityID, const sol::table
|
||||
dim = dimension.value();
|
||||
}
|
||||
else {
|
||||
gkError() << "In mod '" + m_mod.id() + "': Cannot spawn entity '" + entityID + "' without a position and a dimension";
|
||||
gkError() << ("In mod '" + m_mod.id() + "': Cannot spawn entity '" + entityID + "' without a position and a dimension").c_str();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ void LuaEntityLoader::spawnEntity(const std::string &entityID, const sol::table
|
||||
}
|
||||
}
|
||||
else
|
||||
gkError() << "In mod '" + m_mod.id() + "': Cannot find entity with id '" + entityID + "'";
|
||||
gkError() << ("In mod '" + m_mod.id() + "': Cannot find entity with id '" + entityID + "'").c_str();
|
||||
}
|
||||
|
||||
void LuaEntityLoader::tryLoadCallbacks(const sol::table &table) const {
|
||||
@ -122,7 +122,7 @@ void LuaEntityLoader::tryLoadVisual(const sol::table &table, entt::registry ®
|
||||
}
|
||||
}
|
||||
else
|
||||
gkError() << "For entity '" + m_stringID + "': Visual type '" + type + "' unknown";
|
||||
gkError() << ("For entity '" + m_stringID + "': Visual type '" + type + "' unknown").c_str();
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ void LuaEntityLoader::tryLoadAnimation(const sol::table &table, entt::registry &
|
||||
animationComponent.addTranslation(delta[1], delta[2], delta[3], anim["min"], anim["max"], anim["loop"].get_or(true));
|
||||
}
|
||||
else
|
||||
gkError() << "For entity '" + m_stringID + "': Animation type '" + type + "' unknown";
|
||||
gkError() << ("For entity '" + m_stringID + "': Animation type '" + type + "' unknown").c_str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user