mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 03:33:21 +00:00
[MIRROR] Fusion Coil Updates (#12063)
Co-authored-by: Killian <49700375+KillianKirilenko@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
committed by
GitHub
parent
258a4c8537
commit
22a09e47a1
@@ -2,8 +2,9 @@
|
||||
name = "fusion coil"
|
||||
desc = "A special heavy-duty battery used to recharge SMES units. It dumps its entire power reserve into the SMES unit at once, and cannot be recharged locally. Safety systems on the coil itself mean it can't be used on charged SMES units if it would put them over their capacity."
|
||||
icon = 'icons/obj/power_cells.dmi'
|
||||
icon_state = "fc_charged"
|
||||
var/spent_icon = "fc_spent" //icon state used after a fusion coil is "burned out"
|
||||
icon_state = "fc_spent"
|
||||
light_color = "#30B5E6"
|
||||
var/light_color_danger = "#D04E4C"
|
||||
item_state = "egg6"
|
||||
drop_sound = 'sound/items/drop/metalboots.ogg'
|
||||
pickup_sound = 'sound/items/pickup/gascan.ogg'
|
||||
@@ -13,8 +14,59 @@
|
||||
force = 15
|
||||
throw_speed = 4
|
||||
throw_range = 4
|
||||
slowdown = 0.5
|
||||
slowdown = 1 //0.5 was not very much in practice, let's make this a bit more meaningful
|
||||
|
||||
var/spent = FALSE //have we been discharged into something yet?
|
||||
var/coil_charged = TRUE //have we been discharged into something yet?
|
||||
var/coil_damaged = FALSE //have we been damaged? one hit is fine, but two direct hits will explode us if we're charged
|
||||
var/coil_charge = 4800000 //how much power do we dump into the SMES on use? restores the main (if unupgraded) by 20%, or engine by 80%
|
||||
matter = list(MAT_STEEL = 6000, MAT_COPPER = 4000, MAT_PLASTIC = 2000)
|
||||
|
||||
/obj/item/fusion_coil/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
update_icon()
|
||||
|
||||
/obj/item/fusion_coil/update_icon()
|
||||
icon_state = "fc_spent"
|
||||
|
||||
cut_overlays()
|
||||
|
||||
. = list()
|
||||
|
||||
if(coil_damaged)
|
||||
. += mutable_appearance(icon, "fc_unstable")
|
||||
. += emissive_appearance(icon, "fc_unstable")
|
||||
set_light(1, 3, light_color_danger)
|
||||
return add_overlay(.)
|
||||
else if(coil_charged)
|
||||
. += mutable_appearance(icon, "fc_charged")
|
||||
. += emissive_appearance(icon, "fc_charged")
|
||||
set_light(1, 2, light_color)
|
||||
return add_overlay(.)
|
||||
else
|
||||
set_light(0)
|
||||
return
|
||||
|
||||
/obj/item/fusion_coil/bullet_act(obj/item/projectile/P, def_zone)
|
||||
. = ..()
|
||||
|
||||
if(P.nodamage) //the projectile does no damage, abort!
|
||||
return
|
||||
|
||||
if(!coil_charged)
|
||||
return
|
||||
|
||||
if(coil_damaged)
|
||||
visible_message(span_danger("\The [src] explodes in a blinding flash!"))
|
||||
explosion(src.loc, 0, 1, 3)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
visible_message(span_danger("\The [src] sparks and sputters!"))
|
||||
var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread()
|
||||
spark_system.set_up(5, 0, src.loc)
|
||||
spark_system.start()
|
||||
playsound(src, "sparks", 50, 1)
|
||||
coil_damaged = TRUE
|
||||
coil_charge = (coil_charge / 2)
|
||||
update_icon()
|
||||
|
||||
@@ -349,11 +349,11 @@ GLOBAL_LIST_EMPTY(smeses)
|
||||
|
||||
if(istype(W, /obj/item/fusion_coil))
|
||||
var/obj/item/fusion_coil/FC = W
|
||||
if(FC.spent || FC.coil_charge == 0)
|
||||
if(!(FC.coil_charged || FC.coil_charge))
|
||||
to_chat(user, span_filter_notice("\The [FC] has no charge remaining."))
|
||||
return FALSE
|
||||
else if(charge + FC.coil_charge > capacity)
|
||||
to_chat(user, span_filter_notice("\The [FC] has too much charge stored to recharge \the [src]."))
|
||||
to_chat(user, span_filter_notice("\The [FC] has too much charge stored to safely recharge \the [src]."))
|
||||
return FALSE
|
||||
else
|
||||
playsound(src, 'sound/effects/lightning_chargeup.ogg', 75, 0, 1)
|
||||
@@ -361,9 +361,9 @@ GLOBAL_LIST_EMPTY(smeses)
|
||||
to_chat(user, span_filter_notice("You successfully recharge \the [src] with \the [FC]. It is now depleted."))
|
||||
charge += FC.coil_charge
|
||||
FC.coil_charge = 0
|
||||
FC.spent = TRUE
|
||||
FC.coil_charged = FALSE
|
||||
FC.name = "depleted [FC.name]"
|
||||
FC.icon_state = FC.spent_icon
|
||||
FC.update_icon()
|
||||
return FALSE
|
||||
|
||||
else if(W.has_tool_quality(TOOL_WELDER))
|
||||
|
||||
Reference in New Issue
Block a user