From fdb1d4aa7c35cb130c9d32e00aaf22e8e5e0ab2d Mon Sep 17 00:00:00 2001 From: Iajret Creature <122297233+Steals-The-PRs@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:27:09 +0300 Subject: [PATCH] [MIRROR] Removes remove_any from the game (#1497) (#2478) * Removes remove_any from the game (#82020) ## About The Pull Request Okay, so, turns out smoke machines, cigarettes, vapes and all sorts of things intentionally unmix your mixes. Why? For chaotic effects. Well sadly it just deletes chems from mixes and makes them completely useless. It also tends to have very little effect on deathmixes and moreso just gimps you ability to use them for healing. This is pretty bad, especially for machines like the smoke machine that are specifically intended for chemists. This PR entirely removes all uses of remove_any as well as the proc itself from the game. It's just bad. ## Why It's Good For The Game As it turns out, the game intentionally gimping your chem mixes just to fuck with you is bad. Especially when it's both obscure and not really all that fun for gameplay. ## Changelog :cl: balance: Smoke Machines, Showers, Vapes, etc will no longer arbitrarily delete a random amount of the chems they are processing /:cl: * Removes remove_any from the game * Update _cup.dm * Update towels.dm * Update shower.dm --------- Co-authored-by: NovaBot <154629622+NovaBot13@users.noreply.github.com> Co-authored-by: RikuTheKiller <88713943+RikuTheKiller@users.noreply.github.com> Co-authored-by: SomeRandomOwl <2568378+SomeRandomOwl@users.noreply.github.com> --- code/datums/components/food/ghost_edible.dm | 2 +- code/datums/elements/chewable.dm | 2 +- code/game/objects/items/cigs_lighters.dm | 12 ++--- code/game/objects/items/mop.dm | 2 +- code/game/objects/items/tanks/watertank.dm | 2 +- code/game/objects/structures/shower.dm | 4 +- code/game/objects/structures/watercloset.dm | 2 +- .../food_and_drinks/machinery/deep_fryer.dm | 2 +- .../mob/living/silicon/robot/robot_model.dm | 2 +- code/modules/plumbing/plumbers/destroyer.dm | 2 +- .../reagents/chemistry/holder/holder.dm | 45 ------------------- .../chemistry/machinery/smoke_machine.dm | 2 +- .../reagents/reagent_containers/cups/_cup.dm | 2 +- .../reagent_containers/cups/glassbottle.dm | 2 +- code/modules/research/experimentor.dm | 4 +- .../code/modules/clothing/towels.dm | 4 +- 16 files changed, 23 insertions(+), 68 deletions(-) diff --git a/code/datums/components/food/ghost_edible.dm b/code/datums/components/food/ghost_edible.dm index fb8a0c55559..0e3f3b3dd66 100644 --- a/code/datums/components/food/ghost_edible.dm +++ b/code/datums/components/food/ghost_edible.dm @@ -51,7 +51,7 @@ if (!prob(munch_chance)) return playsound(atom_parent.loc,'sound/items/eatfood.ogg', vol = rand(10,50), vary = TRUE) - atom_parent.reagents.remove_any(bite_consumption) + atom_parent.reagents.remove_all(bite_consumption) if (atom_parent.reagents.total_volume <= 0) atom_parent.visible_message(span_notice("[atom_parent] disappears completely!")) new /obj/item/ectoplasm(atom_parent.loc) diff --git a/code/datums/elements/chewable.dm b/code/datums/elements/chewable.dm index 21d546be6aa..d520597f431 100644 --- a/code/datums/elements/chewable.dm +++ b/code/datums/elements/chewable.dm @@ -52,7 +52,7 @@ var/metabolism_amount = metabolization_amount * seconds_per_tick if (!reagents.trans_to(item.loc, metabolism_amount, methods = INGEST)) - reagents.remove_any(metabolism_amount) + reagents.remove_all(metabolism_amount) /datum/element/chewable/proc/on_dropped(datum/source) SIGNAL_HANDLER diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index 1c8e5906a61..cea9daf9a16 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -349,18 +349,18 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(!istype(smoker)) // If not, check if it's a gas mask if(!istype(smoker, /obj/item/clothing/mask/gas)) - reagents.remove_any(to_smoke) + reagents.remove_all(to_smoke) return smoker = smoker.loc // If it is, check if that mask is on a carbon mob if(!istype(smoker) || smoker.get_item_by_slot(ITEM_SLOT_MASK) != loc) - reagents.remove_any(to_smoke) + reagents.remove_all(to_smoke) return else if(src != smoker.wear_mask) - reagents.remove_any(to_smoke) + reagents.remove_all(to_smoke) return reagents.expose(smoker, INGEST, min(to_smoke / reagents.total_volume, 1)) @@ -369,7 +369,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM var/smoker_resistance = HAS_TRAIT(smoker, TRAIT_SMOKER) ? 0.5 : 1 smoker.adjustOrganLoss(ORGAN_SLOT_LUNGS, lung_harm * smoker_resistance) if(!reagents.trans_to(smoker, to_smoke, methods = INGEST, ignore_stomach = TRUE)) - reagents.remove_any(to_smoke) + reagents.remove_all(to_smoke) /obj/item/clothing/mask/cigarette/process(seconds_per_tick) var/mob/living/user = isliving(loc) ? loc : null @@ -1172,7 +1172,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM var/mob/living/carbon/vaper = loc if(!iscarbon(vaper) || src != vaper.wear_mask) - reagents.remove_any(REAGENTS_METABOLISM) + reagents.remove_all(REAGENTS_METABOLISM) return if(reagents.get_reagent_amount(/datum/reagent/fuel)) @@ -1187,7 +1187,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM qdel(src) if(!reagents.trans_to(vaper, REAGENTS_METABOLISM, methods = INGEST, ignore_stomach = TRUE)) - reagents.remove_any(REAGENTS_METABOLISM) + reagents.remove_all(REAGENTS_METABOLISM) /obj/item/clothing/mask/vape/process(seconds_per_tick) var/mob/living/M = loc diff --git a/code/game/objects/items/mop.dm b/code/game/objects/items/mop.dm index 9528894232d..907807397d7 100644 --- a/code/game/objects/items/mop.dm +++ b/code/game/objects/items/mop.dm @@ -67,7 +67,7 @@ var/val2remove = 1 if(cleaner?.mind) val2remove = round(cleaner.mind.get_skill_modifier(/datum/skill/cleaning, SKILL_SPEED_MODIFIER), 0.1) - reagents.remove_any(val2remove) //reaction() doesn't use up the reagents + reagents.remove_all(val2remove) //reaction() doesn't use up the reagents /obj/item/mop/cyborg/Initialize(mapload) . = ..() diff --git a/code/game/objects/items/tanks/watertank.dm b/code/game/objects/items/tanks/watertank.dm index 29dcdbcf702..9950b8e9c93 100644 --- a/code/game/objects/items/tanks/watertank.dm +++ b/code/game/objects/items/tanks/watertank.dm @@ -304,7 +304,7 @@ balloon_alert(user, "still recharging!") return COOLDOWN_START(src, resin_cooldown, 10 SECONDS) - R.remove_any(100) + R.remove_all(100) var/obj/effect/resin_container/resin = new (get_turf(src)) user.log_message("used Resin Launcher", LOG_GAME) playsound(src,'sound/items/syringeproj.ogg',40,TRUE) diff --git a/code/game/objects/structures/shower.dm b/code/game/objects/structures/shower.dm index ab41615fd96..55bdf262c0b 100644 --- a/code/game/objects/structures/shower.dm +++ b/code/game/objects/structures/shower.dm @@ -123,7 +123,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/shower, (-16)) //NOVA EDIT ADDITION /obj/machinery/shower/plunger_act(obj/item/plunger/P, mob/living/user, reinforced) if(do_after(user, 3 SECONDS, src)) - reagents.remove_any(reagents.total_volume) + reagents.remove_all(reagents.total_volume) balloon_alert(user, "reservoir emptied") //NOVA EDIT END @@ -320,7 +320,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/shower, (-16)) if(!ismopable(movable_content)) // Mopables will be cleaned anyways by the turf wash above wash_atom(movable_content) // Reagent exposure is handled in wash_atom - reagents.remove_any(SHOWER_SPRAY_VOLUME) + reagents.remove_all(SHOWER_SPRAY_VOLUME) /obj/machinery/shower/on_deconstruction(disassembled = TRUE) new /obj/item/stack/sheet/iron(drop_location(), 2) diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index edf7f2fc803..eac58d119a8 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -362,7 +362,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/sink, (-14)) return busy = FALSE - reagents.remove_any(5) + reagents.remove_all(5) reagents.expose(user, TOUCH, 5 / max(reagents.total_volume, 5)) begin_reclamation() if(washing_face) diff --git a/code/modules/food_and_drinks/machinery/deep_fryer.dm b/code/modules/food_and_drinks/machinery/deep_fryer.dm index c9b9fca044b..ac6ae105456 100644 --- a/code/modules/food_and_drinks/machinery/deep_fryer.dm +++ b/code/modules/food_and_drinks/machinery/deep_fryer.dm @@ -224,7 +224,7 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list( cold_multiplier += round(target_temp * 1.5 / T0C, 0.01) dunking_target.apply_damage(min(30 * bio_multiplier * cold_multiplier, reagents.total_volume), BURN, BODY_ZONE_HEAD) if(reagents.reagent_list) //This can runtime if reagents has nothing in it. - reagents.remove_any((reagents.total_volume/2)) + reagents.remove_all((reagents.total_volume/2)) dunking_target.Paralyze(60) user.changeNext_move(CLICK_CD_MELEE) return ..() diff --git a/code/modules/mob/living/silicon/robot/robot_model.dm b/code/modules/mob/living/silicon/robot/robot_model.dm index 19661110133..651e7d622f7 100644 --- a/code/modules/mob/living/silicon/robot/robot_model.dm +++ b/code/modules/mob/living/silicon/robot/robot_model.dm @@ -628,7 +628,7 @@ reagents.expose(our_turf, TOUCH, min(1, 10 / reagents.total_volume)) // We use more water doing this then mopping - reagents.remove_any(2) //reaction() doesn't use up the reagents + reagents.remove_all(2) //reaction() doesn't use up the reagents /datum/action/toggle_buffer/update_button_name(atom/movable/screen/movable/action_button/current_button, force) if(buffer_on) diff --git a/code/modules/plumbing/plumbers/destroyer.dm b/code/modules/plumbing/plumbers/destroyer.dm index de03f03aa0f..9ba669818cf 100644 --- a/code/modules/plumbing/plumbers/destroyer.dm +++ b/code/modules/plumbing/plumbers/destroyer.dm @@ -18,7 +18,7 @@ if(reagents.total_volume) if(icon_state != initial(icon_state) + "_working") //threw it here instead of update icon since it only has two states icon_state = initial(icon_state) + "_working" - reagents.remove_any(disposal_rate * seconds_per_tick) + reagents.remove_all(disposal_rate * seconds_per_tick) use_power(active_power_usage * seconds_per_tick) else if(icon_state != initial(icon_state)) diff --git a/code/modules/reagents/chemistry/holder/holder.dm b/code/modules/reagents/chemistry/holder/holder.dm index 1d36747e8f4..3fe2e482f3e 100644 --- a/code/modules/reagents/chemistry/holder/holder.dm +++ b/code/modules/reagents/chemistry/holder/holder.dm @@ -259,51 +259,6 @@ return round(total_removed_amount, CHEMICAL_VOLUME_ROUNDING) -/** - * Removes a reagent at random and by a random quantity till the specified amount has been removed. - * Used to create a shower/spray effect for e.g. when you spill a bottle or turn a shower on - * and you want an chaotic effect of whatever coming out - * Arguments - * - * * amount- the volume to remove - */ -/datum/reagents/proc/remove_any(amount = 1) - if(!IS_FINITE(amount)) - stack_trace("non finite amount passed to remove any reagent [amount]") - return FALSE - - amount = round(amount, CHEMICAL_QUANTISATION_LEVEL) - if(amount <= 0) - return FALSE - - var/list/cached_reagents = reagent_list - var/total_removed = 0 - var/current_list_element = 1 - var/initial_list_length = cached_reagents.len //stored here because removing can cause some reagents to be deleted, ergo length change. - - current_list_element = rand(1, cached_reagents.len) - - while(total_removed < amount) - // There's nothing left in the container - if(total_volume <= 0 || !cached_reagents.len) - break - - if(current_list_element > cached_reagents.len) - current_list_element = 1 - - var/datum/reagent/target_holder = cached_reagents[current_list_element] - var/remove_amt = min(amount - total_removed, round(amount / rand(2, initial_list_length), round(amount / 10, 0.01))) //double round to keep it at a somewhat even spread relative to amount without getting funky numbers. - // If the logic above means removing really tiny amounts (or even zero if it's a remove amount of 10) instead choose a sensible smallish number - // so this proc will actually finish instead of looping forever - remove_amt = max(CHEMICAL_VOLUME_ROUNDING, remove_amt) - remove_amt = remove_reagent(target_holder.type, remove_amt) - - current_list_element++ - total_removed += remove_amt - handle_reactions() - - return round(total_removed, CHEMICAL_VOLUME_ROUNDING) - /** * Removes all reagents either proportionally(amount is the direct volume to remove) * when proportional the total volume of all reagents removed will equal to amount diff --git a/code/modules/reagents/chemistry/machinery/smoke_machine.dm b/code/modules/reagents/chemistry/machinery/smoke_machine.dm index e91aea78d59..e9b920c20e5 100644 --- a/code/modules/reagents/chemistry/machinery/smoke_machine.dm +++ b/code/modules/reagents/chemistry/machinery/smoke_machine.dm @@ -22,7 +22,7 @@ src.location = get_turf(location) src.amount = amount carry?.copy_to(chemholder, 20) - carry?.remove_any(amount / efficiency) + carry?.remove_all(amount / efficiency) /// A factory which produces clouds of smoke for the smoke machine. /datum/effect_system/fluid_spread/smoke/chem/smoke_machine diff --git a/code/modules/reagents/reagent_containers/cups/_cup.dm b/code/modules/reagents/reagent_containers/cups/_cup.dm index 47fcc4ddda3..664b47e5bd6 100644 --- a/code/modules/reagents/reagent_containers/cups/_cup.dm +++ b/code/modules/reagents/reagent_containers/cups/_cup.dm @@ -418,7 +418,7 @@ if(reagents.total_volume == reagents.maximum_volume) user.balloon_alert(user, "mop is full!") return - mop.reagents.remove_any(mop.reagents.total_volume * SQUEEZING_DISPERSAL_RATIO) + mop.reagents.remove_all(mop.reagents.total_volume * SQUEEZING_DISPERSAL_RATIO) mop.reagents.trans_to(src, mop.reagents.total_volume, transferred_by = user) user.balloon_alert(user, "mop squeezed") else diff --git a/code/modules/reagents/reagent_containers/cups/glassbottle.dm b/code/modules/reagents/reagent_containers/cups/glassbottle.dm index 9deb6582508..a69810ca954 100644 --- a/code/modules/reagents/reagent_containers/cups/glassbottle.dm +++ b/code/modules/reagents/reagent_containers/cups/glassbottle.dm @@ -144,7 +144,7 @@ return var/amount_lost = intensity * 5 - reagents.remove_any(amount_lost) + reagents.remove_all(amount_lost) visible_message(span_warning("Some of [name]'s contents are let loose!")) var/intensity_state = null diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 10ed939c55b..04f24637e08 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -351,7 +351,7 @@ playsound(src, 'sound/machines/ding.ogg', 50, TRUE) var/obj/item/reagent_containers/cup/glass/coffee/C = new /obj/item/reagent_containers/cup/glass/coffee(get_turf(pick(oview(1,src)))) chosenchem = pick(/datum/reagent/toxin/plasma,/datum/reagent/consumable/capsaicin,/datum/reagent/consumable/ethanol) - C.reagents.remove_any(25) + C.reagents.remove_all(25) C.reagents.add_reagent(chosenchem , 50) C.name = "Cup of Suspicious Liquid" C.desc = "It has a large hazard symbol printed on the side in fading ink." @@ -395,7 +395,7 @@ var/obj/item/reagent_containers/cup/glass/coffee/C = new /obj/item/reagent_containers/cup/glass/coffee(get_turf(pick(oview(1,src)))) playsound(src, 'sound/machines/ding.ogg', 50, TRUE) //Ding! Your death coffee is ready! chosenchem = pick(/datum/reagent/uranium,/datum/reagent/consumable/frostoil,/datum/reagent/medicine/ephedrine) - C.reagents.remove_any(25) + C.reagents.remove_all(25) C.reagents.add_reagent(chosenchem , 50) C.name = "Cup of Suspicious Liquid" C.desc = "It has a large hazard symbol printed on the side in fading ink." diff --git a/modular_nova/master_files/code/modules/clothing/towels.dm b/modular_nova/master_files/code/modules/clothing/towels.dm index 2712db1a267..4534370808a 100644 --- a/modular_nova/master_files/code/modules/clothing/towels.dm +++ b/modular_nova/master_files/code/modules/clothing/towels.dm @@ -315,7 +315,7 @@ . = ..() // This isn't really needed, but I'm including it in case we ever get dyeable towels. // Washing allows you to remove all reagents from a towel, so it comes out clean! - reagents.remove_any(reagents.total_volume) + reagents.remove_all(reagents.total_volume) set_wet(FALSE, FALSE) make_used(null, silent = TRUE) @@ -459,7 +459,7 @@ reagents.trans_to(target, amount * (1 - loss_factor), no_react = TRUE, transferred_by = user) if(loss_factor && reagents.total_volume) - reagents.remove_any(amount * loss_factor) + reagents.remove_all(amount * loss_factor) if(!reagents.total_volume) set_wet(FALSE, !make_used)