private void CompTickWhatever()
        {
            if (linkedBatteryShare == null)
            {
                Building_PocketDimensionEntranceBase parentEntrance = this.parent as Building_PocketDimensionEntranceBase;

                if (parentEntrance != null)
                {
                    Building_PocketDimensionEntranceBase otherSide = PocketDimensionUtility.GetOtherSide(parentEntrance);

                    if (otherSide != null)
                    {
                        linkedBatteryShare = otherSide.GetComp <CompPocketDimensionBatteryShare>();
                    }
                }
            }

            if (thisBattery != null && linkedBatteryShare != null && linkedBatteryShare.parent.Map != null)
            {
                float newEnergyOtherSide = linkedBatteryShare.GetEnergyStored(thisBattery.StoredEnergy);
                float maxEnergyOtherSide = linkedBatteryShare.GetEnergyMax();

                // Calculate actual energy percent first
                if (maxEnergyOtherSide > 0.0f)
                {
                    energyPercent = newEnergyOtherSide / maxEnergyOtherSide;
                }
                else
                {
                    energyPercent = 0.0f;
                }

                float maxEnergyTotal = maxEnergyOtherSide + Props.storedEnergyMax;


                if (newEnergyOtherSide > maxEnergyTotal)
                {
                    newEnergyOtherSide = maxEnergyTotal;
                }

                storedEnergyMax = maxEnergyTotal;

                // The props is a single instance shared across all instances of the comp. Just need to make sure it can always hold enough.
                if (thisBattery.Props.storedEnergyMax < maxEnergyTotal)
                {
                    thisBattery.Props.storedEnergyMax = maxEnergyTotal;
                }

                float showEnergyPercent = 1.0f;
                if (thisBattery.Props.storedEnergyMax > 0.0f)
                {
                    showEnergyPercent = newEnergyOtherSide / thisBattery.Props.storedEnergyMax;
                }

                thisBattery.SetStoredEnergyPct(showEnergyPercent);

                //Logger.MessageFormat(this, "Updated battery, energy: {0} ({2}), max: {1} ({3}), {4} - {5}", newEnergy, maxEnergy, thisBattery.StoredEnergy, thisBattery.Props.storedEnergyMax, thisBattery.parent.Label, linkedBatteryShare.parent.Label);
            }
        }
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            compPowerBattery = this.GetComp <CompPowerBattery>();
            compBatteryShare = this.GetComp <CompPocketDimensionBatteryShare>();

            CompHasButton compHasButton = this.GetComp <CompHasButton>();

            if (compHasButton.Active != ventOpen)
            {
                compHasButton.SetActiveState(ventOpen);
            }
        }
        public override void Draw()
        {
            base.Draw();

            float redness          = 0.0f;
            float relativeCapacity = 0.0f;
            float energyPercent    = 0.0f;

            Building_PocketDimensionEntranceBase otherSide = PocketDimensionUtility.GetOtherSide(this);

            if (otherSide != null)
            {
                float myTemp    = this.PositionHeld.GetTemperature(this.MapHeld);
                float otherTemp = otherSide.PositionHeld.GetTemperature(otherSide.MapHeld);

                redness  = baseRedness;
                redness += (otherTemp - myTemp) * rednessPerDegree;
                redness  = Mathf.Clamp(redness, 0.0f, 1.0f);


                CompPocketDimensionBatteryShare myBatteryShare    = this.GetComp <CompPocketDimensionBatteryShare>();
                CompPocketDimensionBatteryShare otherBatteryShare = otherSide.GetComp <CompPocketDimensionBatteryShare>();

                if (myBatteryShare != null && otherBatteryShare != null)
                {
                    float otherEnergyCapacity = myBatteryShare.StoredEnergyMax;
                    float myEnergyCapacity    = otherBatteryShare.StoredEnergyMax;
                    if (myEnergyCapacity == 0.0f)
                    {
                        relativeCapacity = 0.0f;
                    }
                    else
                    {
                        relativeCapacity = (((otherEnergyCapacity - myEnergyCapacity) / Mathf.Min(myEnergyCapacity, otherEnergyCapacity)) * energyCapacityColorScale) + 0.5f;
                        relativeCapacity = Mathf.Clamp(relativeCapacity, 0.0f, 1.0f);

                        energyPercent = myBatteryShare.EnergyPercent;
                    }
                }
            }

            Color glowColor = new Color(redness, energyPercent, relativeCapacity);

            glowGraphic.GetColoredVersion(ShaderDatabase.Cutout, glowColor, glowColor).Draw(new Vector3(this.DrawPos.x, this.DrawPos.y + 1f, this.DrawPos.z), Rot4.North, this);
        }