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

@@ -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);
}
}
}