Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions code/__DEFINES/reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,6 @@
#define CARTRIDGE_VOLUME_LARGE 500
#define CARTRIDGE_VOLUME_MEDIUM 250
#define CARTRIDGE_VOLUME_SMALL 100

/// Boiling point of water
#define BOILING_POINT_WATER 373.15
3 changes: 1 addition & 2 deletions code/controllers/subsystem/processing/reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PROCESSING_SUBSYSTEM_DEF(reagents)
name = "Reagents"
init_order = INIT_ORDER_REAGENTS
priority = FIRE_PRIORITY_REAGENTS
wait = 0.25 SECONDS //You might think that rate_up_lim has to be set to half, but since everything is normalised around delta_time, it automatically adjusts it to be per second. Magic!
wait = 0.25 SECONDS //You might think that base_reaction_rate has to be set to half, but since everything is normalised around delta_time, it automatically adjusts it to be per second. Magic!
flags = SS_KEEP_TIMING | SS_HIBERNATE
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
///What time was it when we last ticked
Expand Down Expand Up @@ -61,7 +61,6 @@ PROCESSING_SUBSYSTEM_DEF(reagents)
if(isabstract(path))//Are we abstract?
continue
var/datum/reagent/D = new path()
D.mass = rand(10, 800) //This is terrible and should be removed ASAP!
reagent_list[path] = D

return reagent_list
Expand Down
5 changes: 5 additions & 0 deletions code/datums/looping_sounds/machinery_sounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,8 @@
mid_length = 2.1 SECONDS
end_sound = 'goon/sounds/phone/remote_pickup.ogg'
volume = 10

/datum/looping_sound/boiling
mid_sounds = list('sound/effects/bubbles2.ogg')
mid_length = 7 SECONDS
volume = 40
2 changes: 1 addition & 1 deletion code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@
moving_from_pull = FALSE
forcemove_should_maintain_grab = FALSE

update_offsets()
update_offsets(TRUE)

