mirror of
https://github.com/antopilo/Nuake.git
synced 2026-01-07 10:09:49 +03:00
Fixed rebuild action for quake map component
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user