From 277c8e2ca601c72ec9f9120fef44d5076aad3319 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Wed, 5 May 2021 22:17:09 +0200 Subject: [PATCH] More fixes Moves logging around Refactor of code --- .../atmospherics/environmental/LINDA_fire.dm | 2 +- .../reagents/chemistry/reagents/misc.dm | 2 +- .../chemistry/reagents/pyrotechnic.dm | 38 ++++++++++--------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm index 0b624396489..3bbdd698b56 100644 --- a/code/modules/atmospherics/environmental/LINDA_fire.dm +++ b/code/modules/atmospherics/environmental/LINDA_fire.dm @@ -284,7 +284,7 @@ if(isliving(A)) continue if(A != existing_hotspot) - A.fire_act(null, expose_temp, existing_hotspot.volume) // triggers another fuel tank boom + A.fire_act(null, expose_temp, existing_hotspot.volume) if(isfloorturf(T)) var/turf/simulated/floor/F = T F.burn_tile() diff --git a/code/modules/reagents/chemistry/reagents/misc.dm b/code/modules/reagents/chemistry/reagents/misc.dm index 3ecd4663494..9bc4083e22f 100644 --- a/code/modules/reagents/chemistry/reagents/misc.dm +++ b/code/modules/reagents/chemistry/reagents/misc.dm @@ -205,10 +205,10 @@ var/turf/T = get_turf(holder.my_atom) holder.my_atom.visible_message("The oil burns!") var/datum/reagents/old_holder = holder + fire_flash_log(holder, id) if(holder) holder.del_reagent(id) // Remove first. Else fireflash triggers a reaction again - fire_flash_log(old_holder, id) fireflash(T, min(max(0, volume / 40), 8)) var/datum/effect_system/smoke_spread/bad/BS = new BS.set_up(1, 0, T) diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic.dm index feb4972ad9f..a6ce4bca815 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic.dm @@ -15,8 +15,8 @@ if(holder.chem_temp <= T0C - 50) return var/radius = min(max(0, volume / size_divisor), 8) - fireflash_sm(T, radius, rand(temp_fire - temp_deviance, temp_fire + temp_deviance), 500) fire_flash_log(holder, id) + fireflash_sm(T, radius, rand(temp_fire - temp_deviance, temp_fire + temp_deviance), 500) /datum/reagent/phlogiston/reaction_mob(mob/living/M, method = REAGENT_TOUCH, volume) if(holder.chem_temp <= T0C - 50) @@ -56,10 +56,11 @@ /datum/reagent/napalm/reaction_temperature(exposed_temperature, exposed_volume) if(exposed_temperature > T0C + 100) var/radius = min(max(0, volume * 0.15), 8) - fireflash_sm(get_turf(holder.my_atom), radius, rand(3000, 6000), 500) + var/turf/T = get_turf(holder.my_atom) fire_flash_log(holder, id) if(holder) holder.del_reagent(id) + fireflash_sm(T, radius, rand(3000, 6000), 500) /datum/reagent/napalm/reaction_turf(turf/T, volume) if(isspaceturf(T)) @@ -112,19 +113,22 @@ if(holder) holder.del_reagent(id) return - var/datum/reagents/old_holder = holder + + var/will_explode = volume >= explosion_threshold + if(will_explode && holder.my_atom) + // Log beforehand + holder.my_atom.visible_message("[holder.my_atom] explodes!") + message_admins("Fuel explosion ([holder.my_atom], reagent type: [id]) at [COORD(holder.my_atom.loc)]. Last touched by: [holder.my_atom.fingerprintslast ? "[holder.my_atom.fingerprintslast]" : "*null*"].") + log_game("Fuel explosion ([holder.my_atom], reagent type: [id]) at [COORD(holder.my_atom.loc)]. Last touched by: [holder.my_atom.fingerprintslast ? "[holder.my_atom.fingerprintslast]" : "*null*"].") + holder.my_atom.investigate_log("A fuel explosion, last touched by [holder.my_atom.fingerprintslast ? "[holder.my_atom.fingerprintslast]" : "*null*"], triggered at [COORD(holder.my_atom.loc)].", INVESTIGATE_BOMB) + + var/turf/T = get_turf(holder.my_atom) if(holder) // Delete the fuel from the holder before we trigger the fireball holder.del_reagent(id) - var/turf/T = get_turf(old_holder.my_atom) var/radius = min(max(min_radius, volume * volume_radius_multiplier + volume_radius_modifier), max_radius) fireflash_sm(T, radius, 2200 + radius * 250, radius * 50) - if(old_holder && volume >= explosion_threshold) - if(old_holder.my_atom) - old_holder.my_atom.visible_message("[old_holder.my_atom] explodes!") - message_admins("Fuel explosion ([old_holder.my_atom], reagent type: [id]) at [COORD(old_holder.my_atom.loc)]. Last touched by: [old_holder.my_atom.fingerprintslast ? "[old_holder.my_atom.fingerprintslast]" : "*null*"].") - log_game("Fuel explosion ([old_holder.my_atom], reagent type: [id]) at [COORD(old_holder.my_atom.loc)]. Last touched by: [old_holder.my_atom.fingerprintslast ? "[old_holder.my_atom.fingerprintslast]" : "*null*"].") - old_holder.my_atom.investigate_log("A fuel explosion, last touched by [old_holder.my_atom.fingerprintslast ? "[old_holder.my_atom.fingerprintslast]" : "*null*"], triggered at [COORD(old_holder.my_atom.loc)].", INVESTIGATE_BOMB) + if(will_explode) var/boomrange = min(max(min_explosion_radius, round(volume * volume_explosion_radius_multiplier + volume_explosion_radius_modifier)), max_explosion_radius) explosion(T, -1, -1, boomrange, 1) @@ -151,11 +155,11 @@ /datum/reagent/plasma/reaction_temperature(exposed_temperature, exposed_volume) if(exposed_temperature >= T0C + 100) - var/datum/reagents/old_holder = holder + var/turf/T = get_turf(holder.my_atom) + fire_flash_log(holder, id) if(holder) holder.del_reagent(id) // Remove first. Else fireflash triggers a reaction again - fire_flash_log(old_holder, id) - fireflash(get_turf(old_holder.my_atom), min(max(0, volume / 10), 8)) + fireflash(T, min(max(0, volume / 10), 8)) /datum/reagent/plasma/on_mob_life(mob/living/M) var/update_flags = STATUS_UPDATE_NONE @@ -244,8 +248,8 @@ if(volume < 3) return var/radius = min((volume - 3) * 0.15, 3) - fireflash_sm(T, radius, 4500 + volume * 500, 350) fire_flash_log(holder, id) + fireflash_sm(T, radius, 4500 + volume * 500, 350) /datum/reagent/clf3/reaction_mob(mob/living/M, method = REAGENT_TOUCH, volume) if(method == REAGENT_TOUCH || method == REAGENT_INGEST) @@ -442,11 +446,11 @@ /datum/reagent/plasma_dust/reaction_temperature(exposed_temperature, exposed_volume) if(exposed_temperature >= T0C + 100) - var/datum/reagents/old_holder = holder + var/turf/T = get_turf(holder.my_atom) + fire_flash_log(holder, id) if(holder) holder.del_reagent(id) // Remove first. Else fireflash triggers a reaction again - fire_flash_log(old_holder, id) - fireflash(get_turf(old_holder.my_atom), min(max(0, volume / 10), 8)) + fireflash(T, min(max(0, volume / 10), 8)) /datum/reagent/plasma_dust/on_mob_life(mob/living/M) var/update_flags = STATUS_UPDATE_NONE