Esempio n. 1
0
        private void AddStatsFromUpgrade(Comp_ShieldUpgrade comp)
        {
            CompProperties_ShieldUpgrade _Properties = ((CompProperties_ShieldUpgrade)comp.props);

            Patch.Patcher.LogNULL(_Properties, "_Properties");

            this.m_FieldIntegrity_Max   += _Properties.FieldIntegrity_Increase;
            this.m_FieldRadius_Avalable += _Properties.Range_Increase;

            //Power
            this.m_PowerRequired += _Properties.PowerUsage_Increase;

            if (_Properties.DropPodIntercept)
            {
                this.m_InterceptDropPod_Avalable = true;
            }

            if (_Properties.IdentifyFriendFoe)
            {
                //Log.Message("Setting IFF");
                this.m_IdentifyFriendFoe_Avalable = true;
            }

            if (_Properties.SlowDischarge)
            {
                this.SlowDischarge_Active = true;
            }
        }
Esempio n. 2
0
        private bool IsAvalableUpgrade(Building buildingToCheck, bool ResultMessages = false)
        {
            Comp_ShieldUpgrade _Comp = buildingToCheck.TryGetComp <Comp_ShieldUpgrade>();

            if (_Comp == null)
            {
                if (ResultMessages)
                {
                    Messages.Message("Upgrade Comp Not Found, How did you even get here?.",
                                     buildingToCheck,
                                     MessageTypeDefOf.RejectInput);
                }
                return(false);
            }

            if (this.m_IdentifyFriendFoe_Avalable && _Comp.Properties.IdentifyFriendFoe)
            {
                if (ResultMessages)
                {
                    Messages.Message("Upgrade Contains IFF while shield already has it.",
                                     buildingToCheck,
                                     MessageTypeDefOf.RejectInput);
                }
                return(false);
            }

            if (this.SlowDischarge_Active && _Comp.Properties.SlowDischarge)
            {
                if (ResultMessages)
                {
                    Messages.Message("Upgrade for slow discharge while shield already has it.",
                                     buildingToCheck,
                                     MessageTypeDefOf.RejectInput);
                }
                return(false);
            }

            if (this.m_InterceptDropPod_Avalable && _Comp.Properties.DropPodIntercept)
            {
                if (ResultMessages)
                {
                    Messages.Message("Upgrade for drop pod intercept while shield already has it.",
                                     buildingToCheck,
                                     MessageTypeDefOf.RejectInput);
                }
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        public void RecalculateStatistics()
        {
            //Log.Message("RecalculateStatistics");

            //Visual Settings
            this.m_ColourRed   = 0.5f;
            this.m_ColourGreen = 0.0f;
            this.m_ColourBlue  = 0.5f;

            //Field Settings
            this.m_FieldIntegrity_Max     = this.Properties.m_FieldIntegrity_Max_Base;
            this.m_FieldIntegrity_Initial = this.Properties.m_FieldIntegrity_Initial;
            this.m_FieldRadius_Avalable   = this.Properties.m_Field_Radius_Base;

            //Mode Settings - Avalable
            this.m_BlockIndirect_Avalable    = this.Properties.m_BlockIndirect_Avalable;
            this.m_BlockDirect_Avalable      = this.Properties.m_BlockDirect_Avalable;
            this.m_InterceptDropPod_Avalable = this.Properties.m_InterceptDropPod_Avalable;

            //Power Settings
            this.m_PowerRequired = this.Properties.m_PowerRequired_Charging;

            //Recovery Settings
            this.m_RechargeTickDelayInterval = this.Properties.m_RechargeTickDelayInterval_Base;
            this.m_RecoverWarmupDelayTicks   = this.Properties.m_RecoverWarmupDelayTicks_Base;

            //Power converter
            this.SlowDischarge_Active = false;

            //IFF
            this.m_IdentifyFriendFoe_Avalable = false;

            //Store the List of Building in initilisation????

            this.m_AppliedUpgrades.ForEach(b =>
            {
                Building _Building       = b as Building;
                Comp_ShieldUpgrade _Comp = _Building.GetComp <Comp_ShieldUpgrade>();

                Patch.Patcher.LogNULL(_Building, "_Building");
                Patch.Patcher.LogNULL(_Comp, "_Comp");

                this.AddStatsFromUpgrade(_Comp);
            });

            this.m_Power.powerOutputInt = -this.m_PowerRequired;
        }