[MIRROR] migrate power cells to initialize (#9423)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2024-11-06 13:55:20 -07:00
committed by GitHub
parent f7fa760102
commit 1d918c276f
6 changed files with 104 additions and 109 deletions

View File

@@ -18,7 +18,7 @@
var/emp_proof = FALSE
var/static/cell_uid = 1 // Unique ID of this power cell. Used to reduce bunch of uglier code in nanoUI.
var/c_uid
var/charge = 0 // note %age conveted to actual charge in New
var/charge = 1000 // maximum charge on spawn
var/maxcharge = 1000
var/rigged = 0 // true if rigged to explode
var/minor_fault = 0 //If not 100% reliable, it will build up faults.
@@ -36,11 +36,10 @@
var/standard_overlays = TRUE
var/last_overlay_state = null // Used to optimize update_icon() calls.
/obj/item/cell/New()
..()
/obj/item/cell/Initialize()
. = ..()
c_uid = cell_uid++
charge = maxcharge
//update_icon() //CHOMPRemove
update_icon()
if(self_recharge)
START_PROCESSING(SSobj, src)

View File

@@ -11,15 +11,14 @@
force = 0
throw_speed = 5
throw_range = 7
charge = 480
maxcharge = 480
charge_amount = 5
matter = list(MAT_STEEL = 350, MAT_GLASS = 50)
preserve_item = 1
/obj/item/cell/device/empty/Initialize()
. = ..()
/obj/item/cell/device/empty
charge = 0
update_icon()
/*
* Crap Device
@@ -30,16 +29,15 @@
description_fluff = "You can't top the rust top." //TOTALLY TRADEMARK INFRINGEMENT
origin_tech = list(TECH_POWER = 0)
icon_state = "device_crap"
charge = 240
maxcharge = 240
matter = list(MAT_STEEL = 350, MAT_GLASS = 30)
/obj/item/cell/device/crap/update_icon() //No visible charge indicator
return
/obj/item/cell/device/crap/empty/Initialize()
. = ..()
/obj/item/cell/device/crap/empty
charge = 0
update_icon()
/*
* Hyper Device
@@ -48,13 +46,12 @@
name = "hyper device power cell"
desc = "A small power cell designed to power handheld devices. Has a better charge than a standard device cell."
icon_state = "hype_device_cell"
charge = 600
maxcharge = 600
matter = list(MAT_STEEL = 400, MAT_GLASS = 60)
/obj/item/cell/device/hyper/empty/Initialize()
. = ..()
/obj/item/cell/device/hyper/empty
charge = 0
update_icon()
/*
* EMP Proof Device
@@ -66,10 +63,8 @@
matter = list(MAT_STEEL = 400, MAT_GLASS = 60)
emp_proof = TRUE
/obj/item/cell/device/empproof/empty/Initialize()
. = ..()
/obj/item/cell/device/empproof/empty
charge = 0
update_icon()
/*
* Weapon
@@ -77,11 +72,13 @@
/obj/item/cell/device/weapon
name = "weapon power cell"
desc = "A small power cell designed to power handheld weaponry."
icon_state = "weapon_cell"
charge = 2400
maxcharge = 2400
charge_amount = 20
/obj/item/cell/device/weapon/empty/Initialize()
. = ..()
/obj/item/cell/device/weapon/empty
charge = 0
update_icon()
//Yawn Changes
/obj/item/cell/device/weapon //Aka adv
@@ -144,10 +141,8 @@
matter = list(MAT_STEEL = 400, MAT_GLASS = 60)
emp_proof = TRUE
/obj/item/cell/device/weapon/empproof/empty/Initialize()
. = ..()
/obj/item/cell/device/weapon/empproof/empty
charge = 0
update_icon()
/*
* Self-charging Weapon
@@ -188,7 +183,7 @@
value = CATALOGUER_REWARD_EASY
/obj/item/cell/device/weapon/recharge/alien
name = "void cell"
name = "void cell (device)"
desc = "An alien technology that produces energy seemingly out of nowhere. Its small, cylinderal shape means it might be able to be used with human technology, perhaps?"
catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_void_cell)
icon = 'icons/obj/abductor.dmi'
@@ -196,19 +191,37 @@
charge_amount = 120 // 5%.
charge_delay = 50 // Every five seconds, bit faster than the default.
origin_tech = list(TECH_POWER = 8, TECH_ENGINEERING = 6)
var/swaps_to = /obj/item/cell/void
standard_overlays = FALSE
/obj/item/cell/device/weapon/recharge/alien/update_icon()
return // No overlays please.
/obj/item/cell/device/weapon/recharge/alien/attack_self(var/mob/user)
user.remove_from_mob(src)
to_chat(user, span_notice("You swap [src] to 'machinery cell' mode."))
var/obj/item/cell/newcell = new swaps_to(null)
user.put_in_active_hand(newcell)
var/percentage = charge/maxcharge
newcell.charge = newcell.maxcharge * percentage
newcell.persist_storable = persist_storable
qdel(src)
// Bloo friendlier hybrid tech
/obj/item/cell/device/weapon/recharge/alien/hybrid
icon = 'icons/obj/power_vr.dmi'
icon_state = "cellb"
swaps_to = /obj/item/cell/void/hybrid
//YAWN Addtion
/obj/item/cell/device/weapon/recharge/alien/omni
name = "omni weapon power cell"
desc = "A mix between alien technology and phoron tech. Seems to fit in almost any cell slot..."
charge_amount = 90 // 5%.
charge = 1800
maxcharge = 1800
charge_delay = 50 SECONDS
origin_tech = list(TECH_POWER = 6, TECH_ENGINEERING = 4, TECH_PHORON = 3)
/obj/item/cell/device/weapon/recharge/alien/omni/empty/Initialize()
. = ..()
/obj/item/cell/device/weapon/recharge/alien/omni/empty
charge = 0

View File

@@ -1,53 +0,0 @@
//CHOMP Disabled in DME in favor of modular_chomp folder
//The device cell
/obj/item/cell/device/weapon/recharge/alien
name = "void cell (device)"
var/swaps_to = /obj/item/cell/void
standard_overlays = FALSE
/obj/item/cell/device/weapon/recharge/alien/attack_self(var/mob/user)
user.remove_from_mob(src)
to_chat(user, span_notice("You swap [src] to 'machinery cell' mode."))
var/obj/item/cell/newcell = new swaps_to(null)
user.put_in_active_hand(newcell)
var/percentage = charge/maxcharge
newcell.charge = newcell.maxcharge * percentage
newcell.persist_storable = persist_storable
qdel(src)
//The machine cell
/obj/item/cell/void
name = "void cell (machinery)"
desc = "An alien technology that produces energy seemingly out of nowhere. Its small, cylinderal shape means it might be able to be used with human technology, perhaps?"
origin_tech = list(TECH_POWER = 8, TECH_ENGINEERING = 6)
icon = 'icons/obj/abductor.dmi'
icon_state = "cell"
maxcharge = 4800 //10x the device version
charge_amount = 1200 //10x the device version
self_recharge = TRUE
charge_delay = 50
matter = null
standard_overlays = FALSE
var/swaps_to = /obj/item/cell/device/weapon/recharge/alien
robot_durability = 100
/obj/item/cell/void/attack_self(var/mob/user)
user.remove_from_mob(src)
to_chat(user, span_notice("You swap [src] to 'device cell' mode."))
var/obj/item/cell/newcell = new swaps_to(null)
user.put_in_active_hand(newcell)
var/percentage = charge/maxcharge
newcell.charge = newcell.maxcharge * percentage
newcell.persist_storable = persist_storable
qdel(src)
// Bloo friendlier hybrid tech
/obj/item/cell/device/weapon/recharge/alien/hybrid
icon = 'icons/obj/power_vr.dmi'
icon_state = "cellb"
swaps_to = /obj/item/cell/void/hybrid
/obj/item/cell/void/hybrid
icon = 'icons/obj/power_vr.dmi'
icon_state = "cellb"
swaps_to = /obj/item/cell/device/weapon/recharge/alien/hybrid

View File

@@ -4,6 +4,7 @@
desc = "A modified power cell sitting in a highly conductive chassis."
origin_tech = list(TECH_POWER = 2)
icon_state = "modded"
charge = 10000
maxcharge = 10000
matter = list(MAT_STEEL = 1000, MAT_GLASS = 80, MAT_SILVER = 100)
self_recharge = TRUE

View File

@@ -2,8 +2,7 @@
/*
* Empty
*/
/obj/item/cell/empty/Initialize() //ChompEDIT New --> Initialize
..()
/obj/item/cell/empty
charge = 0
/*
@@ -15,6 +14,7 @@
description_fluff = "You can't top the rust top." //TOTALLY TRADEMARK INFRINGEMENT
origin_tech = list(TECH_POWER = 0)
icon_state = "crap"
charge = 500
maxcharge = 500
matter = list(MAT_STEEL = 700, MAT_GLASS = 40)
robot_durability = 20
@@ -22,8 +22,7 @@
/obj/item/cell/crap/update_icon() //No visible charge indicator
return
/obj/item/cell/crap/empty/Initialize() //ChompEDIT New --> Initialize
..()
/obj/item/cell/crap/empty
charge = 0
/*
@@ -33,6 +32,7 @@
name = "heavy-duty power cell"
origin_tech = list(TECH_POWER = 1)
icon_state = "apc"
charge = 5000
maxcharge = 5000
matter = list(MAT_STEEL = 700, MAT_GLASS = 50)
@@ -41,6 +41,7 @@
*/
/obj/item/cell/robot_station
name = "standard robot power cell"
charge = 7500
maxcharge = 7500
/*
@@ -50,14 +51,13 @@
name = "high-capacity power cell"
origin_tech = list(TECH_POWER = 2)
icon_state = "high"
charge = 10000
maxcharge = 10000
matter = list(MAT_STEEL = 700, MAT_GLASS = 60)
robot_durability = 55
/obj/item/cell/high/empty/Initialize() //ChompEDIT New --> Initialize
..()
/obj/item/cell/high/empty
charge = 0
update_icon()
/*
* Super
@@ -66,14 +66,13 @@
name = "super-capacity power cell"
origin_tech = list(TECH_POWER = 5)
icon_state = "super"
charge = 20000
maxcharge = 20000
matter = list(MAT_STEEL = 700, MAT_GLASS = 70)
robot_durability = 60
/obj/item/cell/super/empty/Initialize() //ChompEDIT New --> Initialize
..()
/obj/item/cell/super/empty
charge = 0
update_icon()
/*
* Syndicate
@@ -82,6 +81,7 @@
name = "syndicate robot power cell"
description_fluff = "Almost as good as a hyper."
icon_state = "super" //We don't want roboticists confuse it with a low standard cell
charge = 25000
maxcharge = 25000
robot_durability = 65
@@ -92,14 +92,13 @@
name = "hyper-capacity power cell"
origin_tech = list(TECH_POWER = 6)
icon_state = "hyper"
charge = 30000
maxcharge = 30000
matter = list(MAT_STEEL = 700, MAT_GLASS = 80)
robot_durability = 70
/obj/item/cell/hyper/empty/Initialize() //ChompEDIT New --> Initialize
..()
/obj/item/cell/hyper/empty
charge = 0
update_icon()
/*
* Mecha
@@ -147,6 +146,7 @@
name = "infinite-capacity power cell!"
icon_state = "infinity"
origin_tech = null
charge = 30000
maxcharge = 30000 //determines how badly mobs get shocked
matter = list(MAT_STEEL = 700, MAT_GLASS = 80)
robot_durability = 200
@@ -181,6 +181,7 @@
icon_state = "yellow slime extract" //"potato_battery"
connector_type = "slime"
description_info = "This 'cell' holds a max charge of 10k and self recharges over time."
charge = 10000
maxcharge = 10000
matter = null
self_recharge = TRUE
@@ -192,6 +193,7 @@
/obj/item/cell/emergency_light
name = "miniature power cell"
desc = "A tiny power cell with a very low power capacity. Used in light fixtures to power them in the event of an outage."
charge = 120
maxcharge = 120 //Emergency lights use 0.2 W per tick, meaning ~10 minutes of emergency power from a cell
matter = list(MAT_GLASS = 20)
icon_state = "em_light"
@@ -248,3 +250,35 @@
cut_overlays()
target.adjust_nutrition(amount)
user.custom_emote(message = "connects \the [src] to [user == target ? "their" : "[target]'s"] charging port, expending it.")
//The machine cell
/obj/item/cell/void
name = "void cell (machinery)"
desc = "An alien technology that produces energy seemingly out of nowhere. Its small, cylinderal shape means it might be able to be used with human technology, perhaps?"
origin_tech = list(TECH_POWER = 8, TECH_ENGINEERING = 6)
icon = 'icons/obj/abductor.dmi'
icon_state = "cell"
charge = 4800
maxcharge = 4800 //10x the device version
charge_amount = 1200 //10x the device version
self_recharge = TRUE
charge_delay = 50
matter = null
standard_overlays = FALSE
var/swaps_to = /obj/item/cell/device/weapon/recharge/alien
robot_durability = 100
/obj/item/cell/void/attack_self(var/mob/user)
user.remove_from_mob(src)
to_chat(user, span_notice("You swap [src] to 'device cell' mode."))
var/obj/item/cell/newcell = new swaps_to(null)
user.put_in_active_hand(newcell)
var/percentage = charge/maxcharge
newcell.charge = newcell.maxcharge * percentage
newcell.persist_storable = persist_storable
qdel(src)
/obj/item/cell/void/hybrid
icon = 'icons/obj/power_vr.dmi'
icon_state = "cellb"
swaps_to = /obj/item/cell/device/weapon/recharge/alien/hybrid

View File

@@ -6,11 +6,11 @@
desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT
origin_tech = list(TECH_POWER = 0)
icon_state = "crap"
charge = 500
maxcharge = 500
matter = list(MAT_STEEL = 700, MAT_GLASS = 40)
/obj/item/cell/crap/empty/Initialize() //ChompEDIT New --> Initialize
..()
/obj/item/cell/crap/empty
charge = 0
/*
@@ -18,6 +18,7 @@
*/
/obj/item/cell/robot_station
name = "standard robot power cell"
charge = 7500
maxcharge = 7500
/*
@@ -27,6 +28,7 @@
name = "syndicate robot power cell"
description_fluff = "Almost as good as a hyper."
icon_state = "b_sup" //We don't want roboticists confuse it with a low standard cell
charge = 25000
maxcharge = 25000
/*
@@ -36,13 +38,12 @@
name = "security borg rechargable D battery"
origin_tech = list(TECH_POWER = 0)
icon_state = "secborg"
charge = 2400
maxcharge = 2400 //who the hell thought 6 shots was enough for a dogborg taser?
matter = list(MAT_STEEL = 700, MAT_GLASS = 40)
/obj/item/cell/secborg/empty/Initialize() //ChompEDIT New --> Initialize
..()
/obj/item/cell/secborg/empty
charge = 0
update_icon()
/*
* APC
@@ -51,6 +52,7 @@
name = "heavy-duty power cell"
origin_tech = list(TECH_POWER = 1)
icon_state = "apc"
charge = 5000
maxcharge = 5000
matter = list(MAT_STEEL = 700, MAT_GLASS = 50)
@@ -61,13 +63,12 @@
name = "high-capacity power cell"
origin_tech = list(TECH_POWER = 2)
icon_state = "b_hi"
charge = 10000
maxcharge = 10000
matter = list(MAT_STEEL = 700, MAT_GLASS = 60)
/obj/item/cell/high/empty/Initialize() //ChompEDIT New --> Initialize
..()
/obj/item/cell/high/empty
charge = 0
update_icon()
/*
* Super
@@ -76,13 +77,12 @@
name = "super-capacity power cell"
origin_tech = list(TECH_POWER = 5)
icon_state = "b_sup"
charge = 20000
maxcharge = 20000
matter = list(MAT_STEEL = 700, MAT_GLASS = 70)
/obj/item/cell/super/empty/Initialize() //ChompEDIT New --> Initialize
..()
/obj/item/cell/super/empty
charge = 0
update_icon()
/*
* Hyper
@@ -91,13 +91,12 @@
name = "hyper-capacity power cell"
origin_tech = list(TECH_POWER = 6)
icon_state = "b_hy"
charge = 30000
maxcharge = 30000
matter = list(MAT_STEEL = 700, MAT_GLASS = 80)
/obj/item/cell/hyper/empty/Initialize() //ChompEDIT New --> Initialize
..()
/obj/item/cell/hyper/empty
charge = 0
update_icon()
/*
* Giga
@@ -106,13 +105,12 @@
name = "giga-capacity power cell"
origin_tech = list(TECH_POWER = 8)
icon_state = "meb_b_hi"
charge = 40000
maxcharge = 40000
matter = list(MAT_STEEL = 1000, MAT_GLASS = 100)
/obj/item/cell/giga/empty/Initialize() //ChompEDIT New --> Initialize
..()
/obj/item/cell/giga/empty
charge = 0
update_icon()
/*
* Mecha
*/
@@ -146,6 +144,7 @@
name = "infinite-capacity power cell!"
icon_state = "infinite_b"
origin_tech = null
charge = 30000
maxcharge = 30000 //determines how badly mobs get shocked
matter = list(MAT_STEEL = 700, MAT_GLASS = 80)
@@ -177,6 +176,7 @@
icon = 'icons/mob/slimes.dmi' //'icons/obj/harvest.dmi'
icon_state = "yellow slime extract" //"potato_battery"
description_info = "This 'cell' holds a max charge of 20k and self recharges over time."
charge = 20000
maxcharge = 20000
charge_amount = 500 // 2.5%.
matter = null
@@ -189,6 +189,7 @@
/obj/item/cell/emergency_light
name = "miniature power cell"
desc = "A tiny power cell with a very low power capacity. Used in light fixtures to power them in the event of an outage."
charge = 120
maxcharge = 120 //Emergency lights use 0.2 W per tick, meaning ~10 minutes of emergency power from a cell
matter = list(MAT_GLASS = 20)
icon_state = "em_light"