Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds fractional condensers #16654

Merged
merged 12 commits into from Nov 14, 2023
1 change: 1 addition & 0 deletions _std/defines/drawing.dm
Expand Up @@ -5,3 +5,4 @@
#define LINEMODE_MOVE 3
#define LINEMODE_SIMPLE 4
#define LINEMODE_SIMPLE_REVERSED 5
#define LINEMODE_STRETCH_NO_CLIP 6
21 changes: 21 additions & 0 deletions code/WorkInProgress/actuallyKeelinsStuff.dm
Expand Up @@ -17,6 +17,9 @@ Arguments:
trg_off_y: Y offset applied to the target location of the beam.
mode: If set to LINEMODE_SEGMENT, the proc will use multiple beam segments to reach the full length. The last segment might still be squished.
If set to LINEMODE_STRETCH, the beam segment will be stretched to the full length of the beam.
-LINEMODE_STRETCH has an existing issue where BYOND will partially clip the line sprites in certain situations.
If set to LINEMODE_STRETCH_NOCLIP, it will attempt to bypass this by not using filter transforms, though this has its' own downsides scaling caps.

TBI: If set to LINEMODE_MOVE, one full sized segment will travel from source to target, repeatedly.
getCrossed: If set to 1, we will return a list of crossed turfs in our /datum/lineResult 's crossed var.
adjustTiles: If 1, will attempt to correct the list of crossed turfs based on the offsets passed into the proc.
Expand Down Expand Up @@ -94,6 +97,24 @@ Returns:
I.filters += filter(type="layer", render_source = (islist(render_source_cap) ? pick(render_source_cap) : render_source_cap), transform=M2)
I.transform = UNLINT(matrix().Turn(-angle).Translate((dist),0).Turn(angle))
result.lineImage = I

