migrate power cells to initialize (#16567)

* migrate power cells to initialize

* forgot the dme
This commit is contained in:
Kashargul
2024-11-05 12:25:37 +01:00
committed by GitHub
parent 5854cf834a
commit 2bc9005f63
6 changed files with 81 additions and 91 deletions
+3 -4
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,10 +36,9 @@
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()
if(self_recharge)
START_PROCESSING(SSobj, src)
+30 -20
View File
@@ -10,15 +10,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
@@ -29,16 +28,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
@@ -47,13 +45,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
@@ -65,10 +62,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,13 +72,12 @@
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()
/*
* EMP Proof Weapon
@@ -95,10 +89,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
@@ -139,7 +131,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'
@@ -147,6 +139,24 @@
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.
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
@@ -1,53 +0,0 @@
//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
@@ -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
+47 -13
View File
@@ -1,8 +1,7 @@
/*
* Empty
*/
/obj/item/cell/empty/New()
..()
/obj/item/cell/empty
charge = 0
/*
@@ -14,6 +13,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
@@ -21,8 +21,7 @@
/obj/item/cell/crap/update_icon() //No visible charge indicator
return
/obj/item/cell/crap/empty/New()
..()
/obj/item/cell/crap/empty
charge = 0
/*
@@ -32,6 +31,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)
@@ -40,6 +40,7 @@
*/
/obj/item/cell/robot_station
name = "standard robot power cell"
charge = 7500
maxcharge = 7500
/*
@@ -49,14 +50,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/New()
..()
/obj/item/cell/high/empty
charge = 0
update_icon()
/*
* Super
@@ -65,14 +65,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/New()
..()
/obj/item/cell/super/empty
charge = 0
update_icon()
/*
* Syndicate
@@ -81,6 +80,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
@@ -91,14 +91,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/New()
..()
/obj/item/cell/hyper/empty
charge = 0
update_icon()
/*
* Mecha
@@ -146,6 +145,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
@@ -180,6 +180,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
@@ -191,6 +192,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"
@@ -247,3 +249,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