From 01080dfe0a445e7d4aa65c40306e4c0aa0a57cb2 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 7 Jan 2022 21:23:12 +0100 Subject: [PATCH] [MIRROR] Makes sure COMSIG_ATOM_EX_ACT is always called. [MDB IGNORE] (#10498) * Makes sure COMSIG_ATOM_EX_ACT is always called. (#63685) Creates a wrapper macro for ex_act() and moves the signal and contents explosion calls to there. This way we can ensure the signal is always fired. Also desnowflakes reagents responding to explosions. Ensures that a signal is always called when the attendant proc is called. * Makes sure COMSIG_ATOM_EX_ACT is always called. Co-authored-by: TemporalOroboros --- .../signals_atom/signals_atom_x_act.dm | 2 +- code/__DEFINES/explosions.dm | 16 +++++ code/controllers/subsystem/explosions.dm | 12 ++-- code/datums/components/explodable.dm | 60 ++++++++++++------- code/datums/martial/wrestling.dm | 6 +- code/datums/materials/basemats.dm | 2 +- code/game/atoms.dm | 6 +- code/game/machinery/syndicatebomb.dm | 1 + code/game/objects/effects/decals/cleanable.dm | 6 -- .../objects/items/devices/chameleonproj.dm | 1 - code/game/objects/items/grenades/grenade.dm | 4 +- code/game/objects/items/grenades/plastic.dm | 2 +- .../game/turfs/open/floor/plating/asteroid.dm | 3 +- .../turfs/open/floor/plating/misc_plating.dm | 2 +- code/game/turfs/open/floor/reinf_floor.dm | 1 - code/game/turfs/open/lava.dm | 2 +- code/modules/events/immovable_rod.dm | 2 +- code/modules/meteors/meteors.dm | 2 +- .../simple_animal/guardian/types/explosive.dm | 2 +- .../hostile/megafauna/demonic_frost_miner.dm | 4 +- code/modules/reagents/chemistry/holder.dm | 4 +- code/modules/reagents/chemistry/reagents.dm | 7 +-- .../chemistry/reagents/alcohol_reagents.dm | 4 ++ .../chemistry/reagents/food_reagents.dm | 3 + .../impure_medicine_reagents.dm | 4 +- .../chemistry/reagents/other_reagents.dm | 1 + .../reagents/pyrotechnic_reagents.dm | 15 ++++- .../chemistry/reagents/unique/eigenstasium.dm | 3 + code/modules/reagents/reagent_containers.dm | 7 --- 29 files changed, 113 insertions(+), 71 deletions(-) diff --git a/code/__DEFINES/dcs/signals/signals_atom/signals_atom_x_act.dm b/code/__DEFINES/dcs/signals/signals_atom/signals_atom_x_act.dm index 32a9f040228..33b279cc3f8 100644 --- a/code/__DEFINES/dcs/signals/signals_atom/signals_atom_x_act.dm +++ b/code/__DEFINES/dcs/signals/signals_atom/signals_atom_x_act.dm @@ -2,7 +2,7 @@ // When the signal is called: (signal arguments) // All signals send the source datum of the signal as the first argument -///from base of atom/ex_act(): (severity, target) +///from the [EX_ACT] wrapper macro: (severity, target) #define COMSIG_ATOM_EX_ACT "atom_ex_act" ///from base of atom/emp_act(): (severity) #define COMSIG_ATOM_EMP_ACT "atom_emp_act" diff --git a/code/__DEFINES/explosions.dm b/code/__DEFINES/explosions.dm index b5d4c8b6b2c..f8ecf51267c 100644 --- a/code/__DEFINES/explosions.dm +++ b/code/__DEFINES/explosions.dm @@ -8,6 +8,14 @@ /// The default explosion severity used to mark that an object is beyond the impact range of the explosion. #define EXPLODE_NONE 0 +/// A wrapper for [/atom/proc/ex_act] to ensure that the explosion propagation and attendant signal are always handled. +#define EX_ACT(target, args...)\ + if(!(target.flags_1 & PREVENT_CONTENTS_EXPLOSION_1)) { \ + target.contents_explosion(##args);\ + };\ + SEND_SIGNAL(target, COMSIG_ATOM_EX_ACT, ##args);\ + target.ex_act(##args); + // Internal explosion argument list keys. // Must match the arguments to [/datum/controller/subsystem/explosions/proc/propagate_blastwave] /// The origin atom of the explosion. @@ -32,3 +40,11 @@ #define EXARG_KEY_SILENT STRINGIFY(silent) /// Whether or not the explosion should produce smoke if it is large enough to warrant it. #define EXARG_KEY_SMOKE STRINGIFY(smoke) + +// Explodable component deletion values +/// Makes the explodable component queue to reset its exploding status when it detonates. +#define EXPLODABLE_NO_DELETE 0 +/// Makes the explodable component delete itself when it detonates. +#define EXPLODABLE_DELETE_SELF 1 +/// Makes the explodable component delete its parent when it detonates. +#define EXPLODABLE_DELETE_PARENT 2 diff --git a/code/controllers/subsystem/explosions.dm b/code/controllers/subsystem/explosions.dm index b10f1dab7b3..5ca49e5a91a 100644 --- a/code/controllers/subsystem/explosions.dm +++ b/code/controllers/subsystem/explosions.dm @@ -646,7 +646,7 @@ SUBSYSTEM_DEF(explosions) lowturf = list() for(var/thing in low_turf) var/turf/turf_thing = thing - turf_thing.ex_act(EXPLODE_LIGHT) + EX_ACT(turf_thing, EXPLODE_LIGHT) cost_lowturf = MC_AVERAGE(cost_lowturf, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) timer = TICK_USAGE_REAL @@ -654,7 +654,7 @@ SUBSYSTEM_DEF(explosions) medturf = list() for(var/thing in med_turf) var/turf/turf_thing = thing - turf_thing.ex_act(EXPLODE_HEAVY) + EX_ACT(turf_thing, EXPLODE_HEAVY) cost_medturf = MC_AVERAGE(cost_medturf, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) timer = TICK_USAGE_REAL @@ -662,7 +662,7 @@ SUBSYSTEM_DEF(explosions) highturf = list() for(var/thing in high_turf) var/turf/turf_thing = thing - turf_thing.ex_act(EXPLODE_DEVASTATE) + EX_ACT(turf_thing, EXPLODE_DEVASTATE) cost_highturf = MC_AVERAGE(cost_highturf, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) timer = TICK_USAGE_REAL @@ -687,7 +687,7 @@ SUBSYSTEM_DEF(explosions) var/atom/movable/movable_thing = thing if(QDELETED(movable_thing)) continue - movable_thing.ex_act(EXPLODE_DEVASTATE) + EX_ACT(movable_thing, EXPLODE_DEVASTATE) cost_high_mov_atom = MC_AVERAGE(cost_high_mov_atom, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) timer = TICK_USAGE_REAL @@ -697,7 +697,7 @@ SUBSYSTEM_DEF(explosions) var/atom/movable/movable_thing = thing if(QDELETED(movable_thing)) continue - movable_thing.ex_act(EXPLODE_HEAVY) + EX_ACT(movable_thing, EXPLODE_HEAVY) cost_med_mov_atom = MC_AVERAGE(cost_med_mov_atom, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) timer = TICK_USAGE_REAL @@ -707,7 +707,7 @@ SUBSYSTEM_DEF(explosions) var/atom/movable/movable_thing = thing if(QDELETED(movable_thing)) continue - movable_thing.ex_act(EXPLODE_LIGHT) + EX_ACT(movable_thing, EXPLODE_LIGHT) cost_low_mov_atom = MC_AVERAGE(cost_low_mov_atom, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) diff --git a/code/datums/components/explodable.dm b/code/datums/components/explodable.dm index bea54e3680b..1d7998e6aed 100644 --- a/code/datums/components/explodable.dm +++ b/code/datums/components/explodable.dm @@ -10,12 +10,16 @@ var/flame_range = 0 /// The flash range of the resulting explosion. var/flash_range = 3 + /// Whether this explosion ignores the bombcap. + var/uncapped + /// Whether we always delete. Useful for nukes turned plasma and such, so they don't default delete and can survive + var/delete_after /// For items, lets us determine where things should be hit. var/equipped_slot - /// Whether we always delete. Useful for nukes turned plasma and such, so they don't default delete and can survive - var/always_delete + /// Whether this component is currently in the process of exploding. + var/tmp/exploding = FALSE -/datum/component/explodable/Initialize(devastation_range_override, heavy_impact_range_override, light_impact_range_override, flame_range_override, flash_range_override, _always_delete = TRUE) +/datum/component/explodable/Initialize(devastation_range, heavy_impact_range, light_impact_range, flame_range, flash_range, uncapped = FALSE, delete_after = EXPLODABLE_DELETE_PARENT) if(!isatom(parent)) return COMPONENT_INCOMPATIBLE @@ -31,19 +35,18 @@ RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, .proc/on_equip) RegisterSignal(parent, COMSIG_ITEM_DROPPED, .proc/on_drop) - - - if(devastation_range_override) - devastation_range = devastation_range_override - if(heavy_impact_range_override) - heavy_impact_range = heavy_impact_range_override - if(light_impact_range_override) - light_impact_range = light_impact_range_override - if(flame_range_override) - flame_range = flame_range_override - if(flash_range_override) - flash_range = flash_range_override - always_delete = _always_delete + if (devastation_range) + src.devastation_range = devastation_range + if (heavy_impact_range) + src.heavy_impact_range = heavy_impact_range + if (light_impact_range) + src.light_impact_range = light_impact_range + if (flame_range) + src.flame_range = flame_range + if (flash_range) + src.flash_range = flash_range + src.uncapped = uncapped + src.delete_after = delete_after /datum/component/explodable/proc/explodable_insert_item(datum/source, obj/item/I, mob/M, silent = FALSE, force = FALSE) SIGNAL_HANDLER @@ -134,11 +137,28 @@ /// Explode and remove the object /datum/component/explodable/proc/detonate() SIGNAL_HANDLER + if (exploding) + return // If we don't do this and this doesn't delete it can lock the MC into only processing Input, Timers, and Explosions. - var/atom/A = parent + var/atom/bomb = parent var/log = TRUE if(light_impact_range < 1) log = FALSE - explosion(A, devastation_range, heavy_impact_range, light_impact_range, flame_range, flash_range, log) //epic explosion time - if(always_delete) - qdel(A) + + exploding = TRUE + explosion(bomb, devastation_range, heavy_impact_range, light_impact_range, flame_range, flash_range, log, uncapped) //epic explosion time + + switch(delete_after) + if(EXPLODABLE_DELETE_SELF) + qdel(src) + if(EXPLODABLE_DELETE_PARENT) + qdel(bomb) + else + addtimer(CALLBACK(src, .proc/reset_exploding), 0.1 SECONDS) + +/** + * Resets the expoding flag + */ +/datum/component/explodable/proc/reset_exploding() + SIGNAL_HANDLER + src.exploding = FALSE diff --git a/code/datums/martial/wrestling.dm b/code/datums/martial/wrestling.dm index 1ae413053f1..d8c4d2b3063 100644 --- a/code/datums/martial/wrestling.dm +++ b/code/datums/martial/wrestling.dm @@ -305,11 +305,11 @@ If you make a derivative work from this code, you must include this notification if (2) D.adjustBruteLoss(rand(20,30)) if (3) - D.ex_act(EXPLODE_LIGHT) + EX_ACT(D, EXPLODE_LIGHT) else D.adjustBruteLoss(rand(10,20)) else - D.ex_act(EXPLODE_LIGHT) + EX_ACT(D, EXPLODE_LIGHT) else if (A) @@ -427,7 +427,7 @@ If you make a derivative work from this code, you must include this notification if (falling == 1) if (prob(33) || D.stat) - D.ex_act(EXPLODE_LIGHT) + EX_ACT(D, EXPLODE_LIGHT) else D.adjustBruteLoss(rand(20,30)) else diff --git a/code/datums/materials/basemats.dm b/code/datums/materials/basemats.dm index ffd2da5b1d0..a974b67e373 100644 --- a/code/datums/materials/basemats.dm +++ b/code/datums/materials/basemats.dm @@ -138,7 +138,7 @@ Unless you know what you're doing, only use the first three numbers. They're in if(ismovable(source)) source.AddElement(/datum/element/firestacker, amount=1) // Ideally exploding plasma objects should delete themselves but we still have the flooder and SSexplosions to rely on deleting it asynchronously so it's not that bad. - source.AddComponent(/datum/component/explodable, 0, 0, amount / 2500, 0, amount / 1250, FALSE) + source.AddComponent(/datum/component/explodable, 0, 0, amount / 2500, 0, amount / 1250, delete_after = EXPLODABLE_NO_DELETE) source.AddComponent(/datum/component/combustible_flooder, "plasma", amount*0.05) //Empty temp arg, fully dependent on whatever ignited it. /datum/material/plasma/on_removed(atom/source, amount, material_flags) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index e85595f21f0..5428ea41af2 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -801,12 +801,12 @@ /** * React to being hit by an explosion * - * Default behaviour is to call [contents_explosion][/atom/proc/contents_explosion] and send the [COMSIG_ATOM_EX_ACT] signal + * Should be called through the [EX_ACT] wrapper macro. + * The wrapper takes care of the [COMSIG_ATOM_EX_ACT] signal. + * as well as calling [/atom/proc/contents_explosion]. */ /atom/proc/ex_act(severity, target) set waitfor = FALSE - contents_explosion(severity, target) - SEND_SIGNAL(src, COMSIG_ATOM_EX_ACT, severity, target) /** * React to a hit by a blob objecd diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index b21419aff0e..560e70655e1 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -278,6 +278,7 @@ lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi' w_class = WEIGHT_CLASS_NORMAL + flags_1 = PREVENT_CONTENTS_EXPLOSION_1 // We detonate upon being exploded. resistance_flags = FLAMMABLE //Burnable (but the casing isn't) var/adminlog = null //SKYRAT EDIT CHANGE BEGIN diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index aa356fe7715..d3438718af4 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -73,12 +73,6 @@ else return ..() -/obj/effect/decal/cleanable/ex_act(severity) - if(reagents) - for(var/datum/reagent/R in reagents.reagent_list) - R.on_ex_act(severity) - return ..() - /obj/effect/decal/cleanable/fire_act(exposed_temperature, exposed_volume) if(reagents) reagents.expose_temperature(exposed_temperature) diff --git a/code/game/objects/items/devices/chameleonproj.dm b/code/game/objects/items/devices/chameleonproj.dm index 860cf203ead..02c8a194e51 100644 --- a/code/game/objects/items/devices/chameleonproj.dm +++ b/code/game/objects/items/devices/chameleonproj.dm @@ -146,7 +146,6 @@ master.disrupt() /obj/effect/dummy/chameleon/ex_act(S, T) - contents_explosion(S, T) master.disrupt() /obj/effect/dummy/chameleon/bullet_act() diff --git a/code/game/objects/items/grenades/grenade.dm b/code/game/objects/items/grenades/grenade.dm index 7c07fa98112..23312d097ab 100644 --- a/code/game/objects/items/grenades/grenade.dm +++ b/code/game/objects/items/grenades/grenade.dm @@ -13,7 +13,7 @@ righthand_file = 'icons/mob/inhands/equipment/security_righthand.dmi' throw_speed = 3 throw_range = 7 - flags_1 = CONDUCT_1 + flags_1 = CONDUCT_1 | PREVENT_CONTENTS_EXPLOSION_1 // We detonate upon being exploded. slot_flags = ITEM_SLOT_BELT resistance_flags = FLAMMABLE max_integrity = 40 @@ -192,7 +192,7 @@ log_game("A projectile ([hitby]) detonated a grenade held by [key_name(owner)] at [COORD(source_turf)]") message_admins("A projectile ([hitby]) detonated a grenade held by [key_name_admin(owner)] at [ADMIN_COORDJMP(source_turf)]") detonate() - + if(!QDELETED(src)) // some grenades don't detonate but we want them destroyed qdel(src) return TRUE //It hit the grenade, not them diff --git a/code/game/objects/items/grenades/plastic.dm b/code/game/objects/items/grenades/plastic.dm index 3e964a44ecc..89ad58bf1a1 100644 --- a/code/game/objects/items/grenades/plastic.dm +++ b/code/game/objects/items/grenades/plastic.dm @@ -53,7 +53,7 @@ location = get_turf(target) target.cut_overlay(plastic_overlay, TRUE) if(!ismob(target) || full_damage_on_mobs) - target.ex_act(EXPLODE_HEAVY, target) + EX_ACT(target, EXPLODE_HEAVY, target) else location = get_turf(src) if(location) diff --git a/code/game/turfs/open/floor/plating/asteroid.dm b/code/game/turfs/open/floor/plating/asteroid.dm index add00eb5212..7ba63bb41ec 100644 --- a/code/game/turfs/open/floor/plating/asteroid.dm +++ b/code/game/turfs/open/floor/plating/asteroid.dm @@ -84,8 +84,7 @@ SEND_SIGNAL(W, COMSIG_PARENT_ATTACKBY, O) /turf/open/floor/plating/asteroid/ex_act(severity, target) - . = SEND_SIGNAL(src, COMSIG_ATOM_EX_ACT, severity, target) - contents_explosion(severity, target) + return /turf/open/floor/plating/lavaland_baseturf baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface diff --git a/code/game/turfs/open/floor/plating/misc_plating.dm b/code/game/turfs/open/floor/plating/misc_plating.dm index 42384396cde..e8a13b450ab 100644 --- a/code/game/turfs/open/floor/plating/misc_plating.dm +++ b/code/game/turfs/open/floor/plating/misc_plating.dm @@ -130,7 +130,7 @@ return /turf/open/floor/plating/beach/ex_act(severity, target) - contents_explosion(severity, target) + return /turf/open/floor/plating/beach/sand gender = PLURAL diff --git a/code/game/turfs/open/floor/reinf_floor.dm b/code/game/turfs/open/floor/reinf_floor.dm index 3b201bf6d65..15556d93d48 100644 --- a/code/game/turfs/open/floor/reinf_floor.dm +++ b/code/game/turfs/open/floor/reinf_floor.dm @@ -54,7 +54,6 @@ return ..() /turf/open/floor/engine/ex_act(severity, target) - contents_explosion(severity, target) if(target == src) ScrapeAway(flags = CHANGETURF_INHERIT_AIR) return TRUE diff --git a/code/game/turfs/open/lava.dm b/code/game/turfs/open/lava.dm index c7caef5b497..2414f8d1a6f 100644 --- a/code/game/turfs/open/lava.dm +++ b/code/game/turfs/open/lava.dm @@ -28,7 +28,7 @@ var/immunity_resistance_flags = LAVA_PROOF /turf/open/lava/ex_act(severity, target) - contents_explosion(severity, target) + return /turf/open/lava/MakeSlippery(wet_setting, min_wet_time, wet_time_to_add, max_wet_time, permanent) return diff --git a/code/modules/events/immovable_rod.dm b/code/modules/events/immovable_rod.dm index e309f87b448..9b8a0f0c769 100644 --- a/code/modules/events/immovable_rod.dm +++ b/code/modules/events/immovable_rod.dm @@ -257,7 +257,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 penetrated_chest?.receive_damage(60, wound_bonus = 20, sharpness=SHARP_POINTY) if(smeared_mob.density || prob(10)) - smeared_mob.ex_act(EXPLODE_HEAVY) + EX_ACT(smeared_mob, EXPLODE_HEAVY) /obj/effect/immovablerod/attack_hand(mob/living/user, list/modifiers) . = ..() diff --git a/code/modules/meteors/meteors.dm b/code/modules/meteors/meteors.dm index f4a4369ca32..f772830e5b8 100644 --- a/code/modules/meteors/meteors.dm +++ b/code/modules/meteors/meteors.dm @@ -314,7 +314,7 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust=1)) //for space dust eve new /obj/effect/decal/cleanable/blood(T) /obj/effect/meteor/meaty/Bump(atom/A) - A.ex_act(hitpwr) + EX_ACT(A, hitpwr) get_hit() //Meaty Ore Xeno edition diff --git a/code/modules/mob/living/simple_animal/guardian/types/explosive.dm b/code/modules/mob/living/simple_animal/guardian/types/explosive.dm index 5f551400331..b2afdbb9734 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/explosive.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/explosive.dm @@ -64,7 +64,7 @@ var/turf/T = get_turf(source) playsound(T,'sound/effects/explosion2.ogg', 200, TRUE) new /obj/effect/temp_visual/explosion(T) - explodee.ex_act(EXPLODE_HEAVY) + EX_ACT(explodee, EXPLODE_HEAVY) UNREGISTER_BOMB_SIGNALS(source) /mob/living/simple_animal/hostile/guardian/bomb/proc/disable(atom/A) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm index d6eaee8cf15..80381f13ae9 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm @@ -198,7 +198,7 @@ Difficulty: Extremely Hard /obj/projectile/colossus/frost_orb/on_hit(atom/target, blocked = FALSE) . = ..() if(isturf(target) || isobj(target)) - target.ex_act(EXPLODE_HEAVY) + EX_ACT(target, EXPLODE_HEAVY) /obj/projectile/colossus/snowball name = "machine-gun snowball" @@ -220,7 +220,7 @@ Difficulty: Extremely Hard /obj/projectile/colossus/ice_blast/on_hit(atom/target, blocked = FALSE) . = ..() if(isturf(target) || isobj(target)) - target.ex_act(EXPLODE_HEAVY) + EX_ACT(target, EXPLODE_HEAVY) /obj/item/resurrection_crystal name = "resurrection crystal" diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 0e22a00b995..216e6d06edf 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -242,9 +242,7 @@ new_reagent.purity = added_purity new_reagent.creation_purity = added_purity new_reagent.ph = added_ph - if(data) - new_reagent.data = data - new_reagent.on_new(data) + new_reagent.on_new(data) if(isliving(my_atom)) new_reagent.on_mob_add(my_atom, amount) //Must occur before it could posibly run on_mob_delete diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 7df0060cd79..20487ae2c68 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -209,7 +209,8 @@ Primarily used in reagents/reaction_agents /// Called after add_reagents creates a new reagent. /datum/reagent/proc/on_new(data) - return + if(data) + src.data = data /// Called when two reagents of the same are mixing. /datum/reagent/proc/on_merge(data, amount) @@ -219,10 +220,6 @@ Primarily used in reagents/reaction_agents /datum/reagent/proc/on_update(atom/A) return -/// Called when the reagent container is hit by an explosion -/datum/reagent/proc/on_ex_act(severity) - return - /// Called if the reagent has passed the overdose threshold and is set to be triggering overdose effects /datum/reagent/proc/overdose_process(mob/living/M, delta_time, times_fired) return diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index 49dac36147a..290e806bc0b 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -2176,6 +2176,10 @@ All effects don't start immediately, but rather get worse over time; the rate is ph = 4 /datum/reagent/consumable/ethanol/fruit_wine/on_new(list/data) + if(!data) + return + + src.data = data names = data["names"] tastes = data["tastes"] boozepwr = data["boozepwr"] diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index cd312f2e401..31d827f8fd0 100644 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -73,6 +73,9 @@ ..() /datum/reagent/consumable/nutriment/on_new(list/supplied_data) + . = ..() + if(!data) + return // taste data can sometimes be ("salt" = 3, "chips" = 1) // and we want it to be in the form ("salt" = 0.75, "chips" = 0.25) // which is called "normalizing" diff --git a/code/modules/reagents/chemistry/reagents/impure_reagents/impure_medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/impure_reagents/impure_medicine_reagents.dm index c3d88ea84d0..635493a564f 100644 --- a/code/modules/reagents/chemistry/reagents/impure_reagents/impure_medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/impure_reagents/impure_medicine_reagents.dm @@ -278,8 +278,10 @@ Basically, we fill the time between now and 2s from now with hands based off the ..() /datum/reagent/inverse/hercuri/on_new(data) + . = ..() + if(!data) + return method |= data["method"] - ..() /datum/reagent/inverse/hercuri/on_mob_life(mob/living/carbon/owner, delta_time, times_fired) var/heating = rand(creation_purity * REM * 3, creation_purity * REM * 6) diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 4ee7daff03b..0d469e425dd 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -42,6 +42,7 @@ /datum/reagent/blood/on_new(list/data) + . = ..() if(istype(data)) SetViruses(src, data) diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm index dfd05e322c7..6c802c1c16b 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm @@ -107,6 +107,16 @@ taste_description = "salt" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED +/datum/reagent/gunpowder/on_new(data) + . = ..() + if(holder?.my_atom) + RegisterSignal(holder.my_atom, COMSIG_ATOM_EX_ACT, .proc/on_ex_act) + +/datum/reagent/gunpowder/Destroy() + if(holder?.my_atom) + UnregisterSignal(holder.my_atom, COMSIG_ATOM_EX_ACT) + return ..() + /datum/reagent/gunpowder/on_mob_life(mob/living/carbon/M, delta_time, times_fired) . = TRUE ..() @@ -116,7 +126,10 @@ if(M.hallucination < volume) M.hallucination += 5 * REM * delta_time -/datum/reagent/gunpowder/on_ex_act() +/datum/reagent/gunpowder/proc/on_ex_act(atom/source, severity, target) + SIGNAL_HANDLER + if(source.flags_1 & PREVENT_CONTENTS_EXPLOSION_1) + return var/location = get_turf(holder.my_atom) var/datum/effect_system/reagents_explosion/e = new() e.set_up(1 + round(volume/6, 1), location, 0, 0, message = 0) diff --git a/code/modules/reagents/chemistry/reagents/unique/eigenstasium.dm b/code/modules/reagents/chemistry/reagents/unique/eigenstasium.dm index f3975f6cd92..5af92d00c87 100644 --- a/code/modules/reagents/chemistry/reagents/unique/eigenstasium.dm +++ b/code/modules/reagents/chemistry/reagents/unique/eigenstasium.dm @@ -33,6 +33,9 @@ var/turf/open/location_return = null /datum/reagent/eigenstate/on_new(list/data) + . = ..() + if(!data) + return location_created = data["location_created"] /datum/reagent/eigenstate/expose_mob(mob/living/living_mob, methods, reac_volume, show_message, touch_protection) diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 9dbcc9c9ec0..8977ad0e258 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -194,13 +194,6 @@ return ..() -/obj/item/reagent_containers/ex_act(severity) - if(reagents) - for(var/datum/reagent/R in reagents.reagent_list) - R.on_ex_act(severity) - if(!QDELETED(src)) - return ..() - /obj/item/reagent_containers/fire_act(exposed_temperature, exposed_volume) reagents.expose_temperature(exposed_temperature) ..()