mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
Rad collectors gone, tesla coils to generate power (#61917)
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
req_access = list(ACCESS_ENGINE_EQUIP, ACCESS_ATMOSPHERICS)
|
||||
max_integrity = 350
|
||||
integrity_failure = 0.2
|
||||
circuit = /obj/item/circuitboard/machine/rad_collector
|
||||
rad_insulation = RAD_EXTREME_INSULATION
|
||||
///Stores the loaded tank instance
|
||||
var/obj/item/tank/internals/plasma/loaded_tank = null
|
||||
|
||||
@@ -221,7 +221,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
var/power_changes = TRUE
|
||||
///Disables the sm's proccessing totally.
|
||||
var/processes = TRUE
|
||||
|
||||
///Stores the time of when the last zap occurred
|
||||
var/last_power_zap = 0
|
||||
|
||||
|
||||
/obj/machinery/power/supermatter_crystal/Initialize(mapload)
|
||||
@@ -486,7 +487,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
|
||||
//Ok, get the air from the turf
|
||||
var/datum/gas_mixture/env = local_turf.return_air()
|
||||
|
||||
var/env_pressure = env.return_pressure()
|
||||
var/datum/gas_mixture/removed
|
||||
if(produces_gas)
|
||||
//Remove gas from surrounding area
|
||||
@@ -643,6 +644,23 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
//(1 + (tritRad + pluoxDampen * bzDampen * o2Rad * plasmaRad / (10 - bzrads))) * freonbonus
|
||||
radiation_pulse(src, power * max(0, (1 + (power_transmission_bonus/(10-(gas_comp[/datum/gas/bz] * BZ_RADIOACTIVITY_MODIFIER)))) * freonbonus))// RadModBZ(500%)
|
||||
|
||||
//Zaps around 2.5 seconds at 1500 MeV, limited to 0.5 from 4000 MeV and up
|
||||
if(power && (last_power_zap + 4 SECONDS - (power * 0.001)) < world.time)
|
||||
//(1 + (tritRad + pluoxDampen * bzDampen * o2Rad * plasmaRad / (10 - bzrads))) * freonbonus
|
||||
playsound(src, 'sound/weapons/emitter2.ogg', 70, TRUE)
|
||||
var/power_multiplier = max(0, (1 + (power_transmission_bonus / (10 - (gas_comp[/datum/gas/bz] * BZ_RADIOACTIVITY_MODIFIER)))) * freonbonus)// RadModBZ(500%)
|
||||
var/pressure_multiplier = max((1 / ((env_pressure ** 1.5) + 5.5) * 0.01) + 0.8, 1)
|
||||
var/co2_power_increase = max(gas_comp[/datum/gas/carbon_dioxide] * 2, 1)
|
||||
supermatter_zap(
|
||||
zapstart = src,
|
||||
range = 3,
|
||||
zap_str = 2.5 * power * power_multiplier * pressure_multiplier * co2_power_increase,
|
||||
zap_flags = ZAP_SUPERMATTER_FLAGS,
|
||||
zap_cutoff = 300,
|
||||
power_level = power
|
||||
)
|
||||
last_power_zap = world.time
|
||||
|
||||
if(prob(gas_comp[/datum/gas/zauker]))
|
||||
playsound(src.loc, 'sound/weapons/emitter2.ogg', 100, TRUE, extrarange = 10)
|
||||
supermatter_zap(src, 6, clamp(power*2, 4000, 20000), ZAP_MOB_STUN, zap_cutoff = src.zap_cutoff, power_level = power, zap_icon = src.zap_icon)
|
||||
@@ -1212,58 +1230,61 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
if(arc_targets.len)//Pick from our pool
|
||||
target = pick(arc_targets)
|
||||
|
||||
if(!QDELETED(target))//If we found something
|
||||
//Do the animation to zap to it from here
|
||||
if(!(zap_flags & ZAP_ALLOW_DUPLICATES))
|
||||
LAZYSET(targets_hit, target, TRUE)
|
||||
zapstart.Beam(target, icon_state=zap_icon, time = 5)
|
||||
var/zapdir = get_dir(zapstart, target)
|
||||
if(zapdir)
|
||||
. = zapdir
|
||||
if(QDELETED(target))//If we didn't found something
|
||||
return
|
||||
|
||||
//Going boom should be rareish
|
||||
if(prob(80))
|
||||
zap_flags &= ~ZAP_MACHINE_EXPLOSIVE
|
||||
if(target_type == COIL)
|
||||
//In the best situation we can expect this to grow up to 2120kw before a delam/IT'S GONE TOO FAR FRED SHUT IT DOWN
|
||||
//The formula for power gen is zap_str * zap_mod / 2 * capacitor rating, between 1 and 4
|
||||
var/multi = 10
|
||||
switch(power_level)//Between 7k and 9k it's 20, above that it's 40
|
||||
if(SEVERE_POWER_PENALTY_THRESHOLD to CRITICAL_POWER_PENALTY_THRESHOLD)
|
||||
multi = 20
|
||||
if(CRITICAL_POWER_PENALTY_THRESHOLD to INFINITY)
|
||||
multi = 40
|
||||
target.zap_act(zap_str * multi, zap_flags)
|
||||
zap_str /= 3 //Coils should take a lot out of the power of the zap
|
||||
|
||||
else if(isliving(target))//If we got a fleshbag on our hands
|
||||
var/mob/living/creature = target
|
||||
creature.set_shocked()
|
||||
addtimer(CALLBACK(creature, /mob/living/proc/reset_shocked), 10)
|
||||
//3 shots a human with no resistance. 2 to crit, one to death. This is at at least 10000 power.
|
||||
//There's no increase after that because the input power is effectivly capped at 10k
|
||||
//Does 1.5 damage at the least
|
||||
var/shock_damage = ((zap_flags & ZAP_MOB_DAMAGE) ? (power_level / 200) - 10 : rand(5,10))
|
||||
creature.electrocute_act(shock_damage, "Supermatter Discharge Bolt", 1, ((zap_flags & ZAP_MOB_STUN) ? SHOCK_TESLA : SHOCK_NOSTUN))
|
||||
zap_str /= 1.5 //Meatsacks are conductive, makes working in pairs more destructive
|
||||
//Do the animation to zap to it from here
|
||||
if(!(zap_flags & ZAP_ALLOW_DUPLICATES))
|
||||
LAZYSET(targets_hit, target, TRUE)
|
||||
zapstart.Beam(target, icon_state=zap_icon, time = 0.5 SECONDS)
|
||||
var/zapdir = get_dir(zapstart, target)
|
||||
if(zapdir)
|
||||
. = zapdir
|
||||
|
||||
//Going boom should be rareish
|
||||
if(prob(80))
|
||||
zap_flags &= ~ZAP_MACHINE_EXPLOSIVE
|
||||
if(target_type == COIL)
|
||||
var/multi = 2
|
||||
switch(power_level)//Between 7k and 9k it's 4, above that it's 8
|
||||
if(SEVERE_POWER_PENALTY_THRESHOLD to CRITICAL_POWER_PENALTY_THRESHOLD)
|
||||
multi = 4
|
||||
if(CRITICAL_POWER_PENALTY_THRESHOLD to INFINITY)
|
||||
multi = 8
|
||||
if(zap_flags & ZAP_SUPERMATTER_FLAGS)
|
||||
var/remaining_power = target.zap_act(zap_str * multi, zap_flags)
|
||||
zap_str = remaining_power * 0.5 //Coils should take a lot out of the power of the zap
|
||||
else
|
||||
zap_str = target.zap_act(zap_str, zap_flags)
|
||||
//This gotdamn variable is a boomer and keeps giving me problems
|
||||
var/turf/target_turf = get_turf(target)
|
||||
var/pressure = 1
|
||||
if(target_turf?.return_air())
|
||||
pressure = max(1,target_turf.return_air().return_pressure())
|
||||
//We get our range with the strength of the zap and the pressure, the higher the former and the lower the latter the better
|
||||
var/new_range = clamp(zap_str / pressure * 10, 2, 7)
|
||||
var/zap_count = 1
|
||||
if(prob(5))
|
||||
zap_str -= (zap_str/10)
|
||||
zap_count += 1
|
||||
for(var/j in 1 to zap_count)
|
||||
if(zap_count > 1)
|
||||
targets_hit = targets_hit.Copy() //Pass by ref begone
|
||||
supermatter_zap(target, new_range, zap_str, zap_flags, targets_hit, zap_cutoff, power_level, zap_icon)
|
||||
zap_str /= 3
|
||||
|
||||
else if(isliving(target))//If we got a fleshbag on our hands
|
||||
var/mob/living/creature = target
|
||||
creature.set_shocked()
|
||||
addtimer(CALLBACK(creature, /mob/living/proc/reset_shocked), 1 SECONDS)
|
||||
//3 shots a human with no resistance. 2 to crit, one to death. This is at at least 10000 power.
|
||||
//There's no increase after that because the input power is effectivly capped at 10k
|
||||
//Does 1.5 damage at the least
|
||||
var/shock_damage = ((zap_flags & ZAP_MOB_DAMAGE) ? (power_level / 200) - 10 : rand(5,10))
|
||||
creature.electrocute_act(shock_damage, "Supermatter Discharge Bolt", 1, ((zap_flags & ZAP_MOB_STUN) ? SHOCK_TESLA : SHOCK_NOSTUN))
|
||||
zap_str /= 1.5 //Meatsacks are conductive, makes working in pairs more destructive
|
||||
|
||||
else
|
||||
zap_str = target.zap_act(zap_str, zap_flags)
|
||||
//This gotdamn variable is a boomer and keeps giving me problems
|
||||
var/turf/target_turf = get_turf(target)
|
||||
var/pressure = 1
|
||||
if(target_turf?.return_air())
|
||||
pressure = max(1,target_turf.return_air().return_pressure())
|
||||
//We get our range with the strength of the zap and the pressure, the higher the former and the lower the latter the better
|
||||
var/new_range = clamp(zap_str / pressure * 10, 2, 7)
|
||||
var/zap_count = 1
|
||||
if(prob(5))
|
||||
zap_str -= (zap_str/10)
|
||||
zap_count += 1
|
||||
for(var/j in 1 to zap_count)
|
||||
if(zap_count > 1)
|
||||
targets_hit = targets_hit.Copy() //Pass by ref begone
|
||||
supermatter_zap(target, new_range, zap_str, zap_flags, targets_hit, zap_cutoff, power_level, zap_icon)
|
||||
|
||||
/obj/overlay/psy
|
||||
icon = 'icons/obj/supermatter.dmi'
|
||||
|
||||
@@ -13,14 +13,25 @@
|
||||
|
||||
circuit = /obj/item/circuitboard/machine/tesla_coil
|
||||
|
||||
var/zap_flags = ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE
|
||||
///Flags of the zap that the coil releases when the wire is pulsed
|
||||
var/zap_flags = ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE | ZAP_LOW_POWER_GEN
|
||||
///Multiplier for power conversion
|
||||
var/input_power_multiplier = 1
|
||||
///Cooldown between pulsed zaps
|
||||
var/zap_cooldown = 100
|
||||
///Reference to the last zap done
|
||||
var/last_zap = 0
|
||||
///Amount of power stored inside the coil to be released in the powernet
|
||||
var/stored_energy = 0
|
||||
|
||||
/obj/machinery/power/tesla_coil/anchored
|
||||
anchored = TRUE
|
||||
|
||||
/obj/machinery/power/tesla_coil/Initialize(mapload)
|
||||
. = ..()
|
||||
wires = new /datum/wires/tesla_coil(src)
|
||||
if(anchored)
|
||||
connect_to_network()
|
||||
|
||||
/obj/machinery/power/tesla_coil/should_have_node()
|
||||
return anchored
|
||||
@@ -71,25 +82,26 @@
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/tesla_coil/process(delta_time)
|
||||
var/power_produced = min(stored_energy, (stored_energy * 0.04) + 1000) * delta_time
|
||||
add_avail(power_produced)
|
||||
stored_energy -= power_produced
|
||||
|
||||
/obj/machinery/power/tesla_coil/zap_act(power, zap_flags)
|
||||
if(anchored && !panel_open)
|
||||
//don't lose arc power when it's not connected to anything
|
||||
//please place tesla coils all around the station to maximize effectiveness
|
||||
obj_flags |= BEING_SHOCKED
|
||||
addtimer(CALLBACK(src, .proc/reset_shocked), 1 SECONDS)
|
||||
zap_buckle_check(power)
|
||||
if(zap_flags & ZAP_GENERATES_POWER) //I don't want no tesla revolver making 8GW you hear
|
||||
return power / 2
|
||||
var/power_produced = powernet ? power * input_power_multiplier : power
|
||||
add_avail(power_produced)
|
||||
var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_ENG)
|
||||
if(D)
|
||||
D.adjust_money(min(power_produced, 1))
|
||||
flick("coilhit", src)
|
||||
playsound(src.loc, 'sound/magic/lightningshock.ogg', 100, TRUE, extrarange = 5)
|
||||
return power - power_produced //You get back the amount we didn't use
|
||||
else
|
||||
. = ..()
|
||||
if(!anchored || panel_open)
|
||||
return ..()
|
||||
obj_flags |= BEING_SHOCKED
|
||||
addtimer(CALLBACK(src, .proc/reset_shocked), 1 SECONDS)
|
||||
flick("coilhit", src)
|
||||
playsound(src.loc, 'sound/magic/lightningshock.ogg', 100, TRUE, extrarange = 5)
|
||||
if(!(zap_flags & ZAP_GENERATES_POWER)) //Prevent infinite recursive power
|
||||
return 0
|
||||
if(zap_flags & ZAP_LOW_POWER_GEN)
|
||||
power /= 10
|
||||
zap_buckle_check(power)
|
||||
var/power_removed = powernet ? power * input_power_multiplier : power
|
||||
stored_energy += max((power_removed - 80) * 200, 0)
|
||||
return max(power - power_removed, 0) //You get back the amount we didn't use
|
||||
|
||||
/obj/machinery/power/tesla_coil/proc/zap()
|
||||
if((last_zap + zap_cooldown) > world.time || !powernet)
|
||||
@@ -114,6 +126,9 @@
|
||||
buckle_lying = 0
|
||||
buckle_requires_restraints = TRUE
|
||||
|
||||
/obj/machinery/power/grounding_rod/anchored
|
||||
anchored = TRUE
|
||||
|
||||
/obj/machinery/power/grounding_rod/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
|
||||
. = ..()
|
||||
if(. == SUCCESSFUL_UNFASTEN)
|
||||
|
||||
Reference in New Issue
Block a user