Skip to content

Commit

Permalink
TGS Test Merge (#6816)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevinz authored and Kevinz committed Oct 26, 2024
2 parents 0a746a0 + 27a2934 commit 2703d4f
Show file tree
Hide file tree
Showing 108 changed files with 2,700 additions and 2,297 deletions.
33 changes: 23 additions & 10 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@
#include "code\__DEFINES\radiation\insulation.dm"
#include "code\__DEFINES\radiation\mobs.dm"
#include "code\__DEFINES\radiation\simulation.dm"
#include "code\__DEFINES\reagents\flags.dm"
#include "code\__DEFINES\reagents\chemical_reaction.dm"
#include "code\__DEFINES\reagents\reagent.dm"
#include "code\__DEFINES\reagents\reagent_holder.dm"
#include "code\__DEFINES\rendering\alert.dm"
#include "code\__DEFINES\rendering\ao.dm"
#include "code\__DEFINES\rendering\atom_huds.dm"
Expand Down Expand Up @@ -540,6 +542,7 @@
#include "code\controllers\subsystem\automata.dm"
#include "code\controllers\subsystem\bellies_vr.dm"
#include "code\controllers\subsystem\chat.dm"
#include "code\controllers\subsystem\chemistry.dm"
#include "code\controllers\subsystem\dcs.dm"
#include "code\controllers\subsystem\DPC.dm"
#include "code\controllers\subsystem\early_init.dm"
Expand Down Expand Up @@ -650,7 +653,6 @@
#include "code\controllers\subsystem\persistence\modules\turf_grid.dm"
#include "code\controllers\subsystem\persistence\modules\bulk_entity_serializers\debris.dm"
#include "code\controllers\subsystem\persistence\modules\bulk_entity_serializers\trash.dm"
#include "code\controllers\subsystem\processing\chemistry.dm"
#include "code\controllers\subsystem\processing\circuits.dm"
#include "code\controllers\subsystem\processing\instruments.dm"
#include "code\controllers\subsystem\processing\moving_cameras.dm"
Expand Down Expand Up @@ -3224,6 +3226,7 @@
#include "code\modules\loadout\accessories\insignia.dm"
#include "code\modules\loadout\accessories\utility.dm"
#include "code\modules\logging\logging.dm"
#include "code\modules\logging\api\reagents.dm"
#include "code\modules\loot\pack.dm"
#include "code\modules\loot\table.dm"
#include "code\modules\loot\packs\archeology.dm"
Expand Down Expand Up @@ -4571,22 +4574,33 @@
#include "code\modules\random_map\noise\noise.dm"
#include "code\modules\random_map\noise\ore.dm"
#include "code\modules\random_map\noise\tundra.dm"
#include "code\modules\reagents\Drink-Recipes.dm"
#include "code\modules\reagents\exposedprocs.dm"
#include "code\modules\reagents\Food-Recipes.dm"
#include "code\modules\reagents\Misc-Recipes.dm"
#include "code\modules\reagents\reagent_containers.dm"
#include "code\modules\reagents\Topical-Recipes.dm"
#include "code\modules\reagents\chemistry\_readme.dm"
#include "code\modules\reagents\chemistry\chemical_reaction-legacy.dm"
#include "code\modules\reagents\chemistry\chemical_reaction.dm"
#include "code\modules\reagents\chemistry\colors.dm"
#include "code\modules\reagents\chemistry\helpers.dm"
#include "code\modules\reagents\chemistry\holder.dm"
#include "code\modules\reagents\chemistry\logging.dm"
#include "code\modules\reagents\chemistry\machinery.dm"
#include "code\modules\reagents\chemistry\metabolism.dm"
#include "code\modules\reagents\chemistry\reaction.dm"
#include "code\modules\reagents\chemistry\reagent.dm"
#include "code\modules\reagents\chemistry\reagent_holder-legacy.dm"
#include "code\modules\reagents\chemistry\reagent_holder-reactions.dm"
#include "code\modules\reagents\chemistry\reagent_holder.dm"
#include "code\modules\reagents\chemistry\wiki_generation.dm"
#include "code\modules\reagents\chemistry\reactions\automata.dm"
#include "code\modules\reagents\chemistry\reactions\carpet.dm"
#include "code\modules\reagents\chemistry\reactions\detonation.dm"
#include "code\modules\reagents\chemistry\reactions\Drink-Recipes.dm"
#include "code\modules\reagents\chemistry\reactions\Food-Recipes.dm"
#include "code\modules\reagents\chemistry\reactions\medicine.dm"
#include "code\modules\reagents\chemistry\reactions\Misc-Recipes.dm"
#include "code\modules\reagents\chemistry\reactions\paint.dm"
#include "code\modules\reagents\chemistry\reactions\pyrotechnic.dm"
#include "code\modules\reagents\chemistry\reactions\solidification.dm"
#include "code\modules\reagents\chemistry\reactions\stack_synthesis.dm"
#include "code\modules\reagents\chemistry\reactions\Topical-Recipes.dm"
#include "code\modules\reagents\chemistry\reactions\food\food-synthesis.dm"
#include "code\modules\reagents\chemistry\reagents\Chemistry-Reagents-Core.dm"
#include "code\modules\reagents\chemistry\reagents\Chemistry-Reagents-Dispenser.dm"
#include "code\modules\reagents\chemistry\reagents\Chemistry-Reagents-Food-Drinks.dm"
Expand All @@ -4598,7 +4612,6 @@
#include "code\modules\reagents\chemistry\reagents\core\elements.dm"
#include "code\modules\reagents\chemistry\reagents\other\cleaner.dm"
#include "code\modules\reagents\chemistry\reagents\pyrotechnics\thermite.dm"
#include "code\modules\reagents\chemistry\recipes\medicine.dm"
#include "code\modules\reagents\distilling\Distilling-Recipes.dm"
#include "code\modules\reagents\distilling\distilling.dm"
#include "code\modules\reagents\items\hypospray.dm"
Expand Down
20 changes: 0 additions & 20 deletions code/__DEFINES/chemistry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,3 @@ var/list/cheartstopper = list("potassium_chloride") // Thi
//! Used by chem master
#define CONDIMASTER_STYLE_AUTO "auto"
#define CONDIMASTER_STYLE_FALLBACK "_"

/// When processing a reaction, iterate this many times.
#define PROCESS_REACTION_ITER 5

/**
* Helper that ensures the reaction rate holds after iterating
* Ex. REACTION_RATE(0.3) means that 30% of the reagents will react each chemistry tick (~2 seconds by default).
*/
#define REACTION_RATE(rate) (1.0 - (1.0-rate)**(1.0/PROCESS_REACTION_ITER))

/**
* Helper to define reaction rate in terms of half-life
*
* Ex.
* HALF_LIFE(0) -> Reaction completes immediately (default chems)
* HALF_LIFE(1) -> Half of the reagents react immediately, the rest over the following ticks.
* HALF_LIFE(2) -> Half of the reagents are consumed after 2 chemistry ticks.
* HALF_LIFE(3) -> Half of the reagents are consumed after 3 chemistry ticks.
*/
#define HALF_LIFE(ticks) (ticks? 1.0 - (0.5)**(1.0/(ticks*PROCESS_REACTION_ITER)) : 1.0)
20 changes: 20 additions & 0 deletions code/__DEFINES/reagents/chemical_reaction.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* flags for /datum/chemical_reaction/var/chemical_reaction_flags *//

// none yet

//* flags for /datum/chemical_reaction/var/reaction_guidebook_flags *//

/// doesn't show in guidebook reaction list
#define REACTION_GUIDEBOOK_UNLISTED (1<<0)
/// can't be pulled up on guidebook at all, other than name
#define REACTION_GUIDEBOOK_HIDDEN (1<<1)

DEFINE_SHARED_BITFIELD(reaction_guidebook_flags, list(
"reaction_guidebook_flags",
), list(
BITFIELD(REACTION_GUIDEBOOK_UNLISTED),
BITFIELD(REACTION_GUIDEBOOK_HIDDEN),
))
39 changes: 0 additions & 39 deletions code/__DEFINES/reagents/flags.dm

This file was deleted.

20 changes: 20 additions & 0 deletions code/__DEFINES/reagents/reagent.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* flags for /datum/reagent/var/reagent_flags *//

// none yet

//* flags for /datum/reagent/var/reagent_guidebook_flags *//

/// doesn't show in guidebook reagent list
#define REAGENT_GUIDEBOOK_UNLISTED (1<<0)
/// can't be pulled up on guidebook at all, other than name
#define REAGENT_GUIDEBOOK_HIDDEN (1<<1)

DEFINE_SHARED_BITFIELD(reagent_guidebook_flags, list(
"reagent_guidebook_flags",
), list(
BITFIELD(REAGENT_GUIDEBOOK_UNLISTED),
BITFIELD(REAGENT_GUIDEBOOK_HIDDEN),
))
7 changes: 7 additions & 0 deletions code/__DEFINES/reagents/reagent_holder.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* flags for /datum/reagent_holder/var/reagent_holder_flags *//

/// currently reacting
#define REAGENT_HOLDER_FLAG_CURRENTLY_REACTING (1<<0)
31 changes: 13 additions & 18 deletions code/__HELPERS/reagents.dm
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
// todo: this doesn't entirely work. see recipe for peridaxon requiring priority.
/proc/chem_recipes_do_conflict(datum/chemical_reaction/r1, datum/chemical_reaction/r2)
// do the non-list tests first, because they are cheaper
if(r1.required_container != r2.required_container)
// we can only conflict with something that requires the same container
if(r1.required_container_path != r2.required_container_path)
return FALSE
// if(r1.is_cold_recipe == r2.is_cold_recipe)
// if(r1.required_temp != r2.required_temp)
// //one reaction requires a more extreme temperature than the other, so there is no conflict
// return FALSE
// else
// var/datum/chemical_reaction/cold_one = r1.is_cold_recipe ? r1 : r2
// var/datum/chemical_reaction/warm_one = r1.is_cold_recipe ? r2 : r1
// if(cold_one.required_temp < warm_one.required_temp)
// //the range of temperatures does not overlap, so there is no conflict
// return FALSE

// we cannot conflict with a non-overlapping temperature range
if(r1.temperature_low >= r2.temperature_high || r1.temperature_high <= r2.temperature_low)
return FALSE

// todo: legacy below

//find the reactions with the shorter and longer required_reagents list
var/datum/chemical_reaction/long_req
var/datum/chemical_reaction/short_req
if(r1.required_reagents.len > r2.required_reagents.len)
if(length(r1.required_reagents) > length(r2.required_reagents))
long_req = r1
short_req = r2
else if(r1.required_reagents.len < r2.required_reagents.len)
else if(length(r1.required_reagents) < length(r2.required_reagents))
long_req = r2
short_req = r1
else
//if they are the same length, sort instead by the length of the catalyst list
//this is important if the required_reagents lists are the same
if(r1.catalysts.len > r2.catalysts.len)
if(length(r1.catalysts) > length(r2.catalysts))
long_req = r1
short_req = r2
else
Expand All @@ -35,15 +30,15 @@


//check if the shorter reaction list is a subset of the longer one
var/list/overlap = r1.required_reagents & r2.required_reagents
var/list/overlap = (r1.required_reagents || list()) & (r2.required_reagents || list())
if(overlap.len != short_req.required_reagents.len)
//there is at least one reagent in the short list that is not in the long list, so there is no conflict
return FALSE

//check to see if the shorter reaction's catalyst list is also a subset of the longer reaction's catalyst list
//if the longer reaction's catalyst list is a subset of the shorter ones, that is fine
//if the reaction lists are the same, the short reaction will have the shorter required_catalysts list, so it will register as a conflict
var/list/short_minus_long_catalysts = short_req.catalysts - long_req.catalysts
var/list/short_minus_long_catalysts = (short_req.catalysts || list()) - (long_req.catalysts || list())
if(short_minus_long_catalysts.len)
//there is at least one unique catalyst for the short reaction, so there is no conflict
return FALSE
Expand Down
Loading

0 comments on commit 2703d4f

Please sign in to comment.