mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-26 01:22:03 +00:00
About The Pull Request Removes the research point gen modes from tesla coils and rad collectors. Someone is gonna take some flak for removing these at some point, may as well be me. Why It's Good For The Game THE DESIGN DOC DICTACT- Nah powergen should be valid on it's own, it shouldn't need to rely on other econs to make it worth the work. We can try that later, but not now. Changelog cl del: Removed the research modes from tesla coils and radiation collectors. /cl
143 lines
4.1 KiB
Plaintext
143 lines
4.1 KiB
Plaintext
/obj/machinery/power/tesla_coil
|
|
name = "tesla coil"
|
|
desc = "For the union!"
|
|
icon = 'icons/obj/tesla_engine/tesla_coil.dmi'
|
|
icon_state = "coil0"
|
|
anchored = FALSE
|
|
density = TRUE
|
|
|
|
// Executing a traitor caught releasing tesla was never this fun!
|
|
can_buckle = TRUE
|
|
buckle_lying = FALSE
|
|
buckle_requires_restraints = TRUE
|
|
|
|
circuit = /obj/item/circuitboard/machine/tesla_coil
|
|
|
|
var/zap_flags = ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE
|
|
var/input_power_multiplier = 1
|
|
var/zap_cooldown = 100
|
|
var/last_zap = 0
|
|
|
|
/obj/machinery/power/tesla_coil/Initialize()
|
|
. = ..()
|
|
wires = new /datum/wires/tesla_coil(src)
|
|
|
|
/obj/machinery/power/tesla_coil/should_have_node()
|
|
return anchored
|
|
|
|
/obj/machinery/power/tesla_coil/RefreshParts()
|
|
var/power_multiplier = 0
|
|
zap_cooldown = 100
|
|
for(var/obj/item/stock_parts/capacitor/C in component_parts)
|
|
power_multiplier += C.rating
|
|
zap_cooldown -= (C.rating * 20)
|
|
input_power_multiplier = power_multiplier
|
|
|
|
/obj/machinery/power/tesla_coil/examine(mob/user)
|
|
. = ..()
|
|
if(in_range(user, src) || isobserver(user))
|
|
. += "<span class='notice'>The status display reads: Power generation at <b>[input_power_multiplier*100]%</b>.<br>Shock interval at <b>[zap_cooldown*0.1]</b> seconds.</span>"
|
|
|
|
/obj/machinery/power/tesla_coil/on_construction()
|
|
if(anchored)
|
|
connect_to_network()
|
|
|
|
/obj/machinery/power/tesla_coil/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
|
|
. = ..()
|
|
if(. == SUCCESSFUL_UNFASTEN)
|
|
if(panel_open)
|
|
icon_state = "coil_open[anchored]"
|
|
else
|
|
icon_state = "coil[anchored]"
|
|
if(anchored)
|
|
connect_to_network()
|
|
else
|
|
disconnect_from_network()
|
|
update_cable_icons_on_turf(get_turf(src))
|
|
|
|
/obj/machinery/power/tesla_coil/attackby(obj/item/W, mob/user, params)
|
|
if(default_deconstruction_screwdriver(user, "coil_open[anchored]", "coil[anchored]", W))
|
|
return
|
|
|
|
if(default_unfasten_wrench(user, W))
|
|
return
|
|
|
|
if(default_deconstruction_crowbar(W))
|
|
return
|
|
|
|
if(is_wire_tool(W) && panel_open)
|
|
wires.interact(user)
|
|
return
|
|
|
|
return ..()
|
|
|
|
/obj/machinery/power/tesla_coil/zap_act(power, zap_flags, shocked_targets)
|
|
if(anchored && !panel_open)
|
|
obj_flags |= BEING_SHOCKED
|
|
//don't lose arc power when it's not connected to anything
|
|
//please place tesla coils all around the station to maximize effectiveness
|
|
var/power_produced = powernet ? power / 2 : power
|
|
add_avail(power_produced*input_power_multiplier)
|
|
flick("coilhit", src)
|
|
var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_ENG)
|
|
if(D)
|
|
D.adjust_money(min(power_produced, 1))
|
|
addtimer(CALLBACK(src, .proc/reset_shocked), 10)
|
|
zap_buckle_check(power)
|
|
playsound(src.loc, 'sound/magic/lightningshock.ogg', 100, TRUE, extrarange = 5)
|
|
return power_produced
|
|
else
|
|
. = ..()
|
|
|
|
/obj/machinery/power/tesla_coil/proc/zap()
|
|
if((last_zap + zap_cooldown) > world.time || !powernet)
|
|
return FALSE
|
|
last_zap = world.time
|
|
var/coeff = (20 - ((input_power_multiplier - 1) * 3))
|
|
coeff = max(coeff, 10)
|
|
var/power = (powernet.avail/2)
|
|
add_load(power)
|
|
playsound(src.loc, 'sound/magic/lightningshock.ogg', 100, TRUE, extrarange = 5)
|
|
tesla_zap(src, 10, power/(coeff/2), zap_flags)
|
|
zap_buckle_check(power/(coeff/2))
|
|
|
|
/obj/machinery/power/grounding_rod
|
|
name = "grounding rod"
|
|
desc = "Keep an area from being fried from Edison's Bane."
|
|
icon = 'icons/obj/tesla_engine/tesla_coil.dmi'
|
|
icon_state = "grounding_rod0"
|
|
anchored = FALSE
|
|
density = TRUE
|
|
|
|
can_buckle = TRUE
|
|
buckle_lying = FALSE
|
|
buckle_requires_restraints = TRUE
|
|
|
|
/obj/machinery/power/grounding_rod/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
|
|
. = ..()
|
|
if(. == SUCCESSFUL_UNFASTEN)
|
|
if(panel_open)
|
|
icon_state = "grounding_rod_open[anchored]"
|
|
else
|
|
icon_state = "grounding_rod[anchored]"
|
|
|
|
/obj/machinery/power/grounding_rod/attackby(obj/item/W, mob/user, params)
|
|
if(default_deconstruction_screwdriver(user, "grounding_rod_open[anchored]", "grounding_rod[anchored]", W))
|
|
return
|
|
|
|
if(default_unfasten_wrench(user, W))
|
|
return
|
|
|
|
if(default_deconstruction_crowbar(W))
|
|
return
|
|
|
|
return ..()
|
|
|
|
/obj/machinery/power/grounding_rod/zap_act(var/power)
|
|
if(anchored && !panel_open)
|
|
flick("grounding_rodhit", src)
|
|
zap_buckle_check(power)
|
|
return 0
|
|
else
|
|
. = ..()
|