From b965e6041cfec78c7777a379aaa6b7f01091ec2e Mon Sep 17 00:00:00 2001 From: Eli Date: Thu, 18 Jul 2024 21:52:53 +1000 Subject: [PATCH] Extra Auto-Transfer Locations (#8644) --- code/modules/vore/eating/belly_obj_vr.dm | 12 ++++-- code/modules/vore/eating/vorepanel_vr.dm | 37 +++++++++++++++++++ .../modules/vore/eating/exportpanel_ch.dm | 2 + .../VoreSelectedBellyInteractions.tsx | 28 ++++++++++++++ .../chompstation/VorePanel/types.ts | 2 + .../VorePanelExportBellyString.tsx | 5 +++ .../VorePanelExportBellyStringHelpers.tsx | 2 + .../chompstation/VorePanelExport/constants.ts | 10 ++--- .../chompstation/VorePanelExport/types.ts | 2 + 9 files changed, 91 insertions(+), 9 deletions(-) diff --git a/code/modules/vore/eating/belly_obj_vr.dm b/code/modules/vore/eating/belly_obj_vr.dm index 506a0a99d6..7245de2a77 100644 --- a/code/modules/vore/eating/belly_obj_vr.dm +++ b/code/modules/vore/eating/belly_obj_vr.dm @@ -69,12 +69,14 @@ var/autotransferchance = 0 // % Chance of prey being autotransferred to transfer location var/autotransferwait = 10 // Time between trying to transfer. var/autotransferlocation // Place to send them + var/autotransferextralocation = list() // List of extra places this could go //CHOMPAdd var/autotransfer_whitelist = 0 // Flags for what can be transferred to the primary location //CHOMPAdd var/autotransfer_blacklist = 2 // Flags for what can not be transferred to the primary location, defaults to Absorbed //CHOMPAdd var/autotransfer_whitelist_items = 0 // Flags for what can be transferred to the primary location //CHOMPAdd var/autotransfer_blacklist_items = 0 // Flags for what can not be transferred to the primary location //CHOMPAdd var/autotransferchance_secondary = 0 // % Chance of prey being autotransferred to secondary transfer location //CHOMPAdd var/autotransferlocation_secondary // Second place to send them //CHOMPAdd + var/autotransferextralocation_secondary = list() // List of extra places the secondary transfer could go //CHOMPAdd var/autotransfer_secondary_whitelist = 0// Flags for what can be transferred to the secondary location //CHOMPAdd var/autotransfer_secondary_blacklist = 2// Flags for what can not be transferred to the secondary location, defaults to Absorbed //CHOMPAdd var/autotransfer_secondary_whitelist_items = 0// Flags for what can be transferred to the secondary location //CHOMPAdd @@ -446,8 +448,10 @@ "autotransferchance", "autotransferwait", "autotransferlocation", + "autotransferextralocation", "autotransfer_enabled", "autotransferchance_secondary", + "autotransferextralocation_secondary", "autotransferlocation_secondary", "autotransfer_secondary_whitelist", "autotransfer_secondary_blacklist", @@ -2331,14 +2335,14 @@ var/dest_belly_name if(autotransferlocation_secondary && prob(autotransferchance_secondary)) if(ismob(prey) && autotransfer_filter(prey, autotransfer_secondary_whitelist, autotransfer_secondary_blacklist)) - dest_belly_name = autotransferlocation_secondary + dest_belly_name = pick(autotransferextralocation_secondary + autotransferlocation_secondary) if(isitem(prey) && autotransfer_filter(prey, autotransfer_secondary_whitelist_items, autotransfer_secondary_blacklist_items)) - dest_belly_name = autotransferlocation_secondary + dest_belly_name = pick(autotransferextralocation_secondary + autotransferlocation_secondary) if(autotransferlocation && prob(autotransferchance)) if(ismob(prey) && autotransfer_filter(prey, autotransfer_whitelist, autotransfer_blacklist)) - dest_belly_name = autotransferlocation + dest_belly_name = pick(autotransferextralocation + autotransferlocation) if(isitem(prey) && autotransfer_filter(prey, autotransfer_whitelist_items, autotransfer_blacklist_items)) - dest_belly_name = autotransferlocation + dest_belly_name = pick(autotransferextralocation + autotransferlocation) if(!dest_belly_name) // Didn't transfer, so wait before retrying prey.belly_cycles = 0 return diff --git a/code/modules/vore/eating/vorepanel_vr.dm b/code/modules/vore/eating/vorepanel_vr.dm index aec165812d..c615229c33 100644 --- a/code/modules/vore/eating/vorepanel_vr.dm +++ b/code/modules/vore/eating/vorepanel_vr.dm @@ -356,8 +356,10 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono", selected_list["autotransfer"]["autotransferchance"] = selected.autotransferchance selected_list["autotransfer"]["autotransferwait"] = selected.autotransferwait selected_list["autotransfer"]["autotransferlocation"] = selected.autotransferlocation + selected_list["autotransfer"]["autotransferextralocation"] = selected.autotransferextralocation //CHOMPAdd selected_list["autotransfer"]["autotransferchance_secondary"] = selected.autotransferchance_secondary //CHOMPAdd selected_list["autotransfer"]["autotransferlocation_secondary"] = selected.autotransferlocation_secondary //CHOMPAdd + selected_list["autotransfer"]["autotransferextralocation_secondary"] = selected.autotransferextralocation_secondary //CHOMPAdd selected_list["autotransfer"]["autotransfer_min_amount"] = selected.autotransfer_min_amount selected_list["autotransfer"]["autotransfer_max_amount"] = selected.autotransfer_max_amount //CHOMPAdd auto-transfer flags @@ -1540,6 +1542,14 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono", if(new_autotransferlocation == new_belly.name) new_belly.autotransferlocation = null + if(islist(belly_data["autotransferextralocation"])) + var/new_autotransferextralocation = belly_data["autotransferextralocation"] + if(new_autotransferextralocation) + new_belly.autotransferextralocation = list() + for(var/extra_belly in new_autotransferextralocation) + if(extra_belly in valid_names) + new_belly.autotransferextralocation += extra_belly + if(isnum(belly_data["autotransferchance_secondary"])) var/new_autotransferchance_secondary = belly_data["autotransferchance_secondary"] new_belly.autotransferchance_secondary = sanitize_integer(new_autotransferchance_secondary, 0, 100, initial(new_belly.autotransferchance_secondary)) @@ -1556,6 +1566,15 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono", if(new_autotransferlocation_secondary == new_belly.name) new_belly.autotransferlocation_secondary = null + if(islist(belly_data["autotransferextralocation_secondary"])) + var/new_autotransferextralocation_secondary = belly_data["autotransferextralocation_secondary"] + if(new_autotransferextralocation_secondary) + new_belly.autotransferextralocation_secondary = list() + for(var/extra_belly in new_autotransferextralocation_secondary) + if(extra_belly in valid_names) + new_belly.autotransferextralocation_secondary += extra_belly + + if(isnum(belly_data["autotransfer_min_amount"])) var/new_autotransfer_min_amount = belly_data["autotransfer_min_amount"] new_belly.autotransfer_min_amount = sanitize_integer(new_autotransfer_min_amount, 0, 100, initial(new_belly.autotransfer_min_amount)) @@ -3597,6 +3616,15 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono", else host.vore_selected.autotransferlocation = choice.name . = TRUE + if("b_autotransferextralocation") + var/obj/belly/choice = tgui_input_list(usr, "What extra places do you want your [lowertext(host.vore_selected.name)] auto-transfer to?","Select Belly", (host.vore_organs - host.vore_selected - host.vore_selected.autotransferlocation)) + if(!choice) //They cancelled, no changes + return FALSE + else if(choice.name in host.vore_selected.autotransferextralocation) + host.vore_selected.autotransferextralocation -= choice.name + else + host.vore_selected.autotransferextralocation += choice.name + . = TRUE if("b_autotransferchance_secondary") var/autotransferchance_secondary_input = input(user, "Set secondary belly auto-transfer chance (as %). You must also set the location for this to have any effect.", "Secondary Auto-Transfer Chance") as num|null if(!isnull(autotransferchance_secondary_input)) @@ -3611,6 +3639,15 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono", else host.vore_selected.autotransferlocation_secondary = choice.name . = TRUE + if("b_autotransferextralocation_secondary") + var/obj/belly/choice = tgui_input_list(usr, "What extra places do you want your [lowertext(host.vore_selected.name)] auto-transfer to?","Select Belly", (host.vore_organs - host.vore_selected - host.vore_selected.autotransferlocation_secondary)) + if(!choice) //They cancelled, no changes + return FALSE + else if(choice.name in host.vore_selected.autotransferextralocation_secondary) + host.vore_selected.autotransferextralocation_secondary -= choice.name + else + host.vore_selected.autotransferextralocation_secondary += choice.name + . = TRUE if("b_autotransfer_whitelist") var/list/menu_list = host.vore_selected.autotransfer_flags_list.Copy() var/toggle_addon = tgui_input_list(user, "Toggle Whitelist", "Whitelist Choice", menu_list) //ChompEDIT - user, not usr diff --git a/modular_chomp/code/modules/vore/eating/exportpanel_ch.dm b/modular_chomp/code/modules/vore/eating/exportpanel_ch.dm index a84f50e407..b2c8236462 100644 --- a/modular_chomp/code/modules/vore/eating/exportpanel_ch.dm +++ b/modular_chomp/code/modules/vore/eating/exportpanel_ch.dm @@ -367,9 +367,11 @@ belly_data["autotransferchance"] = B.autotransferchance belly_data["autotransferwait"] = B.autotransferwait/10 belly_data["autotransferlocation"] = B.autotransferlocation + belly_data["autotransferextralocation"] = B.autotransferextralocation belly_data["autotransfer_enabled"] = B.autotransfer_enabled belly_data["autotransferchance_secondary"] = B.autotransferchance_secondary belly_data["autotransferlocation_secondary"] = B.autotransferlocation_secondary + belly_data["autotransferextralocation_secondary"] = B.autotransferextralocation_secondary belly_data["autotransfer_min_amount"] = B.autotransfer_min_amount belly_data["autotransfer_max_amount"] = B.autotransfer_max_amount var/list/at_whitelist = list() diff --git a/tgui/packages/tgui/interfaces/chompstation/VorePanel/VoreSelectedBellyInteractions.tsx b/tgui/packages/tgui/interfaces/chompstation/VorePanel/VoreSelectedBellyInteractions.tsx index 5139cb2df6..1b16e7769d 100644 --- a/tgui/packages/tgui/interfaces/chompstation/VorePanel/VoreSelectedBellyInteractions.tsx +++ b/tgui/packages/tgui/interfaces/chompstation/VorePanel/VoreSelectedBellyInteractions.tsx @@ -192,6 +192,20 @@ export const VoreSelectedBellyInteractions = (props: { : 'Disabled'} + + {(autotransfer.autotransferextralocation && + autotransfer.autotransferextralocation.join(', ')) || + ''} + + + {(autotransfer.autotransferextralocation_secondary && + autotransfer.autotransferextralocation_secondary.join(', ')) || + ''} +