Hardsuit powersink module now uses CELLRATE properly

- Adds CELLRATE (and SMESRATE for SMESs) into drain_power proc.
- Adds "amount" parameter to drain power proc, sets the powersink module to 40kW draw (80 cell charge/s), which should correspond with normal cell recharger.
- Removes drain_power from all machinery, and adds drain_power to machinery/power. This means you can only drain from machines that have something to do with wiring or electricity.
This commit is contained in:
Atlantiscze
2014-12-29 20:40:57 +01:00
parent a9e1f920fd
commit 90a83c19cf
9 changed files with 44 additions and 71 deletions
@@ -182,7 +182,7 @@ var/list/robot_verbs_default = list(
lawsync()
photosync()
/mob/living/silicon/robot/drain_power(var/drain_check)
/mob/living/silicon/robot/drain_power(var/drain_check, var/surge, var/amount = 0)
if(drain_check)
return 1
@@ -190,14 +190,15 @@ var/list/robot_verbs_default = list(
if(!cell || !cell.charge)
return 0
if(cell.charge)
src << "<span class='danger'>Warning: Unauthorized access through power channel 12 detected.</span>"
var/drained_power = rand(200,400)
if(cell.charge < drained_power)
drained_power = cell.charge
cell.use(drained_power)
return drained_power
// Actual amount to drain from cell, using CELLRATE
var/cell_amount = amount * CELLRATE
if(cell.charge > cell_amount)
// Spam Protection
if(prob(10))
src << "<span class='danger'>Warning: Unauthorized access through power channel [rand(11,29)] detected!</span>"
cell.use(cell_amount)
return amount
return 0
// setup the PDA and its name
+1 -1
View File
@@ -66,7 +66,7 @@
// If drain_check is set it will not actually drain power, just return a value.
// If surge is set, it will destroy/damage the recipient and not return any power.
// Not sure where to define this, so it can sit here for the rest of time.
/atom/proc/drain_power(var/drain_check,var/surge)
/atom/proc/drain_power(var/drain_check,var/surge, var/amount = 0)
return -1
// Show a message to all mobs in earshot of this one