Merge pull request #13658 from DeltaFire15/void-volt-tweaking

Changes to void volt and the clock power_drain() proc
This commit is contained in:
silicons
2020-11-07 00:30:19 -07:00
committed by GitHub
3 changed files with 67 additions and 49 deletions

View File

@@ -1,41 +1,57 @@
//horrifying power drain proc made for clockcult's power drain in lieu of six istypes or six for(x in view) loops
/atom/movable/proc/power_drain(clockcult_user, drain_weapons = FALSE) //This proc as of now is only in use for void volt
/*
horrifying power drain proc made for clockcult's power drain in lieu of six istypes or six for(x in view) loops
args:
clockcult_user: If the user / source has to do with clockcult stuff
drain_weapons: If this drains weaponry, such as batons and guns
recursive: If this recurses through mob / storage contents. ONLY USE THIS IF IT'S NOT CALLED TOO FREQUENTLY, or I'm not liable for any lag / functional issues caused
drain_amount: How much is drained by default; Influenced by a multiplier on most things depending on how much power they usually hold.
*/
/atom/movable/proc/power_drain(clockcult_user, drain_weapons = FALSE, recursive = FALSE, drain_amount = MIN_CLOCKCULT_POWER) //This proc as of now is only in use for void volt and transmission sigils
if(recursive)
var/succ = 0
for(var/V in contents)
var/atom/movable/target = V
succ += target.power_drain(clockcult_user, drain_weapons, recursive, drain_amount)
return succ
var/obj/item/stock_parts/cell/cell = get_cell()
if(cell)
return cell.power_drain(clockcult_user)
return cell.power_drain(clockcult_user, drain_weapons, recursive, drain_amount)
return 0 //Returns 0 instead of FALSE to symbolise it returning the power amount in other cases, not TRUE aka 1
/obj/item/melee/baton/power_drain(clockcult_user, drain_weapons = FALSE) //balance memes
/obj/item/melee/baton/power_drain(clockcult_user, drain_weapons = FALSE, recursive = FALSE, drain_amount = MIN_CLOCKCULT_POWER) //balance memes
if(!drain_weapons)
return 0
return ..()
var/obj/item/stock_parts/cell/cell = get_cell()
if(cell)
return cell.power_drain(clockcult_user, drain_weapons, recursive, drain_amount)
return 0 //No need to recurse further in batons
/obj/item/gun/power_drain(clockcult_user, drain_weapons = FALSE) //balance memes
/obj/item/gun/power_drain(clockcult_user, drain_weapons = FALSE, recursive = FALSE, drain_amount = MIN_CLOCKCULT_POWER) //balance memes
if(!drain_weapons)
return 0
var/obj/item/stock_parts/cell/cell = get_cell()
if(!cell)
return 0
if(cell.charge)
. = min(cell.charge, MIN_CLOCKCULT_POWER*4) //Done snowflakey because guns have far smaller cells than batons / other equipment
. = min(cell.charge, drain_amount*4) //Done snowflakey because guns have far smaller cells than batons / other equipment, also no need to recurse further in guns
cell.use(.)
update_icon()
/obj/machinery/power/apc/power_drain(clockcult_user, drain_weapons = FALSE)
/obj/machinery/power/apc/power_drain(clockcult_user, drain_weapons = FALSE, recursive = FALSE, drain_amount = MIN_CLOCKCULT_POWER)
if(cell && cell.charge)
playsound(src, "sparks", 50, 1)
flick("apc-spark", src)
. = min(cell.charge, MIN_CLOCKCULT_POWER*4)
cell.use(.) //Better than a power sink!
. = min(cell.charge, drain_amount*4)
cell.use(min(cell.charge, . * 4)) //Better than a power sink!
if(!cell.charge && !shorted)
shorted = 1
visible_message("<span class='warning'>The [name]'s screen blurs with static.</span>")
update()
update_icon()
/obj/machinery/power/smes/power_drain(clockcult_user, drain_weapons = FALSE)
/obj/machinery/power/smes/power_drain(clockcult_user, drain_weapons = FALSE, recursive = FALSE, drain_amount = MIN_CLOCKCULT_POWER)
if(charge)
. = min(charge, MIN_CLOCKCULT_POWER*4)
. = min(charge, drain_amount*4)
charge -= . * 50
if(!charge && !panel_open)
panel_open = TRUE
@@ -44,20 +60,26 @@
visible_message("<span class='warning'>[src]'s panel flies open with a flurry of sparks!</span>")
update_icon()
/obj/item/stock_parts/cell/power_drain(clockcult_user, drain_weapons = FALSE)
/obj/item/stock_parts/cell/power_drain(clockcult_user, drain_weapons = FALSE, recursive = FALSE, drain_amount = MIN_CLOCKCULT_POWER)
if(charge)
. = min(charge, MIN_CLOCKCULT_POWER * 4) //Done like this because normal cells are usually quite a bit bigger than the ones used in guns / APCs
. = min(charge, drain_amount * 4) //Done like this because normal cells are usually quite a bit bigger than the ones used in guns / APCs
use(min(charge, . * 10)) //Usually cell-powered equipment that is not a gun has at least ten times the capacity of a gun / 5 times the amount of an APC. This adjusts the drain to account for that.
update_icon()
/mob/living/silicon/robot/power_drain(clockcult_user, drain_weapons = FALSE)
/mob/living/silicon/robot/power_drain(clockcult_user, drain_weapons = FALSE, recursive = FALSE, drain_amount = MIN_CLOCKCULT_POWER)
if((!clockcult_user || !is_servant_of_ratvar(src)) && cell && cell.charge)
. = min(cell.charge, MIN_CLOCKCULT_POWER*4)
. = min(cell.charge, drain_amount*8) //Silicons are very susceptible to Ratvar's might
cell.use(.)
spark_system.start()
/obj/mecha/power_drain(clockcult_user, drain_weapons = FALSE)
if((!clockcult_user || (occupant && !is_servant_of_ratvar(occupant))) && cell && cell.charge)
. = min(cell.charge, MIN_CLOCKCULT_POWER*4)
cell.use(.)
spark_system.start()
/obj/mecha/power_drain(clockcult_user, drain_weapons = FALSE, recursive = FALSE, drain_amount = MIN_CLOCKCULT_POWER)
if(!clockcult_user || (occupant && !is_servant_of_ratvar(occupant)))
if(recursive)
var/succ = 0
for(var/atom/movable/target in contents) //Hiding in your mech won't save you.
succ += target.power_drain(clockcult_user, drain_weapons, recursive, drain_amount)
. = succ
else if(cell && cell.charge)
. = min(cell.charge, drain_amount*4)
cell.use(.)
spark_system.start()

