Example #1
0
    public override void RemoveSupply(GameObject SourceInstance = null)
    {
        bool SendToline = false;

        if (RelatedLine != null)
        {
            if (SourceInstance == null)
            {
                if (Data.Downstream.Count > 0 || Data.Upstream.Count > 0)
                {
                    SendToline = true;
                }
            }
            else
            {
                int InstanceID = SourceInstance.GetInstanceID();
                if (Data.Downstream.ContainsKey(InstanceID))
                {
                    SendToline = true;
                }
            }
        }
        ElectricalDataCleanup.PowerSupplies.RemoveSupply(this, SourceInstance);
        if (SendToline)
        {
            RelatedLine.PassOnRemoveSupply(this, SourceInstance);
        }
    }
Example #2
0
    public override void RemoveSupply(GameObject SourceInstance = null)
    {
        bool SendToline = false;

        if (RelatedLine != null)
        {
            if (SourceInstance == null)
            {
                foreach (var Supply in Data.SupplyDependent)
                {
                    if (Supply.Value.Downstream.Count > 0 || Supply.Value.Upstream.Count > 0)
                    {
                        SendToline = true;
                    }
                }
            }
            else
            {
                int InstanceID = SourceInstance.GetInstanceID();
                if (Data.SupplyDependent[InstanceID].Downstream.Count > 0 || Data.SupplyDependent[InstanceID].Upstream.Count > 0)
                {
                    SendToline = true;
                }
            }
        }
        ElectricalDataCleanup.PowerSupplies.RemoveSupply(this, SourceInstance);
        if (SendToline)
        {
            RelatedLine.PassOnRemoveSupply(this, SourceInstance);
        }
    }