Skip to content

Commit

Permalink
things and stuff from tg
Browse files Browse the repository at this point in the history
  • Loading branch information
Kapu1178 committed Apr 23, 2024
1 parent f269ca9 commit 9742b6a
Show file tree
Hide file tree
Showing 27 changed files with 197 additions and 165 deletions.
8 changes: 5 additions & 3 deletions code/__DEFINES/maths.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Remove these once we have Byond implementation.
#define ISNAN(a) (!(a==a))
#define ISINF(a) (!ISNAN(a) && ISNAN(a-a))
#define IS_INF_OR_NAN(a) (ISNAN(a-a))
// ------------------------------------
#define IS_FINITE(a) (isnum(a) && !isinf(a))

#define IS_INF_OR_NAN(a) (isnan(a) || isinf(a))

// Aight dont remove the rest

// Credits to Nickr5 for the useful procs I've taken from his library resource.
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#define CHEMICAL_QUANTISATION_LEVEL 0.0001
///The smallest amount of volume allowed - prevents tiny numbers
#define CHEMICAL_VOLUME_MINIMUM 0.001
///Round to this, to prevent extreme decimal magic and to keep reagent volumes in line with perceived values.
//Sanity check limit to clamp chems to sane amounts and prevent rounding errors during transfer.
#define CHEMICAL_VOLUME_ROUNDING 0.01
///Default pH for reagents datum
#define CHEMICAL_NORMAL_PH 7.000
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/udder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@
return
slug_turf.wash(CLEAN_SCRUB)
reagents.expose(slug_turf, TOUCH, 5)
reagents.remove_any(5)
reagents.remove_all(5)
2 changes: 1 addition & 1 deletion code/datums/diseases/advance/symptoms/sensory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

M.adjust_timed_status_effect(-2 SECONDS, /datum/status_effect/confusion)
if(purge_alcohol)
M.reagents.remove_all_type(/datum/reagent/consumable/ethanol, 3)
M.reagents.remove_reagent(/datum/reagent/consumable/ethanol, 3, include_subtypes = TRUE)
M.adjust_drunk_effect(-5)

if(A.stage >= 4)
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 * delta_time
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
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@
if(user.can_see_reagents()) //Show each individual reagent
. += span_notice("You see the following reagents:")
for(var/datum/reagent/current_reagent as anything in reagents.reagent_list)
. += span_notice("* [round(current_reagent.volume, 0.01)] units of [current_reagent.name].")
. += span_notice("* [round(current_reagent.volume, CHEMICAL_VOLUME_ROUNDING)] units of [current_reagent.name].")

if(reagents.is_reacting)
. += span_alert("A chemical reaction is taking place.")
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/decals/cleanable/humans.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
else
name = dryname
desc = drydesc
reagents.remove_all_type(/datum/reagent/blood, INFINITY)
reagents.remove_reagent(/datum/reagent/blood, INFINITY, , include_subtypes = TRUE)
var/list/temp_color = rgb2hsv(color || COLOR_WHITE)
color = hsv2rgb(temp_color[1], temp_color[2], max(temp_color[3] - 100, 0))
qdel(GetComponent(/datum/component/smell))
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/items/cigs_lighters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM

var/to_smoke = smoke_all ? (reagents.total_volume * (dragtime / smoketime)) : REAGENTS_METABOLISM
if(!istype(user) || ((src != user.wear_mask) && !drag))
reagents.remove_any(to_smoke)
reagents.remove_all(to_smoke)
return

reagents.expose(user, INJECT, min(to_smoke / reagents.total_volume, 1))
if(!reagents.trans_to(user, to_smoke, methods = INJECT))
reagents.remove_any(to_smoke)
reagents.remove_all(to_smoke)

if(drag || COOLDOWN_FINISHED(src, smoke_cooldown))
new /obj/effect/temp_visual/cig_smoke(drop_location())
Expand Down Expand Up @@ -1075,7 +1075,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 @@ -1090,7 +1090,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
qdel(src)

if(!reagents.trans_to(vaper, REAGENTS_METABOLISM, methods = INJECT)) //Going right into the bloodstream
reagents.remove_any(REAGENTS_METABOLISM)
reagents.remove_all(REAGENTS_METABOLISM)

/obj/item/clothing/mask/vape/process(delta_time)
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 @@ -44,7 +44,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/afterattack(atom/A, mob/user, proximity)
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 @@ -309,7 +309,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))
log_game("[key_name(user)] used Resin Launcher at [AREACOORD(user)].")
playsound(src,'sound/items/syringeproj.ogg',40,TRUE)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/shower.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
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)
return
on = FALSE
soundloop.stop()
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 @@ -320,7 +320,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/urinal, 32)
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/atmospherics/ZAS/Fire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin

