Example #1
0
 public virtual void BroadcastSetUpMessage(ElectricalNodeControl Node)
 {
     RequiresUpdateOn = new HashSet <ElectricalUpdateTypeCategory>
     {
         ElectricalUpdateTypeCategory.PowerUpdateStructureChange,
         ElectricalUpdateTypeCategory.PowerUpdateStructureChangeReact,
         ElectricalUpdateTypeCategory.PowerUpdateCurrentChange,
         ElectricalUpdateTypeCategory.TurnOnSupply,
         ElectricalUpdateTypeCategory.TurnOffSupply,
         ElectricalUpdateTypeCategory.PowerNetworkUpdate,
         ElectricalUpdateTypeCategory.PotentialDestroyed,
         ElectricalUpdateTypeCategory.GoingOffStage,
         ElectricalUpdateTypeCategory.ObjectStateChange,
     };
     ModuleType      = ElectricalModuleTypeCategory.SupplyingDevice;
     ControllingNode = Node;
     ControllingNode.Node.InData.Data.SupplyingVoltage   = SupplyingVoltage;
     ControllingNode.Node.InData.Data.InternalResistance = InternalResistance;
     ControllingNode.Node.InData.Data.SupplyingCurrent   = current;
     Node.AddModule(this);
     if (StartOnStartUp)
     {
         TurnOnSupply();
     }
 }
Example #2
0
 void Awake()
 {
     registerTile          = GetComponent <RegisterTile>();
     securable             = GetComponent <WrenchSecurable>();
     baseSpriteHandler     = GetComponentInChildren <SpriteHandler>();
     electricalNodeControl = GetComponent <ElectricalNodeControl>();
 }
Example #3
0
 private void Awake()
 {
     electricalNodeControl = GetComponent <ElectricalNodeControl>();
     moduleSupplyingDevice = GetComponent <ModuleSupplyingDevice>();
     pushPull     = GetComponent <PushPull>();
     registerTile = GetComponent <RegisterTile>();
 }
 private void Awake()
 {
     electricalNodeControl = GetComponent <ElectricalNodeControl>();
     moduleSupplyingDevice = GetComponent <ModuleSupplyingDevice>();
     wrenchSecurable       = GetComponent <WrenchSecurable>();
     registerTile          = GetComponent <RegisterTile>();
 }
Example #5
0
        public void RemoveSupply(ElectricalNodeControl supply, PowerTypeCategory category)
        {
            var quickAdd = new ElectricalSynchronisationStorage();

            quickAdd.device   = supply;
            quickAdd.category = category;
            ToRemove.Enqueue(quickAdd);
        }
    public static void RemoveSupply(ElectricalNodeControl Supply, PowerTypeCategory category)
    {
        ElectricalSynchronisationStorage QuickAdd = new ElectricalSynchronisationStorage();

        QuickAdd.device   = Supply;
        QuickAdd.category = category;
        ToRemove.Enqueue(QuickAdd);
    }
Example #7
0
 private void Awake()
 {
     directional           = GetComponent <Directional>();
     objectBehaviour       = GetComponent <ObjectBehaviour>();
     registerTile          = GetComponent <RegisterTile>();
     accessRestrictions    = GetComponent <AccessRestrictions>();
     electricalNodeControl = GetComponent <ElectricalNodeControl>();
     spriteHandler         = GetComponentInChildren <SpriteHandler>();
 }
 void Awake()
 {
     registerTile          = GetComponent <RegisterTile>();
     objectBehaviour       = GetComponent <ObjectBehaviour>();
     itemStorage           = GetComponent <ItemStorage>();
     securable             = GetComponent <WrenchSecurable>();
     baseSpriteHandler     = GetComponentInChildren <SpriteHandler>();
     electricalNodeControl = GetComponent <ElectricalNodeControl>();
 }
Example #9
0
        private void Awake()
        {
            powerControlSlot = GetComponent <ItemStorage>().GetIndexedItemSlot(0);
            powerCellSlot    = GetComponent <ItemStorage>().GetIndexedItemSlot(1);

            electricalNodeControl  = GetComponent <ElectricalNodeControl>();
            resistanceSourceModule = GetComponent <ResistanceSourceModule>();
            integrity = GetComponent <Integrity>();
        }
 public static void AddSupply(ElectricalNodeControl Supply, PowerTypeCategory category)
 {
     if (!(AliveSupplies.ContainsKey(category)))
     {
         AliveSupplies[category] = new HashSet <ElectricalNodeControl>();
     }
     AliveSupplies[category].Add(Supply);
     TotalSupplies.Add(Supply);
 }
