From 87c4a81744712a6c0c9b4864efbf85f42be2fd34 Mon Sep 17 00:00:00 2001
From: kiVts <48099872+kiVts@users.noreply.github.com>
Date: Thu, 11 Jul 2024 16:13:33 -0400
Subject: [PATCH 1/3] Chemical simulator TGUI (#6568)
# About the pull request
The one of last NanoUIs are nuked, chemical simulator was moved to tgui,
along with other changes needed to accomplish that.
Consider that the 1.5 part of research rework
Conflicting and combining properties are now in GLOB lists, one bugfix
in save_new_properties, it literally never worked, you cannot add
conflicting properties in create, relate in conflict, and etc etc
Its working and is 100% complete, ~~but I need to do some final
polish(grammer, looks, etc). but if you dont mind ugliness then its
working.~~ Done and looks pretty cool
resolves #6644
# Explain why it's good for the game
Conflicting properties feature, less nanouis, more friendly to new
features.
# Testing Photographs and Procedure
Screenshots & Videos
![image](https://github.com/cmss13-devs/cmss13/assets/48099872/a1b06cf4-ae84-46b9-93af-69cd73acd3b6)
![image](https://github.com/cmss13-devs/cmss13/assets/48099872/5a3d81b7-903a-4a73-842e-2a212a9fc6b4)
# Changelog
:cl: Kivts
ui: The Company spent some money to upgrade the chemical simulator to
work on the TGUI, Including a few prepaid features.
/:cl:
---------
Co-authored-by: harryob <55142896+harryob@users.noreply.github.com>
---
code/_globalvars/global_lists.dm | 28 +
code/modules/reagents/Chemistry-Generator.dm | 37 +-
.../chemical_research/Chemical-Research.dm | 4 +-
.../chemistry_machinery/chem_simulator.dm | 567 +++++++++-------
.../chemistry_properties/prop_positive.dm | 2 +-
nano/templates/chem_simulator.tmpl | 366 ----------
.../tgui/interfaces/ChemSimulator.jsx | 629 ++++++++++++++++++
tgui/packages/tgui/styles/themes/weyland.scss | 8 +-
8 files changed, 986 insertions(+), 655 deletions(-)
delete mode 100644 nano/templates/chem_simulator.tmpl
create mode 100644 tgui/packages/tgui/interfaces/ChemSimulator.jsx
diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm
index c054b9a4bf1f..c6957eefd22c 100644
--- a/code/_globalvars/global_lists.dm
+++ b/code/_globalvars/global_lists.dm
@@ -119,6 +119,34 @@ GLOBAL_LIST(chemical_reactions_filtered_list) //List of all /datum/chemical_reac
GLOBAL_LIST(chemical_reactions_list) //List of all /datum/chemical_reaction datums indexed by reaction id. Used to search for the result instead of the components.
GLOBAL_LIST(chemical_reagents_list) //List of all /datum/reagent datums indexed by reagent id. Used by chemistry stuff
GLOBAL_LIST(chemical_properties_list) //List of all /datum/chem_property datums indexed by property name
+//list of all properties that conflict with each other.
+GLOBAL_LIST_INIT_TYPED(conflicting_properties, /list, list( PROPERTY_NUTRITIOUS = PROPERTY_HEMORRAGING, PROPERTY_NUTRITIOUS = PROPERTY_HEMOLYTIC, PROPERTY_TOXIC = PROPERTY_ANTITOXIC,\
+ PROPERTY_CORROSIVE = PROPERTY_ANTICORROSIVE, PROPERTY_BIOCIDIC = PROPERTY_NEOGENETIC, PROPERTY_HYPERTHERMIC = PROPERTY_HYPOTHERMIC,\
+ PROPERTY_NUTRITIOUS = PROPERTY_KETOGENIC, PROPERTY_PAINING = PROPERTY_PAINKILLING, PROPERTY_HALLUCINOGENIC = PROPERTY_ANTIHALLUCINOGENIC,\
+ PROPERTY_HEPATOTOXIC = PROPERTY_HEPATOPEUTIC, PROPERTY_NEPHROTOXIC = PROPERTY_NEPHROPEUTIC, PROPERTY_PNEUMOTOXIC = PROPERTY_PNEUMOPEUTIC,\
+ PROPERTY_OCULOTOXIC = PROPERTY_OCULOPEUTIC, PROPERTY_CARDIOTOXIC = PROPERTY_CARDIOPEUTIC, PROPERTY_NEUROTOXIC = PROPERTY_NEUROPEUTIC,\
+ PROPERTY_FLUXING = PROPERTY_REPAIRING, PROPERTY_RELAXING = PROPERTY_MUSCLESTIMULATING, PROPERTY_HEMOGENIC = PROPERTY_HEMOLYTIC,\
+ PROPERTY_HEMOGENIC = PROPERTY_HEMORRAGING, PROPERTY_NUTRITIOUS = PROPERTY_EMETIC,\
+ PROPERTY_HYPERGENETIC = PROPERTY_NEOGENETIC, PROPERTY_HYPERGENETIC = PROPERTY_HEPATOPEUTIC, PROPERTY_HYPERGENETIC = PROPERTY_NEPHROPEUTIC,\
+ PROPERTY_HYPERGENETIC = PROPERTY_PNEUMOPEUTIC, PROPERTY_HYPERGENETIC = PROPERTY_OCULOPEUTIC, PROPERTY_HYPERGENETIC = PROPERTY_CARDIOPEUTIC,\
+ PROPERTY_HYPERGENETIC = PROPERTY_NEUROPEUTIC, PROPERTY_ADDICTIVE = PROPERTY_ANTIADDICTIVE, PROPERTY_NEUROSHIELDING = PROPERTY_NEUROTOXIC,\
+ PROPERTY_HYPOMETABOLIC = PROPERTY_HYPERMETABOLIC, PROPERTY_HYPERTHROTTLING = PROPERTY_NEUROINHIBITING,
+ PROPERTY_FOCUSING = PROPERTY_NERVESTIMULATING, PROPERTY_THERMOSTABILIZING = PROPERTY_HYPERTHERMIC, PROPERTY_THERMOSTABILIZING = PROPERTY_HYPOTHERMIC,
+ PROPERTY_AIDING = PROPERTY_NEUROINHIBITING, PROPERTY_OXYGENATING = PROPERTY_HYPOXEMIC, PROPERTY_ANTICARCINOGENIC = PROPERTY_CARCINOGENIC, \
+ PROPERTY_CIPHERING = PROPERTY_CIPHERING_PREDATOR, PROPERTY_TRANSFORMATIVE = PROPERTY_ANTITOXIC, PROPERTY_MUSCLESTIMULATING = PROPERTY_NERVESTIMULATING))
+//list of all properties that combine into something else, now featured in global list
+GLOBAL_LIST_INIT_TYPED(combining_properties, /list, list( PROPERTY_DEFIBRILLATING = list(PROPERTY_MUSCLESTIMULATING, PROPERTY_CARDIOPEUTIC),\
+ PROPERTY_THANATOMETABOL = list(PROPERTY_HYPOXEMIC, PROPERTY_CRYOMETABOLIZING, PROPERTY_NEUROCRYOGENIC),\
+ PROPERTY_HYPERDENSIFICATING = list(PROPERTY_MUSCLESTIMULATING, PROPERTY_BONEMENDING, PROPERTY_CARCINOGENIC),\
+ PROPERTY_HYPERTHROTTLING = list(PROPERTY_PSYCHOSTIMULATING, PROPERTY_HALLUCINOGENIC),\
+ PROPERTY_NEUROSHIELDING = list(PROPERTY_ALCOHOLIC, PROPERTY_BALDING),\
+ PROPERTY_ANTIADDICTIVE = list(PROPERTY_PSYCHOSTIMULATING, PROPERTY_ANTIHALLUCINOGENIC),\
+ PROPERTY_ADDICTIVE = list(PROPERTY_PSYCHOSTIMULATING, PROPERTY_NEUROTOXIC),\
+ PROPERTY_CIPHERING_PREDATOR = list(PROPERTY_CIPHERING, PROPERTY_CROSSMETABOLIZING),\
+ PROPERTY_FIRE_PENETRATING = list(PROPERTY_OXYGENATING, PROPERTY_VISCOUS),\
+ PROPERTY_BONEMENDING = list(PROPERTY_HYPERDENSIFICATING, PROPERTY_NUTRITIOUS),\
+ PROPERTY_BONEMENDING = list(PROPERTY_HYPERDENSIFICATING, PROPERTY_NUTRITIOUS),\
+ PROPERTY_ENCEPHALOPHRASIVE = list(PROPERTY_NERVESTIMULATING, PROPERTY_PSYCHOSTIMULATING)))
//List of all id's from classed /datum/reagent datums indexed by class or tier. Used by chemistry generator and chem spawners.
GLOBAL_LIST_INIT_TYPED(chemical_gen_classes_list, /list, list("C" = list(),"C1" = list(),"C2" = list(),"C3" = list(),"C4" = list(),"C5" = list(),"C6" = list(),"T1" = list(),"T2" = list(),"T3" = list(),"T4" = list(),"tau", list()))
//properties generated in chemicals, helps to make sure the same property doesn't show up 10 times
diff --git a/code/modules/reagents/Chemistry-Generator.dm b/code/modules/reagents/Chemistry-Generator.dm
index 79efe2ef4453..813e0d9686bd 100644
--- a/code/modules/reagents/Chemistry-Generator.dm
+++ b/code/modules/reagents/Chemistry-Generator.dm
@@ -319,33 +319,6 @@
//*****************************************************************************************************/
/datum/reagent/proc/insert_property(property, level)
- //The list below defines what properties should override each other.
- var/list/conflicting_properties = list( PROPERTY_NUTRITIOUS = PROPERTY_HEMORRAGING, PROPERTY_NUTRITIOUS = PROPERTY_HEMOLYTIC, PROPERTY_TOXIC = PROPERTY_ANTITOXIC,\
- PROPERTY_CORROSIVE = PROPERTY_ANTICORROSIVE, PROPERTY_BIOCIDIC = PROPERTY_NEOGENETIC, PROPERTY_HYPERTHERMIC = PROPERTY_HYPOTHERMIC,\
- PROPERTY_NUTRITIOUS = PROPERTY_KETOGENIC, PROPERTY_PAINING = PROPERTY_PAINKILLING, PROPERTY_HALLUCINOGENIC = PROPERTY_ANTIHALLUCINOGENIC,\
- PROPERTY_HEPATOTOXIC = PROPERTY_HEPATOPEUTIC, PROPERTY_NEPHROTOXIC = PROPERTY_NEPHROPEUTIC, PROPERTY_PNEUMOTOXIC = PROPERTY_PNEUMOPEUTIC,\
- PROPERTY_OCULOTOXIC = PROPERTY_OCULOPEUTIC, PROPERTY_CARDIOTOXIC = PROPERTY_CARDIOPEUTIC, PROPERTY_NEUROTOXIC = PROPERTY_NEUROPEUTIC,\
- PROPERTY_FLUXING = PROPERTY_REPAIRING, PROPERTY_RELAXING = PROPERTY_MUSCLESTIMULATING, PROPERTY_HEMOGENIC = PROPERTY_HEMOLYTIC,\
- PROPERTY_HEMOGENIC = PROPERTY_HEMORRAGING, PROPERTY_NUTRITIOUS = PROPERTY_EMETIC,\
- PROPERTY_HYPERGENETIC = PROPERTY_NEOGENETIC, PROPERTY_HYPERGENETIC = PROPERTY_HEPATOPEUTIC, PROPERTY_HYPERGENETIC = PROPERTY_NEPHROPEUTIC,\
- PROPERTY_HYPERGENETIC = PROPERTY_PNEUMOPEUTIC, PROPERTY_HYPERGENETIC = PROPERTY_OCULOPEUTIC, PROPERTY_HYPERGENETIC = PROPERTY_CARDIOPEUTIC,\
- PROPERTY_HYPERGENETIC = PROPERTY_NEUROPEUTIC, PROPERTY_ADDICTIVE = PROPERTY_ANTIADDICTIVE, PROPERTY_NEUROSHIELDING = PROPERTY_NEUROTOXIC,\
- PROPERTY_HYPOMETABOLIC = PROPERTY_HYPERMETABOLIC, PROPERTY_HYPERTHROTTLING = PROPERTY_NEUROINHIBITING,
- PROPERTY_FOCUSING = PROPERTY_NERVESTIMULATING, PROPERTY_THERMOSTABILIZING = PROPERTY_HYPERTHERMIC, PROPERTY_THERMOSTABILIZING = PROPERTY_HYPOTHERMIC,
- PROPERTY_AIDING = PROPERTY_NEUROINHIBITING, PROPERTY_OXYGENATING = PROPERTY_HYPOXEMIC, PROPERTY_ANTICARCINOGENIC = PROPERTY_CARCINOGENIC, \
- PROPERTY_CIPHERING = PROPERTY_CIPHERING_PREDATOR, PROPERTY_TRANSFORMATIVE = PROPERTY_ANTITOXIC, PROPERTY_MUSCLESTIMULATING = PROPERTY_NERVESTIMULATING)
- //The list below defines which properties should be combined into a combo property
- var/list/combining_properties = list( PROPERTY_DEFIBRILLATING = list(PROPERTY_MUSCLESTIMULATING, PROPERTY_CARDIOPEUTIC),\
- PROPERTY_THANATOMETABOL = list(PROPERTY_HYPOXEMIC, PROPERTY_CRYOMETABOLIZING, PROPERTY_NEUROCRYOGENIC),\
- PROPERTY_HYPERDENSIFICATING = list(PROPERTY_MUSCLESTIMULATING, PROPERTY_BONEMENDING, PROPERTY_CARCINOGENIC),\
- PROPERTY_HYPERTHROTTLING = list(PROPERTY_PSYCHOSTIMULATING, PROPERTY_HALLUCINOGENIC),\
- PROPERTY_NEUROSHIELDING = list(PROPERTY_ALCOHOLIC, PROPERTY_BALDING),\
- PROPERTY_ANTIADDICTIVE = list(PROPERTY_PSYCHOSTIMULATING, PROPERTY_ANTIHALLUCINOGENIC),\
- PROPERTY_ADDICTIVE = list(PROPERTY_PSYCHOSTIMULATING, PROPERTY_NEUROTOXIC),\
- PROPERTY_CIPHERING_PREDATOR = list(PROPERTY_CIPHERING, PROPERTY_CROSSMETABOLIZING),\
- PROPERTY_FIRE_PENETRATING = list(PROPERTY_OXYGENATING, PROPERTY_VISCOUS),\
- PROPERTY_BONEMENDING = list(PROPERTY_HYPERDENSIFICATING, PROPERTY_NUTRITIOUS),\
- PROPERTY_ENCEPHALOPHRASIVE = list(PROPERTY_NERVESTIMULATING, PROPERTY_PSYCHOSTIMULATING))
var/datum/chem_property/match
var/datum/chem_property/initial_property
for(var/datum/chem_property/P in properties)
@@ -353,8 +326,8 @@
match = P
else
//Handle properties that combine
- for(var/C in combining_properties)
- var/list/combo = combining_properties[C]
+ for(var/C in GLOB.combining_properties)
+ var/list/combo = GLOB.combining_properties[C]
if(!combo.Find(property) || !combo.Find(P.name))
continue
var/pieces = 0
@@ -372,11 +345,11 @@
LAZYREMOVE(properties, R)
break
//Handle properties that conflict
- for(var/C in conflicting_properties)
- if(property == C && P.name == conflicting_properties[C])
+ for(var/C in GLOB.conflicting_properties)
+ if(property == C && P.name == GLOB.conflicting_properties[C])
match = P
break
- else if (property == conflicting_properties[C] && C == P.name)
+ else if (property == GLOB.conflicting_properties[C] && C == P.name)
match = P
break
if(match)
diff --git a/code/modules/reagents/chemical_research/Chemical-Research.dm b/code/modules/reagents/chemical_research/Chemical-Research.dm
index 2050e7e8e607..a05bc132734d 100644
--- a/code/modules/reagents/chemical_research/Chemical-Research.dm
+++ b/code/modules/reagents/chemical_research/Chemical-Research.dm
@@ -87,8 +87,8 @@ GLOBAL_DATUM_INIT(chemical_data, /datum/chemical_data, new)
if(P.category & PROPERTY_TYPE_UNADJUSTABLE || P.category & PROPERTY_TYPE_ANOMALOUS)
continue
property_names += P.name
- for(var/name in research_property_data)
- property_names -= name
+ for(var/datum/chem_property/property in research_property_data)
+ property_names -= property.name
if(LAZYLEN(property_names))
has_new_properties = TRUE
for(var/name in property_names)
diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm
index 650b6cefbae9..13e051f5dc20 100644
--- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm
+++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm
@@ -1,3 +1,4 @@
+//mode datums at the bottom.
#define MODE_AMPLIFY 1
#define MODE_SUPPRESS 2
#define MODE_RELATE 3
@@ -40,7 +41,6 @@
var/ready = FALSE
var/template_filter = PROPERTY_TYPE_ALL
- var/complexity_editor = FALSE
var/creation_template
var/creation_complexity = list(CHEM_CLASS_COMMON, CHEM_CLASS_UNCOMMON, CHEM_CLASS_RARE)
var/creation_name = ""
@@ -62,29 +62,29 @@
..()
if(inoperable())
icon_state = "modifier_off"
- SSnano.nanomanager.update_uis(src) // update all UIs attached to src
/obj/structure/machinery/chem_simulator/attackby(obj/item/B, mob/living/user)
if(!skillcheck(user, SKILL_RESEARCH, SKILL_RESEARCH_TRAINED))
to_chat(user, SPAN_WARNING("You have no idea how to use this."))
return
if(istype(B, /obj/item/paper/research_notes))
- var/obj/item/paper/research_notes/N = B
+ var/obj/item/paper/research_notes/note = B
if(!target || (mode == MODE_RELATE && !reference))
- B = N.convert_to_chem_report()
+ B = note.convert_to_chem_report()
else
to_chat(user, SPAN_WARNING("Chemical data already inserted."))
return
if(istype(B, /obj/item/paper/research_report))
- if(!target)
+ var/obj/item/paper/research_report/note = B
+ if(!target && note.data)
target = B
ready = check_ready()
- else if(mode == MODE_RELATE && !reference)
- target_property = ""
+ else if(mode == MODE_RELATE && !reference && note.data)
+ target_property = null
reference = B
ready = check_ready()
else
- to_chat(user, SPAN_WARNING("Chemical data already inserted."))
+ to_chat(user, SPAN_WARNING("Chemical data [note.data ? "is already inserted" : "is refused"]"))
return
else
to_chat(user, SPAN_WARNING("[src] refuses [B]."))
@@ -93,7 +93,6 @@
to_chat(user, SPAN_NOTICE("You insert [B] into [src]."))
flick("[icon_state]_reading",src)
update_costs()
- SSnano.nanomanager.update_uis(src) // update all UIs attached to src
/obj/structure/machinery/chem_simulator/attack_hand(mob/user as mob)
if(inoperable())
@@ -101,256 +100,279 @@
if(!skillcheck(user, SKILL_RESEARCH, SKILL_RESEARCH_TRAINED))
to_chat(user, SPAN_WARNING("You have no idea how to use this."))
return
- ui_interact(user)
-
-/obj/structure/machinery/chem_simulator/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0)
- var/list/data = list(
- "rsc_credits" = GLOB.chemical_data.rsc_credits,
- "target" = target,
- "reference" = reference,
- "mode" = mode,
- "complexity_editor" = complexity_editor,
- "property_costs" = property_costs,
- "simulating" = simulating,
- "status_bar" = status_bar,
- "ready" = ready,
- "od_lvl" = new_od_level,
- "recipe_target" = recipe_target,
- "recipe_targets" = list(),
- "property_codings" = list()
- )
-
- if(simulating == SIMULATION_STAGE_FINAL)
- for(var/reagent_id in recipe_targets)
- var/datum/reagent/R = GLOB.chemical_reagents_list[reagent_id]
- var/list/id_name[0]
- id_name["[R.id]"] = R.name
- data["recipe_targets"] += id_name
+ tgui_interact(user)
- if(mode == MODE_CREATE)
- data["creation_name"] = creation_name
- data["creation_cost"] = creation_cost
- data["complexity"] = complexity_to_string_list()
-
- //List of all available properties
- data["property_data_list"] = list()
- for(var/datum/chem_property/P in GLOB.chemical_data.research_property_data)
- data["property_codings"][P.name] = P.code
- if(template_filter && !HAS_FLAG(P.category, template_filter))
- continue
- data["property_data_list"][P.name] = P.level
- data["property_data_list"] = sortAssoc(data["property_data_list"])
- //List of enabled properties
- data["target_property_list"] = list()
- for(var/datum/chem_property/P in creation_template)
- data["target_property_list"][P.name] = P.level
- if(template_filter && !HAS_FLAG(P.category, template_filter))
- continue
- //Override the editor level with the enabled property level
- data["property_data_list"][P.name] = P.level
-
- data["template_filter"] = list(
- "MED" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_MEDICINE), PROPERTY_TYPE_MEDICINE),
- "TOX" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_TOXICANT), PROPERTY_TYPE_TOXICANT),
- "STI" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_STIMULANT), PROPERTY_TYPE_STIMULANT),
- "REA" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_REACTANT), PROPERTY_TYPE_REACTANT),
- "IRR" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_IRRITANT), PROPERTY_TYPE_IRRITANT),
- "MET" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_METABOLITE), PROPERTY_TYPE_METABOLITE)
- )
-
- else if(target && target.data && target.completed)
- data["target_property_list"] = target.data.properties_to_assoc()
- for(var/datum/chem_property/P in target.data.properties)
- data["property_codings"][P.name] = P.code
-
- if(reference && reference.data && reference.completed)
- data["reference_property_list"] = reference.data.properties_to_assoc()
- for(var/datum/chem_property/P in reference.data.properties)
- data["property_codings"][P.name] = P.code
-
- if(target_property)
- data["target_property"] = target_property.name
- data["target_info"] = target_property.description
- data["target_categories"] = target_property.categories_to_string()
- else
- data["target_info"] = ""
-
- if(reference_property)
- data["reference_property"] = reference_property.name
- data["reference_info"] = reference_property.description
- data["reference_categories"] = reference_property.categories_to_string()
- else
- data["reference_info"] = ""
-
- ui = SSnano.nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
+/obj/structure/machinery/chem_simulator/tgui_interact(mob/user, datum/tgui/ui) //death to the chem simulator! All Hail the new chem simulator!
+ ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
- ui = new(user, src, ui_key, "chem_simulator.tmpl", "Synthesis Simulator", 800, 550)
- ui.set_initial_data(data)
+ ui = new(user, src, "ChemSimulator", "Chemical Simulator")
ui.open()
-/obj/structure/machinery/chem_simulator/Topic(href, href_list)
+/obj/structure/machinery/chem_simulator/ui_data(mob/user)
. = ..()
- if(.)
- return
- if(inoperable() || !ishuman(usr))
- return
- var/mob/living/carbon/human/user = usr
- if(user.stat || user.is_mob_restrained() || !in_range(src, user))
- return
+ var/list/data = list()
+ data["status"] = status_bar
+ ready = check_ready()
+ data["is_ready"] = ready
+ data["can_simulate"] = (ready && simulating == SIMULATION_STAGE_OFF)
+ data["can_eject_target"] = ((target ? TRUE : FALSE) && simulating == SIMULATION_STAGE_OFF)
+ data["can_eject_reference"] = ((reference ? TRUE : FALSE) && simulating == SIMULATION_STAGE_OFF)
+ data["is_picking_recipe"] = (simulating == SIMULATION_STAGE_FINAL && mode != MODE_CREATE)
+ data["lock_control"] = (simulating != SIMULATION_STAGE_OFF)
+ data["can_cancel_simulation"] = (simulating <= SIMULATION_STAGE_WAIT)
+ data["estimated_cost"] = (mode == MODE_CREATE ? creation_cost : (!target_property ? "NULL" : property_costs[target_property.name]))
+ calculate_new_od_level()
+ data["od_level"] = new_od_level
+ data["chemical_name"] = (mode == MODE_CREATE ? (creation_name == "" ? "NAME NOT SET" : creation_name) : (isnull(target) ? "CHEMICAL DATA NOT INSERTED" : target.data.name))
+ data["reference_name"] = (isnull(reference) ? "CHEMICAL DATA NOT INSERTED" : reference.data.name)
if(mode == MODE_CREATE && GLOB.chemical_data.has_new_properties)
update_costs()
- if(href_list["simulate"] && ready)
- simulating = SIMULATION_STAGE_BEGIN
- status_bar = "COMMENCING SIMULATION"
- icon_state = "modifier_running"
- recipe_targets = list() //reset
- start_processing()
- if(mode == MODE_CREATE)
- msg_admin_niche("[key_name(user)] has created the chemical: [creation_name]")
- else if(href_list["ejectT"])
- if(target)
- if(!user.put_in_active_hand(target))
- target.forceMove(loc)
- target = null
- target_property = null
- stop_processing()
- simulating = SIMULATION_STAGE_OFF
- flick("[icon_state]_printing",src)
- else if(href_list["ejectR"])
- if(reference)
- if(!user.put_in_active_hand(reference))
- reference.forceMove(loc)
- reference = null
- reference_property = null
- stop_processing()
- simulating = SIMULATION_STAGE_OFF
- flick("[icon_state]_printing",src)
- else if(href_list["set_mode"])
- if(mode == MODE_CREATE) //for when you set the mode away from MODE_CREATE
- target_property = null
- reference_property = null
- complexity_editor = FALSE
- switch(href_list["set_mode"])
- if("amp")
- mode = MODE_AMPLIFY
- if("sup")
- mode = MODE_SUPPRESS
- if("rel")
- mode = MODE_RELATE
- if("cre")
- mode = MODE_CREATE
- target_property = null
- reference_property = null
- calculate_new_od_level()
- if(mode == MODE_CREATE)
- calculate_creation_cost()
- update_costs()
- else if(href_list["set_target"])
- if(simulating)
- return
- if(mode == MODE_CREATE)
- var/target_name = href_list["set_target"]
- for(var/datum/chem_property/P in GLOB.chemical_data.research_property_data)
- if(P.name == target_name)
- if(target_property && target_property.name == target_name)
- //Toggle the property
- if(LAZYISIN(creation_template, target_property))
- target_property.level = 0
- LAZYREMOVE(creation_template, target_property)
- else
- target_property.level = 1
- LAZYADD(creation_template, target_property)
- calculate_creation_cost()
- else
- target_property = P
+ if(simulating == SIMULATION_STAGE_FINAL)
+ for(var/reagent_id in recipe_targets)
+ var/datum/reagent/recipe_option = GLOB.chemical_reagents_list[reagent_id]
+ data["reagent_option_data"] += list(list(
+ "id" = recipe_option.id,
+ "name" = recipe_option.name,
+ ))
+ if(target && length(target?.data?.properties))
+ for(var/datum/chem_property/target_property_data in target.data.properties)
+ var/is_locked = FALSE
+ var/conflicting_tooltip = null
+ if(!isnull(reference_property))
+ if(LAZYACCESS(GLOB.conflicting_properties, reference_property.name) == target_property_data.name || LAZYACCESS(GLOB.conflicting_properties, target_property_data.name) == reference_property.name )
+ is_locked = TRUE
+ conflicting_tooltip = "This property conflicts with the selected reference property!"
+ data["target_data"] += list(list(
+ "code" = target_property_data.code,
+ "level" = target_property_data.level,
+ "name" = target_property_data.name,
+ "desc" = target_property_data.description,
+ "cost" = property_costs[target_property_data.name],
+ "is_locked" = is_locked,
+ "tooltip" = conflicting_tooltip,
+ ))
+ else
+ data["target_data"] = null
+
+ if(reference && length(reference?.data?.properties))
+ for(var/datum/chem_property/reference_property_data in reference.data.properties)
+ var/is_locked = FALSE
+ var/conflicting_tooltip = null
+ if(!isnull(target_property))
+ if(LAZYACCESS(GLOB.conflicting_properties, target_property.name) == reference_property_data.name || LAZYACCESS(GLOB.conflicting_properties, reference_property_data.name) == target_property.name )
+ is_locked = TRUE
+ conflicting_tooltip = "This property conflicts with the selected target property!"
+ data["reference_data"] += list(list(
+ "code" = reference_property_data.code,
+ "level" = reference_property_data.level,
+ "name" = capitalize_first_letters(reference_property_data.name),
+ "desc" = reference_property_data.description,
+ "cost" = property_costs[reference_property_data.name],
+ "is_locked" = is_locked,
+ "tooltip" = conflicting_tooltip,
+ ))
+ else
+ data["reference_data"] = null
+ data["template_filters"] = list(
+ "MED" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_MEDICINE), PROPERTY_TYPE_MEDICINE),
+ "TOX" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_TOXICANT), PROPERTY_TYPE_TOXICANT),
+ "STI" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_STIMULANT), PROPERTY_TYPE_STIMULANT),
+ "REA" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_REACTANT), PROPERTY_TYPE_REACTANT),
+ "IRR" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_IRRITANT), PROPERTY_TYPE_IRRITANT),
+ "MET" = list(HAS_FLAG(template_filter, PROPERTY_TYPE_METABOLITE), PROPERTY_TYPE_METABOLITE)
+ )
+ if(mode == MODE_CREATE)
+ for(var/datum/chem_property/known_properties in GLOB.chemical_data.research_property_data)
+ var/datum/chem_property/template_property
+ var/is_locked = FALSE
+ var/conflicting_tooltip = null
+ if(template_filter && !HAS_FLAG(known_properties.category, template_filter))
+ continue
+ for(var/template in creation_template)
+ template_property = template
+ if(LAZYACCESS(GLOB.conflicting_properties, template_property.name) == known_properties.name || LAZYACCESS(GLOB.conflicting_properties, known_properties.name) == template_property.name)
+ is_locked = TRUE
+ conflicting_tooltip = "This property conflicts with [template_property.code]!"
+ if(template_property.code == known_properties.code)
break
- else
- target_property = target.data.get_property(href_list["set_target"])
- calculate_new_od_level()
- if(simulating)
+ template_property = null
+
+ data["known_properties"] += list(list(
+ "code" = known_properties.code,
+ "level" = (isnull(template_property) ? 0 : template_property.level) ,
+ "name" = capitalize_first_letters(known_properties.name),
+ "desc" = known_properties.description,
+ "is_enabled" = LAZYISIN(creation_template, known_properties),
+ "is_locked" = is_locked,
+ "conflicting_tooltip" = conflicting_tooltip,
+ ))
+ if(!length(data["known_properties"]))
+ data["known_properties"] = null
+ data["complexity_list"] += complexity_to_string_list()
+
+ return data
+
+/obj/structure/machinery/chem_simulator/ui_static_data(mob/user)
+ . = ..()
+ var/list/static_data = list()
+ for(var/modes in subtypesof(/datum/chemical_simulator_modes))
+ var/datum/chemical_simulator_modes/modes_datum = modes
+ static_data["mode_data"] += list(list(
+ "name" = modes_datum.name,
+ "desc" = modes_datum.desc,
+ "mode_id" = modes_datum.mode_id,
+ "icon_type" = modes_datum.icon_type
+ ))
+ static_data["credits"] = GLOB.chemical_data.rsc_credits
+ return static_data
+
+/obj/structure/machinery/chem_simulator/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
+ . = ..()
+ if(.)
+ return
+ switch(action)
+ if("change_mode")
+ mode = params["mode_id"]
+ update_costs()
+ if("eject_target")
+ if(target)
+ if(!usr.put_in_active_hand(target))
+ target.forceMove(loc)
+ target = null
+ target_property = null
stop_processing()
- icon_state = "modifier"
simulating = SIMULATION_STAGE_OFF
- else if(href_list["set_reference"])
- reference_property = reference.data.get_property(href_list["set_reference"])
- if(simulating)
+ flick("[icon_state]_printing",src)
+ if("eject_reference")
+ if(reference)
+ if(!usr.put_in_active_hand(reference))
+ reference.forceMove(loc)
+ reference = null
+ reference_property = null
+ stop_processing()
+ flick("[icon_state]_printing",src)
+ if("select_target_property")
+ if(mode != MODE_CREATE)
+ if(!target)
+ return
+ for(var/datum/chem_property/target_prop in target.data.properties)
+ if(target_prop.code != params["property_code"])
+ continue
+ target_property = target_prop
+ if(!target_property)
+ to_chat(usr, SPAN_WARNING("The [src] makes a suspicious wail."))
+ return
+ if("select_reference_property")
+ if(!reference)
+ return
+ for(var/datum/chem_property/reference_prop in reference.data.properties)
+ if(reference_prop.code != params["property_code"])
+ continue
+ reference_property = reference_prop
+ if(!reference_property)
+ to_chat(usr, SPAN_WARNING("The [src] makes a suspicious wail."))
+ return
+ if("simulate")
+ if(!ready)
+ return
+ simulating = SIMULATION_STAGE_BEGIN
+ status_bar = "COMMENCING SIMULATION"
+ icon_state = "modifier_running"
+ recipe_targets = list() //reset
+ start_processing()
+ if(mode == MODE_CREATE)
+ msg_admin_niche("[key_name(usr)] has created the chemical: [creation_name]")
+ if("submit_recipe_pick")
+ if(recipe_target)
+ return
+ if(params["reagent_picked"] in recipe_targets)
+ recipe_target = params["reagent_picked"]
+ finalize_simulation(chem_cache)
+ recipe_target = null
+ if("cancel_simulation")
stop_processing()
icon_state = "modifier"
simulating = SIMULATION_STAGE_OFF
- update_costs()
- else if(href_list["set_recipe_target"])
- recipe_target = href_list["set_recipe_target"]
- else if(href_list["stop_simulation"])
- stop_processing()
- icon_state = "modifier"
- simulating = SIMULATION_STAGE_OFF
- else if(href_list["finalize_simulation"] && recipe_target)
- finalize_simulation(chem_cache)
- //Template creation editor
- else if(href_list["set_name"])
- var/newname = input("Set name for template (2-20 characters)","[src]") as text
- newname = reject_bad_name(newname, TRUE, 20, FALSE)
- if(isnull(newname))
- to_chat(user, "Bad name.")
- else if(GLOB.chemical_reagents_list[newname])
- to_chat(user, "Name already taken.")
- else
- creation_name = newname
- else if(href_list["set_level"] && target_property)
- var/level_to_set = 1
- if(GLOB.chemical_data.clearance_level <= 2)
- level_to_set = tgui_input_list(usr, "Set target level for [target_property.name]:","[src]", list(1,2,3,4))
- else if(GLOB.chemical_data.clearance_level <= 4)
- level_to_set = tgui_input_list(usr, "Set target level for [target_property.name]:","[src]", list(1,2,3,4,5,6,7,8))
- else
- level_to_set = tgui_input_list(usr, "Set target level for [target_property.name]:","[src]", list(1,2,3,4,5,6,7,8,9,10))
- if(!level_to_set)
- return
-
- target_property.level = level_to_set
- if(target_property.max_level && target_property.level > target_property.max_level)
- target_property.level = target_property.max_level
- to_chat(user, "Max level for [target_property.name] is [target_property.max_level].")
- calculate_creation_cost()
- else if(href_list["set_od"])
- var/od_to_set = tgui_input_list(usr, "Set new OD:", "[src]", list(5,10,15,20,25,30,35,40,45,50,55,60))
- if(!od_to_set)
- return
- new_od_level = od_to_set
- creation_od_level = od_to_set
- calculate_creation_cost()
- else if(href_list["set_filter"])
- if(href_list["set_filter"] == "ALL")
- template_filter = 0
- else
- var/flag_value = text2num(href_list["config_value"])
+ if("toggle_flag")
+ var/flag_value = params["flag_id"]
if(template_filter & flag_value)
template_filter &= ~flag_value
else
template_filter |= flag_value
- else if(href_list["toggle_complexity_editor"])
- complexity_editor = !complexity_editor
- else if(href_list["set_complexity"])
- var/slot = text2num(href_list["set_complexity"])
- var/new_rarity = tgui_input_list(usr, "Set chemical rarity for complexity slot [slot]:","[src]", list("BASIC (+7)","COMMON (+4)","UNCOMMON (1)","RARE (-5)"))
- if(!new_rarity)
+ if("select_create_property")
+ if(mode == MODE_CREATE)
+ if(target_property?.code == params["property_code"])
+ if(LAZYISIN(creation_template, target_property))
+ target_property.level = 0
+ LAZYREMOVE(creation_template, target_property)
+ else
+ target_property.level = 1
+ LAZYADD(creation_template, target_property)
+ else
+ for(var/datum/chem_property/known_prop in GLOB.chemical_data.research_property_data)
+ if(known_prop.code != params["property_code"])
+ continue
+ target_property = known_prop
+ if(!target_property)
+ to_chat(usr, SPAN_WARNING("The [src] makes a suspicious wail."))
+ return
+ calculate_creation_cost()
+ if("select_overdose")
+ if(simulating == SIMULATION_STAGE_OFF && mode == MODE_CREATE)
+ var/od_to_set = tgui_input_list(usr, "Set new OD:", "[src]", list(5,10,15,20,25,30,35,40,45,50,55,60))
+ if(!od_to_set || simulating != SIMULATION_STAGE_OFF)
+ return
+ creation_od_level = od_to_set
+ calculate_new_od_level()
+ calculate_creation_cost()
+ if("change_name")
+ if(simulating == SIMULATION_STAGE_OFF && mode == MODE_CREATE)
+ var/newname = input("Set name for template (2-20 characters)","[src]") as text
+ newname = reject_bad_name(newname, TRUE, 20, FALSE)
+ if(isnull(newname))
+ to_chat(usr, SPAN_WARNING("This name is not permited."))
+ else if(GLOB.chemical_reagents_list[newname])
+ to_chat(usr, SPAN_WARNING("This name is already occupied"))
+ else
+ creation_name = newname
+ if("change_create_target_level")
+ var/level_to_set = 1
+ if(GLOB.chemical_data.clearance_level <= 2)
+ level_to_set = tgui_input_list(usr, "Set target level for [target_property.name]:","[src]", list(1,2,3,4))
+ else if(GLOB.chemical_data.clearance_level <= 4)
+ level_to_set = tgui_input_list(usr, "Set target level for [target_property.name]:","[src]", list(1,2,3,4,5,6,7,8))
+ else
+ level_to_set = tgui_input_list(usr, "Set target level for [target_property.name]:","[src]", list(1,2,3,4,5,6,7,8,9,10))
+ if(!level_to_set)
+ return
+ if(!LAZYISIN(creation_template, target_property))
+ LAZYADD(creation_template, target_property)
+ target_property.level = level_to_set
+ if(target_property.max_level && target_property.level > target_property.max_level)
+ target_property.level = target_property.max_level
+ to_chat(usr, "Max level for [target_property.name] is [target_property.max_level].")
+ calculate_creation_cost()
+ if("change_complexity")
+ var/slot = params["complexity_slot"]
+ var/new_rarity = tgui_input_list(usr, "Set chemical rarity for complexity slot [slot]:", "[src]", list("BASIC (+7)", "COMMON (+4)", "UNCOMMON (1)", "RARE (-5)"))
+ if(!new_rarity || simulating != SIMULATION_STAGE_OFF)
+ return
+ switch(new_rarity)
+ if("BASIC (+7)")
+ creation_complexity[slot] = CHEM_CLASS_BASIC
+ if("COMMON (+4)")
+ creation_complexity[slot] = CHEM_CLASS_COMMON
+ if("UNCOMMON (1)")
+ creation_complexity[slot] = CHEM_CLASS_UNCOMMON
+ if("RARE (-5)")
+ creation_complexity[slot] = CHEM_CLASS_RARE
+ calculate_creation_cost()
+ if("keyboard_sound")//only exists to give sound
+ playsound(loc, pick('sound/machines/computer_typing1.ogg','sound/machines/computer_typing2.ogg','sound/machines/computer_typing3.ogg'), 5, 1)
return
-
- switch(new_rarity)
- if("BASIC (+7)")
- creation_complexity[slot] = CHEM_CLASS_BASIC
- if("COMMON (+4)")
- creation_complexity[slot] = CHEM_CLASS_COMMON
- if("UNCOMMON (1)")
- creation_complexity[slot] = CHEM_CLASS_UNCOMMON
- if("RARE (-5)")
- creation_complexity[slot] = CHEM_CLASS_RARE
- calculate_creation_cost()
- ready = check_ready()
playsound(loc, pick('sound/machines/computer_typing1.ogg','sound/machines/computer_typing2.ogg','sound/machines/computer_typing3.ogg'), 5, 1)
- SSnano.nanomanager.update_uis(src)
/obj/structure/machinery/chem_simulator/process()
if(inoperable())
@@ -534,24 +556,34 @@
if(target_property.level >= GLOB.chemical_data.clearance_level*TECHTREE_LEVEL_MULTIPLIER + 2 && GLOB.chemical_data.clearance_level < 5)
status_bar = "CLEARANCE INSUFFICIENT FOR AMPLIFICATION"
return FALSE
+ else
+ status_bar = "TARGET NOT SELECTED"
+ return FALSE
if(target && length(target.data.properties) < 2)
status_bar = "TARGET COMPLEXITY IMPROPER FOR RELATION"
return FALSE
- if(reference && target)
- if(!reference.completed)
- status_bar = "INCOMPLETE DATA DETECTED IN REFERENCE"
- return FALSE
- if(reference_property)
- if(target.data.get_property(reference_property.name))
- status_bar = "REFERENCE PROPERTY ALREADY IN TARGET"
+ if(mode == MODE_RELATE && isnull(reference))
+ status_bar = "NO REFERENCE DATA DETECTED"
+ return FALSE
+ if(mode == MODE_RELATE)
+ if(reference && target)
+ if(!reference.completed)
+ status_bar = "INCOMPLETE DATA DETECTED IN REFERENCE"
return FALSE
- if(target_property)
- if(target_property.level != reference_property.level)
- status_bar = "REFERENCE AND TARGET PROPERTY MUST BE OF EQUAL LEVELS"
- return FALSE
- if(reference_property.category & PROPERTY_TYPE_UNADJUSTABLE)
- status_bar = "REFERENCE PROPERTY CAN NOT BE SIMULATED"
+ if(reference_property)
+ if(target.data.get_property(reference_property.name))
+ status_bar = "REFERENCE PROPERTY ALREADY IN TARGET"
return FALSE
+ if(target_property)
+ if(target_property.level != reference_property.level)
+ status_bar = "REFERENCE AND TARGET PROPERTY MUST BE OF EQUAL LEVELS"
+ return FALSE
+ if(reference_property.category & PROPERTY_TYPE_UNADJUSTABLE)
+ status_bar = "REFERENCE PROPERTY CAN NOT BE SIMULATED"
+ return FALSE
+ else
+ status_bar = "REFERENCE PROPERTY NOT SELECTED"
+ return FALSE
if(mode == MODE_CREATE)
if(!LAZYLEN(creation_template))
status_bar = "TEMPLATE IS EMPTY"
@@ -565,7 +597,8 @@
else if(!target)
status_bar = "NO TARGET INSERTED"
return FALSE
- status_bar = "READY"
+ if(simulating == SIMULATION_STAGE_OFF)
+ status_bar = "READY"
return TRUE
/obj/structure/machinery/chem_simulator/proc/print(id, is_new)
@@ -714,6 +747,36 @@
status_bar = "SIMULATION COMPLETE"
print(C.id, TRUE)
+/datum/chemical_simulator_modes
+ var/name
+ var/desc
+ var/mode_id
+ var/icon_type
+
+/datum/chemical_simulator_modes/create
+ name = "CREATE"
+ desc = "Create a new custom chemical from the known properties discovered earlier."
+ mode_id = MODE_CREATE
+ icon_type = "bolt"
+
+/datum/chemical_simulator_modes/supress
+ name = "SUPRESS"
+ desc = "Supress one level in the choosen property. This operation lowers the OD level."
+ mode_id = MODE_SUPPRESS
+ icon_type = "square-minus"
+
+/datum/chemical_simulator_modes/amplify
+ name = "AMPLIFY"
+ desc = "Amplify one level in the choosen property. This operation lowers the OD level."
+ mode_id = MODE_AMPLIFY
+ icon_type = "square-plus"
+
+/datum/chemical_simulator_modes/relate
+ name = "RELATE"
+ desc = "Use the reference chemical to replace one choosen property in the target chemical. The target and reference target property level must be equal, This operation lowers the OD level."
+ mode_id = MODE_RELATE
+ icon_type = "repeat"
+
#undef SIMULATION_FAILURE
#undef SIMULATION_STAGE_OFF
#undef SIMULATION_STAGE_FINAL
diff --git a/code/modules/reagents/chemistry_properties/prop_positive.dm b/code/modules/reagents/chemistry_properties/prop_positive.dm
index 40867892afbd..9243c71ae7df 100644
--- a/code/modules/reagents/chemistry_properties/prop_positive.dm
+++ b/code/modules/reagents/chemistry_properties/prop_positive.dm
@@ -71,7 +71,7 @@
/datum/chem_property/positive/repairing
name = PROPERTY_REPAIRING
code = "REP"
- description = "Repairs cybernetic organs by REDACTED."
+ description = "Repairs cybernetic organs by the use of REDACTED property of REDACTED element."
rarity = PROPERTY_UNCOMMON
category = PROPERTY_TYPE_MEDICINE
value = 2
diff --git a/nano/templates/chem_simulator.tmpl b/nano/templates/chem_simulator.tmpl
deleted file mode 100644
index 47057f13bf85..000000000000
--- a/nano/templates/chem_simulator.tmpl
+++ /dev/null
@@ -1,366 +0,0 @@
-
-
-
- STATUS: {{:data.status_bar}}
-
- RESEARCH CREDITS: {{:data.rsc_credits}}
-
- {{if data.mode == 4 }}
- CREATION NAME: {{:data.creation_name}}
- CREATION COST: {{:data.creation_cost}}
- ESTIMATED OVERDOSE LVL: {{:data.od_lvl}} UNITS
- {{else}}
- {{if data.target }}
- TARGET DATA: {{:data.target}}
- {{else}}
- TARGET DATA: NOT FOUND
- {{/if}}
-
- {{if data.reference }}
- REFERENCE DATA: {{:data.reference}}
- {{else}}
- REFERENCE DATA: NOT FOUND
- {{/if}}
-
- ESTIMATED OVERDOSE LVL: {{:data.od_lvl}} UNITS
- {{/if}}
-
- {{if data.simulating }}
-
- {{else}}
-
- {{/if}}
-
-
-
-
- {{if data.mode != 4 }}
-
- {{if data.target_property}}
-
-
- {{:data.target_info}}
-
Type: {{:data.target_categories}}
-
Research Cost: {{:data.property_costs[data.target_property]}}
-
- {{/if}}
-
-
-
Target Properties
- {{if data.target}}
- {{if data.target_property_list }}
-
- {{props data.target_property_list :level:property}}
- {{:helper.link('' + data.property_codings[property] + ' Level ' + level + '', null, {'set_target' : property}, (data.target_property == property) ? 'selected' : null, 'propbutton')}}
- {{/props}}
-
- {{else}}
-
PROPERTIES CAN NOT BE SIMULATED
- {{/if}}
- {{/if}}
-
- {{else}}
-
-
-
- {{props data.property_data_list :level:property}}
- {{if data.target_property == property}}
- {{if level > 0 }}
- {{:helper.link(data.property_codings[property] + ' ' + level, null, {'set_target' : property}, null, 'propbutton templateProp targetedEnabled')}}
- {{else}}
- {{:helper.link(data.property_codings[property] + ' ' + level, null, {'set_target' : property}, null, 'propbutton templateProp targetedDisabled')}}
- {{/if}}
- {{else}}
- {{if level > 0 }}
- {{:helper.link(data.property_codings[property] + ' ' + level, null, {'set_target' : property}, null, 'propbutton templateProp')}}
- {{else}}
- {{:helper.link(data.property_codings[property] + ' ' + level, null, {'set_target' : property}, null, 'propbutton templateProp disabled')}}
- {{/if}}
- {{/if}}
- {{/props}}
-
-
- {{/if}}
-
-
- {{if data.mode == 3 }}
-
- {{if data.reference_property }}
-
-
- {{:data.reference_info}}
-
Type: {{:data.reference_categories}}
-
- {{/if}}
-
-
-
Reference Properties
- {{if data.reference}}
- {{if data.reference_property_list }}
-
- {{props data.reference_property_list :level:property}}
- {{:helper.link('' + data.property_codings[property] + ' Level ' + level + '', null, {'set_reference' : property}, (data.reference_property == property) ? 'selected' : null, 'propbutton')}}
- {{/props}}
-
- {{else}}
-
PROPERTIES CAN NOT BE SIMULATED
- {{/if}}
- {{/if}}
-
- {{else}}
- {{if data.mode == 4 }}
-
- {{if data.target_property}}
-
-
- {{:data.target_info}}
-
Type: {{:data.target_categories}}
-
Value per level: {{:data.property_costs[data.target_property]}}
-
- {{/if}}
-
- {{/if}}
- {{/if}}
-
-
diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx
new file mode 100644
index 000000000000..4243386e14c3
--- /dev/null
+++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx
@@ -0,0 +1,629 @@
+import { map } from 'common/collections';
+
+import { useBackend, useSharedState } from '../backend';
+import {
+ Box,
+ Button,
+ Divider,
+ Flex,
+ NoticeBox,
+ ProgressBar,
+ Section,
+ Stack,
+} from '../components';
+import { Window } from '../layouts';
+
+export const InfoPanel = () => {
+ const { data } = useBackend();
+ const {
+ credits,
+ status,
+ od_level,
+ chemical_name,
+ estimated_cost,
+ reference_name,
+ } = data;
+ return (
+
+
+
+
+ RESEARCH CREDITS: {credits}
+
+
+
+ STATUS: {status}
+
+
+ ESTIMATED SIMULATING COST: {estimated_cost}
+
+
+ TARGET NAME: {chemical_name}
+
+
+ REFERENCE NAME: {reference_name}
+
+
+ OVERDOSE LEVEL AFTER SIMULATION: {od_level}
+
+
+
+ );
+};
+
+export const Controls = (props) => {
+ const { act, data } = useBackend();
+ const {
+ selectedMode,
+ setSelectedMode,
+ complexityMenu,
+ setComplexityMenu,
+ setSelectedReferenceProperty,
+ setSelectedTargetProperty,
+ } = props;
+ const {
+ mode_data,
+ can_simulate,
+ can_eject_target,
+ can_eject_reference,
+ can_cancel_simulation,
+ lock_control,
+ } = data;
+ return (
+
+
+
+
+ {can_cancel_simulation ? (
+
+ ) : (
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {mode_data.map((mode_data, id) => (
+
+
+
+ ))}
+
+
+
+ );
+};
+
+export const RecipeOptions = () => {
+ const { act, data } = useBackend();
+ const [selectedRecipe, setSelectedRecipe] = useSharedState('recipe', null);
+ const { reagent_option_data } = data;
+ return (
+
+
+
+ {map(reagent_option_data, (recipe, id) => (
+
+ ))}
+
+
+ );
+};
+
+export const ModeChange = (props) => {
+ const { act, data } = useBackend();
+ const { target_data, lock_control } = data;
+ const { selectedTargetProperty, setSelectedTargetProperty } = props;
+ return (
+ (target_data && (
+
+
+
+ Target Data
+
+
+
+ {map(target_data, (property) => (
+
+ ))}
+
+
+
+
+
+ {map(
+ target_data,
+ (property) =>
+ property.code === selectedTargetProperty && (
+
+
+
+
+
+ Price of the operation : {property.cost}
+
+
+ ),
+ )}
+
+
+ )) || (
+
+ No data inserted!
+
+ )
+ );
+};
+
+export const ModeRelate = (props) => {
+ const { act, data } = useBackend();
+ const { target_data, reference_data, lock_control } = data;
+ const {
+ setSelectedTargetProperty,
+ setSelectedReferenceProperty,
+ selectedReferenceProperty,
+ selectedTargetProperty,
+ } = props;
+ return (
+ (target_data && reference_data && (
+
+
+
+ Target Data
+
+
+
+ {map(target_data, (property) => (
+
+ ))}
+
+
+
+
+
+
+ Reference Data
+
+
+
+ {map(reference_data, (property) => (
+
+ ))}
+
+
+
+
+
+ {map(
+ target_data,
+ (property) =>
+ property.code === selectedTargetProperty && (
+
+
+
+
+
+ Price of the operation : {property.cost}
+
+
+ ),
+ )}
+
+
+ )) || (
+
+ No data inserted!
+
+ )
+ );
+};
+
+export const ModeCreate = (props) => {
+ const { act, data } = useBackend();
+ const { complexityMenu } = props;
+ const { known_properties } = data;
+ const [selectedProperty, setSelectedProperty] = useSharedState(false);
+ return (
+
+
+
+
+
+
+ {map(known_properties, (property) => (
+
+
+
+ ))}
+
+
+
+ {map(
+ known_properties,
+ (property) =>
+ property.code === selectedProperty && (
+
+ ),
+ )}
+
+
+ );
+};
+
+export const CreateControl = (props) => {
+ const { act, data } = useBackend();
+ const { template_filters, lock_control, complexity_list } = data;
+ const { complexityMenu } = props;
+ return !complexityMenu ? (
+
+
+
+
+
+
+
+
+
+
+ {map(template_filters, (flag, name) => (
+
+
+
+ ))}
+
+ ) : (
+
+ {map(complexity_list, (rarity, id) => (
+
+
+
+ ))}
+
+ );
+};
+
+export const ChemSimulator = () => {
+ const { data } = useBackend();
+ const { is_picking_recipe } = data;
+ const [selectedMode, setSelectedMode] = useSharedState('modes');
+ const [complexityMenu, setComplexityMenu] = useSharedState(
+ 'complexity_flip',
+ false,
+ );
+ const [selectedTargetProperty, setSelectedTargetProperty] = useSharedState(
+ 'target',
+ false,
+ );
+ const [selectedReferenceProperty, setSelectedReferenceProperty] =
+ useSharedState('reference_relate', false);
+ return (
+
+
+
+
+
+
+
+ {(!is_picking_recipe && (
+
+ )) || }
+
+
+
+ {selectedMode === 1 && (
+
+ )}
+ {selectedMode === 2 && (
+
+ )}
+ {selectedMode === 3 && (
+
+ )}
+ {selectedMode === 4 && }
+
+
+ );
+};
diff --git a/tgui/packages/tgui/styles/themes/weyland.scss b/tgui/packages/tgui/styles/themes/weyland.scss
index 665a975e933d..bf2cbbd29cc6 100644
--- a/tgui/packages/tgui/styles/themes/weyland.scss
+++ b/tgui/packages/tgui/styles/themes/weyland.scss
@@ -28,7 +28,7 @@ $weyland: #af7f38;
'../components/Button.scss',
$with: (
'color-default': $weyland,
- 'color-selected': #9d0808,
+ 'color-selected': #e4c69a,
'color-caution': #be6209,
'color-danger': #9a9d00,
'color-transparent-text': color.scale($weyland, $lightness: 30%)
@@ -47,6 +47,10 @@ $weyland: #af7f38;
'../layouts/TitleBar.scss',
$with: ('background-color': color.scale(#252832, $lightness: -25%))
);
+ @include meta.load-css(
+ '../components/Divider.scss',
+ $with: ('color': rgba(28, 30, 32, 0.932), 'thickness': base.em(4px))
+ );
.Button {
font-family: consolas;
@@ -59,7 +63,7 @@ $weyland: #af7f38;
background-color: #252832;
background-image: url('../../assets/bg-weyland.png');
background-position: top;
- background-size: contain;
+ background-size: auto;
background-repeat: repeat no-repeat;
}
From 93ae94fcf0872bb4ac13c56ad366a50d2a67cc36 Mon Sep 17 00:00:00 2001
From: cm13-github <128137806+cm13-github@users.noreply.github.com>
Date: Thu, 11 Jul 2024 21:20:58 +0100
Subject: [PATCH 2/3] Automatic changelog for PR #6568 [ci skip]
---
html/changelogs/AutoChangeLog-pr-6568.yml | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 html/changelogs/AutoChangeLog-pr-6568.yml
diff --git a/html/changelogs/AutoChangeLog-pr-6568.yml b/html/changelogs/AutoChangeLog-pr-6568.yml
new file mode 100644
index 000000000000..da0db1fe41f0
--- /dev/null
+++ b/html/changelogs/AutoChangeLog-pr-6568.yml
@@ -0,0 +1,4 @@
+author: "Kivts"
+delete-after: True
+changes:
+ - ui: "The Company spent some money to upgrade the chemical simulator to work on the TGUI, Including a few prepaid features."
\ No newline at end of file
From cffeff95cb6794c7ec203f0d195d0d84cd89b33d Mon Sep 17 00:00:00 2001
From: Changelogs
Date: Fri, 12 Jul 2024 01:17:18 +0000
Subject: [PATCH 3/3] Automatic changelog compile [ci skip]
---
html/changelogs/AutoChangeLog-pr-6568.yml | 4 ----
html/changelogs/archive/2024-07.yml | 4 ++++
2 files changed, 4 insertions(+), 4 deletions(-)
delete mode 100644 html/changelogs/AutoChangeLog-pr-6568.yml
diff --git a/html/changelogs/AutoChangeLog-pr-6568.yml b/html/changelogs/AutoChangeLog-pr-6568.yml
deleted file mode 100644
index da0db1fe41f0..000000000000
--- a/html/changelogs/AutoChangeLog-pr-6568.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-author: "Kivts"
-delete-after: True
-changes:
- - ui: "The Company spent some money to upgrade the chemical simulator to work on the TGUI, Including a few prepaid features."
\ No newline at end of file
diff --git a/html/changelogs/archive/2024-07.yml b/html/changelogs/archive/2024-07.yml
index cf39262dee86..c151c48934c9 100644
--- a/html/changelogs/archive/2024-07.yml
+++ b/html/changelogs/archive/2024-07.yml
@@ -120,3 +120,7 @@
iloveloopers:
- bugfix: Demolitions scanner now properly works for incinerator tanks.
- spellcheck: Fixed some capitalization with custom incinerator tanks.
+2024-07-12:
+ Kivts:
+ - ui: The Company spent some money to upgrade the chemical simulator to work on
+ the TGUI, Including a few prepaid features.