git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2 316c924e-a436-60f5-8080-3fe189b3f50e

This commit is contained in:
only.lurking
2010-08-23 14:29:20 +00:00
parent 757ea7b077
commit 662c08272a
919 changed files with 136852 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
/obj/machinery/cell_charger/attackby(obj/item/weapon/W, mob/user)
if(stat & BROKEN)
return
if(istype(W, /obj/item/weapon/cell))
if(charging)
user << "There is already a cell in the charger."
return
else
user.drop_item()
W.loc = src
charging = W
user.visible_message("[user] inserts a cell into the charger.", "You insert a cell into the charger.")
chargelevel = -1
updateicon()
/obj/machinery/cell_charger/proc/updateicon()
icon_state = "ccharger[charging ? 1 : 0]"
if(charging && !(stat & (BROKEN|NOPOWER)) )
var/newlevel = round( charging.percent() * 4.0 / 99 )
//world << "nl: [newlevel]"
if(chargelevel != newlevel)
overlays = null
overlays += image('power.dmi', "ccharger-o[newlevel]")
chargelevel = newlevel
else
overlays = null
/obj/machinery/cell_charger/attack_hand(mob/user)
add_fingerprint(user)
if(stat & BROKEN)
return
if(charging)
charging.loc = usr
charging.layer = 20
if (user.hand )
user.l_hand = charging
else
user.r_hand = charging
charging.add_fingerprint(user)
charging.updateicon()
src.charging = null
user.visible_message("[user] removes the cell from the charger.", "You remove the cell from the charger.")
chargelevel = -1
updateicon()
/obj/machinery/cell_charger/process()
//world << "ccpt [charging] [stat]"
if(!charging || (stat & (BROKEN|NOPOWER)) )
return
var/added = charging.give(50)
use_power(added / CELLRATE)
updateicon()