Skip to content

Commit

Permalink
[MIRROR] Removes remove_any from the game (#1497) (#2478)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: RikuTheKiller <[email protected]>
Co-authored-by: SomeRandomOwl <[email protected]>
  • Loading branch information
4 people authored Mar 20, 2024
1 parent 9821458 commit fdb1d4a
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 68 deletions.
2 changes: 1 addition & 1 deletion code/datums/components/food/ghost_edible.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/elements/chewable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions code/game/objects/items/cigs_lighters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down Expand Up @@ -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))
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/mop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/tanks/watertank.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/structures/shower.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/watercloset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/food_and_drinks/machinery/deep_fryer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/robot/robot_model.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/plumbing/plumbers/destroyer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
45 changes: 0 additions & 45 deletions code/modules/reagents/chemistry/holder/holder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/machinery/smoke_machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/reagent_containers/cups/_cup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/modules/research/experimentor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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."
Expand Down
4 changes: 2 additions & 2 deletions modular_nova/master_files/code/modules/clothing/towels.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fdb1d4a

Please sign in to comment.