From 6fbd7914f51910aee2db5232b09f5caffae596d8 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Wed, 15 Jul 2020 16:58:44 -0700 Subject: [PATCH 1/5] stuff --- code/__DEFINES/vv.dm | 7 ++ .../atmospherics/gasmixtures/gas_mixture.dm | 67 ++++++++++++++++++- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/vv.dm b/code/__DEFINES/vv.dm index 889e1bb1c0..101330cc8b 100644 --- a/code/__DEFINES/vv.dm +++ b/code/__DEFINES/vv.dm @@ -76,6 +76,13 @@ #define VV_HK_ADDCOMPONENT "addcomponent" #define VV_HK_MODIFY_TRAITS "modtraits" +// /datum/gas_mixture +#define VV_HK_SET_MOLES "set_moles" +#define VV_HK_EMPTY "empty" +#define VV_HK_SET_TEMPERATURE "set_temp" +#define VV_HK_PARSE_GASSTRING "parse_gasstring" +#define VV_HK_SET_VOLUME "set_volume" + // /atom #define VV_HK_MODIFY_TRANSFORM "atom_transform" #define VV_HK_ADD_REAGENT "addreagent" diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm index 43e54dc2c7..36b1461f8f 100644 --- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm +++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm @@ -16,6 +16,8 @@ GLOBAL_LIST_INIT(meta_gas_dangers, meta_gas_danger_list()) GLOBAL_LIST_INIT(meta_gas_ids, meta_gas_id_list()) GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) /datum/gas_mixture + /// Never ever set this variable, hooked into vv_get_var for view variables viewing. + var/gas_list_view_only var/initial_volume = CELL_VOLUME //liters var/list/reaction_results var/list/analyzer_results //used for analyzer feedback - not initialized until its used @@ -29,9 +31,70 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) reaction_results = new /datum/gas_mixture/vv_edit_var(var_name, var_value) - if(var_name == "_extools_pointer_gasmixture") + if(var_name == NAMEOF(src, _extools_pointer_gasmixture)) return FALSE // please no. segfaults bad. + if(var_name == NAMEOF(src, gas_list_view_only)) + return FALSE return ..() + +/datum/gas_mixture/vv_get_var(var_name) + . = ..() + if(var_name == NAMEOF(gas_list_view_only)) + var/list/dummy = get_gases + return debug_variables("gases (READ ONLY)", dummy, 0, src) + +/datum/gas_mixture/vv_get_dropdown() + . = ..() + VV_DROPDOWN_OPTION(VV_HK_PARSE_GASSTRING, "Parse Gas String") + VV_DROPDOWN_OPTION(VV_HK_EMPTY, "Empty") + VV_DROPDOWN_OPTION(VV_HK_SET_MOLES, "Set Moles") + VV_DROPDOWN_OPTION(VV_HK_SET_TEMPERATURE, "Set Temperature") + VV_DROPDOWN_OPTION(VV_HK_SET_VOLUME, "Set Volume") + +/datum/gas_mixture/vv_do_topic(list/href_list) + . = ..() + if(!.) + return + if(href_list[VV_HK_PARSE_GASSTRING]) + var/gasstring = input(usr, "Input Gas String (WARNING: Advanced. Don't use this unless you know how these work.", "Gas String Parse") as text|null + if(!istext(gasstring)) + return + log_admin("[key_name(usr)] modified gas mixture [REF(src)]: Set to gas string [gasstring].") + message_admins("[key_name(usr)] modified gas mixture [REF(src)]: Set to gas string [gasstring].") + parse_gas_string(gasstring) + if(href_list[VV_HK_EMPTY]) + log_admin("[key_name(usr)] emptied gas mixture [REF(src)].") + message_admins("[key_name(usr)] emptied gas mixture [REF(src)].") + clear() + if(href_list[VV_HK_SET_MOLES]) + var/list/gases = return_gases() + var/gastype = input(usr, "What kind of gas?", "Set Gas") as anything|null in subtypesof(/datum/gas) + if(!ispath(gastype, /datum/gas)) + return + var/amount = input(usr, "Input amount", "Set Gas", gases[gastype] || 0) as num|null + if(!isnum(amount)) + return + amount = max(0, amount) + log_admin("[key_name(usr)] modified gas mixture [REF(src)]: Set gas type [gastype] to [amount] moles.") + message_admins("[key_name(usr)] modified gas mixture [REF(src)]: Set gas type [gastype] to [amount] moles.") + set_moles(gas_type, amount) + if(href_list[VV_HK_SET_TEMPERATURE]) + var/temp = input(usr, "Set the temperature of this mixture to?", "Set Temperature", return_temperature()) as num|null + if(!isnum(temp)) + return + temp = max(2.7, temp) + log_admin("[key_name(usr)] modified gas mixture [REF(src)]: Changed temperature to [temp].") + message_admins("[key_name(usr)] modified gas mixture [REF(src)]: Changed temperature to [temp].") + set_temperature(temp) + if(href_list[VV_HK_SET_VOLUME]) + var/volume = input(usr, "Set the volume of this mixture to?", "Set Volume", return_volume()) as num|null + if(!isnum(volume)) + return + volume = max(0, volume) + log_admin("[key_name(usr)] modified gas mixture [REF(src)]: Changed volume to [volume].") + message_admins("[key_name(usr)] modified gas mixture [REF(src)]: Changed volume to [volume].") + set_volume(volume) + /* /datum/gas_mixture/Del() __gasmixture_unregister() @@ -169,7 +232,7 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) set_moles(path, text2num(gas[id])) archive() return 1 - + /datum/gas_mixture/react(datum/holder) . = NO_REACTION if(!total_moles()) From 96fb3cad8f3fc4873548dc312ca1f2e9767c6e17 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Wed, 15 Jul 2020 17:00:17 -0700 Subject: [PATCH 2/5] ok --- code/modules/atmospherics/gasmixtures/gas_mixture.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm index 36b1461f8f..e7f73d9e05 100644 --- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm +++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm @@ -39,7 +39,7 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) /datum/gas_mixture/vv_get_var(var_name) . = ..() - if(var_name == NAMEOF(gas_list_view_only)) + if(var_name == NAMEOF(src, gas_list_view_only)) var/list/dummy = get_gases return debug_variables("gases (READ ONLY)", dummy, 0, src) @@ -68,7 +68,7 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) clear() if(href_list[VV_HK_SET_MOLES]) var/list/gases = return_gases() - var/gastype = input(usr, "What kind of gas?", "Set Gas") as anything|null in subtypesof(/datum/gas) + var/gastype = input(usr, "What kind of gas?", "Set Gas") as null|anything in subtypesof(/datum/gas) if(!ispath(gastype, /datum/gas)) return var/amount = input(usr, "Input amount", "Set Gas", gases[gastype] || 0) as num|null From dba5855929e74dc3436588a0167d27cd6cd9210e Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Wed, 15 Jul 2020 17:01:22 -0700 Subject: [PATCH 3/5] epic --- code/modules/atmospherics/gasmixtures/gas_mixture.dm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm index e7f73d9e05..bc8f8ba722 100644 --- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm +++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm @@ -40,8 +40,7 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) /datum/gas_mixture/vv_get_var(var_name) . = ..() if(var_name == NAMEOF(src, gas_list_view_only)) - var/list/dummy = get_gases - return debug_variables("gases (READ ONLY)", dummy, 0, src) + return debug_variable("gases (READ ONLY)", get_gases(), 0, src) /datum/gas_mixture/vv_get_dropdown() . = ..() @@ -67,7 +66,7 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) message_admins("[key_name(usr)] emptied gas mixture [REF(src)].") clear() if(href_list[VV_HK_SET_MOLES]) - var/list/gases = return_gases() + var/list/gases = get_gases() var/gastype = input(usr, "What kind of gas?", "Set Gas") as null|anything in subtypesof(/datum/gas) if(!ispath(gastype, /datum/gas)) return @@ -77,7 +76,7 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) amount = max(0, amount) log_admin("[key_name(usr)] modified gas mixture [REF(src)]: Set gas type [gastype] to [amount] moles.") message_admins("[key_name(usr)] modified gas mixture [REF(src)]: Set gas type [gastype] to [amount] moles.") - set_moles(gas_type, amount) + set_moles(gastype, amount) if(href_list[VV_HK_SET_TEMPERATURE]) var/temp = input(usr, "Set the temperature of this mixture to?", "Set Temperature", return_temperature()) as num|null if(!isnum(temp)) From b279c82bb2fe76b7f84d5f1946fec7877ca7b3fe Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Wed, 15 Jul 2020 17:10:08 -0700 Subject: [PATCH 4/5] whew --- code/modules/atmospherics/gasmixtures/gas_mixture.dm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm index bc8f8ba722..1c8cf0436e 100644 --- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm +++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm @@ -40,7 +40,10 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) /datum/gas_mixture/vv_get_var(var_name) . = ..() if(var_name == NAMEOF(src, gas_list_view_only)) - return debug_variable("gases (READ ONLY)", get_gases(), 0, src) + var/list/dummy = get_gases() + for(var/gas in dummy) + dummy[gas] = get_moles(gas) + return debug_variable("gases (READ ONLY)", dummy, 0, src) /datum/gas_mixture/vv_get_dropdown() . = ..() @@ -67,6 +70,8 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) clear() if(href_list[VV_HK_SET_MOLES]) var/list/gases = get_gases() + for(var/gas in gases) + gases[gas] = get_moles(gas) var/gastype = input(usr, "What kind of gas?", "Set Gas") as null|anything in subtypesof(/datum/gas) if(!ispath(gastype, /datum/gas)) return From 7f9571f23989fe21e5d1ea2e0a3c4accfcba3bef Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Wed, 15 Jul 2020 17:17:09 -0700 Subject: [PATCH 5/5] ok --- code/modules/atmospherics/gasmixtures/gas_mixture.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm index 1c8cf0436e..7af823e8a9 100644 --- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm +++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm @@ -47,6 +47,7 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) /datum/gas_mixture/vv_get_dropdown() . = ..() + VV_DROPDOWN_OPTION("", "---") VV_DROPDOWN_OPTION(VV_HK_PARSE_GASSTRING, "Parse Gas String") VV_DROPDOWN_OPTION(VV_HK_EMPTY, "Empty") VV_DROPDOWN_OPTION(VV_HK_SET_MOLES, "Set Moles")