Extra Auto-Transfer Locations (#8644)

This commit is contained in:
Eli
2024-07-18 21:52:53 +10:00
committed by GitHub
parent 54c4dd3714
commit b965e6041c
9 changed files with 91 additions and 9 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -192,6 +192,20 @@ export const VoreSelectedBellyInteractions = (props: {
: 'Disabled'}
</Button>
</LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Primary Location Extras">
{(autotransfer.autotransferextralocation &&
autotransfer.autotransferextralocation.join(', ')) ||
''}
<Button
onClick={() =>
act('set_attribute', {
attribute: 'b_autotransferextralocation',
})
}
ml={1}
icon="plus"
/>
</LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Primary Whitelist (Mobs)">
{(autotransfer.autotransfer_whitelist.length &&
autotransfer.autotransfer_whitelist.join(', ')) ||
@@ -273,6 +287,20 @@ export const VoreSelectedBellyInteractions = (props: {
: 'Disabled'}
</Button>
</LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Secondary Location Extras">
{(autotransfer.autotransferextralocation_secondary &&
autotransfer.autotransferextralocation_secondary.join(', ')) ||
''}
<Button
onClick={() =>
act('set_attribute', {
attribute: 'b_autotransferextralocation_secondary',
})
}
ml={1}
icon="plus"
/>
</LabeledList.Item>
<LabeledList.Item label="Auto-Transfer Secondary Whitelist (Mobs)">
{(autotransfer.autotransfer_secondary_whitelist.length &&
autotransfer.autotransfer_secondary_whitelist.join(', ')) ||

View File

@@ -174,8 +174,10 @@ type autotransferData = {
autotransferchance: number;
autotransferwait: number;
autotransferlocation: string;
autotransferextralocation: string[];
autotransferchance_secondary: number;
autotransferlocation_secondary: string;
autotransferextralocation_secondary: string[];
autotransfer_min_amount: number;
autotransfer_max_amount: number;
autotransfer_whitelist: string[];

View File

@@ -1,3 +1,4 @@
import { ItemModeSpan, ModeSpan } from './constants';
import { Belly } from './types';
import {
GetAddons,
@@ -151,8 +152,10 @@ export const generateBellyString = (belly: Belly, index: number) => {
autotransferwait,
autotransferchance,
autotransferlocation,
autotransferextralocation,
autotransferchance_secondary,
autotransferlocation_secondary,
autotransferextralocation_secondary,
autotransfer_enabled,
autotransfer_min_amount,
autotransfer_max_amount,
@@ -723,12 +726,14 @@ export const generateBellyString = (belly: Belly, index: number) => {
result += '<li class="list-group-item">Auto-Transfer Max Amount: ' + autotransfer_max_amount + '</li>';
result += '<li class="list-group-item">Auto-Transfer Primary Chance: ' + autotransferchance + '%</li>';
result += '<li class="list-group-item">Auto-Transfer Primary Location: ' + autotransferlocation + '</li>';
result += '<li class="list-group-item">Auto-Transfer Primary Location Extras: ' + autotransferextralocation.join(', ') + '</li>';
result += '<li class="list-group-item">Auto-Transfer Primary Whitelist (Mobs): ' + GetAutotransferFlags(autotransfer_whitelist, true) + '</li>';
result += '<li class="list-group-item">Auto-Transfer Primary Whitelist (Items): ' + GetAutotransferFlags(autotransfer_whitelist_items, true) + '</li>';
result += '<li class="list-group-item">Auto-Transfer Primary Blacklist (Mobs): ' + GetAutotransferFlags(autotransfer_blacklist, false) + '</li>';
result += '<li class="list-group-item">Auto-Transfer Primary Blacklist (Items): ' + GetAutotransferFlags(autotransfer_blacklist_items, 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 Location Extras: ' + autotransferextralocation_secondary.join(', ') + '</li>';
result += '<li class="list-group-item">Auto-Transfer Secondary Whitelist (Mobs): ' + GetAutotransferFlags(autotransfer_secondary_whitelist, true) + '</li>';
result += '<li class="list-group-item">Auto-Transfer Secondary Whitelist (Items): ' + GetAutotransferFlags(autotransfer_secondary_whitelist_items, true) + '</li>';
result += '<li class="list-group-item">Auto-Transfer Secondary Blacklist (Mobs): ' + GetAutotransferFlags(autotransfer_secondary_blacklist, false) + '</li>';

View File

@@ -1,5 +1,7 @@
import { BooleanLike } from 'common/react';
import { AddonIcon, AutotransferFlagIcon, ReagentAddonIcon } from './constants';
export const GetAddons = (addons: string[]) => {
let result: string[] = [];

View File

@@ -1,4 +1,4 @@
const ModeSpan = {
export const ModeSpan = {
Hold: '<span class="badge text-bg-secondary">Hold</span>',
Digest: '<span class="badge text-bg-danger">Digest</span>',
Absorb: '<span class="badge text-bg-light">Absorb</span>',
@@ -12,7 +12,7 @@ const ModeSpan = {
'Encase In Egg': '<span class="badge text-bg-primary">Encase In Egg</span>',
};
const ItemModeSpan = {
export const ItemModeSpan = {
Hold: '<span class="badge text-bg-secondary">Item: Hold</span>',
'Digest (Food Only)':
'<span class="badge text-bg-danger">Item: Digest (Food Only)</span>',
@@ -21,7 +21,7 @@ const ItemModeSpan = {
'<span class="badge text-bg-danger">Item: Digest (Dispersed Damage)</span>',
};
const AddonIcon = {
export const AddonIcon = {
Numbing: '',
Stripping: '',
'Leave Remains': '',
@@ -31,14 +31,14 @@ const AddonIcon = {
'Complete Absorb': '',
};
const ReagentAddonIcon = {
export const ReagentAddonIcon = {
'Produce Liquids': '',
'Digestion Liquids': '',
'Absorption Liquids': '',
'Draining Liquids': '',
};
const AutotransferFlagIcon = {
export const AutotransferFlagIcon = {
Creatures: '',
Absorbed: '',
Carbon: '',

View File

@@ -157,9 +157,11 @@ export type Belly = {
autotransferwait: number;
autotransferchance: number;
autotransferlocation: string;
autotransferextralocation: string[];
autotransfer_enabled: BooleanLike;
autotransferchance_secondary: number;
autotransferlocation_secondary: string;
autotransferextralocation_secondary: string[];
autotransfer_min_amount: number;
autotransfer_max_amount: number;
autotransfer_whitelist: string[];