Auto-transfer whitelists and blacklists for filtering (#7034)

This commit is contained in:
Eli
2023-09-27 00:00:41 +10:00
committed by GitHub
parent 2e95447d91
commit 56b0d60711
8 changed files with 329 additions and 89 deletions

View File

@@ -16,3 +16,20 @@
//For belly fullscreen shennanigans outside of bellies, due to Life() clearing belly fullscreens outside of bellies. //For belly fullscreen shennanigans outside of bellies, due to Life() clearing belly fullscreens outside of bellies.
#define ATOM_BELLY_FULLSCREEN "belly_atom_vfx" #define ATOM_BELLY_FULLSCREEN "belly_atom_vfx"
//Auto-transfer flags
#define AT_FLAG_CREATURES 0x1
#define AT_FLAG_ABSORBED 0x2
#define AT_FLAG_CARBON 0x4
#define AT_FLAG_SILICON 0x8
#define AT_FLAG_MOBS 0x10
#define AT_FLAG_ANIMALS 0x20
#define AT_FLAG_MICE 0x40
#define AT_FLAG_DEAD 0x80
#define AT_FLAG_CANDIGEST 0x100
#define AT_FLAG_CANABSORB 0x200
#define AT_FLAG_ITEMS 0x400
#define AT_FLAG_TRASH 0x800
#define AT_FLAG_EGGS 0x1000
#define AT_FLAG_REMAINS 0x2000
#define AT_FLAG_INDIGESTIBLE 0x4000

View File

@@ -68,14 +68,18 @@
var/autotransferchance = 0 // % Chance of prey being autotransferred to transfer location var/autotransferchance = 0 // % Chance of prey being autotransferred to transfer location
var/autotransferwait = 10 // Time between trying to transfer. var/autotransferwait = 10 // Time between trying to transfer.
var/autotransferlocation // Place to send them var/autotransferlocation // Place to send them
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/autotransferchance_secondary = 0 // % Chance of prey being autotransferred to secondary transfer 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/autotransferlocation_secondary // Second place to send them //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_enabled = FALSE // Player toggle var/autotransfer_enabled = FALSE // Player toggle
var/autotransfer_absorbed = FALSE // If belly can auto transfer absorbed creatures //CHOMPAdd
var/autotransfer_absorbed_only = FALSE // If belly ONLY auto transfers absorbed creatures //CHOMPAdd
var/autotransfer_min_amount = 0 // Minimum amount of things to pass at once. //CHOMPAdd var/autotransfer_min_amount = 0 // Minimum amount of things to pass at once. //CHOMPAdd
var/autotransfer_max_amount = 0 // Maximum amount of things to pass at once. //CHOMPAdd var/autotransfer_max_amount = 0 // Maximum amount of things to pass at once. //CHOMPAdd
var/tmp/list/autotransfer_queue = list()// Reserve for above things. //CHOMPAdd var/tmp/list/autotransfer_queue = list()// Reserve for above things. //CHOMPAdd
//Auto-transfer flags for whitelist //CHOMPAdd
var/tmp/static/list/autotransfer_flags_list = list("Creatures" = AT_FLAG_CREATURES, "Absorbed" = AT_FLAG_ABSORBED, "Carbon" = AT_FLAG_CARBON, "Silicon" = AT_FLAG_SILICON, "Mobs" = AT_FLAG_MOBS, "Animals" = AT_FLAG_ANIMALS, "Mice" = AT_FLAG_MICE, "Dead" = AT_FLAG_DEAD, "Digestable Creatures" = AT_FLAG_CANDIGEST, "Absorbable Creatures" = AT_FLAG_CANABSORB, "Items" = AT_FLAG_ITEMS, "Trash" = AT_FLAG_TRASH, "Eggs" = AT_FLAG_EGGS, "Remains" = AT_FLAG_REMAINS, "Indigestible Items" = AT_FLAG_INDIGESTIBLE)
//I don't think we've ever altered these lists. making them static until someone actually overrides them somewhere. //I don't think we've ever altered these lists. making them static until someone actually overrides them somewhere.
//Actual full digest modes //Actual full digest modes
@@ -307,10 +311,12 @@
"autotransferwait", "autotransferwait",
"autotransferlocation", "autotransferlocation",
"autotransfer_enabled", "autotransfer_enabled",
"autotransfer_absorbed",
"autotransfer_absorbed_only",
"autotransferchance_secondary", "autotransferchance_secondary",
"autotransferlocation_secondary", "autotransferlocation_secondary",
"autotransfer_secondary_whitelist",
"autotransfer_secondary_blacklist",
"autotransfer_whitelist",
"autotransfer_blacklist",
"autotransfer_min_amount", "autotransfer_min_amount",
"autotransfer_max_amount", "autotransfer_max_amount",
"slow_digestion", "slow_digestion",
@@ -1603,9 +1609,9 @@
/obj/belly/proc/check_autotransfer(var/atom/movable/prey) /obj/belly/proc/check_autotransfer(var/atom/movable/prey)
if(!(prey in contents) || !prey.autotransferable) return if(!(prey in contents) || !prey.autotransferable) return
var/dest_belly_name var/dest_belly_name
if(autotransferlocation_secondary && prob(autotransferchance_secondary)) if(autotransferlocation_secondary && prob(autotransferchance_secondary) && autotransfer_filter(prey, autotransfer_secondary_whitelist, autotransfer_secondary_blacklist))
dest_belly_name = autotransferlocation_secondary dest_belly_name = autotransferlocation_secondary
if(autotransferlocation && prob(autotransferchance)) if(autotransferlocation && prob(autotransferchance) && autotransfer_filter(prey, autotransfer_whitelist, autotransfer_blacklist))
dest_belly_name = autotransferlocation dest_belly_name = autotransferlocation
if(!dest_belly_name) // Didn't transfer, so wait before retrying if(!dest_belly_name) // Didn't transfer, so wait before retrying
prey.belly_cycles = 0 prey.belly_cycles = 0
@@ -1619,6 +1625,89 @@
transfer_contents(prey, dest_belly) transfer_contents(prey, dest_belly)
return TRUE //CHOMPEdit end return TRUE //CHOMPEdit end
//Autotransfer filter CHOMPEdit Start
/obj/belly/proc/autotransfer_filter(var/atom/movable/prey, var/whitelist, var/blacklist)
if(blacklist & autotransfer_flags_list["Absorbed"])
if(isliving(prey))
var/mob/living/L = prey
if(L.absorbed) return FALSE
if(blacklist != 2) // Default is 2 for Absorbed, if it's not 2, check everything else
if(blacklist & autotransfer_flags_list["Creatures"])
if(isliving(prey)) return FALSE
if(blacklist & autotransfer_flags_list["Carbon"])
if(iscarbon(prey)) return FALSE
if(blacklist & autotransfer_flags_list["Silicon"])
if(issilicon(prey)) return FALSE
if(blacklist & autotransfer_flags_list["Mobs"])
if(istype(prey, /mob/living/simple_mob)) return FALSE
if(blacklist & autotransfer_flags_list["Animals"])
if(istype(prey, /mob/living/simple_mob/animal)) return FALSE
if(blacklist & autotransfer_flags_list["Mice"])
if(ismouse(prey)) return FALSE
if(blacklist & autotransfer_flags_list["Dead"])
if(isliving(prey))
var/mob/living/L = prey
if(L.stat == DEAD) return FALSE
if(blacklist & autotransfer_flags_list["Digestable Creatures"])
if(isliving(prey))
var/mob/living/L = prey
if(L.digestable) return FALSE
if(blacklist & autotransfer_flags_list["Absorbable Creatures"])
if(isliving(prey))
var/mob/living/L = prey
if(L.absorbable) return FALSE
if(blacklist & autotransfer_flags_list["Items"])
if(isitem(prey)) return FALSE
if(blacklist & autotransfer_flags_list["Trash"])
if(istype(prey, /obj/item/trash)) return FALSE
if(blacklist & autotransfer_flags_list["Eggs"])
if(istype(prey, /obj/item/weapon/storage/vore_egg)) return FALSE
if(blacklist & autotransfer_flags_list["Remains"])
if(istype(prey, /obj/item/weapon/digestion_remains)) return FALSE
if(blacklist & autotransfer_flags_list["Indigestible Items"])
if(prey in items_preserved) return FALSE
if(whitelist == 0) return TRUE
if(whitelist & autotransfer_flags_list["Creatures"])
if(isliving(prey)) return TRUE
if(whitelist & autotransfer_flags_list["Absorbed"])
if(isliving(prey))
var/mob/living/L = prey
if(L.absorbed) return TRUE
if(whitelist & autotransfer_flags_list["Carbon"])
if(iscarbon(prey)) return TRUE
if(whitelist & autotransfer_flags_list["Silicon"])
if(issilicon(prey)) return TRUE
if(whitelist & autotransfer_flags_list["Mobs"])
if(istype(prey, /mob/living/simple_mob)) return TRUE
if(whitelist & autotransfer_flags_list["Animals"])
if(istype(prey, /mob/living/simple_mob/animal)) return TRUE
if(whitelist & autotransfer_flags_list["Mice"])
if(ismouse(prey)) return TRUE
if(whitelist & autotransfer_flags_list["Dead"])
if(isliving(prey))
var/mob/living/L = prey
if(L.stat == DEAD) return TRUE
if(whitelist & autotransfer_flags_list["Digestable Creatures"])
if(isliving(prey))
var/mob/living/L = prey
if(L.digestable) return TRUE
if(whitelist & autotransfer_flags_list["Absorbable Creatures"])
if(isliving(prey))
var/mob/living/L = prey
if(L.absorbable) return TRUE
if(whitelist & autotransfer_flags_list["Items"])
if(isitem(prey)) return TRUE
if(whitelist & autotransfer_flags_list["Trash"])
if(istype(prey, /obj/item/trash)) return TRUE
if(whitelist & autotransfer_flags_list["Eggs"])
if(istype(prey, /obj/item/weapon/storage/vore_egg)) return TRUE
if(whitelist & autotransfer_flags_list["Remains"])
if(istype(prey, /obj/item/weapon/digestion_remains)) return TRUE
if(whitelist & autotransfer_flags_list["Indigestible Items"])
if(prey in items_preserved) return TRUE
return FALSE //CHOMPEdit end
// Belly copies and then returns the copy // Belly copies and then returns the copy
// Needs to be updated for any var changes // Needs to be updated for any var changes
/obj/belly/proc/copy(mob/new_owner) /obj/belly/proc/copy(mob/new_owner)

View File

@@ -20,10 +20,8 @@
var/list/autotransferables = list() var/list/autotransferables = list()
for(var/atom/movable/M in contents) for(var/atom/movable/M in contents)
if(!M || !M.autotransferable) continue if(!M || !M.autotransferable) continue
if(isliving(M)) // If the prey can't pass the filter of at least one transfer location, skip it
var/mob/living/L = M if(!(autotransfer_filter(M, autotransfer_secondary_whitelist, autotransfer_secondary_blacklist) || autotransfer_filter(M, autotransfer_whitelist, autotransfer_blacklist))) continue
if(!src.autotransfer_absorbed && L.absorbed) continue
if(src.autotransfer_absorbed && src.autotransfer_absorbed_only && !L.absorbed) continue
M.belly_cycles++ M.belly_cycles++
if(M.belly_cycles < autotransferwait / 60) continue if(M.belly_cycles < autotransferwait / 60) continue
autotransferables += M autotransferables += M

View File

@@ -328,8 +328,28 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
selected_list["autotransfer"]["autotransferlocation_secondary"] = selected.autotransferlocation_secondary //CHOMPAdd selected_list["autotransfer"]["autotransferlocation_secondary"] = selected.autotransferlocation_secondary //CHOMPAdd
selected_list["autotransfer"]["autotransfer_min_amount"] = selected.autotransfer_min_amount selected_list["autotransfer"]["autotransfer_min_amount"] = selected.autotransfer_min_amount
selected_list["autotransfer"]["autotransfer_max_amount"] = selected.autotransfer_max_amount selected_list["autotransfer"]["autotransfer_max_amount"] = selected.autotransfer_max_amount
selected_list["autotransfer"]["autotransfer_absorbed"] = selected.autotransfer_absorbed //CHOMPAdd //CHOMPAdd auto-transfer flags
selected_list["autotransfer"]["autotransfer_absorbed_only"] = selected.autotransfer_absorbed_only //CHOMPAdd var/list/at_whitelist = list()
for(var/flag_name in selected.autotransfer_flags_list)
if(selected.autotransfer_whitelist & selected.autotransfer_flags_list[flag_name])
at_whitelist.Add(flag_name)
selected_list["autotransfer"]["autotransfer_whitelist"] = at_whitelist
var/list/at_blacklist = list()
for(var/flag_name in selected.autotransfer_flags_list)
if(selected.autotransfer_blacklist & selected.autotransfer_flags_list[flag_name])
at_blacklist.Add(flag_name)
selected_list["autotransfer"]["autotransfer_blacklist"] = at_blacklist
var/list/at_secondary_whitelist = list()
for(var/flag_name in selected.autotransfer_flags_list)
if(selected.autotransfer_secondary_whitelist & selected.autotransfer_flags_list[flag_name])
at_secondary_whitelist.Add(flag_name)
selected_list["autotransfer"]["autotransfer_secondary_whitelist"] = at_secondary_whitelist
var/list/at_secondary_blacklist = list()
for(var/flag_name in selected.autotransfer_flags_list)
if(selected.autotransfer_secondary_blacklist & selected.autotransfer_flags_list[flag_name])
at_secondary_blacklist.Add(flag_name)
selected_list["autotransfer"]["autotransfer_secondary_blacklist"] = at_secondary_blacklist
//CHOMPAdd END
selected_list["disable_hud"] = selected.disable_hud selected_list["disable_hud"] = selected.disable_hud
selected_list["colorization_enabled"] = selected.colorization_enabled selected_list["colorization_enabled"] = selected.colorization_enabled
@@ -1161,6 +1181,26 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
if(new_transferlocation_secondary == new_belly.name) if(new_transferlocation_secondary == new_belly.name)
new_belly.transferlocation_secondary = null new_belly.transferlocation_secondary = null
if(islist(belly_data["autotransfer_whitelist"]))
new_belly.autotransfer_whitelist = 0
for(var/at_flag in belly_data["autotransfer_whitelist"])
new_belly.autotransfer_whitelist += new_belly.autotransfer_flags_list[at_flag]
if(islist(belly_data["autotransfer_blacklist"]))
new_belly.autotransfer_blacklist = 0
for(var/at_flag in belly_data["autotransfer_blacklist"])
new_belly.autotransfer_blacklist += new_belly.autotransfer_flags_list[at_flag]
if(islist(belly_data["autotransfer_secondary_whitelist"]))
new_belly.autotransfer_secondary_whitelist = 0
for(var/at_flag in belly_data["autotransfer_secondary_whitelist"])
new_belly.autotransfer_secondary_whitelist += new_belly.autotransfer_flags_list[at_flag]
if(islist(belly_data["autotransfer_secondary_blacklist"]))
new_belly.autotransfer_secondary_blacklist = 0
for(var/at_flag in belly_data["autotransfer_secondary_blacklist"])
new_belly.autotransfer_secondary_blacklist += new_belly.autotransfer_flags_list[at_flag]
if(isnum(belly_data["absorbchance"])) if(isnum(belly_data["absorbchance"]))
var/new_absorbchance = belly_data["absorbchance"] var/new_absorbchance = belly_data["absorbchance"]
new_belly.absorbchance = sanitize_integer(new_absorbchance, 0, 100, initial(new_belly.absorbchance)) new_belly.absorbchance = sanitize_integer(new_absorbchance, 0, 100, initial(new_belly.absorbchance))
@@ -1220,20 +1260,6 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
var/new_autotransfer_max_amount = belly_data["autotransfer_max_amount"] var/new_autotransfer_max_amount = belly_data["autotransfer_max_amount"]
new_belly.autotransfer_max_amount = sanitize_integer(new_autotransfer_max_amount, 0, 100, initial(new_belly.autotransfer_max_amount)) new_belly.autotransfer_max_amount = sanitize_integer(new_autotransfer_max_amount, 0, 100, initial(new_belly.autotransfer_max_amount))
if(isnum(belly_data["autotransfer_absorbed"]))
var/new_autotransfer_absorbed = belly_data["autotransfer_absorbed"]
if(new_autotransfer_absorbed == 0)
new_belly.autotransfer_absorbed = FALSE
if(new_autotransfer_absorbed == 1)
new_belly.autotransfer_absorbed = TRUE
if(isnum(belly_data["autotransfer_absorbed_only"]))
var/new_autotransfer_absorbed_only = belly_data["autotransfer_absorbed_only"]
if(new_autotransfer_absorbed_only == 0)
new_belly.autotransfer_absorbed_only = FALSE
if(new_autotransfer_absorbed_only == 1)
new_belly.autotransfer_absorbed_only = TRUE
// Liquid Options // Liquid Options
if(isnum(belly_data["show_liquids"])) if(isnum(belly_data["show_liquids"]))
var/new_show_liquids = belly_data["show_liquids"] var/new_show_liquids = belly_data["show_liquids"]
@@ -2751,6 +2777,34 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
else else
host.vore_selected.autotransferlocation_secondary = choice.name host.vore_selected.autotransferlocation_secondary = choice.name
. = TRUE . = TRUE
if("b_autotransfer_whitelist")
var/list/menu_list = host.vore_selected.autotransfer_flags_list.Copy()
var/toggle_addon = tgui_input_list(usr, "Toggle Whitelist", "Whitelist Choice", menu_list)
if(!toggle_addon)
return FALSE
host.vore_selected.autotransfer_whitelist ^= host.vore_selected.autotransfer_flags_list[toggle_addon]
. = TRUE
if("b_autotransfer_blacklist")
var/list/menu_list = host.vore_selected.autotransfer_flags_list.Copy()
var/toggle_addon = tgui_input_list(usr, "Toggle Blacklist", "Blacklist Choice", menu_list)
if(!toggle_addon)
return FALSE
host.vore_selected.autotransfer_blacklist ^= host.vore_selected.autotransfer_flags_list[toggle_addon]
. = TRUE
if("b_autotransfer_secondary_whitelist")
var/list/menu_list = host.vore_selected.autotransfer_flags_list.Copy()
var/toggle_addon = tgui_input_list(usr, "Toggle Whitelist", "Whitelist Choice", menu_list)
if(!toggle_addon)
return FALSE
host.vore_selected.autotransfer_secondary_whitelist ^= host.vore_selected.autotransfer_flags_list[toggle_addon]
. = TRUE
if("b_autotransfer_secondary_blacklist")
var/list/menu_list = host.vore_selected.autotransfer_flags_list.Copy()
var/toggle_addon = tgui_input_list(usr, "Toggle Blacklist", "Blacklist Choice", menu_list)
if(!toggle_addon)
return FALSE
host.vore_selected.autotransfer_secondary_blacklist ^= host.vore_selected.autotransfer_flags_list[toggle_addon]
. = TRUE
if("b_autotransfer_min_amount") if("b_autotransfer_min_amount")
var/autotransfer_min_amount_input = input(user, "Set the minimum amount of items your belly can belly auto-transfer at once. Set to 0 for no limit.", "Auto-Transfer Min Amount") as num|null var/autotransfer_min_amount_input = input(user, "Set the minimum amount of items your belly can belly auto-transfer at once. Set to 0 for no limit.", "Auto-Transfer Min Amount") as num|null
if(!isnull(autotransfer_min_amount_input)) if(!isnull(autotransfer_min_amount_input))
@@ -2763,12 +2817,6 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
. = TRUE . = TRUE
if("b_autotransfer_enabled") if("b_autotransfer_enabled")
host.vore_selected.autotransfer_enabled = !host.vore_selected.autotransfer_enabled host.vore_selected.autotransfer_enabled = !host.vore_selected.autotransfer_enabled
. = TRUE
if("b_autotransfer_absorbed")
host.vore_selected.autotransfer_absorbed = !host.vore_selected.autotransfer_absorbed
. = TRUE
if("b_autotransfer_absorbed_only")
host.vore_selected.autotransfer_absorbed_only = !host.vore_selected.autotransfer_absorbed_only
. = TRUE //CHOMPedit End . = TRUE //CHOMPedit End
if("b_fullscreen") if("b_fullscreen")
host.vore_selected.belly_fullscreen = params["val"] host.vore_selected.belly_fullscreen = params["val"]

View File

@@ -249,8 +249,26 @@
belly_data["autotransferlocation_secondary"] = B.autotransferlocation_secondary belly_data["autotransferlocation_secondary"] = B.autotransferlocation_secondary
belly_data["autotransfer_min_amount"] = B.autotransfer_min_amount belly_data["autotransfer_min_amount"] = B.autotransfer_min_amount
belly_data["autotransfer_max_amount"] = B.autotransfer_max_amount belly_data["autotransfer_max_amount"] = B.autotransfer_max_amount
belly_data["autotransfer_absorbed"] = B.autotransfer_absorbed var/list/at_whitelist = list()
belly_data["autotransfer_absorbed_only"] = B.autotransfer_absorbed_only for(var/flag_name in B.autotransfer_flags_list)
if(B.autotransfer_whitelist & B.autotransfer_flags_list[flag_name])
at_whitelist.Add(flag_name)
belly_data["autotransfer_whitelist"] = at_whitelist
var/list/at_blacklist = list()
for(var/flag_name in B.autotransfer_flags_list)
if(B.autotransfer_blacklist & B.autotransfer_flags_list[flag_name])
at_blacklist.Add(flag_name)
belly_data["autotransfer_blacklist"] = at_blacklist
var/list/at_secondary_whitelist = list()
for(var/flag_name in B.autotransfer_flags_list)
if(B.autotransfer_secondary_whitelist & B.autotransfer_flags_list[flag_name])
at_secondary_whitelist.Add(flag_name)
belly_data["autotransfer_secondary_whitelist"] = at_secondary_whitelist
var/list/at_secondary_blacklist = list()
for(var/flag_name in B.autotransfer_flags_list)
if(B.autotransfer_secondary_blacklist & B.autotransfer_flags_list[flag_name])
at_secondary_blacklist.Add(flag_name)
belly_data["autotransfer_secondary_blacklist"] = at_secondary_blacklist
// Liquid Options // Liquid Options
belly_data["show_liquids"] = B.show_liquids belly_data["show_liquids"] = B.show_liquids

View File

@@ -1566,7 +1566,28 @@ const VoreSelectedBellyInteractions = (props, context) => {
} }
/> />
</LabeledList.Item> </LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Chance"> <LabeledList.Item label="Auto-Transfer Min Amount">
<Button
content={autotransfer.autotransfer_min_amount}
onClick={() =>
act('set_attribute', {
attribute: 'b_autotransfer_min_amount',
})
}
/>
</LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Max Amount">
<Button
content={autotransfer.autotransfer_max_amount}
onClick={() =>
act('set_attribute', {
attribute: 'b_autotransfer_max_amount',
})
}
/>
</LabeledList.Item>
<LabeledList.Divider />
<LabeledList.Item label="Auto-Transfer Primary Chance">
<Button <Button
content={autotransfer.autotransferchance + '%'} content={autotransfer.autotransferchance + '%'}
onClick={() => onClick={() =>
@@ -1574,7 +1595,7 @@ const VoreSelectedBellyInteractions = (props, context) => {
} }
/> />
</LabeledList.Item> </LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Location"> <LabeledList.Item label="Auto-Transfer Primary Location">
<Button <Button
content={ content={
autotransfer.autotransferlocation autotransfer.autotransferlocation
@@ -1586,6 +1607,35 @@ const VoreSelectedBellyInteractions = (props, context) => {
} }
/> />
</LabeledList.Item> </LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Primary Whitelist">
{(autotransfer.autotransfer_whitelist.length &&
autotransfer.autotransfer_whitelist.join(', ')) ||
'Everything'}
<Button
onClick={() =>
act('set_attribute', {
attribute: 'b_autotransfer_whitelist',
})
}
ml={1}
icon="plus"
/>
</LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Primary Blacklist">
{(autotransfer.autotransfer_blacklist.length &&
autotransfer.autotransfer_blacklist.join(', ')) ||
'Nothing'}
<Button
onClick={() =>
act('set_attribute', {
attribute: 'b_autotransfer_blacklist',
})
}
ml={1}
icon="plus"
/>
</LabeledList.Item>
<LabeledList.Divider />
<LabeledList.Item label="Auto-Transfer Secondary Chance"> <LabeledList.Item label="Auto-Transfer Secondary Chance">
<Button <Button
content={autotransfer.autotransferchance_secondary + '%'} content={autotransfer.autotransferchance_secondary + '%'}
@@ -1610,62 +1660,34 @@ const VoreSelectedBellyInteractions = (props, context) => {
} }
/> />
</LabeledList.Item> </LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Min Amount"> <LabeledList.Item label="Auto-Transfer Secondary Whitelist">
{(autotransfer.autotransfer_secondary_whitelist.length &&
autotransfer.autotransfer_secondary_whitelist.join(', ')) ||
'Everything'}
<Button <Button
content={autotransfer.autotransfer_min_amount}
onClick={() => onClick={() =>
act('set_attribute', { act('set_attribute', {
attribute: 'b_autotransfer_min_amount', attribute: 'b_autotransfer_secondary_whitelist',
}) })
} }
ml={1}
icon="plus"
/> />
</LabeledList.Item> </LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Max Amount"> <LabeledList.Item label="Auto-Transfer Secondary Blacklist">
{(autotransfer.autotransfer_secondary_blacklist.length &&
autotransfer.autotransfer_secondary_blacklist.join(', ')) ||
'Nothing'}
<Button <Button
content={autotransfer.autotransfer_max_amount}
onClick={() => onClick={() =>
act('set_attribute', { act('set_attribute', {
attribute: 'b_autotransfer_max_amount', attribute: 'b_autotransfer_secondary_blacklist',
}) })
} }
ml={1}
icon="plus"
/> />
</LabeledList.Item> </LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Absorbed Creatures">
<Button
onClick={() =>
act('set_attribute', { attribute: 'b_autotransfer_absorbed' })
}
icon={
autotransfer.autotransfer_absorbed
? 'toggle-on'
: 'toggle-off'
}
selected={autotransfer.autotransfer_absorbed}
content={autotransfer.autotransfer_absorbed ? 'Yes' : 'No'}
/>
</LabeledList.Item>
{autotransfer.autotransfer_absorbed ? (
<LabeledList.Item label="Only Auto-Transfer Absorbed Creatures">
<Button
onClick={() =>
act('set_attribute', {
attribute: 'b_autotransfer_absorbed_only',
})
}
icon={
autotransfer.autotransfer_absorbed_only
? 'toggle-on'
: 'toggle-off'
}
selected={autotransfer.autotransfer_absorbed_only}
content={
autotransfer.autotransfer_absorbed_only ? 'Yes' : 'No'
}
/>
</LabeledList.Item>
) : (
''
)}
</LabeledList> </LabeledList>
) : ( ) : (
'These options only display while Auto-Transfer is enabled.' 'These options only display while Auto-Transfer is enabled.'

View File

@@ -43,6 +43,24 @@ const ReagentAddonIcon = {
'Draining Liquids': '', 'Draining Liquids': '',
}; };
const AutotransferFlagIcon = {
'Creatures': '',
'Absorbed': '',
'Carbon': '',
'Silicon': '',
'Mobs': '',
'Animals': '',
'Mice': '',
'Dead': '',
'Digestable Creatures': '',
'Absorbable Creatures': '',
'Items': '',
'Trash': '',
'Eggs': '',
'Remains': '',
'Indigestible Items': '',
};
const GetAddons = (addons: string[]) => { const GetAddons = (addons: string[]) => {
let result: string[] = []; let result: string[] = [];
@@ -83,6 +101,30 @@ const GetLiquidAddons = (addons: string[]) => {
return result; return result;
}; };
const GetAutotransferFlags = (addons: string[], whitelist: BooleanLike) => {
let result: string[] = [];
addons?.forEach((addon) => {
result.push(
'<span class="badge text-bg-secondary"><i class="' +
AutotransferFlagIcon[addon] +
'"></i>' +
addon +
'</span>'
);
});
if (result.length === 0) {
if (whitelist) {
result.push('Everything');
} else {
result.push('Nothing');
}
}
return result;
};
type Data = { type Data = {
db_version: string; db_version: string;
db_repo: string; db_repo: string;
@@ -212,8 +254,10 @@ type Belly = {
autotransferlocation_secondary: string; autotransferlocation_secondary: string;
autotransfer_min_amount: number; autotransfer_min_amount: number;
autotransfer_max_amount: number; autotransfer_max_amount: number;
autotransfer_absorbed: BooleanLike; autotransfer_whitelist: string[];
autotransfer_absorbed_only: BooleanLike; autotransfer_blacklist: string[];
autotransfer_secondary_whitelist: string[];
autotransfer_secondary_blacklist: string[];
// Liquid Options // Liquid Options
show_liquids: BooleanLike; show_liquids: BooleanLike;
@@ -368,8 +412,10 @@ const generateBellyString = (belly: Belly, index: number) => {
autotransfer_enabled, autotransfer_enabled,
autotransfer_min_amount, autotransfer_min_amount,
autotransfer_max_amount, autotransfer_max_amount,
autotransfer_absorbed, autotransfer_whitelist,
autotransfer_absorbed_only, autotransfer_blacklist,
autotransfer_secondary_whitelist,
autotransfer_secondary_blacklist,
// Liquid Options // Liquid Options
show_liquids, show_liquids,
@@ -714,14 +760,16 @@ const generateBellyString = (belly: Belly, index: number) => {
'</span>)</b>'; '</span>)</b>';
result += '<ul class="list-group">'; result += '<ul class="list-group">';
result += '<li class="list-group-item">Auto-Transfer Time: ' + autotransferwait / 10 + 's</li>'; result += '<li class="list-group-item">Auto-Transfer Time: ' + autotransferwait / 10 + 's</li>';
result += '<li class="list-group-item">Auto-Transfer Chance: ' + autotransferchance + '%</li>';
result += '<li class="list-group-item">Auto-Transfer Location: ' + autotransferlocation + '</li>';
result += '<li class="list-group-item">Auto-Transfer Chance: ' + autotransferchance_secondary + '%</li>';
result += '<li class="list-group-item">Auto-Transfer Location: ' + autotransferlocation_secondary + '</li>';
result += '<li class="list-group-item">Auto-Transfer Min Amount: ' + autotransfer_min_amount + '</li>'; result += '<li class="list-group-item">Auto-Transfer Min Amount: ' + autotransfer_min_amount + '</li>';
result += '<li class="list-group-item">Auto-Transfer Max Amount: ' + autotransfer_max_amount + '</li>'; result += '<li class="list-group-item">Auto-Transfer Max Amount: ' + autotransfer_max_amount + '</li>';
result += '<li class="list-group-item">Auto-Transfer Absorbed Creatures: ' + (autotransfer_absorbed ? '<span style="color: green;">Yes' : '<span style="color: red;">No') + '</li>'; result += '<li class="list-group-item">Auto-Transfer Primary Chance: ' + autotransferchance + '%</li>';
result += '<li class="list-group-item">Only Auto-Transfer Absorbed Creatures: ' + (autotransfer_absorbed_only ? '<span style="color: green;">Yes' : '<span style="color: red;">No') + '</li>'; result += '<li class="list-group-item">Auto-Transfer Primary Location: ' + autotransferlocation + '</li>';
result += '<li class="list-group-item">Auto-Transfer Primary Whitelist: ' + GetAutotransferFlags(autotransfer_whitelist, true) + '</li>';
result += '<li class="list-group-item">Auto-Transfer Primary Blacklist: ' + GetAutotransferFlags(autotransfer_blacklist, false) + '</li>';
result += '<li class="list-group-item">Auto-Transfer Secondary Chance: ' + autotransferchance_secondary + '%</li>';
result += '<li class="list-group-item">Auto-Transfer Secondary Location: ' + autotransferlocation_secondary + '</li>';
result += '<li class="list-group-item">Auto-Transfer Secondary Whitelist: ' + GetAutotransferFlags(autotransfer_secondary_whitelist, true) + '</li>';
result += '<li class="list-group-item">Auto-Transfer Secondary Blacklist: ' + GetAutotransferFlags(autotransfer_secondary_blacklist, false) + '</li>';
result += '</ul>'; result += '</ul>';
result += '</div></div></div>'; result += '</div></div></div>';

File diff suppressed because one or more lines are too long