Kaynağa Gözat

Add additional renderer-side safety check before calling entity renderers

Co-authored-by: djeada <[email protected]>
copilot-swe-agent[bot] 2 ay önce
ebeveyn
işleme
08debd24ae
1 değiştirilmiş dosya ile 5 ekleme ve 0 silme
  1. 5 0
      render/scene_renderer.cpp

+ 5 - 0
render/scene_renderer.cpp

@@ -245,6 +245,11 @@ void Renderer::renderWorld(Engine::Core::World *world) {
 
 
     bool drawnByRegistry = false;
     bool drawnByRegistry = false;
     if (unitComp && !unitComp->unitType.empty() && m_entityRegistry) {
     if (unitComp && !unitComp->unitType.empty() && m_entityRegistry) {
+      if (unitComp->health <= 0 ||
+          entity->hasComponent<Engine::Core::PendingRemovalComponent>()) {
+        continue;
+      }
+
       auto fn = m_entityRegistry->get(unitComp->unitType);
       auto fn = m_entityRegistry->get(unitComp->unitType);
       if (fn) {
       if (fn) {
         DrawContext ctx{resources(), entity, world, modelMatrix};
         DrawContext ctx{resources(), entity, world, modelMatrix};