public override void PostSpawnSetup() { //Log.Message( parent.def.defName + " - PostSpawnSetup()" ); base.PostSpawnSetup(); // Get the power comp PowerTrader = CompPowerTrader; #if DEBUG if (PowerTrader == null) { Log.Error("Community Core Library :: CompPowerLowIdleDraw :: " + parent.def.defName + " requires CompPowerTrader!"); return; } #endif // Get the idle properties IdleProps = this.CompProperties_LowIdleDraw(); #if DEBUG if (IdleProps == null) { Log.Message("Community Core Library :: CompPowerLowIdleDraw :: " + parent.def.defName + " requires CompProperties_LowIdleDraw!"); return; } #endif // Generate the list of cells to check BuildScanList(); // Calculate low-power mode consumption idlePower = IdleProps.idlePowerFactor * -PowerTrader.props.basePowerConsumption; if (idlePower > minIdleDraw) { idlePower = minIdleDraw; } //Log.Message( parent.def.defName + " - " + idlePower + " - " + PowerTrader.props.basePowerConsumption + " - " + IdleProps.idlePowerFactor ); // Initial state... if (curPower > idlePower) { // ...Default off... curPower = idlePower; } // Set power usage PowerTrader.PowerOutput = curPower; }
public override void PostSpawnSetup() { base.PostSpawnSetup(); // Validate power comp #if DEBUG if( CompPower == null ) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Missing CompPower", "CompPowerLowIdleDraw" ); return; } #endif // Get the idle properties IdleProps = this.CompProperties_LowIdleDraw(); #if DEBUG if( IdleProps == null ) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Missing CompProperties_LowIdleDraw", "CompPowerLowIdleDraw" ); return; } #endif #if DEBUG // Validate "InUse" if( ( IdleProps.operationalMode == LowIdleDrawMode.InUse )&& ( !parent.def.hasInteractionCell )&& ( CompFacility == null ) ) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Parent building must be have an interaction cell or CompFacility to use 'InUse'", "CompPowerLowIdleDraw" ); return; } // Validate "Factory" if( ( IdleProps.operationalMode == LowIdleDrawMode.Factory )&& ( AutomatedFactory == null ) ) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Parent building must be ThingClass Building_AutomatedFactory to use 'Factory'", "CompPowerLowIdleDraw" ); return; } // Validate "GroupUse" if( ( IdleProps.operationalMode == LowIdleDrawMode.GroupUse )&& ( parent.def.GetJoyGiverDefsUsing() == null ) ) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Parent building must be used as a thingDef by a JoyGiverDef to use 'GroupUse'", "CompPowerLowIdleDraw" ); return; } #endif // Generate the list of cells to check BuildScanList(); // Calculate low-power mode consumption if( IdleProps.idlePowerFactor < 1.0f ) { IdlePower = IdleProps.idlePowerFactor * -CompPower.Props.basePowerConsumption; } else { IdlePower = -IdleProps.idlePowerFactor; } if( IdlePower > MinIdleDraw ) { IdlePower = MinIdleDraw; } // Initial state... if( curPower > IdlePower ) { // ...Default off... curPower = IdlePower; } // Set power usage CompPower.PowerOutput = curPower; }
public override void PostSpawnSetup() { base.PostSpawnSetup(); // Validate power comp #if DEBUG if (CompPower == null) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Missing CompPower", "CompPowerLowIdleDraw" ); return; } #endif // Get the idle properties IdleProps = this.CompProperties_LowIdleDraw(); #if DEBUG if (IdleProps == null) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Missing CompProperties_LowIdleDraw", "CompPowerLowIdleDraw" ); return; } #endif #if DEBUG // Validate "InUse" if ( (IdleProps.operationalMode == LowIdleDrawMode.InUse) && (!parent.def.hasInteractionCell) && (CompFacility == null) ) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Parent building must be have an interaction cell or CompFacility to use 'InUse'", "CompPowerLowIdleDraw" ); return; } // Validate "Factory" if ( (IdleProps.operationalMode == LowIdleDrawMode.Factory) && (AutomatedFactory == null) ) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Parent building must be ThingClass Building_AutomatedFactory to use 'Factory'", "CompPowerLowIdleDraw" ); return; } // Validate "GroupUse" if ( (IdleProps.operationalMode == LowIdleDrawMode.GroupUse) && (parent.def.GetJoyGiverDefsUsing() == null) ) { CCL_Log.TraceMod( parent.def, Verbosity.FatalErrors, "Parent building must be used as a thingDef by a JoyGiverDef to use 'GroupUse'", "CompPowerLowIdleDraw" ); return; } #endif // Generate the list of cells to check BuildScanList(); // Calculate low-power mode consumption if (IdleProps.idlePowerFactor < 1.0f) { IdlePower = IdleProps.idlePowerFactor * -CompPower.Props.basePowerConsumption; } else { IdlePower = -IdleProps.idlePowerFactor; } if (IdlePower > MinIdleDraw) { IdlePower = MinIdleDraw; } // Initial state... if (curPower > IdlePower) { // ...Default off... curPower = IdlePower; } // Set power usage CompPower.PowerOutput = curPower; }
public override void PostSpawnSetup() { base.PostSpawnSetup(); // Get the power comp PowerTrader = CompPowerTrader; #if DEBUG if( PowerTrader == null ) { CCL_Log.Error( "CompPowerLowIdleDraw requires CompPowerTrader!", parent.def.defName ); return; } #endif // Get the idle properties IdleProps = this.CompProperties_LowIdleDraw(); #if DEBUG if( IdleProps == null ) { CCL_Log.Error( "CompPowerLowIdleDraw requires CompProperties_LowIdleDraw!", parent.def.defName ); return; } #endif // Generate the list of cells to check BuildScanList(); // Calculate low-power mode consumption idlePower = IdleProps.idlePowerFactor * -PowerTrader.props.basePowerConsumption; if( idlePower > minIdleDraw ) { idlePower = minIdleDraw; } // Initial state... if( curPower > idlePower ) { // ...Default off... curPower = idlePower; } // Set power usage PowerTrader.PowerOutput = curPower; }