From 590ca6cd5d1a2d2d30628f9b6baa10cc1e4a64e4 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Wed, 5 May 2021 21:41:38 +0200 Subject: [PATCH] Fixes fireflashes Fix fuel tanks going off multiple times. Fix other reagents going off multiple times Fireflashes now don't go through things they shouldn't be able to --- .../atmospherics/environmental/LINDA_fire.dm | 10 +++--- .../reagents/chemistry/reagents/misc.dm | 11 +++--- .../chemistry/reagents/pyrotechnic.dm | 34 +++++++++++-------- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm index 9c91d72b65c..0b624396489 100644 --- a/code/modules/atmospherics/environmental/LINDA_fire.dm +++ b/code/modules/atmospherics/environmental/LINDA_fire.dm @@ -93,7 +93,7 @@ for(var/A in loc) var/atom/item = A - if(item && item != src) // It's possible that the item is deleted in temperature_expose + if(!QDELETED(item) && item != src) // It's possible that the item is deleted in temperature_expose item.fire_act(null, temperature, volume) color = heat2color(temperature) @@ -284,7 +284,7 @@ if(isliving(A)) continue if(A != existing_hotspot) - A.fire_act(null, expose_temp, existing_hotspot.volume) + A.fire_act(null, expose_temp, existing_hotspot.volume) // triggers another fuel tank boom if(isfloorturf(T)) var/turf/simulated/floor/F = T F.burn_tile() @@ -295,15 +295,13 @@ if(T.density) continue - for(var/obj/O in T) - if(O.density) - continue + if(dist == max_dist) continue for(var/dir in GLOB.cardinal) var/turf/link = get_step(T, dir) - if (!link) + if (!link || !T.CanAtmosPass(link)) // Check if you can get to that turf continue var/dx = link.x - Ce.x var/dy = link.y - Ce.y diff --git a/code/modules/reagents/chemistry/reagents/misc.dm b/code/modules/reagents/chemistry/reagents/misc.dm index a0122dccd78..3ecd4663494 100644 --- a/code/modules/reagents/chemistry/reagents/misc.dm +++ b/code/modules/reagents/chemistry/reagents/misc.dm @@ -204,14 +204,17 @@ if(exposed_temperature > T0C + 600) var/turf/T = get_turf(holder.my_atom) holder.my_atom.visible_message("The oil burns!") + var/datum/reagents/old_holder = holder + 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)) - fire_flash_log(holder, id) var/datum/effect_system/smoke_spread/bad/BS = new BS.set_up(1, 0, T) BS.start() - if(holder) - holder.add_reagent("ash", round(volume * 0.5)) - holder.del_reagent(id) + if(!QDELETED(old_holder)) + old_holder.add_reagent("ash", round(volume * 0.5)) /datum/reagent/oil/reaction_turf(turf/T, volume) if(volume >= 3 && !isspaceturf(T) && !locate(/obj/effect/decal/cleanable/blood/oil) in T) diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic.dm index f3b39d27cf7..feb4972ad9f 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic.dm @@ -112,19 +112,21 @@ if(holder) holder.del_reagent(id) return - var/turf/T = get_turf(holder.my_atom) + var/datum/reagents/old_holder = holder + 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(holder && volume >= explosion_threshold) - if(holder.my_atom) - 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) + 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) 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) - if(holder) - holder.del_reagent(id) /datum/reagent/fuel/reaction_turf(turf/T, volume) //Don't spill the fuel, or you'll regret it if(isspaceturf(T)) @@ -149,10 +151,11 @@ /datum/reagent/plasma/reaction_temperature(exposed_temperature, exposed_volume) if(exposed_temperature >= T0C + 100) - fireflash(get_turf(holder.my_atom), min(max(0, volume / 10), 8)) - fire_flash_log(holder, id) + var/datum/reagents/old_holder = holder if(holder) - holder.del_reagent(id) + 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)) /datum/reagent/plasma/on_mob_life(mob/living/M) var/update_flags = STATUS_UPDATE_NONE @@ -439,10 +442,11 @@ /datum/reagent/plasma_dust/reaction_temperature(exposed_temperature, exposed_volume) if(exposed_temperature >= T0C + 100) - fireflash(get_turf(holder.my_atom), min(max(0, volume / 10), 8)) - fire_flash_log(holder, id) + var/datum/reagents/old_holder = holder if(holder) - holder.del_reagent(id) + 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)) /datum/reagent/plasma_dust/on_mob_life(mob/living/M) var/update_flags = STATUS_UPDATE_NONE