/**
* Called after a successful Move(). By this point, we've already moved.
Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/buckling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
M.setDir(dir)

post_buckle_mob(M)
M.update_offsets()
M.update_offsets(TRUE)

SEND_SIGNAL(src, COMSIG_MOVABLE_BUCKLE, M, force)
return TRUE
Expand Down Expand Up @@ -177,7 +177,7 @@
buckled_mob.zFall()

post_unbuckle_mob(.)
buckled_mob.update_offsets()
buckled_mob.update_offsets(TRUE)

if(!QDELETED(buckled_mob) && !buckled_mob.currently_z_moving && isturf(buckled_mob.loc)) // In the case they unbuckled to a flying movable midflight.
buckled_mob.zFall()
Expand Down Expand Up @@ -362,5 +362,5 @@
span_hear("You hear metal clanking."))
add_fingerprint(user)

update_offsets()
update_offsets(TRUE)
return M
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@
/obj/effect/particle_effect/fluid/smoke/chem
lifetime = 20 SECONDS

/obj/effect/particle_effect/fluid/smoke/chem/transparent
make_opaque = FALSE

/obj/effect/particle_effect/fluid/smoke/chem/process(seconds_per_tick)
. = ..()
if(!.)
Expand Down Expand Up @@ -517,3 +520,4 @@

/datum/effect_system/fluid_spread/smoke/chem/quick
effect_type = /obj/effect/particle_effect/fluid/smoke/chem/quick

3 changes: 3 additions & 0 deletions code/modules/atmospherics/ZAS/zas_extras/gas_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
taste_description = "sweetness"
chemical_flags = REAGENT_NO_RANDOM_RECIPE

boiling_point = 165
dew_point = 165 * 0.9

/datum/reagent/carbon_monoxide
name = "Carbon Monoxide"
description = "A dangerous carbon comubstion byproduct."
Expand Down
2 changes: 1 addition & 1 deletion code/modules/food_and_drinks/recipes/drinks_recipes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
optimal_temp = 250
temp_exponent_factor = 1
thermic_constant = 0
rate_up_lim = 60
base_reaction_rate = 60

////////////////////////////////////////// COCKTAILS //////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion code/modules/food_and_drinks/recipes/food_mixtures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
required_reagents = list(/datum/reagent/consumable/caramel = 1)
required_temp = 483.15
optimal_temp = 1000
rate_up_lim = 10
base_reaction_rate = 10
mob_react = FALSE

/datum/chemical_reaction/food/cheesewheel
Expand Down
2 changes: 1 addition & 1 deletion code/modules/grab/grab_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ GLOBAL_LIST_EMPTY(all_grabstates)
remove_unique_grab_effects(G.affecting)

update_stage_effects(G, src, TRUE)
G.affecting.update_offsets()
G.affecting.update_offsets(TRUE)

SEND_SIGNAL(G.affecting, COMSIG_ATOM_NO_LONGER_GRABBED, G.assailant)
SEND_SIGNAL(G.assailant, COMSIG_LIVING_NO_LONGER_GRABBING, G.affecting)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/grab/grab_living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
G.downgrade()

if(moving_diagonally != FIRST_DIAG_STEP)
pulling.update_offsets()
pulling.update_offsets(TRUE)

var/list/my_grabs = active_grabs
for(var/obj/item/hand_item/grab/G in my_grabs)
Expand Down
10 changes: 7 additions & 3 deletions code/modules/grab/grab_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
for(var/obj/item/hand_item/grab/G in active_grabs)
G.move_victim_towards(destination)

/atom/movable/proc/update_offsets()
/atom/movable/proc/update_offsets(animate = FALSE)
var/last_pixel_x = pixel_x
var/last_pixel_y = pixel_y

Expand All @@ -55,7 +55,7 @@

if(length(buckled_mobs))
for(var/mob/M as anything in buckled_mobs)
M.update_offsets()
M.update_offsets(animate)

if(isliving(src))
var/mob/living/L = src
Expand All @@ -67,6 +67,10 @@
G.current_grab.get_grab_offsets(G, get_dir(G.assailant, G.affecting), &new_pixel_x, &new_pixel_y)

if(last_pixel_x != new_pixel_x || last_pixel_y != new_pixel_y)
animate(src, pixel_x = new_pixel_x, pixel_y = new_pixel_y, 3, 1, (LINEAR_EASING|EASE_IN))
if(animate)
animate(src, pixel_x = new_pixel_x, pixel_y = new_pixel_y, 3, 1, (LINEAR_EASING|EASE_IN), flags = ANIMATION_PARALLEL)
else
pixel_x = new_pixel_x
pixel_y = new_pixel_y

UPDATE_OO_IF_PRESENT
4 changes: 2 additions & 2 deletions code/modules/grab/grab_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
affecting.move_from_pull(assailant, get_turf(assailant))
affecting.setDir(assailant.dir)

affecting.update_offsets()
affecting.update_offsets(TRUE)
affecting.reset_plane_and_layer()

/obj/item/hand_item/grab/proc/move_victim_towards(atom/destination)
Expand All @@ -478,7 +478,7 @@
// Okay, now actually try to move
. = affecting.Move(get_step(affecting.loc, move_dir), move_dir, glide_size)
if(.)
affecting.update_offsets()
affecting.update_offsets(TRUE)

/// Removes any grabs applied to the affected movable that aren't src
/obj/item/hand_item/grab/proc/remove_competing_grabs()
Expand Down
4 changes: 4 additions & 0 deletions code/modules/jobs/job_types/chemist.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,7 @@

box = /obj/item/storage/box/survival/medical
chameleon_extras = /obj/item/gun/syringe

backpack_contents = list(
/obj/item/clothing/mask/gas,
)
2 changes: 1 addition & 1 deletion code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
var/oldMloc = M.loc
forceMove(oldMloc)
M.forceMove(oldloc)
M.update_offsets()
M.update_offsets(TRUE)

now_pushing = FALSE
return TRUE
Expand Down
34 changes: 30 additions & 4 deletions code/modules/reagents/chemistry/equilibrium.dm
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
if(!calculate_yield())//So that this can detect if we're missing reagents
to_delete = TRUE
return

delta_time = deal_with_time(delta_time)

delta_t = 0 //how far off optimal temp we care
Expand Down Expand Up @@ -266,7 +267,7 @@
delta_t *= speed_mod

//Now we calculate how much to add - this is normalised to the rate up limiter
var/delta_chem_factor = reaction.rate_up_lim * delta_t *delta_time //add/remove factor
var/delta_chem_factor = reaction.base_reaction_rate * delta_t *delta_time //add/remove factor
var/total_step_added = 0
//keep limited
if(delta_chem_factor > step_target_vol)
Expand All @@ -281,9 +282,34 @@
var/required_amount
for(var/datum/reagent/requirement as anything in reaction.required_reagents)
required_amount = reaction.required_reagents[requirement]
if(!holder.remove_reagent(requirement, delta_chem_factor * required_amount))
to_delete = TRUE
return
var/alist/requirement_consumption_chance_list = reaction.requirement_consumption_modifiers[requirement.type]
#ifdef UNIT_TESTS
requirement_consumption_chance_list = null
#endif

var/real_required_amount = delta_chem_factor * required_amount

// null is an implicit 100% chance to consume the reagent on reaction.
if(isnull(requirement_consumption_chance_list))
if(!holder.remove_reagent(requirement, real_required_amount))
to_delete = TRUE
return
else
var/reagent_consumption_modifier = pick_weight(requirement_consumption_chance_list)
if(reagent_consumption_modifier == 1)
if(!holder.remove_reagent(requirement, real_required_amount))
to_delete = TRUE
return

else
if(!holder.has_reagent(requirement, real_required_amount))
to_delete = TRUE
return

// Modified required amount could be higher than the base consumption amount. In this instance we do NOT want it to fail the reaction
// if there isn't enough. That's fine. Otherwise reactions could randomly end and restart and leave players confused.
var/modified_required_amount = round(real_required_amount * reagent_consumption_modifier, CHEMICAL_VOLUME_ROUNDING)
holder.remove_reagent(requirement, modified_required_amount)

var/step_add
for(var/datum/reagent/product as anything in reaction.results)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@
reagent_state = LIQUID
color = "#2D2D2D"
taste_description = "oil"
burning_temperature = 1200//Oil is crude
burning_volume = 0.05 //but has a lot of hydrocarbons
boiling_point = 1200 //Oil is crude

addiction_types = null

Expand All @@ -83,8 +82,7 @@
glass_name = "glass of welder fuel"
glass_desc = "Unless you're an industrial tool, this is probably not safe for consumption."
penetrates_skin = NONE
burning_temperature = 1725 //more refined than oil
burning_volume = 0.2
boiling_point = 1725 //more refined than oil

addiction_types = list(/datum/addiction/alcohol = 4)

Expand Down Expand Up @@ -350,6 +348,9 @@
metabolization_rate = 0.04
value = DISPENSER_REAGENT_VALUE

boiling_point = 329
dew_point = 329 * 0.9

/datum/reagent/acetone/affect_blood(mob/living/carbon/C, removed)
C.adjustToxLoss(removed * 3, FALSE, cause_of_death = "Ingesting acetone")
return TRUE
Expand Down
10 changes: 6 additions & 4 deletions code/modules/reagents/chemistry/holder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@
return amount

/// Transfer a specific reagent id to the target object. Accepts a reagent instance, but assumes the reagent is in src.
/datum/reagents/proc/trans_id_to(obj/target, datum/reagent/reagent, amount=1, preserve_data=1)//Not sure why this proc didn't exist before. It does now! /N
/datum/reagents/proc/trans_id_to(obj/target, datum/reagent/reagent, amount=1, preserve_data = TRUE, no_react = FALSE)//Not sure why this proc didn't exist before. It does now! /N
var/list/cached_reagents = reagent_list
if (!target)
return
Expand Down Expand Up @@ -548,7 +548,9 @@

update_total()
holder.update_total()
holder.handle_reactions()
if(!no_react)
handle_reactions()
holder.handle_reactions()
return amount

/// Copies the reagents to the target object
Expand Down Expand Up @@ -1626,7 +1628,7 @@
has_product = FALSE
var/list/names = splittext("[reaction.type]", "/")
var/product_name = names[names.len]
data["reagent_mode_recipe"] = list("name" = product_name, "id" = reaction.type, "hasProduct" = has_product, "reagentCol" = "#FFFFFF", "thermodynamics" = generate_thermodynamic_profile(reaction), "explosive" = generate_explosive_profile(reaction), "thermics" = determine_reaction_thermics(reaction), "thermoUpper" = reaction.rate_up_lim, "tempMin" = reaction.required_temp, "explodeTemp" = reaction.overheat_temp, "reqContainer" = container_name, "subReactLen" = 1, "subReactIndex" = 1)
data["reagent_mode_recipe"] = list("name" = product_name, "id" = reaction.type, "hasProduct" = has_product, "reagentCol" = "#FFFFFF", "thermodynamics" = generate_thermodynamic_profile(reaction), "explosive" = generate_explosive_profile(reaction), "thermics" = determine_reaction_thermics(reaction), "thermoUpper" = reaction.base_reaction_rate, "tempMin" = reaction.required_temp, "explodeTemp" = reaction.overheat_temp, "reqContainer" = container_name, "subReactLen" = 1, "subReactIndex" = 1)

//If we do have a product then we find it
else
Expand All @@ -1648,7 +1650,7 @@
ui_reaction_index = i //update our index
break
i += 1
data["reagent_mode_recipe"] = list("name" = primary_reagent.name, "id" = reaction.type, "hasProduct" = has_product, "reagentCol" = primary_reagent.color, "thermodynamics" = generate_thermodynamic_profile(reaction), "explosive" = generate_explosive_profile(reaction), "thermics" = determine_reaction_thermics(reaction), "thermoUpper" = reaction.rate_up_lim, "tempMin" = reaction.required_temp, "explodeTemp" = reaction.overheat_temp, "reqContainer" = container_name, "subReactLen" = sub_reaction_length, "subReactIndex" = ui_reaction_index)
data["reagent_mode_recipe"] = list("name" = primary_reagent.name, "id" = reaction.type, "hasProduct" = has_product, "reagentCol" = primary_reagent.color, "thermodynamics" = generate_thermodynamic_profile(reaction), "explosive" = generate_explosive_profile(reaction), "thermics" = determine_reaction_thermics(reaction), "thermoUpper" = reaction.base_reaction_rate, "tempMin" = reaction.required_temp, "explodeTemp" = reaction.overheat_temp, "reqContainer" = container_name, "subReactLen" = sub_reaction_length, "subReactIndex" = ui_reaction_index)

//Results sweep
var/has_reagent = "default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
list("name" = "overheat_temp" , "var" = edit_recipe.overheat_temp),
list("name" = "temp_exponent_factor" , "var" = edit_recipe.temp_exponent_factor),
list("name" = "thermic_constant" , "var" = edit_recipe.thermic_constant),
list("name" = "rate_up_lim" , "var" = edit_recipe.rate_up_lim),
list("name" = "base_reaction_rate" , "var" = edit_recipe.base_reaction_rate),
)

return data
Expand Down Expand Up @@ -338,7 +338,7 @@ optimal_temp = [edit_recipe.optimal_temp]
overheat_temp = [edit_recipe.overheat_temp]
temp_exponent_factor = [edit_recipe.temp_exponent_factor]
thermic_constant = [edit_recipe.thermic_constant]
rate_up_lim = [edit_recipe.rate_up_lim]"}
base_reaction_rate = [edit_recipe.base_reaction_rate]"}
say(export)
text2file(export, "[GLOB.log_directory]/chem_parse.txt")

Expand Down
13 changes: 9 additions & 4 deletions code/modules/reagents/chemistry/reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent())
var/reagent_state = LIQUID
/// Special data associated with the reagent that will be passed on upon transfer to a new holder.
var/list/data

/// increments everytime on_mob_life is called
var/current_cycle = 0

///pretend this is moles
var/volume = 0
///The molar mass of the reagent - if you're adding a reagent that doesn't have a recipe, just add a random number between 10 - 800. Higher numbers are "harder" but it's mostly arbitary.
Expand Down Expand Up @@ -83,10 +85,13 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent())
var/show_in_codex = TRUE

///Thermodynamic vars
///How hot this reagent burns when it's on fire - null means it can't burn
var/burning_temperature = null
///How much is consumed when it is burnt per second
var/burning_volume = 0.5
///How hot this reagent needs to be to begin boiling. null means it will not boil.
var/boiling_point = BOILING_POINT_WATER + 100 // Arbitrary default that is "more than water".
/// When output from a condenser, the reagent will be this temperature.
var/dew_point = (BOILING_POINT_WATER + 100) * 0.9 // Value is arbitrary.

/// Units lost per second while boiling.
var/boil_off_rate = 2.5

///Assoc list with key type of addiction this reagent feeds, and value amount of addiction points added per unit of reagent metabolzied (which means * REAGENTS_METABOLISM every life())
var/list/addiction_types = null
Expand Down
3 changes: 1 addition & 2 deletions code/modules/reagents/chemistry/reagents/alcohol_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

touch_met = 5
ingest_met = 0.2
burning_temperature = 2193//ethanol burns at 1970C (at it's peak)
burning_volume = 0.1
boiling_point = 2193 //ethanol burns at 1970C (at it's peak)
var/boozepwr = 65 //Higher numbers equal higher hardness, higher hardness equals more intense alcohol poisoning
var/toxicity = 1

Expand Down
Loading
Loading