From 71c0b2839c48874436613b7357d1549d1f701c51 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:29:25 -0400 Subject: [PATCH 01/22] sync --- .../tgui/interfaces/ChemSimulator.jsx | 240 ++++++++++++++++++ 1 file changed, 240 insertions(+) create mode 100644 tgui/packages/tgui/interfaces/ChemSimulator.jsx diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx new file mode 100644 index 000000000000..d18f5e728a54 --- /dev/null +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -0,0 +1,240 @@ +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 { clearance, credits, status } = data; + return ( + +
+ + + +

RESEARCH CREDITS: {credits}

+
+
+ +

STATUS: {status}

+
+ +

RESEARCH CLEARANCE: {clearance}

+
+ +

RESEARCH CLEARANCE: {clearance}

+
+
+
+
+ ); +}; + +export const Controls = (props) => { + const { act, data } = useBackend(); + const { selectedMode, setSelectedMode } = props; + const { mode_data, can_simulate, can_eject_target, can_eject_reference } = + data; + return ( + + + + + + + + + + + + + + + + + + + + {mode_data.map((mode_data, id) => ( + + + + ))} + + + + ); +}; + +export const ModeChange = (props) => { + const { act, data } = useBackend(); + const { selectedMode } = props; + const { target_data } = data; + const [selectedProperty, setSelectedProperty] = useSharedState(false); + return ( + (target_data && ( + + + {map(target_data, (property, key) => + key <= 3 ? ( + + + + + + ) : ( + false + ), + )} + + + {map(target_data, (property, key) => + key > 3 ? ( + + + + + + ) : ( + false + ), + )} + + + {map( + target_data, + (property, key) => + property.code === selectedProperty && ( +
{property.desc}
+ ), + )} +
+
+ )) || ( + + No data inserted! + + ) + ); +}; + +export const ModeRelate = (props) => { + const { act, data } = useBackend(); + const { selectedMode } = props; + const { target_data } = data; + return relate; +}; + +export const ModeCreate = (props) => { + const { act, data } = useBackend(); + const { selectedMode } = props; + const { mode_data, can_simulate, can_eject_target, can_eject_reference } = + data; + return Create here; +}; + +export const ChemSimulator = () => { + const { act, data } = useBackend(); + const { clearance, credits, status } = data; + const [selectedMode, setSelectedMode] = useSharedState(1); + return ( + + + + + + + + + + + + {selectedMode === 1 && } + {selectedMode === 2 && } + {selectedMode === 3 && } + {selectedMode === 4 && } + + + ); +}; From 2eacec67ab272c0f5114892ef50231089c5cad41 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:30:25 -0400 Subject: [PATCH 02/22] sync --- code/modules/projectiles/gun_attachables.dm | 2 +- .../chemistry_machinery/chem_simulator.dm | 108 +++++++++++++++++- code/modules/recycling/recycler.dm | 2 +- tgui/packages/tgui/styles/themes/weyland.scss | 5 +- 4 files changed, 111 insertions(+), 6 deletions(-) diff --git a/code/modules/projectiles/gun_attachables.dm b/code/modules/projectiles/gun_attachables.dm index d1aff8a33969..982dd116e59e 100644 --- a/code/modules/projectiles/gun_attachables.dm +++ b/code/modules/projectiles/gun_attachables.dm @@ -3088,7 +3088,7 @@ Defined in conflicts.dm of the #defines folder. else . += "It's empty." /obj/item/attachable/attached_gun/shotgun/set_bullet_traits() - LAZYADD(traits_to_give_attached, list( + LAZYA DD(traits_to_give_attached, list( BULLET_TRAIT_ENTRY_ID("turfs", /datum/element/bullet_trait_damage_boost, 5, GLOB.damage_boost_turfs), BULLET_TRAIT_ENTRY_ID("breaching", /datum/element/bullet_trait_damage_boost, 10.8, GLOB.damage_boost_breaching), BULLET_TRAIT_ENTRY_ID("pylons", /datum/element/bullet_trait_damage_boost, 5, GLOB.damage_boost_pylons) diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index fd14698619ad..6963e51ed774 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 @@ -101,7 +102,78 @@ 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) + tgui_interact(user) + +/obj/structure/machinery/chem_simulator/tgui_interact(mob/user, datum/tgui/ui) //death to the chem simulator! All Hail the chem simulator! + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "ChemSimulator", "Chemical Simulator") + ui.open() + +/obj/structure/machinery/chem_simulator/ui_data(mob/user) + . = ..() + var/list/data = list() + data["clearance"] = GLOB.chemical_data.clearance_level + data["credits"] = GLOB.chemical_data.rsc_credits + data["status"] = status_bar + ready = check_ready() + data["can_simulate"] = ready + data["can_eject_target"] = ((target ? TRUE : FALSE) && simulating == SIMULATION_STAGE_OFF) + data["can_eject_reference"] = ((reference ? TRUE : FALSE) && simulating == SIMULATION_STAGE_OFF) + if(target) + if(length(target?.data?.properties)) + for(var/datum/chem_property/target_property_data in target.data.properties) + 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, + )) + else + data["target_data"] = null + 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, + )) + 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"] + if("eject_target") + if(target) + if(!usr.put_in_active_hand(target)) + target.forceMove(loc) + target = null + target_property = null + stop_processing() + simulating = SIMULATION_STAGE_OFF + flick("[icon_state]_printing",src) + if("eject_reference") + if(!target || simulating != SIMULATION_STAGE_OFF) + return + if(!usr.put_in_active_hand(reference)) + reference.forceMove(loc) + reference = null + reference_property = null + stop_processing() + flick("[icon_state]_printing",src) + + + + /obj/structure/machinery/chem_simulator/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0) var/list/data = list( @@ -188,7 +260,7 @@ ui.set_initial_data(data) ui.open() -/obj/structure/machinery/chem_simulator/Topic(href, href_list) +/*/obj/structure/machinery/chem_simulator/Topic(href, href_list) . = ..() if(.) return @@ -351,7 +423,7 @@ 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()) return @@ -714,6 +786,36 @@ status_bar = "SIMULATION COMPLETE" print(C.id, TRUE) +/datum/chemical_simulator_modes + var/name + var/desc + var/mode_id + var/icon + +/datum/chemical_simulator_modes/create + name = "CREATE" + desc = "Create a new custom chemical from the known properties discovered earlier" + mode_id = MODE_CREATE + icon = "minus" + +/datum/chemical_simulator_modes/supress + name = "SUPRESS" + desc = "Supress one level in the choosen property. This decreases the OD level." + mode_id = MODE_SUPPRESS + icon = "minus" + +/datum/chemical_simulator_modes/amplify + name = "AMPLIFY" + desc = "Amplify one level in the choosen property. This decreases the OD level" + mode_id = MODE_AMPLIFY + icon = "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." + mode_id = MODE_RELATE + icon = "minus" + #undef SIMULATION_FAILURE #undef SIMULATION_STAGE_OFF #undef SIMULATION_STAGE_FINAL diff --git a/code/modules/recycling/recycler.dm b/code/modules/recycling/recycler.dm index b61854d2e788..1713dee71b08 100644 --- a/code/modules/recycling/recycler.dm +++ b/code/modules/recycling/recycler.dm @@ -47,7 +47,7 @@ /obj/structure/machinery/recycler/proc/recycle(obj/item/I) var/turf/T = get_turf(I) - for(var/forbidden_path in ignored_items) + for(var/forbidden_path in igno red_items) if(istype(I, forbidden_path)) I.forceMove(loc) return diff --git a/tgui/packages/tgui/styles/themes/weyland.scss b/tgui/packages/tgui/styles/themes/weyland.scss index 665a975e933d..627521b05007 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': #d6b480, 'color-caution': #be6209, 'color-danger': #9a9d00, 'color-transparent-text': color.scale($weyland, $lightness: 30%) @@ -55,6 +55,9 @@ $weyland: #af7f38; outline: base.em(1px) solid #161613; } + .Button--color--danger { + background-color: #d16c0e; + } .Layout__content { background-color: #252832; background-image: url('../../assets/bg-weyland.png'); From cdde3d6632bae4b171f51dc19d39e68a0c58de78 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Wed, 12 Jun 2024 02:18:43 -0400 Subject: [PATCH 03/22] its never going to end Im stuck here help me --- code/modules/projectiles/gun_attachables.dm | 2 +- .../chemistry_machinery/chem_simulator.dm | 70 ++++- code/modules/recycling/recycler.dm | 2 +- .../tgui/interfaces/ChemSimulator.jsx | 242 +++++++++++------- 4 files changed, 209 insertions(+), 107 deletions(-) diff --git a/code/modules/projectiles/gun_attachables.dm b/code/modules/projectiles/gun_attachables.dm index 982dd116e59e..d1aff8a33969 100644 --- a/code/modules/projectiles/gun_attachables.dm +++ b/code/modules/projectiles/gun_attachables.dm @@ -3088,7 +3088,7 @@ Defined in conflicts.dm of the #defines folder. else . += "It's empty." /obj/item/attachable/attached_gun/shotgun/set_bullet_traits() - LAZYA DD(traits_to_give_attached, list( + LAZYADD(traits_to_give_attached, list( BULLET_TRAIT_ENTRY_ID("turfs", /datum/element/bullet_trait_damage_boost, 5, GLOB.damage_boost_turfs), BULLET_TRAIT_ENTRY_ID("breaching", /datum/element/bullet_trait_damage_boost, 10.8, GLOB.damage_boost_breaching), BULLET_TRAIT_ENTRY_ID("pylons", /datum/element/bullet_trait_damage_boost, 5, GLOB.damage_boost_pylons) diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index 6963e51ed774..b277c9167fa8 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -93,8 +93,7 @@ user.drop_inv_item_to_loc(B, src) 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 + update_costs()// update all UIs attached to src /obj/structure/machinery/chem_simulator/attack_hand(mob/user as mob) if(inoperable()) @@ -117,18 +116,29 @@ data["credits"] = GLOB.chemical_data.rsc_credits data["status"] = status_bar ready = check_ready() - data["can_simulate"] = 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) - if(target) - if(length(target?.data?.properties)) - for(var/datum/chem_property/target_property_data in target.data.properties) - 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, - )) + data["is_picking_recipe"] = (simulating == SIMULATION_STAGE_FINAL && mode != MODE_CREATE) + data["lock_target_control"] = (simulating != SIMULATION_STAGE_OFF) + data["can_cancel_simulation"] = (simulating <= SIMULATION_STAGE_WAIT) + 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) + 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] + )) else data["target_data"] = null return data @@ -152,6 +162,7 @@ switch(action) if("change_mode") mode = params["mode_id"] + update_costs() if("eject_target") if(target) if(!usr.put_in_active_hand(target)) @@ -170,6 +181,38 @@ reference_property = null stop_processing() flick("[icon_state]_printing",src) + if("select_target_property") + 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 suspcious vail.")) + 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 + @@ -637,7 +680,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) diff --git a/code/modules/recycling/recycler.dm b/code/modules/recycling/recycler.dm index 1713dee71b08..b61854d2e788 100644 --- a/code/modules/recycling/recycler.dm +++ b/code/modules/recycling/recycler.dm @@ -47,7 +47,7 @@ /obj/structure/machinery/recycler/proc/recycle(obj/item/I) var/turf/T = get_turf(I) - for(var/forbidden_path in igno red_items) + for(var/forbidden_path in ignored_items) if(istype(I, forbidden_path)) I.forceMove(loc) return diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index d18f5e728a54..53b5b8fac767 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -4,8 +4,10 @@ import { useBackend, useSharedState } from '../backend'; import { Box, Button, + Dimmer, Divider, Flex, + Icon, NoticeBox, ProgressBar, Section, @@ -52,22 +54,40 @@ export const InfoPanel = () => { export const Controls = (props) => { const { act, data } = useBackend(); const { selectedMode, setSelectedMode } = props; - const { mode_data, can_simulate, can_eject_target, can_eject_reference } = - data; + const { + mode_data, + can_simulate, + can_eject_target, + can_eject_reference, + can_cancel_simulation, + } = data; return ( - + {can_cancel_simulation ? ( + + ) : ( + + )} - - - ) : ( - false - ), - )} - - - {map(target_data, (property, key) => - key > 3 ? ( - - - - - - ) : ( - false - ), - )} - - - {map( - target_data, - (property, key) => - property.code === selectedProperty && ( -
{property.desc}
- ), - )} -
-
- )) || ( - - No data inserted! - - ) + + + + {map(reagent_option_data, (recipe, id) => ( + + ))} + + ); }; +export const ModeChange = () => { + const { act, data } = useBackend(); + const { target_data, lock_target_control, is_ready, status } = data; + const [selectedProperty, setSelectedProperty] = useSharedState(false); + if (is_ready) { + return ( +
+ + + {status} + +
+ ); + } else { + return ( + (target_data && ( + + + {map(target_data, (property, key) => ( + + ))} + + + {map( + target_data, + (property, key) => + property.code === selectedProperty && ( + + +
{property.desc}
+
+ + Price of the operation : {property.cost} + +
+ ), + )} +
+
+ )) || ( + + No data inserted! + + ) + ); + } +}; + export const ModeRelate = (props) => { const { act, data } = useBackend(); const { selectedMode } = props; @@ -206,32 +257,39 @@ export const ModeRelate = (props) => { export const ModeCreate = (props) => { const { act, data } = useBackend(); const { selectedMode } = props; - const { mode_data, can_simulate, can_eject_target, can_eject_reference } = - data; + const { + mode_data, + can_simulate, + can_eject_target, + can_eject_reference, + is_picking_recipe, + } = data; return Create here; }; export const ChemSimulator = () => { const { act, data } = useBackend(); - const { clearance, credits, status } = data; + const { clearance, credits, status, is_picking_recipe, is_ready } = data; const [selectedMode, setSelectedMode] = useSharedState(1); return ( - + - + {(!is_picking_recipe && ( + + )) || } - {selectedMode === 1 && } - {selectedMode === 2 && } + {selectedMode === 1 && } + {selectedMode === 2 && } {selectedMode === 3 && } {selectedMode === 4 && } From beefd1f9f4b193eb697cdc5a9b5df3f8bf6d6959 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Thu, 13 Jun 2024 02:24:55 -0400 Subject: [PATCH 04/22] its ugly but it works! --- code/_globalvars/global_lists.dm | 26 +++ code/modules/reagents/Chemistry-Generator.dm | 36 +--- .../chemistry_machinery/chem_simulator.dm | 51 ++++- .../tgui/interfaces/ChemSimulator.jsx | 191 ++++++++++++------ 4 files changed, 201 insertions(+), 103 deletions(-) diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm index 2bd24af5a0ff..93f38f37963e 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -116,6 +116,32 @@ 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))) //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 f4cc32be3670..813e0d9686bd 100644 --- a/code/modules/reagents/Chemistry-Generator.dm +++ b/code/modules/reagents/Chemistry-Generator.dm @@ -319,32 +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)) var/datum/chem_property/match var/datum/chem_property/initial_property for(var/datum/chem_property/P in properties) @@ -352,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 @@ -371,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/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index b277c9167fa8..47e0de3ae8bd 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -81,7 +81,7 @@ target = B ready = check_ready() else if(mode == MODE_RELATE && !reference) - target_property = "" + target_property = null reference = B ready = check_ready() else @@ -132,15 +132,43 @@ )) 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] + "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" = 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 return data /obj/structure/machinery/chem_simulator/ui_static_data(mob/user) @@ -173,11 +201,10 @@ simulating = SIMULATION_STAGE_OFF flick("[icon_state]_printing",src) if("eject_reference") - if(!target || simulating != SIMULATION_STAGE_OFF) - return - if(!usr.put_in_active_hand(reference)) - reference.forceMove(loc) - reference = null + if(reference) + if(!usr.put_in_active_hand(reference)) + reference.forceMove(loc) + reference = null reference_property = null stop_processing() flick("[icon_state]_printing",src) @@ -191,6 +218,16 @@ if(!target_property) to_chat(usr, SPAN_WARNING("The [src] makes a suspcious vail.")) 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 suspcious vail.")) + return if("simulate") if(!ready) return diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index 53b5b8fac767..387309a51575 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -4,10 +4,8 @@ import { useBackend, useSharedState } from '../backend'; import { Box, Button, - Dimmer, Divider, Flex, - Icon, NoticeBox, ProgressBar, Section, @@ -185,73 +183,136 @@ export const RecipeOptions = (props) => { export const ModeChange = () => { const { act, data } = useBackend(); - const { target_data, lock_target_control, is_ready, status } = data; + const { target_data, lock_target_control } = data; const [selectedProperty, setSelectedProperty] = useSharedState(false); - if (is_ready) { - return ( -
- - - {status} - -
- ); - } else { - return ( - (target_data && ( - - - {map(target_data, (property, key) => ( - - ))} - - - {map( - target_data, - (property, key) => - property.code === selectedProperty && ( - - -
{property.desc}
-
- - Price of the operation : {property.cost} - -
- ), - )} -
-
- )) || ( - - No data inserted! - - ) - ); - } + return ( + (target_data && ( + + + {map(target_data, (property, key) => ( + + ))} + + + {map( + target_data, + (property, key) => + property.code === selectedProperty && ( + + +
{property.desc}
+
+ + Price of the operation : {property.cost} + +
+ ), + )} +
+
+ )) || ( + + No data inserted! + + ) + ); }; -export const ModeRelate = (props) => { +export const ModeRelate = () => { const { act, data } = useBackend(); - const { selectedMode } = props; - const { target_data } = data; - return relate; + const { target_data, reference_data, lock_target_control } = data; + const [selectedTargetProperty, setSelectedTargetProperty] = useSharedState( + 'target', + false, + ); + const [selectedReferenceProperty, setSelectedReferenceProperty] = + useSharedState('reference', false); + const [InfoPanel, setInfoPanel] = useSharedState('panel', false); + return ( + (target_data && reference_data && ( + + + {map(target_data, (property) => ( + + ))} + + + {map(reference_data, (property) => ( + + ))} + + + {map( + target_data, + (property, key) => + property.code === selectedTargetProperty && ( + + +
{property.desc}
+
+ + Price of the operation : {property.cost} + +
+ ), + )} +
+
+ )) || ( + + No data insertsed! + + ) + ); }; export const ModeCreate = (props) => { From 2346cc06faf5259647418dc3e6d0ff247b8c8402 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Wed, 19 Jun 2024 14:40:15 -0400 Subject: [PATCH 05/22] ugh --- .../chemistry_machinery/chem_simulator.dm | 29 ++++++-- .../tgui/interfaces/ChemSimulator.jsx | 68 ++++++++++++++++--- 2 files changed, 82 insertions(+), 15 deletions(-) diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index 47e0de3ae8bd..d5b1d1478804 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -116,7 +116,7 @@ data["credits"] = GLOB.chemical_data.rsc_credits data["status"] = status_bar ready = check_ready() - data["is_ready"] = !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) @@ -169,6 +169,22 @@ )) 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) + data["known_properties"] += list(list( + "code" = known_properties.code, + "level" = known_properties.level, + "name" = known_properties.name, + "desc" = known_properties.description, + )) return data /obj/structure/machinery/chem_simulator/ui_static_data(mob/user) @@ -249,11 +265,12 @@ stop_processing() icon_state = "modifier" simulating = SIMULATION_STAGE_OFF - - - - - + if("toogle_flag") + var/flag_value = params["flag_id"] + if(template_filter & flag_value) + template_filter &= ~flag_value + else + template_filter |= flag_value /obj/structure/machinery/chem_simulator/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0) var/list/data = list( diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index 387309a51575..2c23697fc295 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -317,15 +317,65 @@ export const ModeRelate = () => { export const ModeCreate = (props) => { const { act, data } = useBackend(); - const { selectedMode } = props; - const { - mode_data, - can_simulate, - can_eject_target, - can_eject_reference, - is_picking_recipe, - } = data; - return Create here; + const { complexityMenu } = props; + const { known_properties } = data; + return ( + + + + + + + {map(known_properties, (property, key) => ( + + + + ))} + + + + ); +}; + +export const CreateControl = () => { + const { act, data } = useBackend(); + const { template_filters } = data; + return ( + + + + + + + + + + + {map(template_filters, (flag, name) => ( + + + + ))} + + ); }; export const ChemSimulator = () => { From af93d9e06f467c0ed8fe07ffcec5fe8d7e0892c6 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Sat, 22 Jun 2024 23:27:52 -0400 Subject: [PATCH 06/22] suffering is almost over --- .../chemistry_machinery/chem_simulator.dm | 72 ++++++++++++++++--- .../tgui/interfaces/ChemSimulator.jsx | 59 ++++++++++++--- 2 files changed, 110 insertions(+), 21 deletions(-) diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index d5b1d1478804..f220127df3a5 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -121,7 +121,7 @@ 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_target_control"] = (simulating != SIMULATION_STAGE_OFF) + data["lock_control"] = (simulating != SIMULATION_STAGE_OFF) data["can_cancel_simulation"] = (simulating <= SIMULATION_STAGE_WAIT) if(simulating == SIMULATION_STAGE_FINAL) for(var/reagent_id in recipe_targets) @@ -179,11 +179,26 @@ ) 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 //fix me + var/conflicting_tooltip = null + for(var/template in creation_template) + template_property = template + if(LAZYACCESS(GLOB.conflicting_properties, template_property.name) == known_properties.name) + is_locked = TRUE + conflicting_tooltip = "This property conflicts with [template_properties.code]!" + if(template_property.code == known_properties.code) + break + template_property = null + data["known_properties"] += list(list( "code" = known_properties.code, - "level" = known_properties.level, + "level" = (isnull(template_property) ? 0 : template_property.level) , "name" = known_properties.name, "desc" = known_properties.description, + "is_enabled" = LAZYISIN(creation_template, known_properties) + "is_locked" = is_locked + "conflicting_tooltip" = conflicting_tooltip )) return data @@ -225,14 +240,15 @@ stop_processing() flick("[icon_state]_printing",src) if("select_target_property") - 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 suspcious vail.")) + 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 suspcious vail.")) return if("select_reference_property") if(!reference) @@ -271,6 +287,42 @@ template_filter &= ~flag_value else template_filter |= flag_value + 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 suspcious vail.")) + return + if("select_overdose") + if(mode == 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) + return + new_od_level = od_to_set + creation_od_level = od_to_set + calculate_creation_cost() + if("change_name") + if(mode == 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(user, "Bad name.") + else if(GLOB.chemical_reagents_list[newname]) + to_chat(user, "Name already taken.") + else + creation_name = newname + /obj/structure/machinery/chem_simulator/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0) var/list/data = list( diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index 2c23697fc295..bd58b7ab78ac 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -183,7 +183,7 @@ export const RecipeOptions = (props) => { export const ModeChange = () => { const { act, data } = useBackend(); - const { target_data, lock_target_control } = data; + const { target_data, lock_control } = data; const [selectedProperty, setSelectedProperty] = useSharedState(false); return ( (target_data && ( @@ -202,7 +202,7 @@ export const ModeChange = () => { setSelectedProperty(property.code); }} selected={selectedProperty === property.code ? true : false} - disabled={lock_target_control} + disabled={lock_control} > {property.code} {property.level} @@ -235,7 +235,7 @@ export const ModeChange = () => { export const ModeRelate = () => { const { act, data } = useBackend(); - const { target_data, reference_data, lock_target_control } = data; + const { target_data, reference_data, lock_control } = data; const [selectedTargetProperty, setSelectedTargetProperty] = useSharedState( 'target', false, @@ -260,7 +260,7 @@ export const ModeRelate = () => { setSelectedTargetProperty(property.code); }} selected={selectedTargetProperty === property.code ? true : false} - disabled={lock_target_control || property.is_locked} + disabled={lock_control || property.is_locked} tooltip={property.tooltip} > {property.code} {property.level} {selectedTargetProperty} @@ -283,7 +283,7 @@ export const ModeRelate = () => { selected={ selectedReferenceProperty === property.code ? true : false } - disabled={lock_target_control || property.is_locked} + disabled={lock_control || property.is_locked} tooltip={property.tooltip} > {property.code} {property.level} {selectedReferenceProperty} @@ -319,6 +319,7 @@ export const ModeCreate = (props) => { const { act, data } = useBackend(); const { complexityMenu } = props; const { known_properties } = data; + const [selectedProperty, setSelectedProperty] = useSharedState(false); return ( @@ -328,8 +329,20 @@ export const ModeCreate = (props) => { {map(known_properties, (property, key) => ( - ))} @@ -341,21 +354,45 @@ export const ModeCreate = (props) => { export const CreateControl = () => { const { act, data } = useBackend(); - const { template_filters } = data; + const { template_filters, lock_control } = data; return ( - - - + {map(template_filters, (flag, name) => ( From 7321c23f4d076948a5cacbc0bb8f400d860abdbc Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Tue, 25 Jun 2024 23:14:48 -0400 Subject: [PATCH 07/22] time to pr this bad boy --- .../chemical_research/Chemical-Research.dm | 4 +- .../chemistry_machinery/chem_simulator.dm | 71 ++++++++-- .../tgui/interfaces/ChemSimulator.jsx | 127 ++++++++++++++---- tgui/packages/tgui/styles/themes/weyland.scss | 4 +- 4 files changed, 165 insertions(+), 41 deletions(-) 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 f220127df3a5..990f83e54942 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -123,6 +123,13 @@ 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])) + data["od_level"] = (mode == MODE_CREATE ? creation_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)) + + if(mode == MODE_CREATE && GLOB.chemical_data.has_new_properties) + update_costs() + if(simulating == SIMULATION_STAGE_FINAL) for(var/reagent_id in recipe_targets) var/datum/reagent/recipe_option = GLOB.chemical_reagents_list[reagent_id] @@ -147,6 +154,7 @@ "is_locked" = is_locked, "tooltip" = conflicting_tooltip, )) + data["target_data"] = sortAssoc(data["target_data"]) else data["target_data"] = null @@ -182,11 +190,13 @@ var/datum/chem_property/template_property var/is_locked = FALSE //fix me 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) + 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_properties.code]!" + conflicting_tooltip = "This property conflicts with [template_property.code]!" if(template_property.code == known_properties.code) break template_property = null @@ -196,10 +206,14 @@ "level" = (isnull(template_property) ? 0 : template_property.level) , "name" = known_properties.name, "desc" = known_properties.description, - "is_enabled" = LAZYISIN(creation_template, known_properties) - "is_locked" = is_locked - "conflicting_tooltip" = conflicting_tooltip + "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) @@ -304,8 +318,9 @@ if(!target_property) to_chat(usr, SPAN_WARNING("The [src] makes a suspcious vail.")) return + calculate_creation_cost() if("select_overdose") - if(mode == SIMULATION_STAGE_OFF && mode == MODE_CREATE) + 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) return @@ -313,17 +328,49 @@ creation_od_level = od_to_set calculate_creation_cost() if("change_name") - if(mode == SIMULATION_STAGE_OFF && mode == MODE_CREATE) + 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(user, "Bad name.") + to_chat(usr, SPAN_WARNING("This name is not permited.")) else if(GLOB.chemical_reagents_list[newname]) - to_chat(user, "Name already taken.") + 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) + 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() + playsound(loc, pick('sound/machines/computer_typing1.ogg','sound/machines/computer_typing2.ogg','sound/machines/computer_typing3.ogg'), 5, 1) +/* /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, @@ -408,7 +455,7 @@ ui = new(user, src, ui_key, "chem_simulator.tmpl", "Synthesis Simulator", 800, 550) ui.set_initial_data(data) ui.open() - +*/ /*/obj/structure/machinery/chem_simulator/Topic(href, href_list) . = ..() if(.) diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index bd58b7ab78ac..52cfaea30a3f 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -15,11 +15,24 @@ import { Window } from '../layouts'; export const InfoPanel = () => { const { data } = useBackend(); - const { clearance, credits, status } = data; + const { + clearance, + credits, + status, + od_level, + chemical_name, + estimated_cost, + is_ready, + } = data; return (
- + {

RESEARCH CREDITS: {credits}

- -

STATUS: {status}

+ + STATUS: {status} - -

RESEARCH CLEARANCE: {clearance}

+ + RESEARCH CLEARANCE: {clearance} - -

RESEARCH CLEARANCE: {clearance}

+ + ESTIMATED SIMULATIONG COST: {estimated_cost} + + + CHEMICAL NAME: {chemical_name} + + + OVERDOSE LEVEL AFTER SIMULATION: {od_level}
@@ -51,7 +70,8 @@ export const InfoPanel = () => { export const Controls = (props) => { const { act, data } = useBackend(); - const { selectedMode, setSelectedMode } = props; + const { selectedMode, setSelectedMode, complexityMenu, setComplexityMenu } = + props; const { mode_data, can_simulate, @@ -110,7 +130,15 @@ export const Controls = (props) => { - +
@@ -323,15 +351,32 @@ export const ModeCreate = (props) => { return ( - + - - {map(known_properties, (property, key) => ( - + + {map(known_properties, (property) => ( + - + ))} - + + + + {map( + known_properties, + (property) => + property.code === selectedProperty && ( +
+

{property.desc}

+
+ ), + )}
); }; -export const CreateControl = () => { +export const CreateControl = (props) => { const { act, data } = useBackend(); - const { template_filters, lock_control } = data; - return ( + const { template_filters, lock_control, complexity_list } = data; + const { complexityMenu } = props; + return complexityMenu ? ( + + ))} + ); }; @@ -419,18 +493,21 @@ export const ChemSimulator = () => { const { act, data } = useBackend(); const { clearance, credits, status, is_picking_recipe, is_ready } = data; const [selectedMode, setSelectedMode] = useSharedState(1); + const [complexityMenu, setComplexityMenu] = useSharedState(2, false); return ( - + {(!is_picking_recipe && ( )) || } @@ -439,7 +516,7 @@ export const ChemSimulator = () => { {selectedMode === 1 && } {selectedMode === 2 && } {selectedMode === 3 && } - {selectedMode === 4 && } + {selectedMode === 4 && } ); diff --git a/tgui/packages/tgui/styles/themes/weyland.scss b/tgui/packages/tgui/styles/themes/weyland.scss index 627521b05007..f4400f19dd83 100644 --- a/tgui/packages/tgui/styles/themes/weyland.scss +++ b/tgui/packages/tgui/styles/themes/weyland.scss @@ -50,7 +50,7 @@ $weyland: #af7f38; .Button { font-family: consolas; - color: #161613; + color: #131613; border: base.em(2px) outset #e8e4c9; outline: base.em(1px) solid #161613; } @@ -62,7 +62,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 ae75afdb734f5cbf31509bdb71d689e03b4bc7fe Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Tue, 25 Jun 2024 23:18:49 -0400 Subject: [PATCH 08/22] def time to pr this bad boy --- tgui/packages/tgui/styles/themes/weyland.scss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tgui/packages/tgui/styles/themes/weyland.scss b/tgui/packages/tgui/styles/themes/weyland.scss index f4400f19dd83..0865472a6497 100644 --- a/tgui/packages/tgui/styles/themes/weyland.scss +++ b/tgui/packages/tgui/styles/themes/weyland.scss @@ -47,10 +47,14 @@ $weyland: #af7f38; '../layouts/TitleBar.scss', $with: ('background-color': color.scale(#252832, $lightness: -25%)) ); + @include meta.load-css( + '../components/Divider.scss', + $with: ('color': rgba(0, 0, 0, 0.685), 'thickness': base.em(4px)) + ); .Button { font-family: consolas; - color: #131613; + color: #161613; border: base.em(2px) outset #e8e4c9; outline: base.em(1px) solid #161613; } From 141dd22ce12e659e340cf30cce82ed0118e25144 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Tue, 25 Jun 2024 23:21:49 -0400 Subject: [PATCH 09/22] forgot this --- tgui/packages/tgui/interfaces/ChemSimulator.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index 52cfaea30a3f..3adcbbeed7ec 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -386,6 +386,8 @@ export const ModeCreate = (props) => { selected={ property.is_enabled || selectedProperty === property.code } + disabled={property.is_locked} + tooltip={property.conflicting_tooltip} > {property.code} {property.level} From aab32332adfa679f0d677150405a8f31301e09a4 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Tue, 25 Jun 2024 23:38:41 -0400 Subject: [PATCH 10/22] final thinggss ugghg --- .../chemistry_machinery/chem_simulator.dm | 259 +------------ nano/templates/chem_simulator.tmpl | 366 ------------------ .../tgui/interfaces/ChemSimulator.jsx | 94 ++--- 3 files changed, 48 insertions(+), 671 deletions(-) delete mode 100644 nano/templates/chem_simulator.tmpl diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index 990f83e54942..1542a6a7dfb6 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -41,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 = "" @@ -93,7 +92,7 @@ user.drop_inv_item_to_loc(B, src) to_chat(user, SPAN_NOTICE("You insert [B] into [src].")) flick("[icon_state]_reading",src) - update_costs()// update all UIs attached to src + update_costs() /obj/structure/machinery/chem_simulator/attack_hand(mob/user as mob) if(inoperable()) @@ -103,7 +102,7 @@ return tgui_interact(user) -/obj/structure/machinery/chem_simulator/tgui_interact(mob/user, datum/tgui/ui) //death to the chem simulator! All Hail the chem simulator! +/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, "ChemSimulator", "Chemical Simulator") @@ -112,7 +111,6 @@ /obj/structure/machinery/chem_simulator/ui_data(mob/user) . = ..() var/list/data = list() - data["clearance"] = GLOB.chemical_data.clearance_level data["credits"] = GLOB.chemical_data.rsc_credits data["status"] = status_bar ready = check_ready() @@ -126,6 +124,7 @@ data["estimated_cost"] = (mode == MODE_CREATE ? creation_cost : (!target_property ? "NULL" : property_costs[target_property.name])) data["od_level"] = (mode == MODE_CREATE ? creation_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() @@ -369,257 +368,11 @@ if("RARE (-5)") creation_complexity[slot] = CHEM_CLASS_RARE calculate_creation_cost() - playsound(loc, pick('sound/machines/computer_typing1.ogg','sound/machines/computer_typing2.ogg','sound/machines/computer_typing3.ogg'), 5, 1) -/* -/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 - - 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) - if(!ui) - ui = new(user, src, ui_key, "chem_simulator.tmpl", "Synthesis Simulator", 800, 550) - ui.set_initial_data(data) - ui.open() -*/ -/*/obj/structure/machinery/chem_simulator/Topic(href, href_list) - . = ..() - 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 - - 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 - break - else - target_property = target.data.get_property(href_list["set_target"]) - calculate_new_od_level() - if(simulating) - 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) - 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(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("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()) return 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.property_codings[data.target_property]}} - {{: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}} -
-
- {{if data.complexity_editor }} - {{:helper.link(data.complexity[0], 'gear', {'set_complexity' : 1}, null, 'menubutton templateButton')}} - {{:helper.link(data.complexity[1], 'gear', {'set_complexity' : 2}, null, 'menubutton templateButton')}} - {{:helper.link(data.complexity[2], 'gear', {'set_complexity' : 3}, null, 'menubutton templateButton')}} - {{else}} - {{:helper.link('SET LVL', 'gear', {'set_level' : 1}, (data.target_property && data.property_data_list[data.target_property] >= 1) ? null : 'disabled', 'menubutton templateButton')}} - {{:helper.link('SET NAME', 'gear', {'set_name' : 1}, null, 'templateButton')}} - {{:helper.link('SET OD', 'gear', {'set_od' : 1}, null, 'templateButton')}} - {{props data.template_filter :setting:configuration}} - {{if setting[0] == 1 }} - {{:helper.link(configuration, null, {'set_filter' : configuration, 'config_value' : setting[1]}, null, 'modebutton templateButton enabled')}} - {{else}} - {{:helper.link(configuration, null, {'set_filter' : configuration, 'config_value' : setting[1]}, null, 'modebutton templateButton')}} - {{/if}} - {{/props}} - {{/if}} -
-
- {{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.property_codings[data.reference_property]}} - {{: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.property_codings[data.target_property]}} - {{: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 index 3adcbbeed7ec..3dcd6445d858 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -16,55 +16,47 @@ import { Window } from '../layouts'; export const InfoPanel = () => { const { data } = useBackend(); const { - clearance, credits, status, od_level, chemical_name, estimated_cost, - is_ready, + reference_name, } = data; return ( - -
- - - -

RESEARCH CREDITS: {credits}

-
-
- - STATUS: {status} - - - RESEARCH CLEARANCE: {clearance} - - - ESTIMATED SIMULATIONG COST: {estimated_cost} - - - CHEMICAL NAME: {chemical_name} - - - OVERDOSE LEVEL AFTER SIMULATION: {od_level} - -
-
-
+
+ + + +

RESEARCH CREDITS: {credits}

+
+
+ + STATUS: {status} + + + ESTIMATED SIMULATIONG COST: {estimated_cost} + + + TARGET NAME: {chemical_name} + + + REFERENCE NAME: {reference_name} + + + OVERDOSE LEVEL AFTER SIMULATION: {od_level} + +
+
); }; @@ -133,9 +125,10 @@ export const Controls = (props) => { @@ -239,13 +232,13 @@ export const ModeChange = () => { {map( target_data, - (property, key) => + (property) => property.code === selectedProperty && (
{property.desc}
- + Price of the operation : {property.cost}
@@ -270,7 +263,6 @@ export const ModeRelate = () => { ); const [selectedReferenceProperty, setSelectedReferenceProperty] = useSharedState('reference', false); - const [InfoPanel, setInfoPanel] = useSharedState('panel', false); return ( (target_data && reference_data && ( @@ -336,8 +328,8 @@ export const ModeRelate = () => {
)) || ( - - No data insertsed! + + No data inserted! ) ); @@ -365,9 +357,7 @@ export const ModeCreate = (props) => { > {map(known_properties, (property) => ( { const { act, data } = useBackend(); const { template_filters, lock_control, complexity_list } = data; const { complexityMenu } = props; - return complexityMenu ? ( + return !complexityMenu ? ( ))} - + + + + {map(reference_data, (property) => ( ))} - + {map( target_data, (property, key) => @@ -319,7 +322,7 @@ export const ModeRelate = () => {
{property.desc}
- + Price of the operation : {property.cost} diff --git a/tgui/packages/tgui/styles/themes/weyland.scss b/tgui/packages/tgui/styles/themes/weyland.scss index 5fd9f0173ef2..ce0e0fbb5525 100644 --- a/tgui/packages/tgui/styles/themes/weyland.scss +++ b/tgui/packages/tgui/styles/themes/weyland.scss @@ -49,7 +49,7 @@ $weyland: #af7f38; ); @include meta.load-css( '../components/Divider.scss', - $with: ('color': rgba(0, 0, 0, 0.685), 'thickness': base.em(4px)) + $with: ('color': rgba(28, 30, 32, 0.932), 'thickness': base.em(4px)) ); .Button { From 0582897485c2f8d3ea37098135818a0a0e903092 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Wed, 26 Jun 2024 00:20:23 -0400 Subject: [PATCH 13/22] okay actually the time --- .../chemistry_machinery/chem_simulator.dm | 27 ++++++++++--------- .../tgui/interfaces/ChemSimulator.jsx | 10 +++---- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index 39cf6f6e1dee..d6d6480d8cf3 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -560,21 +560,22 @@ if(mode == MODE_RELATE && isnull(reference)) status_bar = "NO REFERENCE DATA DETECTED" 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) + 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 if(mode == MODE_CREATE) if(!LAZYLEN(creation_template)) status_bar = "TEMPLATE IS EMPTY" diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index 2fc09da59db1..e7ce4ec900b4 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -40,19 +40,19 @@ export const InfoPanel = () => {

RESEARCH CREDITS: {credits}

- + STATUS: {status} - + ESTIMATED SIMULATIONG COST: {estimated_cost} - + TARGET NAME: {chemical_name} - + REFERENCE NAME: {reference_name} - + OVERDOSE LEVEL AFTER SIMULATION: {od_level}
From 0d30279ead77b7157013a30e2b40c1e45936889c Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Wed, 26 Jun 2024 01:32:29 -0400 Subject: [PATCH 14/22] too tired just sleep --- .../chemistry_machinery/chem_simulator.dm | 6 +++--- tgui/packages/tgui/interfaces/ChemSimulator.jsx | 15 +++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index d6d6480d8cf3..9b4eb2464f1a 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -167,7 +167,7 @@ data["reference_data"] += list(list( "code" = reference_property_data.code, "level" = reference_property_data.level, - "name" = reference_property_data.name, + "name" = capitalize_first_letters(reference_property_data.name), "desc" = reference_property_data.description, "cost" = property_costs[reference_property_data.name], "is_locked" = is_locked, @@ -202,7 +202,7 @@ data["known_properties"] += list(list( "code" = known_properties.code, "level" = (isnull(template_property) ? 0 : template_property.level) , - "name" = known_properties.name, + "name" = capitalize_first_letters(known_properties.name), "desc" = known_properties.description, "is_enabled" = LAZYISIN(creation_template, known_properties), "is_locked" = is_locked, @@ -261,7 +261,7 @@ target_property = target_prop if(!target_property) to_chat(usr, SPAN_WARNING("The [src] makes a suspcious vail.")) - return + return if("select_reference_property") if(!reference) return diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index e7ce4ec900b4..d89f333e606c 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -266,7 +266,7 @@ export const ModeRelate = () => { return ( (target_data && reference_data && ( - + {map(target_data, (property) => ( ))} - - - - + {map(reference_data, (property) => ( ))} - + {map( target_data, (property, key) => From 2927961ffa9ad6abf45568cb5cacb7df091ef50e Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Sat, 29 Jun 2024 23:37:08 -0400 Subject: [PATCH 15/22] finishers --- .../chemistry_machinery/chem_simulator.dm | 19 +- .../chemistry_properties/prop_positive.dm | 2 +- .../tgui/interfaces/ChemSimulator.jsx | 281 ++++++++++++------ 3 files changed, 206 insertions(+), 96 deletions(-) diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index 9b4eb2464f1a..8d585612ed85 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -186,7 +186,7 @@ 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 //fix me + var/is_locked = FALSE var/conflicting_tooltip = null if(template_filter && !HAS_FLAG(known_properties.category, template_filter)) continue @@ -223,6 +223,7 @@ "name" = modes_datum.name, "desc" = modes_datum.desc, "mode_id" = modes_datum.mode_id, + "icon_type" = modes_datum.icon_type )) return static_data @@ -554,6 +555,9 @@ 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 @@ -576,6 +580,9 @@ 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" @@ -743,31 +750,31 @@ var/name var/desc var/mode_id - var/icon + 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 = "minus" + icon_type = "bolt" /datum/chemical_simulator_modes/supress name = "SUPRESS" desc = "Supress one level in the choosen property. This decreases the OD level." mode_id = MODE_SUPPRESS - icon = "minus" + icon_type = "square-minus" /datum/chemical_simulator_modes/amplify name = "AMPLIFY" desc = "Amplify one level in the choosen property. This decreases the OD level" mode_id = MODE_AMPLIFY - icon = "plus" + 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." mode_id = MODE_RELATE - icon = "minus" + icon_type = "repeat" #undef SIMULATION_FAILURE #undef SIMULATION_STAGE_OFF diff --git a/code/modules/reagents/chemistry_properties/prop_positive.dm b/code/modules/reagents/chemistry_properties/prop_positive.dm index d469daff494c..dd8259426767 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/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index d89f333e606c..7a13c414eb7e 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -62,14 +62,21 @@ export const InfoPanel = () => { export const Controls = (props) => { const { act, data } = useBackend(); - const { selectedMode, setSelectedMode, complexityMenu, setComplexityMenu } = - props; + 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 ( @@ -83,13 +90,14 @@ export const Controls = (props) => { act('simulate'); }} disabled={!can_simulate} + icon={'radiation'} > SIMULATE ) : ( @@ -115,8 +125,10 @@ export const Controls = (props) => { fluid onClick={() => { act('eject_reference'); + setSelectedReferenceProperty(null); }} - disabled={!can_eject_reference} + disabled={!can_eject_reference || lock_control} + icon={can_eject_reference ? 'eject' : 'file-import'} > EJECT REFERENCE @@ -129,6 +141,7 @@ export const Controls = (props) => { setComplexityMenu(!complexityMenu); }} selected={complexityMenu} + icon={'hard-drive'} > COMPLEXITY @@ -146,8 +159,9 @@ export const Controls = (props) => { setSelectedMode(mode_data.mode_id); }} tooltip={mode_data.desc} - icon={mode_data.icon} - disabled={mode_data.mode_id === selectedMode} + icon={mode_data.icon_type} + disabled={mode_data.mode_id === selectedMode || lock_control} + tooltipPosition="bottom" > {mode_data.name} @@ -159,9 +173,9 @@ export const Controls = (props) => { ); }; -export const RecipeOptions = (props) => { +export const RecipeOptions = () => { const { act, data } = useBackend(); - const [selectedRecipe, setSelectedRecipe] = useSharedState(false); + const [selectedRecipe, setSelectedRecipe] = useSharedState('recipe', null); const { reagent_option_data } = data; return ( @@ -171,17 +185,20 @@ export const RecipeOptions = (props) => { bold textAlign={'center'} width={28} - height={3} + height={2.6} fluid + disabled={selectedRecipe === null} + mb={'5px'} onClick={() => { act('submit_recipe_pick', { reagent_picked: selectedRecipe }); + setSelectedRecipe(null); }} >

FINALIZE

{map(reagent_option_data, (recipe, id) => ( - ))} -
- + + + Target Data + + + + {map(target_data, (property) => ( + + ))} + + + + + {map( target_data, (property) => - property.code === selectedProperty && ( + property.code === selectedTargetProperty && (
{property.desc}
@@ -254,39 +288,60 @@ export const ModeChange = () => { ); }; -export const ModeRelate = () => { +export const ModeRelate = (props) => { const { act, data } = useBackend(); const { target_data, reference_data, lock_control } = data; - const [selectedTargetProperty, setSelectedTargetProperty] = useSharedState( - 'target', - false, - ); - const [selectedReferenceProperty, setSelectedReferenceProperty] = - useSharedState('reference', false); + const { + setSelectedTargetProperty, + setSelectedReferenceProperty, + selectedReferenceProperty, + selectedTargetProperty, + } = props; return ( (target_data && reference_data && ( - - {map(target_data, (property) => ( - - ))} - + {map(target_data, (property) => ( + + ))} +
+
+ { height={10} mr={1} > - {map(reference_data, (property) => ( - - ))} + Reference Data + + + + {map(reference_data, (property) => ( + + ))} + + + - + {map( target_data, - (property, key) => + (property) => property.code === selectedTargetProperty && ( @@ -489,9 +564,18 @@ export const CreateControl = (props) => { export const ChemSimulator = () => { const { act, data } = useBackend(); - const { clearance, credits, status, is_picking_recipe, is_ready } = data; - const [selectedMode, setSelectedMode] = useSharedState(1); - const [complexityMenu, setComplexityMenu] = useSharedState(2, false); + 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 ( @@ -506,14 +590,33 @@ export const ChemSimulator = () => { setSelectedMode={setSelectedMode} complexityMenu={complexityMenu} setComplexityMenu={setComplexityMenu} + setSelectedTargetProperty={setSelectedTargetProperty} + setSelectedReferenceProperty={setSelectedReferenceProperty} /> )) || }
- {selectedMode === 1 && } - {selectedMode === 2 && } - {selectedMode === 3 && } + {selectedMode === 1 && ( + + )} + {selectedMode === 2 && ( + + )} + {selectedMode === 3 && ( + + )} {selectedMode === 4 && }
From aa93a88bcd78b9421d760cd6e7e57323303cb55f Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Sat, 29 Jun 2024 23:39:42 -0400 Subject: [PATCH 16/22] nanoui does not exist and is simply enemy propaganda --- code/modules/reagents/chemistry_machinery/chem_simulator.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index 8d585612ed85..682f780e577f 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -62,7 +62,6 @@ ..() 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)) From 97fc82959998760ea88c1ded5b53dfa3b25cb29f Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Sat, 29 Jun 2024 23:53:45 -0400 Subject: [PATCH 17/22] final thing --- tgui/packages/tgui/interfaces/ChemSimulator.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index 7a13c414eb7e..e65846d63eb3 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -44,7 +44,7 @@ export const InfoPanel = () => { STATUS: {status} - ESTIMATED SIMULATIONG COST: {estimated_cost} + ESTIMATED SIMULATING COST: {estimated_cost} TARGET NAME: {chemical_name} @@ -459,6 +459,7 @@ export const ModeCreate = (props) => { } disabled={property.is_locked} tooltip={property.conflicting_tooltip} + tooltipPosition="bottom" > {property.code} {property.level} @@ -563,7 +564,7 @@ export const CreateControl = (props) => { }; export const ChemSimulator = () => { - const { act, data } = useBackend(); + const { data } = useBackend(); const { is_picking_recipe } = data; const [selectedMode, setSelectedMode] = useSharedState('modes'); const [complexityMenu, setComplexityMenu] = useSharedState( From ae43ef36badb3c5ccb8cebf767cd627143798515 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Thu, 4 Jul 2024 01:47:53 -0400 Subject: [PATCH 18/22] polish --- .../chemistry_machinery/chem_simulator.dm | 8 ++++---- tgui/packages/tgui/interfaces/ChemSimulator.jsx | 15 ++++++++++----- tgui/packages/tgui/styles/themes/weyland.scss | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index 682f780e577f..ea21181ebd5a 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -753,25 +753,25 @@ /datum/chemical_simulator_modes/create name = "CREATE" - desc = "Create a new custom chemical from the known properties discovered earlier" + 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 decreases the OD level." + 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 decreases the OD level" + 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." + 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" diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index e65846d63eb3..007ce62e1961 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -429,7 +429,7 @@ export const ModeCreate = (props) => { { m={0.5} bold grow - fontSize={'14px'} - minWidth={5} + fontSize={'12px'} + minWidth={4} maxHeight={2} > {map(template_filters, (flag, name) => ( - + diff --git a/tgui/packages/tgui/styles/themes/weyland.scss b/tgui/packages/tgui/styles/themes/weyland.scss index ce0e0fbb5525..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': #d6b480, + 'color-selected': #e4c69a, 'color-caution': #be6209, 'color-danger': #9a9d00, 'color-transparent-text': color.scale($weyland, $lightness: 30%) From fb80bc23c5205dc165ea019003bde92ad810cbca Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Thu, 4 Jul 2024 01:51:37 -0400 Subject: [PATCH 19/22] ugh --- tgui/packages/tgui/interfaces/ChemSimulator.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tgui/packages/tgui/interfaces/ChemSimulator.jsx b/tgui/packages/tgui/interfaces/ChemSimulator.jsx index 007ce62e1961..dd3533cf333b 100644 --- a/tgui/packages/tgui/interfaces/ChemSimulator.jsx +++ b/tgui/packages/tgui/interfaces/ChemSimulator.jsx @@ -448,7 +448,7 @@ export const ModeCreate = (props) => { From f353b22c706e49c2640bea9d47bb6b1e19025cf8 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Thu, 4 Jul 2024 13:36:09 -0400 Subject: [PATCH 20/22] it was funny but not anymore --- code/modules/reagents/chemistry_machinery/chem_simulator.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index ea21181ebd5a..d1174d917327 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -121,7 +121,8 @@ 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])) - data["od_level"] = (mode == MODE_CREATE ? creation_od_level : new_od_level) + 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) @@ -322,9 +323,9 @@ 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() + calculate_new_od_level() if("change_name") if(simulating == SIMULATION_STAGE_OFF && mode == MODE_CREATE) var/newname = input("Set name for template (2-20 characters)","[src]") as text From 5280d571c913847ec246e25dfa23c7aaffc798bf Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Sat, 6 Jul 2024 00:25:37 -0400 Subject: [PATCH 21/22] abuses are bad also Im stupid --- code/modules/reagents/chemistry_machinery/chem_simulator.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index d1174d917327..e2db814c90a0 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -321,11 +321,11 @@ 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) + if(!od_to_set || simulating != SIMULATION_STAGE_OFF) return creation_od_level = od_to_set - calculate_creation_cost() 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 @@ -356,7 +356,7 @@ 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) + if(!new_rarity || simulating != SIMULATION_STAGE_OFF) return switch(new_rarity) if("BASIC (+7)") From d97f093ee71c0f07e2ed6500ac805b9c33ed416b Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Sun, 7 Jul 2024 17:25:15 -0400 Subject: [PATCH 22/22] ugh --- code/_globalvars/global_lists.dm | 4 +++- .../reagents/chemistry_machinery/chem_simulator.dm | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm index 93f38f37963e..0c1aeb7ec5e6 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -141,7 +141,9 @@ GLOBAL_LIST_INIT_TYPED(combining_properties, /list, list( PROPERTY_DEFIBRILLATIN 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_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_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index e2db814c90a0..420c5b675f71 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -68,22 +68,23 @@ 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) + 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].")) @@ -110,7 +111,6 @@ /obj/structure/machinery/chem_simulator/ui_data(mob/user) . = ..() var/list/data = list() - data["credits"] = GLOB.chemical_data.rsc_credits data["status"] = status_bar ready = check_ready() data["is_ready"] = ready @@ -225,6 +225,7 @@ "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)