Example #11
0
        public void AddSupply(ElectricalNodeControl supply, PowerTypeCategory category)
        {
            var adding = new QueueAddSupply()
            {
                category = category,
                supply   = supply
            };

            SupplyToadd.Add(adding);
        }
Example #12
0
        private void Awake()
        {
            selfPart              = GetComponent <ParticleAcceleratorPart>();
            registerTile          = GetComponent <RegisterTile>();
            electricalNodeControl = GetComponent <ElectricalNodeControl>();

            damageData = DamageData.CreateInstance <DamageData>();
            damageData.SetAttackType(AttackType.Rad);
            damageData.SetDamageType(DamageType.Clone);
        }
Example #13
0
        private void Awake()
        {
            baseSpriteHandler      = transform.GetChild(0).GetComponent <SpriteHandler>();
            chargingIndicator      = transform.GetChild(1).GetComponent <SpriteHandler>();
            outputEnabledIndicator = transform.GetChild(2).GetComponent <SpriteHandler>();
            chargeLevelIndicator   = transform.GetChild(3).GetComponent <SpriteHandler>();

            electricalNodeControl  = GetComponent <ElectricalNodeControl>();
            batterySupplyingModule = GetComponent <BatterySupplyingModule>();
        }
Example #14
0
        void Awake()
        {
            registerTile          = GetComponent <RegisterTile>();
            securable             = GetComponent <WrenchSecurable>();
            baseSpriteHandler     = GetComponentInChildren <SpriteHandler>();
            electricalNodeControl = GetComponent <ElectricalNodeControl>();
            var itemStorage = GetComponent <ItemStorage>();

            itemSlot = itemStorage.GetIndexedItemSlot(0);
            securable.OnAnchoredChange.AddListener(OnSecuredChanged);
        }
Example #15
0
        private void Awake()
        {
            baseSpriteHandler      = transform.GetChild(0).GetComponent <SpriteHandler>();
            chargingIndicator      = transform.GetChild(1).GetComponent <SpriteHandler>();
            outputEnabledIndicator = transform.GetChild(2).GetComponent <SpriteHandler>();
            chargeLevelIndicator   = transform.GetChild(3).GetComponent <SpriteHandler>();
            registerTile           = GetComponent <RegisterTile>();
            objectBehaviour        = GetComponent <ObjectBehaviour>();
            machine = GetComponent <Machine>();

            electricalNodeControl  = GetComponent <ElectricalNodeControl>();
            batterySupplyingModule = GetComponent <BatterySupplyingModule>();
        }
 public void BroadcastSetUpMessage(ElectricalNodeControl Node)
 {
     RequiresUpdateOn = new HashSet <ElectricalUpdateTypeCategory>
     {
         ElectricalUpdateTypeCategory.ModifyElectricityInput,
         ElectricalUpdateTypeCategory.ModifyResistancyOutput,
     };
     ModuleType      = ElectricalModuleTypeCategory.Transformer;
     ControllingNode = Node;
     if (InvertingTurnRatio)
     {
         TurnRatio = 1 / TurnRatio;
     }
     Node.AddModule(this);
 }
 public override void BroadcastSetUpMessage(ElectricalNodeControl Node)
 {
     RequiresUpdateOn = new HashSet <ElectricalUpdateTypeCategory>
     {
         ElectricalUpdateTypeCategory.PowerUpdateStructureChange,
         ElectricalUpdateTypeCategory.PowerUpdateStructureChangeReact,
         ElectricalUpdateTypeCategory.PowerUpdateCurrentChange,
         ElectricalUpdateTypeCategory.TurnOnSupply,
         ElectricalUpdateTypeCategory.TurnOffSupply,
         ElectricalUpdateTypeCategory.PowerNetworkUpdate,
         ElectricalUpdateTypeCategory.ModifyElectricityOutput,
         ElectricalUpdateTypeCategory.PotentialDestroyed,             //Remember to keep the inherited updates
     };
     ModuleType      = ElectricalModuleTypeCategory.BatterySupplyingDevice;
     ControllingNode = Node;
     Node.AddModule(this);
 }
 public void BroadcastSetUpMessage(ElectricalNodeControl Node)
 {
     RequiresUpdateOn = new HashSet <ElectricalUpdateTypeCategory>
     {
         ElectricalUpdateTypeCategory.InitialPowerUpdateResistance,
         ElectricalUpdateTypeCategory.PowerUpdateResistanceChange,
         ElectricalUpdateTypeCategory.PowerNetworkUpdate,
         ElectricalUpdateTypeCategory.PotentialDestroyed,
     };
     ModuleType      = ElectricalModuleTypeCategory.ResistanceSource;
     ControllingNode = Node;
     resistance.Ohms = ReactionTo.ResistanceReactionA.Resistance.Ohms;
     ReactionTo.ResistanceReactionA.Resistance = resistance;
     ControllingNode.Node.InData.ConnectionReaction[ReactionTo.ConnectingDevice] = ReactionTo;
     ElectricalSynchronisation.PoweredDevices.Add(ControllingNode);
     Node.AddModule(this);
 }
 public void BroadcastSetUpMessage(ElectricalNodeControl Node)
 {
     RequiresUpdateOn = new HashSet <ElectricalUpdateTypeCategory>
     {
         ElectricalUpdateTypeCategory.InitialPowerUpdateResistance,
         ElectricalUpdateTypeCategory.PowerUpdateResistanceChange,
         ElectricalUpdateTypeCategory.PowerNetworkUpdate,
         ElectricalUpdateTypeCategory.PotentialDestroyed,
     };
     ModuleType      = ElectricalModuleTypeCategory.ResistanceSource;
     ControllingNode = Node;
     //resistance.Ohms = ReactionTo.ResistanceReactionA.Resistance.Ohms;
     ReactionTo.ResistanceReactionA.Resistance = resistance;
     if (resistance.Ohms == 0)
     {
         resistance.Ohms = 9999991;
     }
     ControllingNode.Node.InData.ConnectionReaction[ReactionTo.ConnectingDevice] = ReactionTo;
     ElectricalManager.Instance.electricalSync.PoweredDevices.Add(ControllingNode);
     ComingFromDevice.SetDeadEnd();
     Node.AddModule(this);
 }
