// Handle the case where a cockpit is removed but the car remains
        // If a lock is present, either move the lock to another cockpit or destroy it
        private void OnEntityKill(VehicleModuleSeating seatingModule)
        {
            if (seatingModule == null || !seatingModule.HasADriverSeat())
            {
                return;
            }

            var car = seatingModule.Vehicle as ModularCar;

            if (car == null)
            {
                return;
            }

            var codeLock = seatingModule.GetComponentInChildren <CodeLock>();

            if (codeLock == null)
            {
                NextTick(() =>
                {
                    if (car != null)
                    {
                        UIManager.UpdateCarUI(car);
                    }
                });
                return;
            }

            codeLock.SetParent(null);
            NextTick(() =>
            {
                if (car == null)
                {
                    return;
                }

                var driverModule = FindFirstDriverModule(car);
                if (driverModule != null)
                {
                    codeLock.SetParent(driverModule);
                }
                else
                {
                    codeLock.Kill();
                    UIManager.UpdateCarUI(car);
                }
            });
        }
 // Handle the case where a cockpit is added while a player is editing the car
 void OnEntitySpawned(VehicleModuleSeating seatingModule)
 {
     if (seatingModule == null || !seatingModule.HasADriverSeat())
     {
         return;
     }
     NextTick(() =>
     {
         var car = seatingModule.Vehicle as ModularCar;
         if (car == null)
         {
             return;
         }
         UIManager.UpdateCarUI(car);
     });
 }