Adds dynamic belly mush overlay system and other liquid setting tweaks (#6669)

This commit is contained in:
Verkister
2023-07-30 09:13:06 +03:00
committed by GitHub
parent 4e50bd8fdf
commit fe771abc41
6 changed files with 323 additions and 13 deletions

View File

@@ -14,12 +14,20 @@
var/show_liquids = FALSE //Moved from vorepanel_ch to be a belly var
var/show_fullness_messages = FALSE //Moved from vorepanel_ch to be a belly var
var/liquid_overlay = TRUE //Belly-specific liquid overlay toggle
var/mush_overlay = FALSE //Toggle for nutrition mush overlay
var/mush_color = "#664330" //Nutrition mush overlay color
var/mush_alpha = 255 //Mush overlay transparency.
var/max_mush = 500 //How much nutrition for full mush overlay
var/min_mush = 0 //Manual setting for lowest mush level
var/nutri_reagent_gen = FALSE //if belly produces reagent over time using nutrition, needs to be optimized to use subsystem - Jack
var/list/generated_reagents = list("water" = 1) //Any number of reagents, the associated value is how many units are generated per process()
var/reagent_name = "water" //What is shown when reagents are removed, doesn't need to be an actual reagent
var/reagentid = "water" //Selected reagent's id, for use in puddle system currently
var/reagentcolor = "#0064C877" //Selected reagent's color, for use in puddle system currently
var/custom_reagentcolor //Custom reagent color. Blank for normal reagent color
var/custom_reagentalpha //Custom reagent alpha. Blank for capacity based alpha
var/gen_cost = 1 //amount of nutrient taken from the host everytime nutrition is used to make reagents
var/gen_amount = 1 //Does not actually influence amount produced, but is used as a way to tell the system how much total reagent it has to take into account when filling a belly

View File

@@ -261,6 +261,14 @@
"reagent_chosen",
"reagentid",
"reagentcolor",
"liquid_overlay",
"mush_overlay",
"mush_color",
"mush_alpha",
"max_mush",
"min_mush",
"custom_reagentcolor",
"custom_reagentalpha",
"gen_cost",
"gen_amount",
"gen_time",
@@ -522,13 +530,27 @@
I.color = belly_fullscreen_color4
I.alpha = belly_fullscreen_alpha
F.add_overlay(I)
if(L.liquidbelly_visuals && reagents.total_volume)
if(L.liquidbelly_visuals && mush_overlay && (owner.nutrition > 0 || max_mush == 0 || min_mush > 0))
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "mush")
I.color = mush_color
I.alpha = mush_alpha
I.pixel_y = -450 + (450 / max(max_mush, 1) * max(min(max_mush, owner.nutrition), 1))
if(I.pixel_y < -450 + (450 / 100 * min_mush))
I.pixel_y = -450 + (450 / 100 * min_mush)
F.add_overlay(I)
if(L.liquidbelly_visuals && liquid_overlay && reagents.total_volume)
if(digest_mode == DM_HOLD && item_digest_mode == IM_HOLD)
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "calm")
else
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "bubbles")
I.color = reagentcolor
I.alpha = max(150, min(custom_max_volume, 255)) - (255 - belly_fullscreen_alpha)
if(custom_reagentcolor)
I.color = custom_reagentcolor
else
I.color = reagentcolor
if(custom_reagentalpha)
I.alpha = custom_reagentalpha
else
I.alpha = max(150, min(custom_max_volume, 255)) - (255 - belly_fullscreen_alpha)
I.pixel_y = -450 + (450 / custom_max_volume * reagents.total_volume)
F.add_overlay(I)
F.update_for_view(L.client.view)
@@ -540,14 +562,29 @@
F.add_overlay(image(F.icon, belly_fullscreen+"-2"))
F.add_overlay(image(F.icon, belly_fullscreen+"-3"))
F.add_overlay(image(F.icon, belly_fullscreen+"-4"))
if(L.liquidbelly_visuals && reagents.total_volume)
if(L.liquidbelly_visuals && mush_overlay && (owner.nutrition > 0 || max_mush == 0 || min_mush > 0))
var/image/I
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "mush")
I.color = mush_color
I.alpha = mush_alpha
I.pixel_y = -450 + (450 / max(max_mush, 1) * max(min(max_mush, owner.nutrition), 1))
if(I.pixel_y < -450 + (450 / 100 * min_mush))
I.pixel_y = -450 + (450 / 100 * min_mush)
F.add_overlay(I)
if(L.liquidbelly_visuals && liquid_overlay && reagents.total_volume)
var/image/I
if(digest_mode == DM_HOLD && item_digest_mode == IM_HOLD)
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "calm")
else
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "bubbles")
I.color = reagentcolor
I.alpha = max(150, min(custom_max_volume, 255)) - (255 - belly_fullscreen_alpha)
if(custom_reagentcolor)
I.color = custom_reagentcolor
else
I.color = reagentcolor
if(custom_reagentalpha)
I.alpha = custom_reagentalpha
else
I.alpha = max(150, min(custom_max_volume, 255)) - (255 - belly_fullscreen_alpha)
I.pixel_y = -450 + (450 / custom_max_volume * reagents.total_volume)
F.add_overlay(I)
F.update_for_view(L.client.view)
@@ -606,13 +643,27 @@
I.color = belly_fullscreen_color4
I.alpha = belly_fullscreen_alpha
F.add_overlay(I)
if(L.liquidbelly_visuals && reagents.total_volume)
if(L.liquidbelly_visuals && mush_overlay && (owner.nutrition > 0 || max_mush == 0 || min_mush > 0))
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "mush")
I.color = mush_color
I.alpha = mush_alpha
I.pixel_y = -450 + (450 / max(max_mush, 1) * max(min(max_mush, owner.nutrition), 1))
if(I.pixel_y < -450 + (450 / 100 * min_mush))
I.pixel_y = -450 + (450 / 100 * min_mush)
F.add_overlay(I)
if(L.liquidbelly_visuals && liquid_overlay && reagents.total_volume)
if(digest_mode == DM_HOLD && item_digest_mode == IM_HOLD)
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "calm")
else
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "bubbles")
I.color = reagentcolor
I.alpha = max(150, min(custom_max_volume, 255)) - (255 - belly_fullscreen_alpha)
if(custom_reagentcolor)
I.color = custom_reagentcolor
else
I.color = reagentcolor
if(custom_reagentalpha)
I.alpha = custom_reagentalpha
else
I.alpha = max(150, min(custom_max_volume, 255)) - (255 - belly_fullscreen_alpha)
I.pixel_y = -450 + (450 / custom_max_volume * reagents.total_volume)
F.add_overlay(I)
F.update_for_view(L.client.view)
@@ -623,14 +674,29 @@
F.add_overlay(image(F.icon, belly_fullscreen+"-2"))
F.add_overlay(image(F.icon, belly_fullscreen+"-3"))
F.add_overlay(image(F.icon, belly_fullscreen+"-4"))
if(L.liquidbelly_visuals && reagents.total_volume)
if(L.liquidbelly_visuals && mush_overlay && (owner.nutrition > 0 || max_mush == 0 || min_mush > 0))
var/image/I
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "mush")
I.color = mush_color
I.alpha = mush_alpha
I.pixel_y = -450 + (450 / max(max_mush, 1) * max(min(max_mush, owner.nutrition), 1))
if(I.pixel_y < -450 + (450 / 100 * min_mush))
I.pixel_y = -450 + (450 / 100 * min_mush)
F.add_overlay(I)
if(L.liquidbelly_visuals && liquid_overlay && reagents.total_volume)
var/image/I
if(digest_mode == DM_HOLD && item_digest_mode == IM_HOLD)
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "calm")
else
I = image('modular_chomp/icons/mob/vore_fullscreens/bubbles.dmi', "bubbles")
I.color = reagentcolor
I.alpha = max(150, min(custom_max_volume, 255)) - (255 - belly_fullscreen_alpha)
if(custom_reagentcolor)
I.color = custom_reagentcolor
else
I.color = reagentcolor
if(custom_reagentalpha)
I.alpha = custom_reagentalpha
else
I.alpha = max(150, min(custom_max_volume, 255)) - (255 - belly_fullscreen_alpha)
I.pixel_y = -450 + (450 / custom_max_volume * reagents.total_volume)
F.add_overlay(I)
F.update_for_view(L.client.view)
@@ -1585,6 +1651,14 @@
dupe.reagent_chosen = reagent_chosen
dupe.reagentid = reagentid
dupe.reagentcolor = reagentcolor
dupe.liquid_overlay = liquid_overlay
dupe.mush_overlay = mush_overlay
dupe.mush_color = mush_color
dupe.mush_alpha = mush_alpha
dupe.max_mush = max_mush
dupe.min_mush = min_mush
dupe.custom_reagentcolor = custom_reagentcolor
dupe.custom_reagentalpha = custom_reagentalpha
dupe.gen_cost = gen_cost
dupe.gen_amount = gen_amount
dupe.gen_time = gen_time

