[MIRROR] Process procs now properly utilize deltatime when implementing rates, timers and probabilities (#709)

* Process procs now properly utilize deltatime when implementing rates, timers and probabilities (#52981)

* Process procs now properly use deltatime when implementing rates, timers and probabilities

* Review fixes

* Geiger counters cleanup

Made hardsuit geiger code more similar to geiger counter code
Geiger counters are more responsive now

* Moved SS*_DT defines to subsystems.dm

* Rebase fix

* Redefined the SS*_DT defines to use the subsystem wait vars

* Implemented suggested changes by @AnturK

* Commented /datum/proc/process about the deltatime stuff

* Send delta_time as a process parameter instead of the defines

Also DTfied acid_processing

* Dtfied new acid component

* Process procs now properly utilize deltatime when implementing rates, timers and probabilities

Co-authored-by: Donkie <daniel.cf.hultgren@gmail.com>
This commit is contained in:
SkyratBot
2020-09-09 08:19:23 +02:00
committed by GitHub
co-authored by Donkie
parent a18452f0da
commit 1e705faa19
159 changed files with 808 additions and 719 deletions
+27 -22
View File
@@ -16,6 +16,8 @@
var/datum/looping_sound/acid/sizzle
/// Used exclusively for melting turfs. TODO: Move integrity to the atom level so that this can be dealt with there.
var/parent_integrity = 30
/// How far the acid melting of turfs has progressed
var/stage = 0
/// The proc used to handle the parent [/atom] when processing. TODO: Unify damage and resistance flags so that this doesn't need to exist!
var/datum/callback/process_effect
@@ -94,25 +96,25 @@
/// Handles the slow corrosion of the parent [/atom].
/datum/component/acid/process()
process_effect?.InvokeAsync()
/datum/component/acid/process(delta_time)
process_effect?.InvokeAsync(delta_time)
if(QDELING(src)) //The process effect deals damage, and on turfs diminishes the acid volume, potentially destroying the component. Let's not destroy it twice.
return
set_volume(acid_volume - (ACID_DECAY_BASE + (ACID_DECAY_SCALING*round(sqrt(acid_volume)))))
set_volume(acid_volume - (ACID_DECAY_BASE + (ACID_DECAY_SCALING*round(sqrt(acid_volume)))) * delta_time)
/// Handles processing on a [/obj].
/datum/component/acid/proc/process_obj(obj/target)
/datum/component/acid/proc/process_obj(obj/target, delta_time)
if(target.resistance_flags & ACID_PROOF)
return
target.take_damage(min(1 + round(sqrt(acid_power * acid_volume)*0.3), OBJ_ACID_DAMAGE_MAX), BURN, ACID, 0)
target.take_damage(min(1 + round(sqrt(acid_power * acid_volume)*0.3), OBJ_ACID_DAMAGE_MAX) * delta_time, BURN, ACID, 0)
/// Handles processing on a [/mob/living].
/datum/component/acid/proc/process_mob(mob/living/target)
target.acid_act(acid_power, acid_volume)
/datum/component/acid/proc/process_mob(mob/living/target, delta_time)
target.acid_act(acid_power, acid_volume * delta_time)
/// Handles processing on a [/turf].
/datum/component/acid/proc/process_turf(turf/target_turf)
var/acid_used = min(acid_volume * 0.05, 20)
/datum/component/acid/proc/process_turf(turf/target_turf, delta_time)
var/acid_used = min(acid_volume * 0.05, 20) * delta_time
var/applied_targets = 0
for(var/am in target_turf)
var/atom/movable/target_movable = am
@@ -126,19 +128,22 @@
if(acid_power < ACID_POWER_MELT_TURF)
return
switch(parent_integrity--)
if(-INFINITY to 0)
target_turf.visible_message("<span class='warning'>[target_turf] collapses under its own weight into a puddle of goop and undigested debris!</span>")
target_turf.acid_melt()
if(0 to 4)
target_turf.visible_message("<span class='warning'>[target_turf] begins to crumble under the acid!</span>")
if(4 to 8)
target_turf.visible_message("<span class='warning'>[target_turf] is struggling to withstand the acid!</span>")
if(8 to 16)
target_turf.visible_message("<span class='warning'>[target_turf] is being melted by the acid!</span>")
if(16 to 24)
target_turf.visible_message("<span class='warning'>[target_turf] is holding up against the acid!</span>")
parent_integrity -= delta_time
if(parent_integrity <= 0)
target_turf.visible_message("<span class='warning'>[target_turf] collapses under its own weight into a puddle of goop and undigested debris!</span>")
target_turf.acid_melt()
else if(parent_integrity <= 4 && stage <= 3)
target_turf.visible_message("<span class='warning'>[target_turf] begins to crumble under the acid!</span>")
stage = 4
else if(parent_integrity <= 8 && stage <= 2)
target_turf.visible_message("<span class='warning'>[target_turf] is struggling to withstand the acid!</span>")
stage = 3
else if(parent_integrity <= 16 && stage <= 1)
target_turf.visible_message("<span class='warning'>[target_turf] is being melted by the acid!</span>")
stage = 2
else if(parent_integrity <= 24 && stage == 0)
target_turf.visible_message("<span class='warning'>[target_turf] is holding up against the acid!</span>")
stage = 1
/// Used to maintain the acid overlay on the parent [/atom].
/datum/component/acid/proc/on_update_overlays(atom/parent_atom, list/overlays)
+3 -3
View File
@@ -120,7 +120,7 @@
/datum/component/embedded/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_MOVABLE_MOVED, COMSIG_CARBON_EMBED_RIP, COMSIG_CARBON_EMBED_REMOVAL))
/datum/component/embedded/process()
/datum/component/embedded/process(delta_time)
var/mob/living/carbon/victim = parent
if(!victim || !limb) // in case the victim and/or their limbs exploded (say, due to a sticky bomb)
@@ -132,7 +132,7 @@
return
var/damage = weapon.w_class * pain_mult
var/pain_chance_current = pain_chance
var/pain_chance_current = DT_PROB_RATE(pain_chance / 100, delta_time) * 100
if(pain_stam_pct && HAS_TRAIT_FROM(victim, TRAIT_INCAPACITATED, STAMINA)) //if it's a less-lethal embed, give them a break if they're already stamcritted
pain_chance_current *= 0.2
damage *= 0.5
@@ -143,7 +143,7 @@
limb.receive_damage(brute=(1-pain_stam_pct) * damage, stamina=pain_stam_pct * damage, wound_bonus = CANT_WOUND)
to_chat(victim, "<span class='userdanger'>[weapon] embedded in your [limb.name] hurts!</span>")
var/fall_chance_current = fall_chance
var/fall_chance_current = DT_PROB_RATE(fall_chance / 100, delta_time) * 100
if(victim.mobility_flags & ~MOBILITY_STAND)
fall_chance_current *= 0.2
+9 -9
View File
@@ -170,26 +170,26 @@
break
///Called on SSmood process
/datum/component/mood/process()
/datum/component/mood/process(delta_time)
switch(mood_level)
if(1)
setSanity(sanity-0.3, SANITY_INSANE)
setSanity(sanity-0.3*delta_time, SANITY_INSANE)
if(2)
setSanity(sanity-0.15, SANITY_INSANE)
setSanity(sanity-0.15*delta_time, SANITY_INSANE)
if(3)
setSanity(sanity-0.1, SANITY_CRAZY)
setSanity(sanity-0.1*delta_time, SANITY_CRAZY)
if(4)
setSanity(sanity-0.05, SANITY_UNSTABLE)
setSanity(sanity-0.05*delta_time, SANITY_UNSTABLE)
if(5)
setSanity(sanity, SANITY_UNSTABLE) //This makes sure that mood gets increased should you be below the minimum.
if(6)
setSanity(sanity+0.2, SANITY_UNSTABLE)
setSanity(sanity+0.2*delta_time, SANITY_UNSTABLE)
if(7)
setSanity(sanity+0.3, SANITY_UNSTABLE)
setSanity(sanity+0.3*delta_time, SANITY_UNSTABLE)
if(8)
setSanity(sanity+0.4, SANITY_NEUTRAL, SANITY_MAXIMUM)
setSanity(sanity+0.4*delta_time, SANITY_NEUTRAL, SANITY_MAXIMUM)
if(9)
setSanity(sanity+0.6, SANITY_NEUTRAL, SANITY_MAXIMUM)
setSanity(sanity+0.6*delta_time, SANITY_NEUTRAL, SANITY_MAXIMUM)
HandleNutrition()
///Sets sanity to the specified amount and applies effects.
+2 -2
View File
@@ -109,9 +109,9 @@
else
adjust_nanites(null, amount) //just add to the nanite volume
/datum/component/nanites/process()
/datum/component/nanites/process(delta_time)
if(!IS_IN_STASIS(host_mob))
adjust_nanites(null, regen_rate + (SSresearch.science_tech.researched_nodes["nanite_harmonic"] ? HARMONIC_REGEN_BOOST : 0))
adjust_nanites(null, (regen_rate + (SSresearch.science_tech.researched_nodes["nanite_harmonic"] ? HARMONIC_REGEN_BOOST : 0)) * delta_time)
add_research()
for(var/X in programs)
var/datum/nanite_program/NP = X
+2 -2
View File
@@ -39,8 +39,8 @@
master.remove_filter("rad_glow")
return ..()
/datum/component/radioactive/process()
if(!prob(50))
/datum/component/radioactive/process(delta_time)
if(!DT_PROB(50, delta_time))
return
radiation_pulse(parent, strength, RAD_DISTANCE_COEFFICIENT*2, FALSE, can_contaminate)
if(!hl3_release_date)
+2 -2
View File
@@ -10,7 +10,7 @@
START_PROCESSING(SSprocessing, src)
/datum/component/rot/process()
/datum/component/rot/process(delta_time)
var/atom/A = parent
var/turf/open/T = get_turf(A)
@@ -19,7 +19,7 @@
var/datum/gas_mixture/stank = new
ADD_GAS(/datum/gas/miasma, stank.gases)
stank.gases[/datum/gas/miasma][MOLES] = amount
stank.gases[/datum/gas/miasma][MOLES] = amount * delta_time
stank.temperature = BODYTEMP_NORMAL // otherwise we have gas below 2.7K which will break our lag generator
T.assume_air(stank)
T.air_update_turf()