Belly option for absorbed auto-transfer (#7009)

This commit is contained in:
Eli
2023-09-21 02:00:49 +10:00
committed by GitHub
parent 576b4be92b
commit e71485cb63
7 changed files with 73 additions and 2 deletions

View File

@@ -71,6 +71,8 @@
var/autotransferchance_secondary = 0 // % Chance of prey being autotransferred to secondary transfer location //CHOMPAdd
var/autotransferlocation_secondary // Second place to send them //CHOMPAdd
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_max_amount = 0 // Maximum amount of things to pass at once. //CHOMPAdd
var/tmp/list/autotransfer_queue = list()// Reserve for above things. //CHOMPAdd
@@ -305,6 +307,8 @@
"autotransferwait",
"autotransferlocation",
"autotransfer_enabled",
"autotransfer_absorbed",
"autotransfer_absorbed_only",
"autotransferchance_secondary",
"autotransferlocation_secondary",
"autotransfer_min_amount",

View File

@@ -22,7 +22,8 @@
if(!M || !M.autotransferable) continue
if(isliving(M))
var/mob/living/L = M
if(L.absorbed) continue
if(!src.autotransfer_absorbed && L.absorbed) continue
if(src.autotransfer_absorbed && src.autotransfer_absorbed_only && !L.absorbed) continue
M.belly_cycles++
if(M.belly_cycles < autotransferwait / 60) continue
autotransferables += M

View File

@@ -328,6 +328,8 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
selected_list["autotransfer"]["autotransferlocation_secondary"] = selected.autotransferlocation_secondary //CHOMPAdd
selected_list["autotransfer"]["autotransfer_min_amount"] = selected.autotransfer_min_amount
selected_list["autotransfer"]["autotransfer_max_amount"] = selected.autotransfer_max_amount
selected_list["autotransfer"]["autotransfer_absorbed"] = selected.autotransfer_absorbed //CHOMPAdd
selected_list["autotransfer"]["autotransfer_absorbed_only"] = selected.autotransfer_absorbed_only //CHOMPAdd
selected_list["disable_hud"] = selected.disable_hud
selected_list["colorization_enabled"] = selected.colorization_enabled
@@ -1218,6 +1220,20 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
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))
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
if(isnum(belly_data["show_liquids"]))
var/new_show_liquids = belly_data["show_liquids"]
@@ -2741,6 +2757,12 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
. = TRUE
if("b_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
if("b_fullscreen")
host.vore_selected.belly_fullscreen = params["val"]

View File

@@ -246,6 +246,8 @@
belly_data["autotransferlocation_secondary"] = B.autotransferlocation_secondary
belly_data["autotransfer_min_amount"] = B.autotransfer_min_amount
belly_data["autotransfer_max_amount"] = B.autotransfer_max_amount
belly_data["autotransfer_absorbed"] = B.autotransfer_absorbed
belly_data["autotransfer_absorbed_only"] = B.autotransfer_absorbed_only
// Liquid Options
belly_data["show_liquids"] = B.show_liquids

View File

@@ -1630,6 +1630,42 @@ const VoreSelectedBellyInteractions = (props, context) => {
}
/>
</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>
) : (
'These options only display while Auto-Transfer is enabled.'

View File

@@ -201,6 +201,8 @@ type Belly = {
autotransferlocation_secondary: string;
autotransfer_min_amount: number;
autotransfer_max_amount: number;
autotransfer_absorbed: BooleanLike;
autotransfer_absorbed_only: BooleanLike;
// Liquid Options
show_liquids: BooleanLike;
@@ -334,6 +336,8 @@ const generateBellyString = (belly: Belly, index: number) => {
autotransfer_enabled,
autotransfer_min_amount,
autotransfer_max_amount,
autotransfer_absorbed,
autotransfer_absorbed_only,
// Liquid Options
show_liquids,
@@ -674,6 +678,8 @@ const generateBellyString = (belly: Belly, index: number) => {
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 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">Only Auto-Transfer Absorbed Creatures: ' + (autotransfer_absorbed_only ? '<span style="color: green;">Yes' : '<span style="color: red;">No') + '</li>';
result += '</ul>';
result += '</div></div></div>';

File diff suppressed because one or more lines are too long