View File

@@ -235,6 +235,14 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
"belly_fullscreen_color4" = selected.belly_fullscreen_color4,
"belly_fullscreen_alpha" = selected.belly_fullscreen_alpha,
"colorization_enabled" = selected.colorization_enabled,
"custom_reagentcolor" = selected.custom_reagentcolor,
"custom_reagentalpha" = selected.custom_reagentalpha,
"liquid_overlay" = selected.liquid_overlay,
"mush_overlay" = selected.mush_overlay,
"mush_color" = selected.mush_color,
"mush_alpha" = selected.mush_alpha,
"max_mush" = selected.max_mush,
"min_mush" = selected.min_mush,
"vorespawn_blacklist" = selected.vorespawn_blacklist,
"sound_volume" = selected.sound_volume,
"affects_voresprite" = selected.affects_vore_sprites,
@@ -367,6 +375,14 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
var/list/selected_list_member = selected_list["liq_interacts"]["liq_reagent_addons"]
ASSERT(islist(selected_list_member))
selected_list_member.Add(flag_name)
selected_list["liq_interacts"]["custom_reagentcolor"] = selected.custom_reagentcolor ? selected.custom_reagentcolor : selected.reagentcolor
selected_list["liq_interacts"]["custom_reagentalpha"] = selected.custom_reagentalpha ? selected.custom_reagentalpha : "Default"
selected_list["liq_interacts"]["liquid_overlay"] = selected.liquid_overlay
selected_list["liq_interacts"]["mush_overlay"] = selected.mush_overlay
selected_list["liq_interacts"]["mush_color"] = selected.mush_color
selected_list["liq_interacts"]["mush_alpha"] = selected.mush_alpha
selected_list["liq_interacts"]["max_mush"] = selected.max_mush
selected_list["liq_interacts"]["min_mush"] = selected.min_mush
selected_list["show_liq_fullness"] = selected.show_fullness_messages
selected_list["liq_messages"] = list()
@@ -1240,6 +1256,40 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
for(var/reagent_flag in belly_data["reagent_mode_flag_list"])
new_belly.reagent_mode_flags += new_belly.reagent_mode_flag_list[reagent_flag]
if(istext(belly_data["custom_reagentcolor"]))
var/custom_reagentcolor = sanitize_hexcolor(belly_data["custom_reagentcolor"],new_belly.custom_reagentcolor)
new_belly.custom_reagentcolor = custom_reagentcolor
if(istext(belly_data["mush_color"]))
var/mush_color = sanitize_hexcolor(belly_data["mush_color"],new_belly.mush_color)
new_belly.mush_color = mush_color
if(istext(belly_data["mush_alpha"]))
var/new_mush_alpha = sanitize_integer(belly_data["mush_alpha"],0,255,initial(new_belly.mush_alpha))
new_belly.mush_alpha = new_mush_alpha
if(isnum(belly_data["max_mush"]))
var/max_mush = belly_data["max_mush"]
new_belly.max_mush = CLAMP(max_mush, 0, 6000)
if(isnum(belly_data["min_mush"]))
var/min_mush = belly_data["min_mush"]
new_belly.min_mush = CLAMP(min_mush, 0, 100)
if(isnum(belly_data["liquid_overlay"]))
var/new_liquid_overlay = belly_data["liquid_overlay"]
if(new_liquid_overlay == 0)
new_belly.liquid_overlay = FALSE
if(new_liquid_overlay == 1)
new_belly.liquid_overlay = TRUE
if(isnum(belly_data["mush_overlay"]))
var/new_mush_overlay = belly_data["mush_overlay"]
if(new_mush_overlay == 0)
new_belly.mush_overlay = FALSE
if(new_mush_overlay == 1)
new_belly.mush_overlay = TRUE
// Liquid Messages
if(isnum(belly_data["show_fullness_messages"]))
var/new_show_fullness_messages = belly_data["show_fullness_messages"]
@@ -1718,6 +1768,7 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
var/mob/living/datarget = target
if(datarget.client)
available_options += "Process"
available_options += "Health"
intent = tgui_input_list(user, "What would you like to do with [target]?", "Vore Pick", available_options)
switch(intent)
if("Examine")
@@ -1946,6 +1997,10 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
H.reload_fullscreen()
MMI.body_backup = null
return TRUE
if("Health")
var/mob/living/ourtarget = target
to_chat(user, "<span class='notice'>Current health reading for \The [ourtarget]: [ourtarget.health] / [ourtarget.maxHealth] </span>")
return TRUE
//CHOMPEdit End
if("Process")
var/mob/living/ourtarget = target
@@ -2924,6 +2979,67 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
return FALSE
host.vore_selected.reagent_mode_flags ^= host.vore_selected.reagent_mode_flag_list[reagent_toggle_addon]
. = TRUE
if("b_liquid_overlay")
if(!host.vore_selected.liquid_overlay)
host.vore_selected.liquid_overlay = 1
to_chat(usr,"<span class='warning'>Your [lowertext(host.vore_selected.name)] now has liquid overlay enabled.</span>")
else
host.vore_selected.liquid_overlay = 0
to_chat(usr,"<span class='warning'>Your [lowertext(host.vore_selected.name)] no longer has liquid overlay enabled.</span>")
. = TRUE
if("b_custom_reagentcolor")
var/newcolor = input(usr, "Choose custom color for liquid overlay. Cancel for normal reagent color.", "", host.vore_selected.custom_reagentcolor) as color|null
if(newcolor)
host.vore_selected.custom_reagentcolor = newcolor
else
host.vore_selected.custom_reagentcolor = null
host.vore_selected.update_internal_overlay()
. = TRUE
if("b_custom_reagentalpha")
var/newalpha = tgui_input_number(usr, "Set alpha transparency between 0-255. Leave blank to use capacity based alpha.", "Custom Liquid Alpha",255,255,0,0,1)
if(newalpha != null)
host.vore_selected.custom_reagentalpha = newalpha
else
host.vore_selected.custom_reagentalpha = null
host.vore_selected.update_internal_overlay()
. = TRUE
if("b_mush_overlay")
if(!host.vore_selected.mush_overlay)
host.vore_selected.mush_overlay = 1
to_chat(usr,"<span class='warning'>Your [lowertext(host.vore_selected.name)] now has fullness overlay enabled.</span>")
else
host.vore_selected.mush_overlay = 0
to_chat(usr,"<span class='warning'>Your [lowertext(host.vore_selected.name)] no longer has fullness overlay enabled.</span>")
host.vore_selected.update_internal_overlay()
. = TRUE
if("b_mush_color")
var/newcolor = input(usr, "Choose custom color for mush overlay.", "", host.vore_selected.mush_color) as color|null
if(newcolor)
host.vore_selected.mush_color = newcolor
host.vore_selected.update_internal_overlay()
. = TRUE
if("b_mush_alpha")
var/newalpha = tgui_input_number(usr, "Set alpha transparency between 0-255", "Mush Alpha",255,255,0,0,1)
if(newalpha != null)
host.vore_selected.mush_alpha = newalpha
host.vore_selected.update_internal_overlay()
. = TRUE
if("b_max_mush")
var/new_max_mush = input(user, "Choose the amount of nutrition required for full mush overlay. Ranges from 0 to 6000. Default 500.", "Set Fullness Overlay Scaling.", host.vore_selected.max_mush) as num|null
if(new_max_mush == null)
return FALSE
var/new_new_max_mush = CLAMP(new_max_mush, 0, 6000)
host.vore_selected.max_mush = new_new_max_mush
host.vore_selected.update_internal_overlay()
. = TRUE
if("b_min_mush")
var/new_min_mush = input(user, "Set custom minimum mush level. 0-100%", "Set Custom Minimum.", host.vore_selected.min_mush) as num|null
if(new_min_mush == null)
return FALSE
var/new_new_min_mush = CLAMP(new_min_mush, 0, 100)
host.vore_selected.min_mush = new_new_min_mush
host.vore_selected.update_internal_overlay()
. = TRUE
if("b_liq_purge")
var/alert = alert("Are you sure you want to delete the liquids in your [lowertext(host.vore_selected.name)]?","Confirmation","Delete","Cancel")
if(!(alert == "Delete"))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@@ -1704,6 +1704,14 @@ const VoreSelectedBellyLiquidOptions = (props, context) => {
liq_msg3,
liq_msg4,
liq_msg5,
custom_reagentcolor,
custom_reagentalpha,
liquid_overlay,
mush_overlay,
mush_color,
mush_alpha,
max_mush,
min_mush,
} = belly;
return (
@@ -1814,6 +1822,82 @@ const VoreSelectedBellyLiquidOptions = (props, context) => {
icon="plus"
/>
</LabeledList.Item>
<LabeledList.Item label="Custom Liquid Color">
<LiquidColorInput
action_name="b_custom_reagentcolor"
value_of={null}
back_color={liq_interacts.custom_reagentcolor}
name_of="Custom Liquid Color"
/>
</LabeledList.Item>
<LabeledList.Item label="Liquid Overlay">
<Button
onClick={() =>
act('liq_set_attribute', { liq_attribute: 'b_liquid_overlay' })
}
icon={liq_interacts.liquid_overlay ? 'toggle-on' : 'toggle-off'}
selected={liq_interacts.liquid_overlay}
content={liq_interacts.liquid_overlay ? 'On' : 'Off'}
/>
</LabeledList.Item>
<LabeledList.Item label="Custom Liquid Alpha">
<Button
onClick={() =>
act('liq_set_attribute', {
liq_attribute: 'b_custom_reagentalpha',
})
}
content={liq_interacts.custom_reagentalpha}
/>
</LabeledList.Item>
<LabeledList.Item label="Fullness Overlay">
<Button
onClick={() =>
act('liq_set_attribute', { liq_attribute: 'b_mush_overlay' })
}
icon={liq_interacts.mush_overlay ? 'toggle-on' : 'toggle-off'}
selected={liq_interacts.mush_overlay}
content={liq_interacts.mush_overlay ? 'On' : 'Off'}
/>
</LabeledList.Item>
<LabeledList.Item label="Mush Overlay Color">
<LiquidColorInput
action_name="b_mush_color"
value_of={null}
back_color={liq_interacts.mush_color}
name_of="Custom Mush Color"
/>
</LabeledList.Item>
<LabeledList.Item label="Mush Overlay Alpha">
<Button
onClick={() =>
act('liq_set_attribute', {
liq_attribute: 'b_mush_alpha',
})
}
content={liq_interacts.mush_alpha}
/>
</LabeledList.Item>
<LabeledList.Item label="Mush Overlay Scaling">
<Button
onClick={() =>
act('liq_set_attribute', {
liq_attribute: 'b_max_mush',
})
}
content={liq_interacts.max_mush}
/>
</LabeledList.Item>
<LabeledList.Item label="Minimum Mush Level">
<Button
onClick={() =>
act('liq_set_attribute', {
liq_attribute: 'b_min_mush',
})
}
content={liq_interacts.min_mush + '%'}
/>
</LabeledList.Item>
<LabeledList.Item label="Purge Liquids">
<Button
color="red"
@@ -2649,3 +2733,31 @@ const FeatureColorInput = (props, context) => {
</Button>
);
};
const LiquidColorInput = (props, context) => {
const { act } = useBackend(context);
const { action_name, value_of, back_color, name_of } = props;
return (
<Button
onClick={() => {
act('liq_set_attribute', { liq_attribute: action_name, val: value_of });
}}>
<Stack align="center" fill>
<Stack.Item>
<Box
style={{
background: back_color.startsWith('#')
? back_color
: `#${back_color}`,
border: '2px solid white',
'box-sizing': 'content-box',
height: '11px',
width: '11px',
}}
/>
</Stack.Item>
<Stack.Item>Change {name_of}</Stack.Item>
</Stack>
</Button>
);
};

File diff suppressed because one or more lines are too long