View File

@@ -167,7 +167,7 @@ Judgement 5 converts
set waitfor = FALSE
chanting = TRUE
for(var/invocation in invocations)
sleep(channel_time / invocations.len)
sleep(channel_time / (invocations.len + 1)) //So it always finishes the invocation
if(QDELETED(src) || QDELETED(slab) || !chanting)
return
if(multiple_invokers_used)

View File

@@ -393,45 +393,49 @@
<b>Left-click a target to fire, quickly!</b></span>"
timeout_time = 20
/datum/clockwork_scripture/channeled/void_volt
descname = "Channeled, Power Drain"
/datum/clockwork_scripture/void_volt
descname = "Pulse, Power Drain"
name = "Void Volt"
desc = "A channeled spell that quickly drains any powercells in a radius of eight tiles, but burns the invoker. \
Can be channeled with more cultists to increase range and split the caused damage evenly over all invokers. \
desc = "A spell that releases a pulse which drains the power of anything in a radius of eight tiles, but burns the invoker. \
Can be used with more servants to increase range and split the caused damage evenly among all invokers. \
Also charges clockwork power by a small percentage of the drained power amount, which can help offset this scriptures powercost."
invocations = list("Channel their energy through my body... ", "... so it may fuel Engine!")
chant_invocations = list("Make their lights fall dark!", "They shall be powerless!", "Rob them of their power!")
chant_amount = 20
chant_interval = 10 //100KW drain per pulse for guns / APCs / 1MW for other cells = 10 chants / 100ds / 10s to drain a charged weapon or a baton with a nonupgraded cell
channel_time = 50
power_cost = 300
invocations = list("Take the energy...", "...of their inventions...", "...and grant it to Engine...", "...for they already live in utter darkness!")
channel_time = 130 //You need alot of time, but it pays off. - ten times as powerful as a regular drain (done by transmission sigils) and recurses + affects weapons - incredibly useful if you can pull this off before a big fight.
power_cost = 500 //Relatively medium powercost, but can be offset due to it adding a part of drained power to the power pool.
multiple_invokers_used = TRUE
multiple_invokers_optional = TRUE
usage_tip = "It may be useful to end channelling early if the burning becomes too much to handle.."
usage_tip = "Be sure to not be injured when using this, or the power channeled through you may overwhelm your body."
tier = SCRIPTURE_SCRIPT
primary_component = GEIS_CAPACITOR
sort_priority = 11
quickbind = TRUE
quickbind_desc = "Quickly drains power in an area around the invoker, causing burns proportional to the amount of energy drained.<br><b>Maximum of 20 chants.</b>"
quickbind_desc = "Quickly drains power in an area around the invoker, causing burns proportional to the amount of energy drained."
/datum/clockwork_scripture/channeled/void_volt/scripture_effects()
/datum/clockwork_scripture/void_volt/chant()
invoker.visible_message("<span class='warning'>[invoker] glows in a brilliant golden light!</span>")
invoker.add_atom_colour("#FFD700", ADMIN_COLOUR_PRIORITY)
invoker.light_power = 2
invoker.light_range = 4
invoker.light_color = LIGHT_COLOR_FIRE
invoker.update_light()
return ..()
addtimer(CALLBACK(invoker, /mob.proc/stop_void_volt_glow), channel_time)
..()//Do the timer & Chant
/mob/proc/stop_void_volt_glow() //Needed so the scripture being qdel()d doesn't prevent it.
visible_message("<span class='warning'>[src] stops glowing...</span>")
remove_atom_colour(ADMIN_COLOUR_PRIORITY)
light_power = 0
light_range = 0
update_light()
/datum/clockwork_scripture/channeled/void_volt/chant_effects(chant_number)
/datum/clockwork_scripture/void_volt/scripture_effects()
var/power_drained = 0
var/power_mod = 0.005 //Amount of power drained (generally) is multiplied with this, and subsequently dealt in damage to the invoker, then 15 times that is added to the clockwork cult's power reserves.
var/drain_range = 8
var/drain_range = 12
var/additional_chanters = 0
var/list/chanters = list()
chanters += invoker
for(var/mob/living/L in range(1, invoker))
for(var/mob/living/L in orange(1, invoker))
if(!L.stat && is_servant_of_ratvar(L))
additional_chanters++
chanters += L
@@ -440,22 +444,14 @@
var/turf/T = t
for(var/M in T)
var/atom/movable/A = M
power_drained += A.power_drain(TRUE, TRUE) //Yes, this absolutely does drain weaponry. 10 pulses to drain guns / batons, though of course they can just be recharged.
power_drained += A.power_drain(TRUE, TRUE, TRUE, MIN_CLOCKCULT_POWER * 10) //Yes, this absolutely does drain weaponry, aswell as recurse through objects. No more hiding in lockers / mechs to avoid it.
new /obj/effect/temp_visual/ratvar/sigil/transgression(invoker.loc, 1 + (power_drained * power_mod))
var/datum/effect_system/spark_spread/S = new
S.set_up(round(1 + (power_drained * power_mod), 1), 0, get_turf(invoker))
S.start()
adjust_clockwork_power(power_drained * power_mod * 15)
for(var/mob/living/L in chanters)
L.adjustFireLoss(round(clamp(power_drained * power_mod / (1 + additional_chanters), 0, 20), 0.1)) //No you won't just immediately melt if you do this in a very power-rich area
L.adjustFireLoss(round(clamp(power_drained * power_mod / (1 + additional_chanters), 0, 70), 0.1)) //No you won't just immediately melt if you do this in a very power-rich area, but it'll be close.
return TRUE
/datum/clockwork_scripture/channeled/void_volt/chant_end_effects()
invoker.visible_message("<span class='warning'>[invoker] stops glowing...</span>")
invoker.remove_atom_colour(ADMIN_COLOUR_PRIORITY)
invoker.light_power = 0
invoker.light_range = 0
invoker.update_light()
return ..()