private void AddStatsFromUpgrade(Comp_ShieldUpgrade comp) { this.m_FieldIntegrity_Max += comp.Properties.FieldIntegrity_Increase; this.m_FieldRadius_Avalable += comp.Properties.Range_Increase; //Power this.m_PowerRequired += comp.Properties.PowerUsage_Increase; if (comp.Properties.DropPodIntercept) { this.m_InterceptDropPod_Avalable = true; } if (comp.Properties.IdentifyFriendFoe) { //Log.Message("Setting IFF"); this.m_IdentifyFriendFoe_Avalable = true; } if (comp.Properties.SlowDischarge) { this.SlowDischarge_Active = true; } }
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???? CompFacility _Facility = this.parent.GetComp <CompFacility>(); Patch.Patcher.LogNULL(_Facility, "_Facility"); FieldInfo _LinkedBuildingsInfo = typeof(CompFacility).GetField("linkedBuildings", BindingFlags.NonPublic | BindingFlags.Instance); Patch.Patcher.LogNULL(_LinkedBuildingsInfo, "_LinkedBuildingsInfo"); List <Thing> _LinkedBuildings = _LinkedBuildingsInfo.GetValue(_Facility) as List <Thing>; Patch.Patcher.LogNULL(_LinkedBuildings, "_LinkedBuildings"); //Log.Message(_LinkedBuildings.Count.ToString()); _LinkedBuildings.ForEach(b => { Building _Building = b as Building; Comp_ShieldUpgrade _Comp = _Building.GetComp <Comp_ShieldUpgrade>(); Patch.Patcher.LogNULL(_Comp, "_Comp"); Patch.Patcher.LogNULL(_Comp.Properties, "_Comp.Properties"); this.AddStatsFromUpgrade(_Comp); }); this.m_Power.powerOutputInt = -this.m_PowerRequired; }