Fixed rebuild action for quake map component

This commit is contained in:
WiggleWizard
2024-09-16 10:05:55 +01:00
parent 52776186d3
commit bb43bbe1b8
2 changed files with 19 additions and 4 deletions

View File

@@ -35,6 +35,8 @@ namespace Nuake {
bool AutoRebuild = false;
float ScaleFactor = 1.f;
bool rebuildNextTick = false;
std::vector<Ref<Mesh>> m_Meshes;
std::vector<Entity> m_Brushes;
std::vector<int> m_SerializedBrushIDs;
@@ -98,5 +100,6 @@ namespace Nuake {
inline void QuakeMapComponent::ActionRebuild()
{
rebuildNextTick = true;
}
}

View File

@@ -273,17 +273,29 @@ namespace Nuake
for (const auto& e : view)
{
auto& map = view.get<QuakeMapComponent>(e);
bool buildMap = false;
if (map.rebuildNextTick && map.Path.Exist())
{
buildMap = true;
map.rebuildNextTick = false;
}
if (map.AutoRebuild && map.Path.Exist())
{
if (auto file = FileSystem::GetFile(map.Path.GetRelativePath()); file->Exist() && file->GetHasBeenModified())
{
file->SetHasBeenModified(false);
Entity entity = Entity(e, this);
QuakeMapBuilder builder;
builder.BuildQuakeMap(entity, map.HasCollisions);
buildMap = true;
}
}
if (buildMap)
{
Entity entity = Entity(e, this);
QuakeMapBuilder builder;
builder.BuildQuakeMap(entity, map.HasCollisions);
}
}
}