From 56b3c415cddff686644e299ee3582c869f078aac Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 17 Feb 2023 04:43:43 +0100 Subject: [PATCH] [MIRROR] Made assembly bombs unable to multignite [MDB IGNORE] (#19387) * Made assembly bombs unable to multignite (#73446) Added stack traces for multignition events Also moves the tank procs into the tanks file from bomb because I can and I hate the previous organisation * Made assembly bombs unable to multignite --------- Co-authored-by: oranges --- code/game/objects/items/tanks/tanks.dm | 72 +++++++++++++++++++++++++- code/modules/assembly/bomb.dm | 63 ---------------------- 2 files changed, 71 insertions(+), 64 deletions(-) diff --git a/code/game/objects/items/tanks/tanks.dm b/code/game/objects/items/tanks/tanks.dm index 1e18f1591e7..7b768070209 100644 --- a/code/game/objects/items/tanks/tanks.dm +++ b/code/game/objects/items/tanks/tanks.dm @@ -28,6 +28,8 @@ actions_types = list(/datum/action/item_action/set_internals) armor_type = /datum/armor/item_tank integrity_failure = 0.5 + /// If we are in the process of exploding, stops multi explosions + var/igniting = FALSE /// The gases this tank contains. Don't modify this directly, use return_air() to get it instead var/datum/gas_mixture/air_contents = null /// The volume of this tank. Among other things gas tank explosions (including TTVs) scale off of this. Be sure to account for that if you change this or you will break ~~toxins~~ordinance. @@ -119,8 +121,8 @@ return /obj/item/tank/Destroy() - air_contents = null STOP_PROCESSING(SSobj, src) + air_contents = null return ..() /obj/item/tank/examine(mob/user) @@ -359,4 +361,72 @@ /obj/item/tank/proc/explosion_information() return list(TANK_RESULTS_REACTION = reaction_info, TANK_RESULTS_MISC = explosion_info) +/obj/item/tank/proc/ignite() //This happens when a bomb is told to explode + if(igniting) + stack_trace("Attempted to ignite a /obj/item/tank multiple times") + return //no double ignite + igniting = TRUE + // This is done in return_air call, but even then it actually makes zero sense, this tank is going to be deleted + // before ever getting a chance to process. + //START_PROCESSING(SSobj, src) + var/datum/gas_mixture/our_mix = return_air() + + our_mix.assert_gases(/datum/gas/plasma, /datum/gas/oxygen) + var/fuel_moles = our_mix.gases[/datum/gas/plasma][MOLES] + our_mix.gases[/datum/gas/oxygen][MOLES]/6 + our_mix.garbage_collect() + var/datum/gas_mixture/bomb_mixture = our_mix.copy() + var/strength = 1 + + var/turf/ground_zero = get_turf(loc) + + if(bomb_mixture.temperature > (T0C + 400)) + strength = (fuel_moles/15) + + if(strength >= 2) + explosion(ground_zero, devastation_range = round(strength,1), heavy_impact_range = round(strength*2,1), light_impact_range = round(strength*3,1), flash_range = round(strength*4,1), explosion_cause = src) + else if(strength >= 1) + explosion(ground_zero, devastation_range = round(strength,1), heavy_impact_range = round(strength*2,1), light_impact_range = round(strength*2,1), flash_range = round(strength*3,1), explosion_cause = src) + else if(strength >= 0.5) + explosion(ground_zero, heavy_impact_range = 1, light_impact_range = 2, flash_range = 4, explosion_cause = src) + else if(strength >= 0.2) + explosion(ground_zero, devastation_range = -1, light_impact_range = 1, flash_range = 2, explosion_cause = src) + else + ground_zero.assume_air(bomb_mixture) + ground_zero.hotspot_expose(1000, 125) + + else if(bomb_mixture.temperature > (T0C + 250)) + strength = (fuel_moles/20) + + if(strength >= 1) + explosion(ground_zero, heavy_impact_range = round(strength,1), light_impact_range = round(strength*2,1), flash_range = round(strength*3,1), explosion_cause = src) + else if(strength >= 0.5) + explosion(ground_zero, devastation_range = -1, light_impact_range = 1, flash_range = 2, explosion_cause = src) + else + ground_zero.assume_air(bomb_mixture) + ground_zero.hotspot_expose(1000, 125) + + else if(bomb_mixture.temperature > (T0C + 100)) + strength = (fuel_moles/25) + + if(strength >= 1) + explosion(ground_zero, devastation_range = -1, light_impact_range = round(strength,1), flash_range = round(strength*3,1), explosion_cause = src) + else + ground_zero.assume_air(bomb_mixture) + ground_zero.hotspot_expose(1000, 125) + + else + ground_zero.assume_air(bomb_mixture) + ground_zero.hotspot_expose(1000, 125) + + if(master) + qdel(master) + qdel(src) + +/obj/item/tank/proc/release() //This happens when the bomb is not welded. Tank contents are just spat out. + var/datum/gas_mixture/our_mix = return_air() + var/datum/gas_mixture/removed = remove_air(our_mix.total_moles()) + var/turf/T = get_turf(src) + if(!T) + return + T.assume_air(removed) #undef ASSUME_AIR_DT_FACTOR diff --git a/code/modules/assembly/bomb.dm b/code/modules/assembly/bomb.dm index 6ffe77d20a9..0153c121d45 100644 --- a/code/modules/assembly/bomb.dm +++ b/code/modules/assembly/bomb.dm @@ -148,69 +148,6 @@ to_chat(user, span_notice("You attach [assembly] to [src].")) return -/obj/item/tank/proc/ignite() //This happens when a bomb is told to explode - START_PROCESSING(SSobj, src) - var/datum/gas_mixture/our_mix = return_air() - - our_mix.assert_gases(/datum/gas/plasma, /datum/gas/oxygen) - var/fuel_moles = our_mix.gases[/datum/gas/plasma][MOLES] + our_mix.gases[/datum/gas/oxygen][MOLES]/6 - our_mix.garbage_collect() - var/datum/gas_mixture/bomb_mixture = our_mix.copy() - var/strength = 1 - - var/turf/ground_zero = get_turf(loc) - - if(bomb_mixture.temperature > (T0C + 400)) - strength = (fuel_moles/15) - - if(strength >= 2) - explosion(ground_zero, devastation_range = round(strength,1), heavy_impact_range = round(strength*2,1), light_impact_range = round(strength*3,1), flash_range = round(strength*4,1), explosion_cause = src) - else if(strength >= 1) - explosion(ground_zero, devastation_range = round(strength,1), heavy_impact_range = round(strength*2,1), light_impact_range = round(strength*2,1), flash_range = round(strength*3,1), explosion_cause = src) - else if(strength >= 0.5) - explosion(ground_zero, heavy_impact_range = 1, light_impact_range = 2, flash_range = 4, explosion_cause = src) - else if(strength >= 0.2) - explosion(ground_zero, devastation_range = -1, light_impact_range = 1, flash_range = 2, explosion_cause = src) - else - ground_zero.assume_air(bomb_mixture) - ground_zero.hotspot_expose(1000, 125) - - else if(bomb_mixture.temperature > (T0C + 250)) - strength = (fuel_moles/20) - - if(strength >= 1) - explosion(ground_zero, heavy_impact_range = round(strength,1), light_impact_range = round(strength*2,1), flash_range = round(strength*3,1), explosion_cause = src) - else if(strength >= 0.5) - explosion(ground_zero, devastation_range = -1, light_impact_range = 1, flash_range = 2, explosion_cause = src) - else - ground_zero.assume_air(bomb_mixture) - ground_zero.hotspot_expose(1000, 125) - - else if(bomb_mixture.temperature > (T0C + 100)) - strength = (fuel_moles/25) - - if(strength >= 1) - explosion(ground_zero, devastation_range = -1, light_impact_range = round(strength,1), flash_range = round(strength*3,1), explosion_cause = src) - else - ground_zero.assume_air(bomb_mixture) - ground_zero.hotspot_expose(1000, 125) - - else - ground_zero.assume_air(bomb_mixture) - ground_zero.hotspot_expose(1000, 125) - - if(master) - qdel(master) - qdel(src) - -/obj/item/tank/proc/release() //This happens when the bomb is not welded. Tank contents are just spat out. - var/datum/gas_mixture/our_mix = return_air() - var/datum/gas_mixture/removed = remove_air(our_mix.total_moles()) - var/turf/T = get_turf(src) - if(!T) - return - T.assume_air(removed) - /obj/item/onetankbomb/return_analyzable_air() if(bombtank) return bombtank.return_analyzable_air()