mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
[MIRROR] [NO GBP]Zap strength is now measured in joules. NT CIMs will now display the power transmission from the zaps, accounting for every factor. [MDB IGNORE] (#23887)
* [NO GBP]Zap strength is now measured in joules. NT CIMs will now display the power transmission from the zaps, accounting for every factor. (#78310) ## About The Pull Request Zap strength is now measured in joules. Scales everything to account for this. NT CIMS will now display the zap power transmission in watts, instead of a modifier. This will allow you to actually see how much power the supermatter is generating accurately, without knowledge of hidden multipliers. NT CIMs will also show the internal energy gain from heat in eV/K/s, so you can easily figure out how internal energy gain works, and how much energy gain it actually gives. The internal energy measurement will also adjust its prefix. Internal energy is now a measure of internal energy, rather than internal energy density, removing the "/cm^3". Here is what it looked like:  This image was created on an earlier commit where the numbers were wrong due to a hidden multiplier that got removed later, so keep that in mind. Also fixes inactive supermatters unnecessarily scaling delta time. The high energy (>5GeV) additional zaps now also scale with delta time. The code in this PR is absolute garbage trash and there are some major issues, so I'm drafting this for now. ## Why It's Good For The Game Makes it more clear what the factors add, and also how much power the SM is releasing. Zap strength being measured in joules will simplify a lot of things, making power balance more clear rather than guessimating. Adjusting the prefix for internal energy is just the natural thing to do. The per cubic centimeter part of internal energy would imply it is energy density, however it is functionally not. It would probably confuse people thinking the volume of the turf or the size of the supermatter actually matters for what the internal energy does, when it does not (except for gas absorption I guess, which changes heating/mol requirements, but nothing else), so I am removing that part. ## Changelog 🆑 qol: NT CIMs shows how much power the supermatter is releasing. qol: NT CIMs internal energy will adjust its prefix. qol: Energy displays (such as multitooling grid) will use the full range of SI prefixes available, up to the peta prefix if you somehow managed to reach that. del: Removes the per cubic centimeter part of internal energy. fix: Fix unnecessary delta time scaling on inactive supermatters. fix: Fix high energy zaps not scaling with delta time. fix: Fixes grounding rods lying about potential power you can generate. code: Convert supermatter_zap() and tesla_zap() zap_str argument unit to be in joules, and scales everything that uses that argument. /🆑 * [NO GBP]Zap strength is now measured in joules. NT CIMs will now display the power transmission from the zaps, accounting for every factor. --------- Co-authored-by: Pickle-Coding <58013024+Pickle-Coding@users.noreply.github.com>
This commit is contained in:
co-authored by
Pickle-Coding
parent
3e3bb6d393
commit
f5eb6b48b8
@@ -22,5 +22,5 @@
|
||||
addtimer(CALLBACK(src, PROC_REF(zap)), rand(30, 100))
|
||||
|
||||
/obj/item/organ/internal/heart/gland/electric/proc/zap()
|
||||
tesla_zap(owner, 4, 8000, ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE | ZAP_MOB_STUN)
|
||||
tesla_zap(owner, 4, 3.2e6, ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE | ZAP_MOB_STUN)
|
||||
playsound(get_turf(owner), 'sound/magic/lightningshock.ogg', 50, TRUE)
|
||||
|
||||
@@ -227,10 +227,10 @@
|
||||
/obj/structure/blob/zap_act(power, zap_flags)
|
||||
if(overmind)
|
||||
if(overmind.blobstrain.tesla_reaction(src, power))
|
||||
take_damage(power * 0.0025, BURN, ENERGY)
|
||||
take_damage(power * 3.125e-6, BURN, ENERGY)
|
||||
else
|
||||
take_damage(power * 0.0025, BURN, ENERGY)
|
||||
power -= power * 0.0025 //You don't get to do it for free
|
||||
take_damage(power * 3.125e-6, BURN, ENERGY)
|
||||
power -= power * 2.5e-3 //You don't get to do it for free
|
||||
return ..() //You don't get to do it for free
|
||||
|
||||
/obj/structure/blob/extinguish()
|
||||
|
||||
@@ -480,8 +480,8 @@
|
||||
if(critical_threshold_proximity > 650 && prob(20))
|
||||
zap_number += 1
|
||||
|
||||
var/cutoff = 1500
|
||||
cutoff = clamp(3000 - (power_level * (internal_fusion.total_moles() * 0.45)), 450, 3000)
|
||||
var/cutoff = 1.2e6
|
||||
cutoff = clamp(2.4e6 - (power_level * (internal_fusion.total_moles() * 360)), 3.6e5, 2.4e6)
|
||||
|
||||
var/zaps_aspect = DEFAULT_ZAP_ICON_STATE
|
||||
var/flags = ZAP_SUPERMATTER_FLAGS
|
||||
@@ -495,7 +495,7 @@
|
||||
|
||||
playsound(loc, 'sound/weapons/emitter2.ogg', 100, TRUE, extrarange = 10)
|
||||
for(var/i in 1 to zap_number)
|
||||
supermatter_zap(src, 5, power_level * 300, flags, zap_cutoff = cutoff, power_level = src.power_level * 1000, zap_icon = zaps_aspect)
|
||||
supermatter_zap(src, 5, power_level * 2.4e5, flags, zap_cutoff = cutoff, power_level = src.power_level * 1000, zap_icon = zaps_aspect)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/hypertorus/core/proc/check_gravity_pulse(seconds_per_tick)
|
||||
if(SPT_PROB(100 - critical_threshold_proximity / 15, seconds_per_tick))
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
emp_message = span_warning("The tesla capacitors beep ominously for a moment.")
|
||||
clothing_traits = list(TRAIT_TESLA_SHOCKIMMUNE)
|
||||
/// How strong are the zaps we give off?
|
||||
var/zap_power = 25000
|
||||
var/zap_power = 1e7
|
||||
/// How far to the zaps we give off go?
|
||||
var/zap_range = 20
|
||||
/// What flags do we pass to the zaps we give off?
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
visible_message(span_danger("\The [src] lets out a shower of sparks as it starts to lose stability!"),\
|
||||
span_hear("You hear a loud electrical crack!"))
|
||||
playsound(src.loc, 'sound/magic/lightningshock.ogg', 100, TRUE, extrarange = 5)
|
||||
tesla_zap(src, 5, power_gen * 0.05)
|
||||
tesla_zap(src, 5, power_gen * 20)
|
||||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(explosion), src, 2, 3, 4, null, 8), 10 SECONDS) // Not a normal explosion.
|
||||
|
||||
/obj/machinery/power/rtg/abductor/bullet_act(obj/projectile/Proj)
|
||||
|
||||
@@ -53,8 +53,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
var/damage_archived = 0
|
||||
var/list/damage_factors
|
||||
|
||||
/// How much extra power does the main zap generate.
|
||||
var/zap_multiplier = 1
|
||||
/// The zap power transmission over internal energy. W/MeV.
|
||||
var/zap_transmission_rate = BASE_POWER_TRANSMISSION_RATE
|
||||
var/list/zap_factors
|
||||
|
||||
/// The temperature at which we start taking damage
|
||||
@@ -95,7 +95,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
/// How much power decay is negated. Complete power decay negation at 1.
|
||||
var/gas_powerloss_inhibition = 0
|
||||
/// Affects the amount of power the main SM zap makes.
|
||||
var/gas_power_transmission = 0
|
||||
var/gas_power_transmission_rate = 0
|
||||
/// Affects the power gain the SM experiances from heat.
|
||||
var/gas_heat_power_generation = 0
|
||||
|
||||
@@ -109,7 +109,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
var/external_damage_immediate = 0
|
||||
|
||||
///The cutoff for a bolt jumping, grows with heat, lowers with higher mol count,
|
||||
var/zap_cutoff = 1500
|
||||
var/zap_cutoff = 1.2e6
|
||||
///How much the bullets damage should be multiplied by when it is added to the internal variables
|
||||
var/bullet_energy = SUPERMATTER_DEFAULT_BULLET_ENERGY
|
||||
///How much hallucination should we produce per unit of power?
|
||||
@@ -153,6 +153,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
|
||||
///Stores the time of when the last zap occurred
|
||||
var/last_power_zap = 0
|
||||
var/last_high_energy_zap = 0
|
||||
///Do we show this crystal in the CIMS modular program
|
||||
var/include_in_cims = TRUE
|
||||
|
||||
@@ -275,7 +276,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
|
||||
// PART 3: POWER PROCESSING
|
||||
internal_energy_factors = calculate_internal_energy()
|
||||
zap_factors = calculate_zap_multiplier()
|
||||
zap_factors = calculate_zap_transmission_rate()
|
||||
if(internal_energy && (last_power_zap + (4 - internal_energy * 0.001) SECONDS) < world.time)
|
||||
playsound(src, 'sound/weapons/emitter2.ogg', 70, TRUE)
|
||||
hue_angle_shift = clamp(903 * log(10, (internal_energy + 8000)) - 3590, -50, 240)
|
||||
@@ -286,9 +287,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
supermatter_zap(
|
||||
zapstart = src,
|
||||
range = 3,
|
||||
zap_str = 1.25 * internal_energy * zap_multiplier * delta_time,
|
||||
zap_str = internal_energy * zap_transmission_rate * delta_time,
|
||||
zap_flags = ZAP_SUPERMATTER_FLAGS,
|
||||
zap_cutoff = 300 * delta_time,
|
||||
zap_cutoff = 2.4e5 * delta_time,
|
||||
power_level = internal_energy,
|
||||
color = zap_color,
|
||||
)
|
||||
@@ -374,15 +375,20 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
"name" = factor,
|
||||
"amount" = amount * -1
|
||||
))
|
||||
var/list/internal_energy_si_derived_data = siunit_isolated(internal_energy * 1e6, "eV", 3)
|
||||
data["internal_energy"] = internal_energy
|
||||
data["internal_energy_coefficient"] = internal_energy_si_derived_data[SI_COEFFICIENT]
|
||||
data["internal_energy_unit"] = internal_energy_si_derived_data[SI_UNIT]
|
||||
data["internal_energy_factors"] = list()
|
||||
for (var/factor in internal_energy_factors)
|
||||
var/list/internal_energy_factor_si_derived_data = siunit_isolated(internal_energy_factors[factor] * 1e6, "eV", 3)
|
||||
var/amount = round(internal_energy_factors[factor], 0.01)
|
||||
if(!amount)
|
||||
continue
|
||||
data["internal_energy_factors"] += list(list(
|
||||
"name" = factor,
|
||||
"amount" = amount
|
||||
"amount" = internal_energy_factor_si_derived_data[SI_COEFFICIENT],
|
||||
"unit" = internal_energy_factor_si_derived_data[SI_UNIT],
|
||||
))
|
||||
data["temp_limit"] = temp_limit
|
||||
data["temp_limit_factors"] = list()
|
||||
@@ -392,7 +398,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
continue
|
||||
data["temp_limit_factors"] += list(list(
|
||||
"name" = factor,
|
||||
"amount" = amount
|
||||
"amount" = amount,
|
||||
))
|
||||
data["waste_multiplier"] = waste_multiplier
|
||||
data["waste_multiplier_factors"] = list()
|
||||
@@ -402,18 +408,42 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
continue
|
||||
data["waste_multiplier_factors"] += list(list(
|
||||
"name" = factor,
|
||||
"amount" = amount
|
||||
"amount" = amount,
|
||||
))
|
||||
data["zap_multiplier"] = zap_multiplier
|
||||
data["zap_multiplier_factors"] = list()
|
||||
|
||||
data["zap_transmission_factors"] = list()
|
||||
for (var/factor in zap_factors)
|
||||
var/amount = round(zap_factors[factor], 0.01)
|
||||
if(!amount)
|
||||
var/list/zap_factor_si_derived_data = siunit_isolated(zap_factors[factor] * internal_energy, "W", 2)
|
||||
if(!zap_factor_si_derived_data[SI_COEFFICIENT])
|
||||
continue
|
||||
data["zap_multiplier_factors"] += list(list(
|
||||
data["zap_transmission_factors"] += list(list(
|
||||
"name" = factor,
|
||||
"amount" = amount
|
||||
"amount" = zap_factor_si_derived_data[SI_COEFFICIENT],
|
||||
"unit" = zap_factor_si_derived_data[SI_UNIT],
|
||||
))
|
||||
|
||||
///Add high energy bonus to the zap transmission data so we can accurately measure our power generation from zaps.
|
||||
var/high_energy_bonus = 0
|
||||
var/zap_transmission = zap_transmission_rate * internal_energy
|
||||
var/zap_power_multiplier = 1
|
||||
if(internal_energy > POWER_PENALTY_THRESHOLD) //Supermatter zaps multiply power internally under some conditions for some reason, so we'll snowflake this for now.
|
||||
///Power multiplier bonus applied to all zaps. Zap power generation doubles when it reaches 7GeV and 9GeV.
|
||||
zap_power_multiplier *= 2 ** clamp(round((internal_energy - POWER_PENALTY_THRESHOLD) / 2000), 0, 2)
|
||||
///The supermatter releases additional zaps after 5GeV, with more at 7GeV and 9GeV.
|
||||
var/additional_zap_bonus = clamp(internal_energy * 3200, 6.4e6, 3.2e7) * clamp(round(INVERSE_LERP(1000, 3000, internal_energy)), 1, 4)
|
||||
high_energy_bonus = (zap_transmission + additional_zap_bonus) * zap_power_multiplier - zap_transmission
|
||||
var/list/zap_factor_si_derived_data = siunit_isolated(high_energy_bonus, "W", 2)
|
||||
data["zap_transmission_factors"] += list(list(
|
||||
"name" = "High Energy Bonus",
|
||||
"amount" = zap_factor_si_derived_data[SI_COEFFICIENT],
|
||||
"unit" = zap_factor_si_derived_data[SI_UNIT],
|
||||
))
|
||||
|
||||
var/list/zap_transmission_si_derived_data = siunit_isolated(zap_transmission + high_energy_bonus, "W", 2)
|
||||
data["zap_transmission"] = zap_transmission + high_energy_bonus
|
||||
data["zap_transmission_coefficient"] = zap_transmission_si_derived_data[SI_COEFFICIENT]
|
||||
data["zap_transmission_unit"] = zap_transmission_si_derived_data[SI_UNIT]
|
||||
|
||||
data["absorbed_ratio"] = absorption_ratio
|
||||
var/list/formatted_gas_percentage = list()
|
||||
for (var/datum/gas/gas_path as anything in subtypesof(/datum/gas))
|
||||
@@ -577,7 +607,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
*
|
||||
* Updates:
|
||||
* [/obj/machinery/power/supermatter_crystal/var/list/gas_percentage]
|
||||
* [/obj/machinery/power/supermatter_crystal/var/gas_power_transmission]
|
||||
* [/obj/machinery/power/supermatter_crystal/var/gas_power_transmission_rate]
|
||||
* [/obj/machinery/power/supermatter_crystal/var/gas_heat_modifier]
|
||||
* [/obj/machinery/power/supermatter_crystal/var/gas_heat_resistance]
|
||||
* [/obj/machinery/power/supermatter_crystal/var/gas_heat_power_generation]
|
||||
@@ -590,7 +620,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
return
|
||||
|
||||
gas_percentage = list()
|
||||
gas_power_transmission = 0
|
||||
gas_power_transmission_rate = 0
|
||||
gas_heat_modifier = 0
|
||||
gas_heat_resistance = 0
|
||||
gas_heat_power_generation = 0
|
||||
@@ -607,7 +637,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
var/datum/sm_gas/sm_gas = current_gas_behavior[gas_path]
|
||||
if(!sm_gas)
|
||||
continue
|
||||
gas_power_transmission += sm_gas.power_transmission * gas_percentage[gas_path]
|
||||
gas_power_transmission_rate += sm_gas.power_transmission * gas_percentage[gas_path]
|
||||
gas_heat_modifier += sm_gas.heat_modifier * gas_percentage[gas_path]
|
||||
gas_heat_resistance += sm_gas.heat_resistance * gas_percentage[gas_path]
|
||||
gas_heat_power_generation += sm_gas.heat_power_generation * gas_percentage[gas_path]
|
||||
@@ -637,7 +667,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
external_power_trickle -= min(additive_power[SM_POWER_EXTERNAL_TRICKLE], external_power_trickle)
|
||||
additive_power[SM_POWER_EXTERNAL_IMMEDIATE] = external_power_immediate
|
||||
external_power_immediate = 0
|
||||
additive_power[SM_POWER_HEAT] = gas_heat_power_generation * absorbed_gasmix.temperature / 6
|
||||
additive_power[SM_POWER_HEAT] = gas_heat_power_generation * absorbed_gasmix.temperature * GAS_HEAT_POWER_SCALING_COEFFICIENT
|
||||
additive_power[SM_POWER_HEAT] && log_activation(who = "environmental factors")
|
||||
|
||||
// I'm sorry for this, but we need to calculate power lost immediately after power gain.
|
||||
@@ -660,6 +690,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
if(internal_energy && !activation_logged)
|
||||
stack_trace("Supermatter powered for the first time without being logged. Internal energy factors: [json_encode(internal_energy_factors)]")
|
||||
activation_logged = TRUE // so we dont spam the log.
|
||||
else if(!internal_energy)
|
||||
last_power_zap = world.time
|
||||
return additive_power
|
||||
|
||||
/** Log when the supermatter is activated for the first time.
|
||||
@@ -685,24 +717,24 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
activation_logged = TRUE
|
||||
|
||||
/**
|
||||
* Perform calculation for the main zap power multiplier.
|
||||
* Perform calculation for the main zap power transmission rate in W/MeV.
|
||||
* Description of each factors can be found in the defines.
|
||||
*
|
||||
* Updates:
|
||||
* [/obj/machinery/power/supermatter_crystal/var/zap_multiplier]
|
||||
* [/obj/machinery/power/supermatter_crystal/var/zap_transmission_rate]
|
||||
*
|
||||
* Returns: The factors that have influenced the calculation. list[FACTOR_DEFINE] = number
|
||||
*/
|
||||
/obj/machinery/power/supermatter_crystal/proc/calculate_zap_multiplier()
|
||||
var/list/additive_transmission = list()
|
||||
additive_transmission[SM_ZAP_BASE] = 1
|
||||
additive_transmission[SM_ZAP_GAS] = gas_power_transmission
|
||||
/obj/machinery/power/supermatter_crystal/proc/calculate_zap_transmission_rate()
|
||||
var/list/additive_transmission_rate = list()
|
||||
additive_transmission_rate[SM_ZAP_BASE] = BASE_POWER_TRANSMISSION_RATE
|
||||
additive_transmission_rate[SM_ZAP_GAS] = BASE_POWER_TRANSMISSION_RATE * gas_power_transmission_rate
|
||||
|
||||
zap_multiplier = 0
|
||||
for (var/transmission_types in additive_transmission)
|
||||
zap_multiplier += additive_transmission[transmission_types]
|
||||
zap_multiplier = max(zap_multiplier, 0)
|
||||
return additive_transmission
|
||||
zap_transmission_rate = 0
|
||||
for (var/transmission_types in additive_transmission_rate)
|
||||
zap_transmission_rate += additive_transmission_rate[transmission_types]
|
||||
zap_transmission_rate = max(zap_transmission_rate, 0)
|
||||
return additive_transmission_rate
|
||||
|
||||
/**
|
||||
* Perform calculation for the waste multiplier.
|
||||
@@ -836,7 +868,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
delamination_strategy.on_select(src)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/proc/supermatter_zap(atom/zapstart = src, range = 5, zap_str = 4000, zap_flags = ZAP_SUPERMATTER_FLAGS, list/targets_hit = list(), zap_cutoff = 1500, power_level = 0, zap_icon = DEFAULT_ZAP_ICON_STATE, color = null)
|
||||
/obj/machinery/proc/supermatter_zap(atom/zapstart = src, range = 5, zap_str = 3.2e6, zap_flags = ZAP_SUPERMATTER_FLAGS, list/targets_hit = list(), zap_cutoff = 1.2e6, power_level = 0, zap_icon = DEFAULT_ZAP_ICON_STATE, color = null)
|
||||
if(QDELETED(zapstart))
|
||||
return
|
||||
. = zapstart.dir
|
||||
@@ -931,13 +963,13 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
//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(target_type == COIL || target_type == ROD)
|
||||
var/multi = 1
|
||||
switch(power_level)//Between 7k and 9k it's 2, above that it's 4
|
||||
if(SEVERE_POWER_PENALTY_THRESHOLD to CRITICAL_POWER_PENALTY_THRESHOLD)
|
||||
multi = 4
|
||||
multi = 2
|
||||
if(CRITICAL_POWER_PENALTY_THRESHOLD to INFINITY)
|
||||
multi = 8
|
||||
multi = 4
|
||||
if(zap_flags & ZAP_SUPERMATTER_FLAGS)
|
||||
var/remaining_power = target.zap_act(zap_str * multi, zap_flags)
|
||||
zap_str = remaining_power / multi //Coils should take a lot out of the power of the zap
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
|
||||
/obj/machinery/power/supermatter_crystal/proc/handle_high_power()
|
||||
if(internal_energy <= POWER_PENALTY_THRESHOLD && damage <= danger_point) //If the power is above 5000 or if the damage is above 550
|
||||
last_high_energy_zap = world.time //Prevent oddly high initial zap due to high energy zaps not getting triggered via too low energy.
|
||||
return
|
||||
var/range = 4
|
||||
zap_cutoff = 1500
|
||||
@@ -99,7 +100,7 @@
|
||||
var/temp = absorbed_gasmix.temperature
|
||||
if(pressure > 0 && temp > 0)
|
||||
//You may be able to freeze the zapstate of the engine with good planning, we'll see
|
||||
zap_cutoff = clamp(3000 - (internal_energy * total_moles / 10) / temp, 350, 3000)//If the core is cold, it's easier to jump, ditto if there are a lot of mols
|
||||
zap_cutoff = clamp(1.2e6 - (internal_energy * total_moles * 40) / temp, 1.4e5, 1.2e6)//If the core is cold, it's easier to jump, ditto if there are a lot of mols
|
||||
//We should always be able to zap our way out of the default enclosure
|
||||
//See supermatter_zap() for more details
|
||||
range = clamp(internal_energy / pressure * 10, 2, 7)
|
||||
@@ -128,9 +129,10 @@
|
||||
|
||||
if(zap_count >= 1)
|
||||
playsound(loc, 'sound/weapons/emitter2.ogg', 100, TRUE, extrarange = 10)
|
||||
var/delta_time = min((world.time - last_high_energy_zap) * 0.1, 16)
|
||||
for(var/i in 1 to zap_count)
|
||||
supermatter_zap(src, range, clamp(internal_energy*2, 4000, 20000), flags, zap_cutoff = src.zap_cutoff, power_level = internal_energy, zap_icon = src.zap_icon)
|
||||
|
||||
supermatter_zap(src, range, clamp(internal_energy * 3200, 6.4e6, 3.2e7) * delta_time, flags, zap_cutoff = src.zap_cutoff * delta_time, power_level = internal_energy, zap_icon = src.zap_icon)
|
||||
last_high_energy_zap = world.time
|
||||
if(prob(5))
|
||||
supermatter_anomaly_gen(src, FLUX_ANOMALY, rand(5, 10))
|
||||
if(prob(5))
|
||||
|
||||
@@ -17,33 +17,40 @@
|
||||
// Positive is true if more of the amount is a good thing.
|
||||
var/list/numeric_data = list()
|
||||
if(sm_gas.power_transmission)
|
||||
var/list/si_derived_data = siunit_isolated(sm_gas.power_transmission * BASE_POWER_TRANSMISSION_RATE, "W/MeV", 2)
|
||||
numeric_data += list(list(
|
||||
"name" = "Power Transmission",
|
||||
"amount" = sm_gas.power_transmission,
|
||||
"name" = "Power Transmission Bonus",
|
||||
"amount" = si_derived_data["coefficient"],
|
||||
"unit" = si_derived_data["unit"],
|
||||
"positive" = TRUE,
|
||||
))
|
||||
if(sm_gas.heat_modifier)
|
||||
numeric_data += list(list(
|
||||
"name" = "Waste Multiplier",
|
||||
"amount" = sm_gas.heat_modifier,
|
||||
"amount" = 100 * sm_gas.heat_modifier,
|
||||
"unit" = "%",
|
||||
"positive" = FALSE,
|
||||
))
|
||||
if(sm_gas.heat_resistance)
|
||||
numeric_data += list(list(
|
||||
"name" = "Heat Resistance",
|
||||
"amount" = sm_gas.heat_resistance,
|
||||
"amount" = 100 * sm_gas.heat_resistance,
|
||||
"unit" = "%",
|
||||
"positive" = TRUE,
|
||||
))
|
||||
if(sm_gas.heat_power_generation)
|
||||
var/list/si_derived_data = siunit_isolated(sm_gas.heat_power_generation * GAS_HEAT_POWER_SCALING_COEFFICIENT * 1e7 / SSair.wait, "eV/K/s", 2)
|
||||
numeric_data += list(list(
|
||||
"name" = "Heat Power Gain",
|
||||
"amount" = sm_gas.heat_power_generation,
|
||||
"amount" = si_derived_data["coefficient"],
|
||||
"unit" = si_derived_data["unit"],
|
||||
"positive" = TRUE,
|
||||
))
|
||||
if(sm_gas.powerloss_inhibition)
|
||||
numeric_data += list(list(
|
||||
"name" = "Power Decay Negation",
|
||||
"amount" = sm_gas.powerloss_inhibition,
|
||||
"amount" = 100 * sm_gas.powerloss_inhibition,
|
||||
"unit" = "%",
|
||||
"positive" = TRUE,
|
||||
))
|
||||
singular_gas_data["numeric_data"] = numeric_data
|
||||
@@ -59,8 +66,7 @@ GLOBAL_LIST_INIT(sm_gas_behavior, init_sm_gas())
|
||||
/datum/sm_gas
|
||||
/// Path of the [/datum/gas] involved with this interaction.
|
||||
var/gas_path
|
||||
|
||||
/// Influences zap power without interfering with the crystal's own energy.
|
||||
/// Influences zap power without interfering with the crystal's own energy. Gets scaled by [BASE_POWER_TRANSMISSION_RATE].
|
||||
var/power_transmission = 0
|
||||
/// How much more waste heat and gas the SM generates.
|
||||
var/heat_modifier = 0
|
||||
@@ -216,7 +222,7 @@ GLOBAL_LIST_INIT(sm_gas_behavior, init_sm_gas())
|
||||
sm.supermatter_zap(
|
||||
sm,
|
||||
range = 6,
|
||||
zap_str = clamp(sm.internal_energy * 2, 4000, 20000),
|
||||
zap_str = clamp(sm.internal_energy * 1600, 3.2e6, 1.6e7),
|
||||
zap_flags = ZAP_MOB_STUN,
|
||||
zap_cutoff = sm.zap_cutoff,
|
||||
power_level = sm.internal_energy,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// zap needs to be over this amount to get power
|
||||
#define TESLA_COIL_THRESHOLD 80
|
||||
// each zap power unit produces 400 joules
|
||||
#define ZAP_TO_ENERGY(p) (joules_to_energy((p) * 400))
|
||||
#define TESLA_COIL_THRESHOLD 32000
|
||||
|
||||
/obj/machinery/power/energy_accumulator/tesla_coil
|
||||
name = "tesla coil"
|
||||
@@ -107,7 +105,7 @@
|
||||
power /= 10
|
||||
zap_buckle_check(power)
|
||||
var/power_removed = powernet ? power * input_power_multiplier : power
|
||||
stored_energy += max(ZAP_TO_ENERGY(power_removed - TESLA_COIL_THRESHOLD), 0)
|
||||
stored_energy += max(joules_to_energy(power_removed - TESLA_COIL_THRESHOLD), 0)
|
||||
return max(power - power_removed, 0) //You get back the amount we didn't use
|
||||
|
||||
/obj/machinery/power/energy_accumulator/tesla_coil/proc/zap()
|
||||
@@ -170,10 +168,9 @@
|
||||
if(anchored && !panel_open)
|
||||
flick("grounding_rodhit", src)
|
||||
zap_buckle_check(power)
|
||||
stored_energy += ZAP_TO_ENERGY(power)
|
||||
stored_energy += joules_to_energy(power)
|
||||
return 0
|
||||
else
|
||||
. = ..()
|
||||
|
||||
#undef TESLA_COIL_THRESHOLD
|
||||
#undef ZAP_TO_ENERGY
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#define TESLA_DEFAULT_POWER 1738260
|
||||
#define TESLA_MINI_POWER 869130
|
||||
#define TESLA_DEFAULT_POWER 6.95304e8
|
||||
#define TESLA_MINI_POWER 3.47652e8
|
||||
//Zap constants, speeds up targeting
|
||||
#define BIKE (COIL + 1)
|
||||
#define COIL (ROD + 1)
|
||||
@@ -205,7 +205,7 @@
|
||||
if(!(zap_flags & ZAP_ALLOW_DUPLICATES))
|
||||
LAZYSET(shocked_targets, source, TRUE) //I don't want no null refs in my list yeah?
|
||||
. = source.dir
|
||||
if(power < 1000)
|
||||
if(power < 4e5)
|
||||
return
|
||||
|
||||
/*
|
||||
@@ -334,7 +334,7 @@
|
||||
var/mob/living/closest_mob = closest_atom
|
||||
ADD_TRAIT(closest_mob, TRAIT_BEING_SHOCKED, WAS_SHOCKED)
|
||||
addtimer(TRAIT_CALLBACK_REMOVE(closest_mob, TRAIT_BEING_SHOCKED, WAS_SHOCKED), 1 SECONDS)
|
||||
var/shock_damage = (zap_flags & ZAP_MOB_DAMAGE) ? (min(round(power/600), 90) + rand(-5, 5)) : 0
|
||||
var/shock_damage = (zap_flags & ZAP_MOB_DAMAGE) ? (min(round(power/2.4e5), 90) + rand(-5, 5)) : 0
|
||||
closest_mob.electrocute_act(shock_damage, source, 1, SHOCK_TESLA | ((zap_flags & ZAP_MOB_STUN) ? NONE : SHOCK_NOSTUN))
|
||||
if(issilicon(closest_mob))
|
||||
var/mob/living/silicon/S = closest_mob
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
damage = 10 //A worse lasergun
|
||||
var/zap_flags = ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE | ZAP_LOW_POWER_GEN
|
||||
var/zap_range = 3
|
||||
var/power = 10000
|
||||
var/power = 4e6
|
||||
|
||||
/obj/projectile/energy/tesla/on_hit(atom/target)
|
||||
. = ..()
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
/obj/projectile/energy/tesla/cannon
|
||||
name = "tesla orb"
|
||||
power = 20000
|
||||
power = 8e6
|
||||
damage = 15 //Mech man big
|
||||
|
||||
/obj/projectile/energy/tesla_cannon
|
||||
|
||||
@@ -481,7 +481,7 @@
|
||||
speed = 0.3
|
||||
|
||||
/// The power of the zap itself when it electrocutes someone
|
||||
var/zap_power = 20000
|
||||
var/zap_power = 8e6
|
||||
/// The range of the zap itself when it electrocutes someone
|
||||
var/zap_range = 15
|
||||
/// The flags of the zap itself when it electrocutes someone
|
||||
@@ -503,7 +503,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/projectile/magic/aoe/lightning/no_zap
|
||||
zap_power = 10000
|
||||
zap_power = 4e6
|
||||
zap_range = 4
|
||||
zap_flags = ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE | ZAP_LOW_POWER_GEN
|
||||
|
||||
|
||||
@@ -542,9 +542,9 @@
|
||||
reaction_tags = REACTION_TAG_EASY | REACTION_TAG_EXPLOSIVE | REACTION_TAG_DANGEROUS
|
||||
|
||||
/datum/chemical_reaction/reagent_explosion/teslium_lightning/on_reaction(datum/reagents/holder, datum/equilibrium/reaction, created_volume)
|
||||
var/T1 = created_volume * 20 //100 units : Zap 3 times, with powers 2000/5000/12000. Tesla revolvers have a power of 10000 for comparison.
|
||||
var/T2 = created_volume * 50
|
||||
var/T3 = created_volume * 120
|
||||
var/T1 = created_volume * 8e3 //100 units : Zap 3 times, with powers 8e5/2e6/4.8e6. Tesla revolvers have a power of 10000 for comparison.
|
||||
var/T2 = created_volume * 2e4
|
||||
var/T3 = created_volume * 4.8e4
|
||||
var/added_delay = 0.5 SECONDS
|
||||
if(created_volume >= 75)
|
||||
addtimer(CALLBACK(src, PROC_REF(zappy_zappy), holder, T1), added_delay)
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
playsound(carbon, 'sound/magic/lightningshock.ogg', 100, TRUE, extrarange = 5)
|
||||
carbon.cut_overlay(overcharge)
|
||||
tesla_zap(carbon, 2, crystal_charge*2.5, ZAP_OBJ_DAMAGE | ZAP_LOW_POWER_GEN | ZAP_ALLOW_DUPLICATES)
|
||||
tesla_zap(carbon, 2, crystal_charge * 1e3, ZAP_OBJ_DAMAGE | ZAP_LOW_POWER_GEN | ZAP_ALLOW_DUPLICATES)
|
||||
adjust_charge(ETHEREAL_CHARGE_FULL - crystal_charge)
|
||||
carbon.visible_message(span_danger("[carbon] violently discharges energy!"), span_warning("You violently discharge energy!"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user