From 59dd02fe7cd54b4153b294ccb965249c587f189d Mon Sep 17 00:00:00 2001 From: san7890 Date: Fri, 9 Jun 2023 00:25:10 -0600 Subject: [PATCH] Welding Fuel Tanks now log_bomber when hit by projectile (#75885) ## About The Pull Request This was intended behavior, but I think a lot of bullshit over the years sorta corrupted this proc's intention. Anyways, we just override the whole ass proc for this one check, give a good return value (or at least the same one that we were always giving) if our criteria is met, rather than deal with the problems that parent was feeding us. ![image](https://github.com/tgstation/tgstation/assets/34697715/e2b39140-d365-43aa-8834-2740f9fa5036) The specific issue here was that the parent of `bullet_act()` was invoking `take_damage()` which prematurely invoked `boom()` which invokes `qdel()`, meaning that the `QDELETED()` check would _always_ early return without fail every time. Let's just do our own thing here. ## Why It's Good For The Game ![image](https://github.com/tgstation/tgstation/assets/34697715/ca8fdeba-9f5d-4bed-afba-88824d389cfb) Intended behavior actually works. ## Changelog :cl: admin: Shooting a welding fuel tank (big or small) with a projectile will now accurately post to list_bombers with the name of the person who shot the projectile from the gun. If you don't know how to list-bombers, it will also be present in game.log for your viewing pleasure. /:cl: --- code/modules/reagents/reagent_dispenser.dm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index 9136b3ccc01..4fabe682f1b 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -155,6 +155,8 @@ * Other dispensers will scatter their contents within range. */ /obj/structure/reagent_dispensers/proc/boom() + if(QDELETED(src)) + return // little bit of sanity sauce before we wreck ourselves somehow var/datum/reagent/fuel/volatiles = reagents.has_reagent(/datum/reagent/fuel) var/fuel_amt = 0 if(istype(volatiles) && volatiles.volume >= 25) @@ -264,14 +266,15 @@ if(ZAP_OBJ_DAMAGE & zap_flags) boom() -/obj/structure/reagent_dispensers/fueltank/bullet_act(obj/projectile/P) - . = ..() - if(QDELETED(src)) //wasn't deleted by the projectile's effects. - return - - if(P.damage > 0 && ((P.damage_type == BURN) || (P.damage_type == BRUTE))) - log_bomber(P.firer, "detonated a", src, "via projectile") +/obj/structure/reagent_dispensers/fueltank/bullet_act(obj/projectile/hitting_projectile) + if(hitting_projectile.damage > 0 && ((hitting_projectile.damage_type == BURN) || (hitting_projectile.damage_type == BRUTE))) + log_bomber(hitting_projectile.firer, "detonated a", src, "via projectile") boom() + return hitting_projectile.on_hit(src, 0) + + // we override parent like this because otherwise we won't actually properly log the fact that a projectile caused this welding tank to explode. + // if this sucks, feel free to change it, but make sure the damn thing will log. thanks. + return ..() /obj/structure/reagent_dispensers/fueltank/attackby(obj/item/I, mob/living/user, params) if(I.tool_behaviour == TOOL_WELDER)