Power Cell Code Cleanup

This commit is contained in:
Fox McCloud
2018-05-02 19:35:18 -04:00
parent 31a2687fb6
commit 8bd042240f
17 changed files with 314 additions and 296 deletions

View File

@@ -96,7 +96,7 @@
if(istype(W, /obj/item/screwdriver))
if(bcell)
bcell.updateicon()
bcell.update_icon()
bcell.loc = get_turf(src.loc)
bcell = null
to_chat(user, "<span class='notice'>You remove the cell from the [src].</span>")

View File

@@ -1,211 +0,0 @@
/obj/item/stock_parts/cell
name = "power cell"
desc = "A rechargable electrochemical power cell."
icon = 'icons/obj/power.dmi'
icon_state = "cell"
item_state = "cell"
origin_tech = "powerstorage=1"
force = 5
throwforce = 5
throw_speed = 2
throw_range = 5
w_class = WEIGHT_CLASS_SMALL
var/charge = 0 // note %age conveted to actual charge in New
var/maxcharge = 1000
materials = list(MAT_METAL=700, MAT_GLASS=50)
var/rigged = 0 // true if rigged to explode
var/chargerate = 100 //how much power is given every tick in a recharger
var/self_recharge = 0 //does it self recharge, over time, or not?
var/grown_battery = FALSE // If it's a grown that acts as a battery, add a wire overlay to it.
/obj/item/stock_parts/cell/New()
..()
processing_objects.Add(src)
charge = maxcharge
updateicon()
/obj/item/stock_parts/cell/Destroy()
processing_objects.Remove(src)
return ..()
/obj/item/stock_parts/cell/vv_edit_var(var_name, var_value)
switch(var_name)
if("self_recharge")
if(var_value)
processing_objects.Add(src)
else
processing_objects.Remove(src)
. = ..()
/obj/item/stock_parts/cell/suicide_act(mob/user)
to_chat(viewers(user), "<span class='suicide'>[user] is licking the electrodes of the [src.name]! It looks like \he's trying to commit suicide.</span>")
return (FIRELOSS)
/obj/item/stock_parts/cell/process()
if(self_recharge)
give(chargerate * 0.25)
else
return PROCESS_KILL
/obj/item/stock_parts/cell/proc/updateicon()
overlays.Cut()
if(grown_battery)
overlays += image('icons/obj/power.dmi', "grown_wires")
if(charge < 0.01)
return
else if(charge/maxcharge >=0.995)
overlays += image('icons/obj/power.dmi', "cell-o2")
else
overlays += image('icons/obj/power.dmi', "cell-o1")
/obj/item/stock_parts/cell/crap
name = "\improper Nanotrasen brand rechargable AA battery"
desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT
maxcharge = 500
materials = list(MAT_GLASS=40)
rating = 2
/obj/item/stock_parts/cell/crap/empty/New()
..()
charge = 0
/obj/item/stock_parts/cell/secborg
name = "\improper Security borg rechargable D battery"
origin_tech = null
maxcharge = 600 //600 max charge / 100 charge per shot = six shots
materials = list(MAT_GLASS=40)
rating = 2.5
/obj/item/stock_parts/cell/secborg/empty/New()
..()
charge = 0
/obj/item/stock_parts/cell/high
name = "high-capacity power cell"
origin_tech = "powerstorage=2"
icon_state = "hcell"
maxcharge = 10000
materials = list(MAT_GLASS=60)
rating = 3
chargerate = 1500
/obj/item/stock_parts/cell/high/plus
name = "high-capacity power cell+"
desc = "Where did these come from?"
icon_state = "h+cell"
maxcharge = 15000
chargerate = 2250
/obj/item/stock_parts/cell/high/empty/New()
..()
charge = 0
/obj/item/stock_parts/cell/super
name = "super-capacity power cell"
origin_tech = "powerstorage=3;materials=3"
icon_state = "scell"
maxcharge = 20000
materials = list(MAT_GLASS=300)
rating = 4
chargerate = 2000
/obj/item/stock_parts/cell/super/empty/New()
..()
charge = 0
/obj/item/stock_parts/cell/hyper
name = "hyper-capacity power cell"
origin_tech = "powerstorage=4;engineering=4;materials=4"
icon_state = "hpcell"
maxcharge = 30000
materials = list(MAT_GLASS=400)
rating = 5
chargerate = 3000
/obj/item/stock_parts/cell/hyper/empty/New()
..()
charge = 0
/obj/item/stock_parts/cell/bluespace
name = "bluespace power cell"
origin_tech = "powerstorage=5;bluespace=4;materials=4;engineering=4"
icon_state = "bscell"
maxcharge = 40000
materials = list(MAT_GLASS=600)
rating = 6
chargerate = 4000
/obj/item/stock_parts/cell/bluespace/empty/New()
..()
charge = 0
/obj/item/stock_parts/cell/infinite
name = "infinite-capacity power cell!"
icon_state = "icell"
origin_tech = "powerstorage=7"
maxcharge = 30000
materials = list(MAT_GLASS=1000)
rating = 6
chargerate = 30000
/obj/item/stock_parts/cell/infinite/use()
return 1
/obj/item/stock_parts/cell/potato
name = "potato battery"
desc = "A rechargable starch based power cell."
icon = 'icons/obj/hydroponics/harvest.dmi'
icon_state = "potato"
origin_tech = "powerstorage=1;biotech=1"
charge = 100
maxcharge = 300
materials = list()
rating = 1
grown_battery = TRUE //it has the overlays for wires
/obj/item/stock_parts/cell/high/slime
name = "charged slime core"
desc = "A yellow slime core infused with plasma, it crackles with power."
origin_tech = "powerstorage=5;biotech=4"
icon = 'icons/mob/slimes.dmi'
icon_state = "yellow slime extract"
materials = list()
self_recharge = 1 // Infused slime cores self-recharge, over time
chargerate = 500
/obj/item/stock_parts/cell/pulse //200 pulse shots
name = "pulse rifle power cell"
maxcharge = 40000
rating = 3
chargerate = 1500
/obj/item/stock_parts/cell/pulse/carbine //25 pulse shots
name = "pulse carbine power cell"
maxcharge = 5000
/obj/item/stock_parts/cell/pulse/pistol //10 pulse shots
name = "pulse pistol power cell"
maxcharge = 2000
/obj/item/stock_parts/cell/ninja
name = "spider-clan power cell"
desc = "A standard ninja-suit power cell."
maxcharge = 10000
rating = 3
materials = list(MAT_GLASS=60)
/obj/item/stock_parts/cell/emproof
name = "\improper EMP-proof cell"
desc = "An EMP-proof cell."
maxcharge = 500
rating = 2
/obj/item/stock_parts/cell/emproof/empty/New()
..()
charge = 0
/obj/item/stock_parts/cell/emproof/emp_act(severity)
return
/obj/item/stock_parts/cell/emproof/corrupt()
return

View File

@@ -78,7 +78,7 @@
else if(istype(W, /obj/item/screwdriver))
if(bcell)
bcell.updateicon()
bcell.update_icon()
bcell.loc = get_turf(src.loc)
bcell = null
to_chat(user, "<span class='notice'>You remove the cell from the [src].</span>")

View File

@@ -1,7 +1,6 @@
/obj
//var/datum/module/mod //not used
var/origin_tech = null //Used by R&D to determine what research bonuses it grants.
var/reliability = 100 //Used by SOME devices to determine how reliable they are.
var/crit_fail = 0
var/unacidable = 0 //universal "unacidabliness" var, here so you can use it in any obj.
animate_movement = 2