else if(mode == LINEMODE_STRETCH_NO_CLIP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be turned into a switch statement instead? a suggestion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be. im not really fussed though as the end result wont be something like a nice, compact C# switch, it's still going to be huge

TDHooligan marked this conversation as resolved.
Show resolved Hide resolved
// This mode is mostly the same as LINEMODE_STRETCH, but does the transformation outside of filters.
// This prevents some weird issues that cause LINEMODE_STRETCH to cut off the sprite at certain pixel offsets, but
// makes it difficult to have caps at both ends of a line.

//Matrix M scales down our 64 pixel line to whatever length was calculated earlier, then moves it into place.
var/matrix/M = UNLINT(matrix().Scale(scale,1).Translate((dist/2),0).Turn(angle).Translate(src_off_x,src_off_y))
var/image/I = image(null,source)
I.appearance_flags = KEEP_APART //Required for some odd reason.
I.filters += filter(type="layer", render_source = (islist(render_source_line) ? pick(render_source_line) : render_source_line))
if(render_source_cap != null)
//And to avoid resizing caps, we pre-emptively upscale the source cap, so that it looks the same.
//This probably breaks dual-ended caps.
var/matrix/M2 = UNLINT(matrix().Scale(1/scale,1).Translate(-((1/scale)-1)*32,0))
I.filters += filter(type="layer", render_source = (islist(render_source_cap) ? pick(render_source_cap) : render_source_cap), transform=M2)
I.transform = M
result.lineImage = I
else if(mode == LINEMODE_SIMPLE)
var/image/I = image(null,source)
I.icon = 'icons/effects/lines2.dmi'
Expand Down
9 changes: 9 additions & 0 deletions code/datums/manufacturing.dm
Expand Up @@ -820,6 +820,15 @@ ABSTRACT_TYPE(/datum/manufacture)
create = 1
category = "Tool"

/datum/manufacture/fractionalcondenser
name = "Fractional Condenser"
item_paths = list("molitz")
item_amounts = list(6)
item_outputs = list(/obj/item/reagent_containers/glass/condenser/fractional)
time = 5 SECONDS
create = 1
category = "Tool"

/datum/manufacture/beaker_lid_box
name = "Beaker Lid Box"
item_paths = list("RUB")
Expand Down
4 changes: 2 additions & 2 deletions code/modules/chemistry/Chemistry-Holder.dm
Expand Up @@ -784,10 +784,10 @@ proc/chem_helmet_check(mob/living/carbon/human/H, var/what_liquid="hot")
temp_fluid_reagents.update_total()
fluid_turf.fluid_react(temp_fluid_reagents, temp_fluid_reagents.total_volume)

proc/add_reagent(var/reagent, var/amount, var/sdata, var/temp_new=T20C, var/donotreact = 0, var/donotupdate = 0, var/chemical_reaction = FALSE)
proc/add_reagent(var/reagent, var/amount, var/sdata, var/temp_new=T20C, var/donotreact = 0, var/donotupdate = 0, var/chemical_reaction = FALSE, var/chem_reaction_priority = 1)
if(istype(my_atom, /obj/item/reagent_containers/glass/condenser) && chemical_reaction)
var/obj/item/reagent_containers/glass/condenser/condenser = my_atom
condenser.try_adding_reagents_to_container(reagent, amount, sdata, temp_new, donotreact, donotupdate)
condenser.try_adding_reagents_to_container(reagent, amount, sdata, temp_new, donotreact, donotupdate, chem_reaction_priority)
return
if(!isnum(amount) || amount <= 0 || src.disposed)
return 1
Expand Down
60 changes: 30 additions & 30 deletions code/modules/chemistry/Chemistry-Recipes.dm
Expand Up @@ -359,7 +359,7 @@
smoke.set_up(1, 0, t)
smoke.start()
else
holder.add_reagent("steam", amount_to_boil, temp_new = holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("steam", amount_to_boil, temp_new = holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 1)

steam_condensation
name = "Steam Condensation"
Expand Down Expand Up @@ -2279,7 +2279,7 @@
mix_phrase = "The mixture settles into a white powder."
result_amount = 1
on_reaction(var/datum/reagents/holder, var/created_volume)
holder.add_reagent("hydrogen", created_volume * 2, chemical_reaction = TRUE)
holder.add_reagent("hydrogen", created_volume * 2, chemical_reaction = TRUE, chem_reaction_priority = 2)

mg_nh3_cl
name = "Magnesium-Ammonium Chloride"
Expand All @@ -2299,7 +2299,7 @@
min_temperature = T0C + 150
hidden = TRUE
on_reaction(var/datum/reagents/holder, var/created_volume)
holder.add_reagent("ammonia", created_volume * 6, chemical_reaction = TRUE)
holder.add_reagent("ammonia", created_volume * 6, chemical_reaction = TRUE, chem_reaction_priority = 2)
mix_phrase = "The mixture bubbles aggressively."

silicate
Expand All @@ -2321,8 +2321,8 @@
instant = 0
mix_phrase = "A small particulate forms into a tiny lattice."
on_reaction(var/datum/reagents/holder, var/created_volume)
holder.add_reagent("oxygen", created_volume, chemical_reaction = TRUE)
holder.add_reagent("salt", created_volume, chemical_reaction = TRUE)
holder.add_reagent("oxygen", created_volume, chemical_reaction = TRUE, chem_reaction_priority = 2)
holder.add_reagent("salt", created_volume, chemical_reaction = TRUE, chem_reaction_priority = 3)

graphene_compound
name = "Graphene Hardening Compound"
Expand Down Expand Up @@ -2414,10 +2414,10 @@
mix_phrase = "The hemolymph bubbles as a black precipitate falls out of the solution, denaturing into basic components."
hidden = TRUE
on_reaction(var/datum/reagents/holder, created_volume)
holder.add_reagent("meat_slurry", created_volume, chemical_reaction = TRUE)// meat slurry, since animal tissue
holder.add_reagent("saline", 2*created_volume, chemical_reaction = TRUE)// saline-glucose solution, since blood
holder.add_reagent("spaceacillin", created_volume, chemical_reaction = TRUE)// spaceacillin, since hemolymph is used for bacterial tests IRL
holder.add_reagent("denatured_enzyme", created_volume, chemical_reaction = TRUE)// and just some random biological chemicals for good measure
holder.add_reagent("meat_slurry", created_volume, chemical_reaction = TRUE, chem_reaction_priority = 2)// meat slurry, since animal tissue
holder.add_reagent("saline", 2*created_volume, chemical_reaction = TRUE, chem_reaction_priority = 3)// saline-glucose solution, since blood
holder.add_reagent("spaceacillin", created_volume, chemical_reaction = TRUE, chem_reaction_priority = 4)// spaceacillin, since hemolymph is used for bacterial tests IRL
holder.add_reagent("denatured_enzyme", created_volume, chemical_reaction = TRUE, chem_reaction_priority = 5)// and just some random biological chemicals for good measure

mutagen
name = "Unstable mutagen"
Expand Down Expand Up @@ -2603,8 +2603,8 @@
nitrogen -= temp
holder.remove_reagent("nitrogen", temp)

holder.add_reagent("salbutamol",created_volume, chemical_reaction = TRUE)
holder.add_reagent("water",created_volume, chemical_reaction = TRUE)
holder.add_reagent("salbutamol",created_volume, chemical_reaction = TRUE, chem_reaction_priority = 2)
holder.add_reagent("water",created_volume, chemical_reaction = TRUE, chem_reaction_priority = 3)
return

lube
Expand Down Expand Up @@ -3764,7 +3764,7 @@
on_reaction(var/datum/reagents/holder, var/created_volume)
// water byproduct
// some nitrification processes create additional water.
holder.add_reagent("water", created_volume,,holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("water", created_volume,,holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 2)
// disgusting
var/turf/location = pick(holder.covered_turf())
location.fluid_react_single("miasma", created_volume, airborne = 1)
Expand Down Expand Up @@ -3881,7 +3881,7 @@
result_amount = 2
mix_phrase = "The mixture gives off a biting odor."
on_reaction(var/datum/reagents/holder, created_volume)
holder.add_reagent("oxygen", created_volume,, holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("oxygen", created_volume,, holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 2)

nitric_acid
name = "Nitric Acid"
Expand Down Expand Up @@ -3911,8 +3911,8 @@
mix_phrase = "The mixture bubbles and white crystals form."
hidden = TRUE
on_reaction(var/datum/reagents/holder, var/created_volume)
holder.add_reagent("nitrogen_dioxide", created_volume, , holder.total_temperature)
holder.add_reagent("water", created_volume, , holder.total_temperature)
holder.add_reagent("nitrogen_dioxide", created_volume, , holder.total_temperature, chem_reaction_priority = 2)
holder.add_reagent("water", created_volume, , holder.total_temperature, chem_reaction_priority = 3)

silver_fulminate
name = "Silver Fulminate"
Expand All @@ -3938,8 +3938,8 @@
mix_phrase = "Silver hairlike strands of silver form in the mixture, and the mixture becomes more blue."
hidden = TRUE
on_reaction(var/datum/reagents/holder, var/created_volume)
holder.add_reagent("silver", created_volume*2, , holder.total_temperature)
holder.add_reagent("water", created_volume, , holder.total_temperature)
holder.add_reagent("silver", created_volume*2, , holder.total_temperature, chem_reaction_priority = 2)
holder.add_reagent("water", created_volume, , holder.total_temperature, chem_reaction_priority = 3)

// 2 AgNO3 + Cu + (ethanol solvent) -> Cu(NO3)2 + 2 Ag
silver_nitrate_copper_nitrate_2
Expand All @@ -3951,8 +3951,8 @@
mix_phrase = "Silver hairlike strands of silver form in the mixture, and the mixture becomes more blue."
hidden = TRUE
on_reaction(var/datum/reagents/holder, var/created_volume)
holder.add_reagent("silver", created_volume*2, , holder.total_temperature)
holder.add_reagent("ethanol", created_volume, , holder.total_temperature)
holder.add_reagent("silver", created_volume*2, , holder.total_temperature, chem_reaction_priority = 2)
holder.add_reagent("ethanol", created_volume, , holder.total_temperature, chem_reaction_priority = 3)

// 2 AgNO3 + (heat) -> 2 Ag + O2 + 2 NO2
silver_nitrate_decomposition
Expand All @@ -3965,8 +3965,8 @@
mix_phrase = "Silver specks form in the mixture as it decomposes."
hidden = TRUE
on_reaction(var/datum/reagents/holder, var/created_volume)
holder.add_reagent("nitrogen_dioxide", created_volume, , holder.total_temperature)
holder.add_reagent("oxygen", created_volume/2, , holder.total_temperature)
holder.add_reagent("nitrogen_dioxide", created_volume, , holder.total_temperature, chem_reaction_priority = 2)
holder.add_reagent("oxygen", created_volume/2, , holder.total_temperature, chem_reaction_priority = 3)

/*
weedkiller/weedkiller2
Expand Down Expand Up @@ -3996,7 +3996,7 @@

on_reaction(var/datum/reagents/holder, var/created_volume)
// nickel is a catalyst and does not get used in the process
holder.add_reagent("nickel", created_volume / 2,,holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("nickel", created_volume / 2,,holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 2)


foam
Expand Down Expand Up @@ -4254,10 +4254,10 @@

on_reaction(var/datum/reagents/holder, var/created_volume)
// sewage is a catalyst and does not get used in the process
holder.add_reagent("sewage", created_volume * 5,,holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("sewage", created_volume * 5,,holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 2)
// Byproduct is some nutrients from the decomposted egg and some bacterials toxins
holder.add_reagent("poo", created_volume * 2,,holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("toxin", created_volume,,holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("poo", created_volume * 2,,holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 3)
holder.add_reagent("toxin", created_volume,,holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 4)
// the decomposition process create some unbearable stench
var/turf/location = pick(holder.covered_turf())
location.fluid_react_single("miasma", created_volume * 4, airborne = 1)
Expand Down Expand Up @@ -4461,7 +4461,7 @@
reaction_speed = 1

on_reaction(datum/reagents/holder, created_volume) // TODO: actual byproduct/multi-output handling
holder.add_reagent("phenol", created_volume, temp_new = holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("phenol", created_volume, temp_new = holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 2)

espresso //makin' caffeine by dehydrating coffee
name = "Coffee concentration"
Expand Down Expand Up @@ -5152,7 +5152,7 @@
mix_sound = 'sound/misc/fuse.ogg'

on_reaction(var/datum/reagents/holder, created_volume)
holder.add_reagent("salt", created_volume * 2,,holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("salt", created_volume * 2,,holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 2)

gypsum //H2SO4 + CaCO3 -> CaSO4 + H2O + CO2
name = "calcium sulfate"
Expand All @@ -5163,7 +5163,7 @@
mix_phrase = "The mixture bubbles fervently."

on_reaction(var/datum/reagents/holder, created_volume)
holder.add_reagent("water", created_volume,,holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("water", created_volume,,holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 2)

chalk //"pastels also contain clays and oils for binding, and strong pigments" some website i found
name = "chalk"
Expand Down Expand Up @@ -5207,8 +5207,8 @@
result_amount = 3
mix_phrase = "The white flakes turn into a white powder."
on_reaction(var/datum/reagents/holder, created_volume)
holder.add_reagent("water", created_volume / 3,,holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("sodium_sulfate", created_volume / 3,,holder.total_temperature, chemical_reaction = TRUE)
holder.add_reagent("water", created_volume / 3,,holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 2)
holder.add_reagent("sodium_sulfate", created_volume / 3,,holder.total_temperature, chemical_reaction = TRUE, chem_reaction_priority = 3)

perfect_cement //lime, alumina, magnesia, iron (iii) oxide, calcium sulfate, sulfur trioxide
name = "perfect cement"
Expand Down