[MIRROR] Vore Panel tweaks and fixes (#8856)

Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com>
Co-authored-by: Kashargul <KashL@t-online.de>
This commit is contained in:
CHOMPStation2
2024-08-31 20:07:26 -07:00
committed by GitHub
parent 5209bc4158
commit 4c0c25c489
10 changed files with 496 additions and 374 deletions

View File

@@ -3798,7 +3798,7 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
host.vore_selected.update_internal_overlay() host.vore_selected.update_internal_overlay()
. = TRUE . = TRUE
if("b_fullscreen_alpha") if("b_fullscreen_alpha")
var/newalpha = tgui_input_number(user, "Set alpha transparency between 0-255", "Vore Alpha",255,255,0,0,1) //ChompEDIT - user, not usr var/newalpha = tgui_input_number(user, "Set alpha transparency between 0-255", "Vore Alpha",host.vore_selected.belly_fullscreen_alpha,255,0,0,1) //ChompEDIT - user, not usr
if(newalpha) if(newalpha)
host.vore_selected.belly_fullscreen_alpha = newalpha host.vore_selected.belly_fullscreen_alpha = newalpha
host.vore_selected.update_internal_overlay() host.vore_selected.update_internal_overlay()

View File

@@ -17,9 +17,9 @@ export const VoreBellySelectionAndCustomization = (props: {
const { our_bellies, selected, show_pictures, host_mobtype } = props; const { our_bellies, selected, show_pictures, host_mobtype } = props;
return ( return (
<Flex> <Flex height="83%">
<Flex.Item shrink> <Flex.Item shrink basis="30%">
<Section title="My Bellies" scrollable> <Section title="My Bellies" scrollable fill>
<Tabs vertical> <Tabs vertical>
<Tabs.Tab onClick={() => act('newbelly')}> <Tabs.Tab onClick={() => act('newbelly')}>
New New
@@ -53,7 +53,7 @@ export const VoreBellySelectionAndCustomization = (props: {
</Flex.Item> </Flex.Item>
<Flex.Item grow> <Flex.Item grow>
{selected && ( {selected && (
<Section title={selected.belly_name}> <Section title={selected.belly_name} fill scrollable>
<VoreSelectedBelly <VoreSelectedBelly
belly={selected} belly={selected}
show_pictures={show_pictures} show_pictures={show_pictures}

View File

@@ -1,5 +1,8 @@
import { useBackend } from '../../../backend'; import { ReactNode, useEffect, useState } from 'react';
import { Button, LabeledList } from '../../../components'; import { useBackend } from 'tgui/backend';
import { Box, Button, LabeledList } from 'tgui/components';
import { SYNTAX_COLOR, SYNTAX_REGEX } from '../constants';
import { selectedData } from '../types'; import { selectedData } from '../types';
import { VoreSelectedBellyDescriptionsBellymode } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsBellymode'; import { VoreSelectedBellyDescriptionsBellymode } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsBellymode';
import { VoreSelectedBellyDescriptionsEscape } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsEscape'; import { VoreSelectedBellyDescriptionsEscape } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsEscape';
@@ -8,6 +11,39 @@ import { VoreSelectedBellyDescriptionsInteractionChance } from '../VoreSelectedB
import { VoreSelectedBellyDescriptionsStruggle } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsStruggle'; import { VoreSelectedBellyDescriptionsStruggle } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsStruggle';
import { VoreSelectedBellyDescriptionsTransfer } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsTransfer'; import { VoreSelectedBellyDescriptionsTransfer } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsTransfer';
const DescriptionSyntaxHighlighting = (props: { desc: string }) => {
const { desc } = props;
const [htmlDesc, setHtmlDesc] = useState<ReactNode[]>([]);
useEffect(() => {
if (!desc || desc.length === 0) {
return;
}
let elements: ReactNode[] = [];
const regexCopy = new RegExp(SYNTAX_REGEX);
let lastIndex = 0;
let result;
while ((result = regexCopy.exec(desc)) !== null) {
elements.push(<>{desc.substring(lastIndex, result.index)}</>);
elements.push(
<Box inline color={SYNTAX_COLOR[result[0]]}>
{result[0]}
</Box>,
);
lastIndex = result.index + result[0].length;
}
elements.push(<>{desc.substring(lastIndex)}</>);
setHtmlDesc(elements);
}, [desc]);
return <Box preserveWhitespace>{htmlDesc}</Box>;
};
export const VoreSelectedBellyDescriptions = (props: { export const VoreSelectedBellyDescriptions = (props: {
belly: selectedData; belly: selectedData;
}) => { }) => {
@@ -27,31 +63,8 @@ export const VoreSelectedBellyDescriptions = (props: {
} = belly; } = belly;
return ( return (
<Box>
<LabeledList> <LabeledList>
<LabeledList.Item
label="Description"
buttons={
<Button
onClick={() => act('set_attribute', { attribute: 'b_desc' })}
icon="pen"
/>
}
>
{desc}
</LabeledList.Item>
<LabeledList.Item
label="Description (Absorbed)"
buttons={
<Button
onClick={() =>
act('set_attribute', { attribute: 'b_absorbed_desc' })
}
icon="pen"
/>
}
>
{absorbed_desc}
</LabeledList.Item>
<LabeledList.Item label="Vore Verb"> <LabeledList.Item label="Vore Verb">
<Button onClick={() => act('set_attribute', { attribute: 'b_verb' })}> <Button onClick={() => act('set_attribute', { attribute: 'b_verb' })}>
{verb} {verb}
@@ -59,7 +72,9 @@ export const VoreSelectedBellyDescriptions = (props: {
</LabeledList.Item> </LabeledList.Item>
<LabeledList.Item label="Release Verb"> <LabeledList.Item label="Release Verb">
<Button <Button
onClick={() => act('set_attribute', { attribute: 'b_release_verb' })} onClick={() =>
act('set_attribute', { attribute: 'b_release_verb' })
}
> >
{release_verb} {release_verb}
</Button> </Button>
@@ -149,5 +164,27 @@ export const VoreSelectedBellyDescriptions = (props: {
</Button> </Button>
</LabeledList.Item> </LabeledList.Item>
</LabeledList> </LabeledList>
<Box color="label" mt={1} mb={1}>
Description:{' '}
<Button
icon="pencil"
onClick={() => act('set_attribute', { attribute: 'b_desc' })}
>
Edit
</Button>
</Box>
<DescriptionSyntaxHighlighting desc={desc} />
<Box color="label" mt={2} mb={1}>
Description (Absorbed):{' '}
<Button
icon="pencil"
onClick={() => act('set_attribute', { attribute: 'b_absorbed_desc' })}
>
Edit
</Button>
</Box>
<DescriptionSyntaxHighlighting desc={absorbed_desc} />
<Box mb={2} />
</Box>
); );
}; };

View File

@@ -1,7 +1,14 @@
import { classes } from 'common/react'; import { classes } from 'common/react';
import { useBackend } from '../../../backend'; import { useBackend } from '../../../backend';
import { Box, Button, Flex, LabeledList, Section } from '../../../components'; import {
Box,
Button,
Flex,
LabeledList,
Section,
Stack,
} from '../../../components';
import { selectedData } from '../types'; import { selectedData } from '../types';
export const VoreSelectedBellyVisuals = (props: { belly: selectedData }) => { export const VoreSelectedBellyVisuals = (props: { belly: selectedData }) => {
@@ -211,13 +218,17 @@ export const VoreSelectedBellyVisuals = (props: { belly: selectedData }) => {
</Flex> </Flex>
</Section> </Section>
<Section title="Belly Fullscreens Preview and Coloring"> <Section title="Belly Fullscreens Preview and Coloring">
<Flex direction="row"> <Stack align="center">
<Stack.Item shrink>
<Box <Box
backgroundColor={belly_fullscreen_color} backgroundColor={belly_fullscreen_color}
width="20px" width="20px"
height="20px" height="20px"
/> />
</Stack.Item>
<Stack.Item grow>
<Button <Button
fluid
icon="eye-dropper" icon="eye-dropper"
onClick={() => onClick={() =>
act('set_attribute', { act('set_attribute', {
@@ -228,12 +239,17 @@ export const VoreSelectedBellyVisuals = (props: { belly: selectedData }) => {
> >
Select Primary Color Select Primary Color
</Button> </Button>
</Stack.Item>
<Stack.Item shrink>
<Box <Box
backgroundColor={belly_fullscreen_color_secondary} backgroundColor={belly_fullscreen_color_secondary}
width="20px" width="20px"
height="20px" height="20px"
/> />
</Stack.Item>
<Stack.Item grow>
<Button <Button
fluid
icon="eye-dropper" icon="eye-dropper"
onClick={() => onClick={() =>
act('set_attribute', { act('set_attribute', {
@@ -244,12 +260,17 @@ export const VoreSelectedBellyVisuals = (props: { belly: selectedData }) => {
> >
Select Secondary Color Select Secondary Color
</Button> </Button>
</Stack.Item>
<Stack.Item shrink>
<Box <Box
backgroundColor={belly_fullscreen_color_trinary} backgroundColor={belly_fullscreen_color_trinary}
width="20px" width="20px"
height="20px" height="20px"
/> />
</Stack.Item>
<Stack.Item grow>
<Button <Button
fluid
icon="eye-dropper" icon="eye-dropper"
onClick={() => onClick={() =>
act('set_attribute', { act('set_attribute', {
@@ -260,6 +281,10 @@ export const VoreSelectedBellyVisuals = (props: { belly: selectedData }) => {
> >
Select Trinary Color Select Trinary Color
</Button> </Button>
</Stack.Item>
</Stack>
<Box mt={1}>
<LabeledList>
<LabeledList.Item label="Enable Coloration"> <LabeledList.Item label="Enable Coloration">
<Button <Button
onClick={() => onClick={() =>
@@ -289,7 +314,8 @@ export const VoreSelectedBellyVisuals = (props: { belly: selectedData }) => {
Clear Clear
</Button> </Button>
</LabeledList.Item> </LabeledList.Item>
</Flex> </LabeledList>
</Box>
</Section> </Section>
<Section> <Section>
<Section title="Vore FX"> <Section title="Vore FX">
@@ -307,7 +333,7 @@ export const VoreSelectedBellyVisuals = (props: { belly: selectedData }) => {
</LabeledList.Item> </LabeledList.Item>
</LabeledList> </LabeledList>
</Section> </Section>
<Section title="Belly Fullscreens Styles" width="800px"> <Section title="Belly Fullscreens Styles">
Belly styles: Belly styles:
<Button <Button
fluid fluid

View File

@@ -27,3 +27,10 @@ export const digestModeToPreyMode = {
Heal: 'being healed.', Heal: 'being healed.',
'Encase In Egg': 'being encased in an egg.', 'Encase In Egg': 'being encased in an egg.',
}; };
export const SYNTAX_REGEX = /%belly|%pred|%prey/g;
export const SYNTAX_COLOR = {
'%belly': 'average',
'%pred': 'bad',
'%prey': 'good',
};

View File

@@ -37,7 +37,7 @@ export const VorePanel = (props) => {
return ( return (
<Window width={890} height={660} theme="abstract"> <Window width={890} height={660} theme="abstract">
<Window.Content scrollable> <Window.Content>
{(data.unsaved_changes && ( {(data.unsaved_changes && (
<NoticeBox danger> <NoticeBox danger>
<Flex> <Flex>

View File

@@ -12,27 +12,30 @@ export const FeatureColorInput = (props: {
const { act } = useBackend(); const { act } = useBackend();
const { action_name, value_of, back_color, name_of } = props; const { action_name, value_of, back_color, name_of } = props;
return ( return (
<>
<Stack.Item shrink>
<Box
backgroundColor={
back_color.startsWith('#') ? back_color : `#${back_color}`
}
style={{
border: '2px solid white',
}}
width="20px"
height="20px"
/>
</Stack.Item>
<Stack.Item grow>
<Button <Button
fluid
icon="eye-dropper"
onClick={() => { onClick={() => {
act('set_attribute', { attribute: action_name, val: value_of }); act('set_attribute', { attribute: action_name, val: value_of });
}} }}
> >
<Stack align="center" fill> Change {name_of}
<Stack.Item>
<Box
style={{
background: back_color.startsWith('#')
? back_color
: `#${back_color}`,
border: '2px solid white',
boxSizing: 'content-box',
height: '11px',
width: '11px',
}}
/>
</Stack.Item>
<Stack.Item>Change {name_of}</Stack.Item>
</Stack>
</Button> </Button>
</Stack.Item>
</>
); );
}; };

View File

@@ -1,5 +1,8 @@
import { useBackend } from '../../../../backend'; import { ReactNode, useEffect, useState } from 'react';
import { Button, LabeledList } from '../../../../components'; import { useBackend } from 'tgui/backend';
import { Box, Button, LabeledList } from 'tgui/components';
import { SYNTAX_COLOR, SYNTAX_REGEX } from '../constants';
import { selectedData } from '../types'; import { selectedData } from '../types';
import { VoreSelectedBellyDescriptionsBellymode } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsBellymode'; import { VoreSelectedBellyDescriptionsBellymode } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsBellymode';
import { VoreSelectedBellyDescriptionsEscape } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsEscape'; import { VoreSelectedBellyDescriptionsEscape } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsEscape';
@@ -8,6 +11,39 @@ import { VoreSelectedBellyDescriptionsInteractionChance } from '../VoreSelectedB
import { VoreSelectedBellyDescriptionsStruggle } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsStruggle'; import { VoreSelectedBellyDescriptionsStruggle } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsStruggle';
import { VoreSelectedBellyDescriptionsTransfer } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsTransfer'; import { VoreSelectedBellyDescriptionsTransfer } from '../VoreSelectedBellyDescriptionTexts/VoreSelectedBellyDescriptionsTransfer';
const DescriptionSyntaxHighlighting = (props: { desc: string }) => {
const { desc } = props;
const [htmlDesc, setHtmlDesc] = useState<ReactNode[]>([]);
useEffect(() => {
if (!desc || desc.length === 0) {
return;
}
let elements: ReactNode[] = [];
const regexCopy = new RegExp(SYNTAX_REGEX);
let lastIndex = 0;
let result;
while ((result = regexCopy.exec(desc)) !== null) {
elements.push(<>{desc.substring(lastIndex, result.index)}</>);
elements.push(
<Box inline color={SYNTAX_COLOR[result[0]]}>
{result[0]}
</Box>,
);
lastIndex = result.index + result[0].length;
}
elements.push(<>{desc.substring(lastIndex)}</>);
setHtmlDesc(elements);
}, [desc]);
return <Box preserveWhitespace>{htmlDesc}</Box>;
};
export const VoreSelectedBellyDescriptions = (props: { export const VoreSelectedBellyDescriptions = (props: {
belly: selectedData; belly: selectedData;
}) => { }) => {
@@ -29,31 +65,29 @@ export const VoreSelectedBellyDescriptions = (props: {
} = belly; } = belly;
return ( return (
<LabeledList> <Box>
<LabeledList.Item <Box color="label" mt={1} mb={1}>
label="Description" Description:{' '}
buttons={
<Button <Button
icon="pencil"
onClick={() => act('set_attribute', { attribute: 'b_desc' })} onClick={() => act('set_attribute', { attribute: 'b_desc' })}
icon="pen"
/>
}
> >
{desc} Edit
</LabeledList.Item> </Button>
<LabeledList.Item </Box>
label="Description (Absorbed)" <DescriptionSyntaxHighlighting desc={desc} />
buttons={ <Box color="label" mt={2} mb={1}>
Description (Absorbed):{' '}
<Button <Button
onClick={() => icon="pencil"
act('set_attribute', { attribute: 'b_absorbed_desc' }) onClick={() => act('set_attribute', { attribute: 'b_absorbed_desc' })}
}
icon="pen"
/>
}
> >
{absorbed_desc} Edit
</LabeledList.Item> </Button>
</Box>
<DescriptionSyntaxHighlighting desc={absorbed_desc} />
<Box mb={2} />
<LabeledList>
<LabeledList.Item label="Vore Verb"> <LabeledList.Item label="Vore Verb">
<Button onClick={() => act('set_attribute', { attribute: 'b_verb' })}> <Button onClick={() => act('set_attribute', { attribute: 'b_verb' })}>
{verb} {verb}
@@ -61,7 +95,9 @@ export const VoreSelectedBellyDescriptions = (props: {
</LabeledList.Item> </LabeledList.Item>
<LabeledList.Item label="Release Verb"> <LabeledList.Item label="Release Verb">
<Button <Button
onClick={() => act('set_attribute', { attribute: 'b_release_verb' })} onClick={() =>
act('set_attribute', { attribute: 'b_release_verb' })
}
> >
{release_verb} {release_verb}
</Button> </Button>
@@ -159,5 +195,6 @@ export const VoreSelectedBellyDescriptions = (props: {
</Button> </Button>
</LabeledList.Item> </LabeledList.Item>
</LabeledList> </LabeledList>
</Box>
); );
}; };

View File

@@ -1,13 +1,14 @@
import { classes } from 'common/react'; import { classes } from 'common/react';
import { useBackend } from 'tgui/backend';
import { useBackend } from '../../../../backend';
import { import {
Box, Box,
Button, Button,
Flex, Flex,
LabeledList, LabeledList,
Section, Section,
} from '../../../../components'; Stack,
} from 'tgui/components';
import { FeatureColorInput } from '../FeatureColorInput'; import { FeatureColorInput } from '../FeatureColorInput';
import { selectedData } from '../types'; import { selectedData } from '../types';
@@ -254,7 +255,7 @@ export const VoreSelectedBellyVisuals = (props: { belly: selectedData }) => {
</Flex> </Flex>
</Section> </Section>
<Section title="Belly Fullscreens Preview and Coloring"> <Section title="Belly Fullscreens Preview and Coloring">
<Flex direction="row"> <Stack align="center">
<FeatureColorInput <FeatureColorInput
action_name="b_fullscreen_color" action_name="b_fullscreen_color"
value_of={null} value_of={null}
@@ -285,7 +286,9 @@ export const VoreSelectedBellyVisuals = (props: { belly: selectedData }) => {
back_color="#FFFFFF" back_color="#FFFFFF"
name_of="Alpha" name_of="Alpha"
/> />
</Flex> </Stack>
<Box mt={1}>
<LabeledList>
<LabeledList.Item label="Enable Coloration"> <LabeledList.Item label="Enable Coloration">
<Button <Button
onClick={() => onClick={() =>
@@ -315,6 +318,8 @@ export const VoreSelectedBellyVisuals = (props: { belly: selectedData }) => {
Clear Clear
</Button> </Button>
</LabeledList.Item> </LabeledList.Item>
</LabeledList>
</Box>
</Section> </Section>
<Section> <Section>
<Section title="Vore FX"> <Section title="Vore FX">

View File

@@ -49,3 +49,10 @@ export const digestModeToPreyMode = {
Heal: 'being healed.', Heal: 'being healed.',
'Encase In Egg': 'being encased in an egg.', 'Encase In Egg': 'being encased in an egg.',
}; };
export const SYNTAX_REGEX = /%belly|%pred|%prey/g;
export const SYNTAX_COLOR = {
'%belly': 'average',
'%pred': 'bad',
'%prey': 'good',
};