Example #20
0
 public virtual void DirectionInput(ElectricalOIinheritance SourceInstance, ElectricalOIinheritance ComingFrom, ElectricalNodeControl ComplexPassOn)
 {
 }
Example #21
0
        private IEnumerator RestartPowerSupply(ElectricalNodeControl node)
        {
            yield return(WaitFor.Seconds(Random.Range(30, 120)));

            node.TurnOnSupply();
        }
Example #22
0
 private void Awake()
 {
     electricalNodeControl  = GetComponent <ElectricalNodeControl>();
     resistanceSourceModule = GetComponent <ResistanceSourceModule>();
 }
Example #23
0
        /// <summary>
        /// Clear currents and Calculate the currents And voltage
        /// </summary>
        private void PowerUpdateCurrentChange()
        {
            for (var i = 0; i < UnconditionalSupplies.Count; i++)
            {
                var categoryHashset = AliveSupplies[OrderList[i]];
                foreach (var supply in categoryHashset)
                {
                    if (NUCurrentChange.Contains(supply) && !NUStructureChangeReact.Contains(supply) && !NUResistanceChange.Contains(supply))
                    {
                        //Does all the updates for the constant sources since they don't have to worry about other supplies being on or off since they just go steaming ahead
                        supply.PowerUpdateCurrentChange();
                        NUCurrentChange.Remove(supply);
                    }
                }
            }

            var doneSupplies = new HashSet <ElectricalNodeControl>();
            ElectricalNodeControl lowestReactive = null;
            var lowestReactiveInt = 9999;
            var nodeToRemove      = new List <ElectricalNodeControl>();

            //This is to calculate the lowest number of supplies that are above the reactive supply so therefore the one that needs to be updated first
            while (NumberOfReactiveSupplies_f() > 0)
            {
                foreach (var supply in NUCurrentChange)
                {
                    if (!doneSupplies.Contains(supply))
                    {
                        if (TotalSupplies.Contains(supply))
                        {
                            if (ReactiveSuppliesSet.Contains(supply.Node.InData.Categorytype))
                            {
                                if (NUCurrentChange.Contains(supply) && !(NUStructureChangeReact.Contains(supply)) &&
                                    !(NUResistanceChange.Contains(supply)))
                                {
                                    if (lowestReactive == null)
                                    {
                                        lowestReactive    = supply;
                                        lowestReactiveInt = NumberOfReactiveSupplies(supply.Node.InData);
                                    }
                                    else if (lowestReactiveInt > NumberOfReactiveSupplies(supply.Node.InData))
                                    {
                                        lowestReactive    = supply;
                                        lowestReactiveInt = NumberOfReactiveSupplies(supply.Node.InData);
                                    }
                                }
                                else
                                {
                                    nodeToRemove.Add(supply);
                                }
                            }
                        }
                        else
                        {
                            nodeToRemove.Add(supply);
                        }
                    }
                    else
                    {
                        nodeToRemove.Add(supply);
                    }
                }

                if (lowestReactive != null)
                {
                    lowestReactive.PowerUpdateCurrentChange();
                    NUCurrentChange.Remove(lowestReactive);
                    doneSupplies.Add(lowestReactive);
                }

                lowestReactive    = null;
                lowestReactiveInt = 9999;
                foreach (var node in nodeToRemove)
                {
                    NUCurrentChange.Remove(node);
                }

                nodeToRemove = new List <ElectricalNodeControl>();
            }
        }
    /// <summary>
    /// Clear currents and Calculate the currents And voltage
    /// </summary>
    private void PowerUpdateCurrentChange()
    {
        //Logger.Log("PowerUpdateCurrentChange");
        for (int i = 0; i < UnconditionalSupplies.Count; i++)
        {
            foreach (ElectricalNodeControl TheSupply in AliveSupplies[OrderList[i]])
            {
                if (NUCurrentChange.Contains(TheSupply) && !(NUStructureChangeReact.Contains(TheSupply)) &&
                    !(NUResistanceChange.Contains(TheSupply)))
                {
                    TheSupply
                    .PowerUpdateCurrentChange();                             //Does all the updates for the constant sources since they don't have to worry about other supplies being on or off since they just go steaming ahead
                    NUCurrentChange.Remove(TheSupply);
                }
            }
        }

        HashSet <ElectricalNodeControl> DoneSupplies   = new HashSet <ElectricalNodeControl>();
        ElectricalNodeControl           LowestReactive = null;
        int LowestReactiveint = 9999;
        List <ElectricalNodeControl> QToRemove = new List <ElectricalNodeControl>();

        while (NumberOfReactiveSupplies_f() > 0
               )  //This is to calculate the lowest number of supplies that are above the reactive supply so therefore the one that needs to be updated first
        {
            foreach (ElectricalNodeControl TheSupply in NUCurrentChange)
            {
                if (!DoneSupplies.Contains(TheSupply))
                {
                    if (TotalSupplies.Contains(TheSupply))
                    {
                        if (ReactiveSuppliesSet.Contains(TheSupply.Node.InData.Categorytype))
                        {
                            if (NUCurrentChange.Contains(TheSupply) && !(NUStructureChangeReact.Contains(TheSupply)) &&
                                !(NUResistanceChange.Contains(TheSupply)))
                            {
                                if (LowestReactive == null)
                                {
                                    LowestReactive    = TheSupply;
                                    LowestReactiveint = NumberOfReactiveSupplies(TheSupply.Node.InData);
                                }
                                else if (LowestReactiveint > NumberOfReactiveSupplies(TheSupply.Node.InData))
                                {
                                    LowestReactive    = TheSupply;
                                    LowestReactiveint = NumberOfReactiveSupplies(TheSupply.Node.InData);
                                }
                            }
                            else
                            {
                                QToRemove.Add(TheSupply);
                            }
                        }
                    }
                    else
                    {
                        QToRemove.Add(TheSupply);
                    }
                }
                else
                {
                    QToRemove.Add(TheSupply);
                }
            }

            if (LowestReactive != null)
            {
                LowestReactive.PowerUpdateCurrentChange();
                NUCurrentChange.Remove(LowestReactive);
                DoneSupplies.Add(LowestReactive);
            }

            LowestReactive    = null;
            LowestReactiveint = 9999;
            foreach (ElectricalNodeControl re in QToRemove)
            {
                NUCurrentChange.Remove(re);
            }

            QToRemove = new List <ElectricalNodeControl>();
        }
    }