mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-23 12:06:22 +01:00
Merge pull request #617 from Sharkmare/patch-72
Restructure of power trans code for drones.
This commit is contained in:
@@ -436,13 +436,18 @@ var/list/mob_hat_cache = list()
|
||||
set name = "Transmit Power"
|
||||
if(!power)
|
||||
power=250
|
||||
if(power<=0 || power>=cell.maxcharge || power>=cell.charge) return //Safeties to not kill ourselves, also safeties to not use this to drain.
|
||||
actpower(power)
|
||||
return
|
||||
if(power<=0 || power>=cell.maxcharge || power>=cell.charge) return //Safeties to not kill ourselves, also safeties to not use this to drain.
|
||||
actpower(power)
|
||||
return
|
||||
/mob/living/silicon/robot/drone/proc/actpower(var/power)
|
||||
for(var/obj/item/weapon/cell/remotecell in range(1, src)) //assuming 1 = 1 tile next to us, if this works will lower to 0
|
||||
src << "<b>Trying to transfer power to a cell.</b>."
|
||||
if(power>=cell.charge) return //rechecking our initial safety so if we mass charge we dont die.
|
||||
var/newcharge = remotecell.charge + power //What the battery is at after charge
|
||||
if(newcharge<=remotecell.maxcharge) //Making sure we arent wasting power
|
||||
remotecell.give(power) //give is a proc native to cells that increases charge and updates the iconstate if needed
|
||||
cell.give(-power)//TO BE TESTED, no idea if negative give works, once i've tested this i'll add this as a verb-shark
|
||||
else return
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user