diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index da2a1dfadc6..2f452345ef9 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -326,6 +326,9 @@ #define SSMOBS_DT (SSmobs.wait/10) #define SSOBJ_DT (SSobj.wait/10) +// The change in the world's time from the subsystem's last fire in seconds. +#define DELTA_WORLD_TIME(ss) ((world.time - ss.last_fire) * 0.1) + /// The timer key used to know how long subsystem initialization takes #define SS_INIT_TIMER_KEY "ss_init" diff --git a/code/modules/antagonists/changeling/changeling.dm b/code/modules/antagonists/changeling/changeling.dm index 6f9456eed98..e3e287f7e4c 100644 --- a/code/modules/antagonists/changeling/changeling.dm +++ b/code/modules/antagonists/changeling/changeling.dm @@ -282,13 +282,15 @@ /datum/antagonist/changeling/proc/on_life(datum/source, seconds_per_tick, times_fired) SIGNAL_HANDLER + var/delta_time = DELTA_WORLD_TIME(SSmobs) + // If dead, we only regenerate up to half chem storage. if(owner.current.stat == DEAD) - adjust_chemicals((chem_recharge_rate - chem_recharge_slowdown) * seconds_per_tick, total_chem_storage * 0.5) + adjust_chemicals((chem_recharge_rate - chem_recharge_slowdown) * delta_time, total_chem_storage * 0.5) // If we're not dead - we go up to the full chem cap. else - adjust_chemicals((chem_recharge_rate - chem_recharge_slowdown) * seconds_per_tick) + adjust_chemicals((chem_recharge_rate - chem_recharge_slowdown) * delta_time) /** * Signal proc for [COMSIG_LIVING_POST_FULLY_HEAL], getting admin-healed restores our chemicals. diff --git a/code/modules/mob/living/carbon/alien/organs.dm b/code/modules/mob/living/carbon/alien/organs.dm index 00c8a617c64..5ef9b23c418 100644 --- a/code/modules/mob/living/carbon/alien/organs.dm +++ b/code/modules/mob/living/carbon/alien/organs.dm @@ -51,21 +51,24 @@ actions_types = list(/datum/action/cooldown/alien/transfer) /obj/item/organ/internal/alien/plasmavessel/on_life(seconds_per_tick, times_fired) + var/delta_time = DELTA_WORLD_TIME(SSmobs) + //Instantly healing to max health in a single tick would be silly. If it takes 8 seconds to fire, then something's fucked. + var/delta_time_capped = min(delta_time, 8) //If there are alien weeds on the ground then heal if needed or give some plasma if(locate(/obj/structure/alien/weeds) in owner.loc) if(owner.health >= owner.maxHealth) - owner.adjustPlasma(plasma_rate * seconds_per_tick) + owner.adjustPlasma(plasma_rate * delta_time) else var/heal_amt = heal_rate if(!isalien(owner)) heal_amt *= 0.2 - owner.adjustPlasma(0.5 * plasma_rate * seconds_per_tick) - owner.adjustBruteLoss(-heal_amt * seconds_per_tick) - owner.adjustFireLoss(-heal_amt * seconds_per_tick) - owner.adjustOxyLoss(-heal_amt * seconds_per_tick) - owner.adjustCloneLoss(-heal_amt * seconds_per_tick) + owner.adjustPlasma(0.5 * plasma_rate * delta_time_capped) + owner.adjustBruteLoss(-heal_amt * delta_time_capped) + owner.adjustFireLoss(-heal_amt * delta_time_capped) + owner.adjustOxyLoss(-heal_amt * delta_time_capped) + owner.adjustCloneLoss(-heal_amt * delta_time_capped) else - owner.adjustPlasma(0.1 * plasma_rate * seconds_per_tick) + owner.adjustPlasma(0.1 * plasma_rate * delta_time) /obj/item/organ/internal/alien/plasmavessel/on_insert(mob/living/carbon/organ_owner) . = ..() diff --git a/code/modules/mob/living/simple_animal/revenant.dm b/code/modules/mob/living/simple_animal/revenant.dm index 82c2be6920a..6e2ec11afea 100644 --- a/code/modules/mob/living/simple_animal/revenant.dm +++ b/code/modules/mob/living/simple_animal/revenant.dm @@ -132,6 +132,7 @@ /mob/living/simple_animal/revenant/Life(seconds_per_tick = SSMOBS_DT, times_fired) if(stasis) return + var/delta_time = DELTA_WORLD_TIME(SSmobs) if(revealed && essence <= 0) death() if(unreveal_time && world.time >= unreveal_time) @@ -145,7 +146,7 @@ REMOVE_TRAIT(src, TRAIT_NO_TRANSFORM, REVENANT_STUNNED_TRAIT) to_chat(src, span_revenboldnotice("You can move again!")) if(essence_regenerating && !inhibited && essence < essence_regen_cap) //While inhibited, essence will not regenerate - essence = min(essence + (essence_regen_amount * seconds_per_tick), essence_regen_cap) + essence = min(essence + (essence_regen_amount * delta_time), essence_regen_cap) update_mob_action_buttons() //because we update something required by our spells in life, we need to update our buttons update_spooky_icon() update_health_hud() diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 15fba3cc8fe..b78472e2b34 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -271,16 +271,19 @@ 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() - if(internal_energy && (last_power_zap + 4 SECONDS - (internal_energy * 0.001)) < world.time) + 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) var/zap_color = color_matrix_rotate_hue(hue_angle_shift) + //Scale the strength of the zap with the world's time elapsed between zaps in seconds. + //Capped at 16 seconds to prevent a crazy burst of energy if atmos was halted for a long time. + var/delta_time = min((world.time - last_power_zap) * 0.1, 16) supermatter_zap( zapstart = src, range = 3, - zap_str = 5 * internal_energy * zap_multiplier, + zap_str = 1.25 * internal_energy * zap_multiplier * delta_time, zap_flags = ZAP_SUPERMATTER_FLAGS, - zap_cutoff = 300, + zap_cutoff = 300 * delta_time, power_level = internal_energy, color = zap_color, )