Merge pull request #4922 from mwerezak/power

Fixed cell chargers being infinite energy sources.
This commit is contained in:
Mloc
2014-05-07 21:48:54 +01:00
5 changed files with 13 additions and 8 deletions

View File

@@ -187,8 +187,8 @@
var/heat_capacity = gas.heat_capacity()
var/energy_used = min( abs( heat_capacity*(gas.temperature - target_temperature) ), MAX_ENERGY_CHANGE)
//Use power. Assuming that each power unit represents 1000 watts....
use_power(energy_used/1000, ENVIRON)
//Use power. Assuming that each power unit represents 1 watts....
use_power(energy_used, ENVIRON)
//We need to cool ourselves.
if(environment.temperature > target_temperature)

View File

@@ -10,6 +10,7 @@
power_channel = EQUIP
var/obj/item/weapon/cell/charging = null
var/chargelevel = -1
var/efficiency = 0.875 //<1.0 means some power is lost in the charging process, >1.0 means free energy.
proc
updateicon()
icon_state = "ccharger[charging ? 1 : 0]"
@@ -91,8 +92,10 @@
//world << "ccpt [charging] [stat]"
if(!charging || (stat & (BROKEN|NOPOWER)) || !anchored)
return
use_power(200) //this used to use CELLRATE, but CELLRATE is fucking awful. feel free to fix this properly!
charging.give(175) //inefficiency.
var/power_used = 100000 //for 200 units of charge. Yes, thats right, 100 kW. Is something wrong with CELLRATE?
power_used = charging.give(power_used*CELLRATE*efficiency)
use_power(power_used)
updateicon()