var/fuel_to_remove = GASFUEL_AMOUNT_TO_LIQUID(used_liquid_fuel) //convert back to liquid volume units

liquid_fuel.reagents.remove_any(fuel_to_remove)
liquid_fuel.reagents.remove_all(fuel_to_remove)
if(liquid_fuel.reagents.total_volume <= 0.1) //Precision loss kinda fucks with us here so
qdel(liquid_fuel)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list(

dunking_target.apply_damage(min(30 * permeability * 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)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/hydroponics/hydroponics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@
// Nutrients deplete at a constant rate, since new nutrients can boost stats far easier.
apply_chemicals(lastuser?.resolve())
if(self_sustaining)
reagents.remove_any(min(0.5, nutridrain))
reagents.remove_all(min(0.5, nutridrain))
else
reagents.remove_any(nutridrain)
reagents.remove_all(nutridrain)

// Lack of nutrients hurts non-weeds
if(reagents.total_volume <= 0 && !myseed.get_gene(/datum/plant_gene/trait/plant_type/weed_hardy))
Expand Down
4 changes: 2 additions & 2 deletions code/modules/hydroponics/seeds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,14 @@
// Heats up the plant's contents by 25 kelvin per 1 unit of nutriment. Mutually exclusive with cooling.
if(get_gene(/datum/plant_gene/trait/chem_heating))
T.visible_message(span_notice("[T] releases freezing air, consuming its nutriments to heat its contents."))
T.reagents.remove_all_type(/datum/reagent/consumable/nutriment, num_nutriment, strict = TRUE)
T.reagents.remove_reagent(/datum/reagent/consumable/nutriment, num_nutriment)
T.reagents.chem_temp = min(1000, (T.reagents.chem_temp + num_nutriment * 25))
T.reagents.handle_reactions()
playsound(T.loc, 'sound/effects/wounds/sizzle2.ogg', 5)
// Cools down the plant's contents by 5 kelvin per 1 unit of nutriment. Mutually exclusive with heating.
else if(get_gene(/datum/plant_gene/trait/chem_cooling))
T.visible_message(span_notice("[T] releases a blast of hot air, consuming its nutriments to cool its contents."))
T.reagents.remove_all_type(/datum/reagent/consumable/nutriment, num_nutriment, strict = TRUE)
T.reagents.remove_reagent(/datum/reagent/consumable/nutriment, num_nutriment)
T.reagents.chem_temp = max(3, (T.reagents.chem_temp + num_nutriment * -5))
T.reagents.handle_reactions()
playsound(T.loc, 'sound/effects/space_wind.ogg', 50)
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 @@ -549,7 +549,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/build_all_button_icons(status_only = FALSE, force = FALSE)
if(buffer_on)
Expand Down
10 changes: 5 additions & 5 deletions code/modules/reagents/chemistry/equilibrium.dm
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@
//keep limited
if(delta_chem_factor > step_target_vol)
delta_chem_factor = step_target_vol
else if (delta_chem_factor < CHEMICAL_VOLUME_MINIMUM)
delta_chem_factor = CHEMICAL_VOLUME_MINIMUM
//Normalise to multiproducts
delta_chem_factor /= product_ratio
//delta_chem_factor = round(delta_chem_factor, CHEMICAL_QUANTISATION_LEVEL) // Might not be needed - left here incase testmerge shows that it does. Remove before full commit.

delta_chem_factor = round(delta_chem_factor / product_ratio, CHEMICAL_VOLUME_ROUNDING)
if(delta_chem_factor <= 0)
to_delete = TRUE
return

//Calculate how much product to make and how much reactant to remove factors..
for(var/reagent in reaction.required_reagents)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
C.set_drowsyness(0)
C.remove_status_effect(/datum/status_effect/speech/slurring/drunk)
C.remove_status_effect(/datum/status_effect/confusion)
holder.remove_all_type(/datum/reagent/consumable/ethanol, 3 * removed, FALSE, TRUE)
holder.remove_reagent(/datum/reagent/consumable/ethanol, 3 * removed, include_subtypes = TRUE)
var/obj/item/organ/stomach = C.getorganslot(ORGAN_SLOT_STOMACH)
if(stomach)
stomach.reagents.remove_all_type(/datum/reagent/consumable/ethanol, 3 * removed, FALSE, TRUE)
stomach.reagents.remove_reagent(/datum/reagent/consumable/ethanol, 3 * removed, include_subtypes = TRUE)
C.adjustToxLoss(-0.2 * removed, 0)
C.adjust_drunk_effect(-10 * removed)
. = TRUE
Expand Down
Loading

0 comments on commit 9742b6a

Please sign in to comment.