Added power balancing to create variable voltage based on generated power

This commit is contained in:
Calclavia 2015-01-21 19:00:31 +08:00
parent d66a109caa
commit 1fc51def45
2 changed files with 2 additions and 10 deletions

View file

@ -6,13 +6,9 @@ import codechicken.multipart.TileMultipart
import cpw.mods.fml.client.FMLClientHandler import cpw.mods.fml.client.FMLClientHandler
import cpw.mods.fml.client.registry.{ClientRegistry, RenderingRegistry} import cpw.mods.fml.client.registry.{ClientRegistry, RenderingRegistry}
import cpw.mods.fml.relauncher.{Side, SideOnly} import cpw.mods.fml.relauncher.{Side, SideOnly}
import edx.basic.BasicContent
import edx.basic.process.mixing.TileGlassJar
import edx.basic.process.sifting.TileSieve
import edx.basic.process.smelting.firebox.{RenderHotPlate, TileHotPlate} import edx.basic.process.smelting.firebox.{RenderHotPlate, TileHotPlate}
import edx.basic.process.smelting.{RenderCastingMold, TileCastingMold} import edx.basic.process.smelting.{RenderCastingMold, TileCastingMold}
import edx.electrical.ElectricalContent import edx.electrical.ElectricalContent
import edx.electrical.battery.TileBattery
import edx.electrical.multimeter.{GuiMultimeter, PartMultimeter, RenderMultimeter} import edx.electrical.multimeter.{GuiMultimeter, PartMultimeter, RenderMultimeter}
import edx.electrical.tesla.{RenderTesla, TileTesla} import edx.electrical.tesla.{RenderTesla, TileTesla}
import edx.electrical.transformer.RenderTransformer import edx.electrical.transformer.RenderTransformer
@ -52,8 +48,6 @@ import resonant.lib.transform.vector.Vector3
override def init() override def init()
{ {
//Basic //Basic
ItemRenderHandler.register(Item.getItemFromBlock(BasicContent.blockGlassJar), new TileGlassJar)
ItemRenderHandler.register(Item.getItemFromBlock(BasicContent.blockSieve), new TileSieve)
//Mechanical //Mechanical
ItemRenderHandler.register(MechanicalContent.itemGear, RenderGear) ItemRenderHandler.register(MechanicalContent.itemGear, RenderGear)
@ -67,7 +61,6 @@ import resonant.lib.transform.vector.Vector3
ItemRenderHandler.register(ElectricalContent.itemTransformer, RenderTransformer) ItemRenderHandler.register(ElectricalContent.itemTransformer, RenderTransformer)
ItemRenderHandler.register(ElectricalContent.itemMultimeter, RenderMultimeter) ItemRenderHandler.register(ElectricalContent.itemMultimeter, RenderMultimeter)
ItemRenderHandler.register(ElectricalContent.itemQuantumGlyph, RenderQuantumGlyph) ItemRenderHandler.register(ElectricalContent.itemQuantumGlyph, RenderQuantumGlyph)
ItemRenderHandler.register(Item.getItemFromBlock(ElectricalContent.blockBattery), new TileBattery)
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileTesla], new RenderTesla) ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileTesla], new RenderTesla)

View file

@ -85,9 +85,8 @@ class TileBattery extends SpatialTile(Material.iron) with TIO with TElectric wit
{ {
if (energy > 0) if (energy > 0)
{ {
//TODO: Voltage of battery should decrease over time. //TODO: Allow player to set the power output
dcNode.generateVoltage(500) dcNode.generatePower(100000)
val dissipatedEnergy = dcNode.power / 20 val dissipatedEnergy = dcNode.power / 20
energy -= dissipatedEnergy energy -= dissipatedEnergy
markUpdate() markUpdate()