Merge pull request #7583 from atlantiscze/cellrate-hardsuit-stuff

Hardsuit Powersink Adjustments
This commit is contained in:
Chinsky
2014-12-31 08:17:20 +03:00
10 changed files with 61 additions and 76 deletions
+7 -4
View File
@@ -116,7 +116,7 @@
if(terminal)
terminal.connect_to_network()
/obj/machinery/power/apc/drain_power(var/drain_check, var/surge)
/obj/machinery/power/apc/drain_power(var/drain_check, var/surge, var/amount = 0)
if(drain_check)
return 1
@@ -131,7 +131,10 @@
update_icon()
return 0
return cell.drain_power(drain_check)
if(terminal && terminal.powernet)
terminal.powernet.trigger_warning()
return cell.drain_power(drain_check, surge, amount)
/obj/machinery/power/apc/New(turf/loc, var/ndir, var/building=0)
..()
@@ -178,10 +181,10 @@
del(cell) // qdel
if(terminal)
disconnect_terminal()
//If there's no more APC then there shouldn't be a cause for alarm I guess
area.poweralert(1, src) //so that alarms don't go on forever
..()
/obj/machinery/power/apc/proc/make_terminal()
+2 -13
View File
@@ -36,7 +36,7 @@ By design, d1 is the smallest direction and d2 is the highest
color = COLOR_RED
var/obj/machinery/power/breakerbox/breaker_box
/obj/structure/cable/drain_power(var/drain_check)
/obj/structure/cable/drain_power(var/drain_check, var/surge, var/amount = 0)
if(drain_check)
return 1
@@ -44,18 +44,7 @@ By design, d1 is the smallest direction and d2 is the highest
var/datum/powernet/PN = get_powernet()
if(!PN) return 0
var/drained_power = round(rand(200,400)/2)
var/drained_this_tick = PN.draw_power(drained_power)
if(drained_this_tick < drained_power)
for(var/obj/machinery/power/terminal/T in PN.nodes)
if(istype(T.master, /obj/machinery/power/apc))
var/obj/machinery/power/apc/AP = T.master
if(AP.emagged)
continue
drained_power += AP.drain_power() //Indirect draw won't emag the APC, should this be amended?
return drained_power
return PN.draw_power(amount)
/obj/structure/cable/yellow
color = COLOR_YELLOW
+7 -6
View File
@@ -9,16 +9,17 @@
spawn(5)
updateicon()
/obj/item/weapon/cell/drain_power(var/drain_check)
/obj/item/weapon/cell/drain_power(var/drain_check, var/surge, var/amount = 0)
if(drain_check)
return 1
var/drained_power = rand(200,400)
if(charge < drained_power)
drained_power = charge
use(drained_power)
return drained_power
if(charge <= 0)
return 0
var/cell_amt = min((amount * CELLRATE), charge)
use(cell_amt)
return cell_amt / CELLRATE
/obj/item/weapon/cell/proc/updateicon()
overlays.Cut()
+8
View File
@@ -24,6 +24,14 @@
//////////////////////////////
// common helper procs for all power machines
/obj/machinery/power/drain_power(var/drain_check, var/surge, var/amount = 0)
if(drain_check)
return 1
if(powernet && powernet.avail)
powernet.trigger_warning()
return powernet.draw_power(amount)
/obj/machinery/power/proc/add_avail(var/amount)
if(powernet)
powernet.newavail += amount
+6 -15
View File
@@ -1,6 +1,7 @@
// the SMES
// stores power
#define SMESRATE 0.05
#define SMESMAXCHARGELEVEL 250000
#define SMESMAXOUTPUT 250000
@@ -43,22 +44,15 @@
var/obj/machinery/power/terminal/terminal = null
var/should_be_mapped = 0 // If this is set to 0 it will send out warning on New()
/obj/machinery/power/smes/drain_power(var/drain_check)
/obj/machinery/power/smes/drain_power(var/drain_check, var/surge, var/amount = 0)
if(drain_check)
return 1
if(!charge)
return 0
var/smes_amt = min((amount * SMESRATE), charge)
charge -= smes_amt
return smes_amt / SMESRATE
if(charge)
var/drained_power = rand(200,400)
if(charge < drained_power)
drained_power = charge
charge -= drained_power
return drained_power
return 0
/obj/machinery/power/smes/New()
..()
@@ -112,9 +106,6 @@
/obj/machinery/power/smes/proc/chargedisplay()
return round(5.5*charge/(capacity ? capacity : 5e6))
#define SMESRATE 0.05 // rate of internal charge to external power
/obj/machinery/power/smes/process()
if(stat & BROKEN) return
@@ -420,4 +411,4 @@
/obj/machinery/power/smes/magical/process()
charge = 5000000
..()
..()