Files
GS13NG/code/modules/power/tesla/coil.dm
Poojawa 0bca862419 Overhauls and 2/28 sync (#244)
* map tweaks/shuttle engines

* helpers and defines

* global/onclick

* controllers and datums

* mapping

* game folder

* some other stuff

* some modules

* modules that aren't mobs

* some mob stuff

* new player stuff

* mob living

* silicon stuff

* simple animal things

* carbon/ayylmao

* update_icons

* carbon/human

* sounds and tools

* icons and stuff

* hippie grinder changes + tgui

* kitchen.dmi

* compile issues fixed

* mapfix

* Mapfixes 2.0

* mapedit2.0

* mapmerger pls

* Revert "mapedit2.0"

This reverts commit 74139a3cacea10df7aafca06c0a10bd3daf3a481.

* clean up vore folder + 2 hotfixes

* admin ticket refinement

* Blob tweaks and LAZYADD

* LAZYADD IS LAZY

* Magic strings purged

* DEFINES NEED HIGHER PRIORITIES

* Only a sleepless idiot deals in absolute TRUE|FALSE

* u h g

* progress bar fix

* reverts ticket logs

* there's always that one guy

* fixes and stuff

* 2/27 fixes

* game folder stuff

* stats

* some modules again

* clothing stuff

gets vg clothing out of the main files

* everything not mobs again

* mob stuff

* maps, tgui, sql stuff

* icons

* additional fixes and compile errors

* don't need this anymore

* Oh right this isn't needed anymore

* maint bar re-added

* that doesn't need to be here

* stupid events

* wtfeven

* probably makes Travis happy

* don't care to fix the grinder atm

* fixes vending sprites, changes turret

* lethal, not lethals

* overylays are finicky creatures

* lazy fix for bleeding edgy (#252)

* map tweaks/shuttle engines

* helpers and defines

* global/onclick

* controllers and datums

* mapping

* game folder

* some other stuff

* some modules

* modules that aren't mobs

* some mob stuff

* new player stuff

* mob living

* silicon stuff

* simple animal things

* carbon/ayylmao

* update_icons

* carbon/human

* sounds and tools

* icons and stuff

* hippie grinder changes + tgui

* kitchen.dmi

* compile issues fixed

* mapfix

* Mapfixes 2.0

* mapedit2.0

* mapmerger pls

* Revert "mapedit2.0"

This reverts commit 74139a3cacea10df7aafca06c0a10bd3daf3a481.

* clean up vore folder + 2 hotfixes

* admin ticket refinement

* Blob tweaks and LAZYADD

* LAZYADD IS LAZY

* Magic strings purged

* DEFINES NEED HIGHER PRIORITIES

* Only a sleepless idiot deals in absolute TRUE|FALSE

* u h g

* progress bar fix

* reverts ticket logs

* there's always that one guy

* fixes and stuff

* 2/27 fixes

* game folder stuff

* stats

* some modules again

* clothing stuff

gets vg clothing out of the main files

* everything not mobs again

* mob stuff

* maps, tgui, sql stuff

* icons

* additional fixes and compile errors

* don't need this anymore

* Oh right this isn't needed anymore

* maint bar re-added

* that doesn't need to be here

* stupid events

* wtfeven

* probably makes Travis happy

* don't care to fix the grinder atm

* fixes vending sprites, changes turret

* lethal, not lethals

* overylays are finicky creatures
2017-02-28 09:30:49 -06:00

156 lines
4.5 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 = 0
density = 1
// Executing a traitor caught releasing tesla was never this fun!
can_buckle = TRUE
buckle_lying = FALSE
buckle_requires_restraints = TRUE
var/power_loss = 2
var/input_power_multiplier = 1
var/zap_cooldown = 100
var/last_zap = 0
/obj/machinery/power/tesla_coil/New()
..()
var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/tesla_coil(null)
B.apply_default_parts(src)
wires = new /datum/wires/tesla_coil(src)
/obj/item/weapon/circuitboard/machine/tesla_coil
name = "Tesla Coil (Machine Board)"
build_path = /obj/machinery/power/tesla_coil
origin_tech = "programming=3;magnets=3;powerstorage=3"
req_components = list(/obj/item/weapon/stock_parts/capacitor = 1)
/obj/machinery/power/tesla_coil/RefreshParts()
var/power_multiplier = 0
zap_cooldown = 100
for(var/obj/item/weapon/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/default_unfasten_wrench(mob/user, obj/item/weapon/wrench/W, 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()
/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(exchange_parts(user, 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/attack_hand(mob/user)
if(user.a_intent == INTENT_GRAB && user_buckle_mob(user.pulling, user, check_loc = 0))
return
..()
/obj/machinery/power/tesla_coil/tesla_act(var/power)
if(anchored && !panel_open)
being_shocked = 1
//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 / power_loss : power
add_avail(power_produced*input_power_multiplier)
flick("coilhit", src)
playsound(src.loc, 'sound/magic/LightningShock.ogg', 100, 1, extrarange = 5)
tesla_zap(src, 5, power_produced)
addtimer(CALLBACK(src, .proc/reset_shocked), 10)
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, 1, extrarange = 5)
tesla_zap(src, 10, 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 = 0
density = 1
can_buckle = TRUE
buckle_lying = FALSE
buckle_requires_restraints = TRUE
/obj/machinery/power/grounding_rod/New()
..()
var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/grounding_rod(null)
B.apply_default_parts(src)
/obj/item/weapon/circuitboard/machine/grounding_rod
name = "Grounding Rod (Machine Board)"
build_path = /obj/machinery/power/grounding_rod
origin_tech = "programming=3;powerstorage=3;magnets=3;plasmatech=2"
req_components = list(/obj/item/weapon/stock_parts/capacitor = 1)
/obj/machinery/power/grounding_rod/default_unfasten_wrench(mob/user, obj/item/weapon/wrench/W, 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(exchange_parts(user, W))
return
if(default_unfasten_wrench(user, W))
return
if(default_deconstruction_crowbar(W))
return
return ..()
/obj/machinery/power/grounding_rod/attack_hand(mob/user)
if(user.a_intent == INTENT_GRAB && user_buckle_mob(user.pulling, user, check_loc = 0))
return
..()
/obj/machinery/power/grounding_rod/tesla_act(var/power)
if(anchored && !panel_open)
flick("grounding_rodhit", src)
else
..()