Polish wired extra and trigger editors

This commit is contained in:
Lorenzune
2026-03-24 02:11:54 +01:00
parent 3e20f65f3a
commit bf05948e86
8 changed files with 109 additions and 16 deletions
+2
View File
@@ -29,6 +29,8 @@
"wiredfurni.params.anim_time.title": "Durata animazione movimento",
"wiredfurni.params.anim_time.description": "Regola la velocita dello slide per i Wired che spostano utenti e furni.",
"wiredfurni.params.anim_time.value": "%ms% ms",
"wiredfurni.params.pickamount": "Seleziona %picks% effetti",
"wiredfurni.params.skipactions": "Evita gli effetti delle ultime %skips% esecuzioni.",
"wiredfurni.params.mov_no_animation.title": "Animazione movimento",
"wiredfurni.params.mov_no_animation.description": "Questo extra disattiva lo slide per i Wired che spostano utenti e furni.",
"wiredfurni.params.select_options": "Seleziona opzioni:",
+2
View File
@@ -60,4 +60,6 @@ export class WiredActionLayoutCode
public static MOVE_NO_ANIMATION_EXTRA: number = 59;
public static ANIMATION_TIME_EXTRA: number = 60;
public static MOVE_PHYSICS_EXTRA: number = 61;
public static UNSEEN_EXTRA: number = 62;
public static RANDOM_EXTRA: number = 63;
}
@@ -56,6 +56,8 @@ import { WiredExtraAnimationTimeView } from '../extras/WiredExtraAnimationTimeVi
import { WiredExtraMoveCarryUsersView } from '../extras/WiredExtraMoveCarryUsersView';
import { WiredExtraMoveNoAnimationView } from '../extras/WiredExtraMoveNoAnimationView';
import { WiredExtraMovePhysicsView } from '../extras/WiredExtraMovePhysicsView';
import { WiredExtraRandomView } from '../extras/WiredExtraRandomView';
import { WiredExtraUnseenView } from '../extras/WiredExtraUnseenView';
export const WiredActionLayoutView = (code: number) =>
{
@@ -177,6 +179,10 @@ export const WiredActionLayoutView = (code: number) =>
return <WiredExtraAnimationTimeView />;
case WiredActionLayoutCode.MOVE_PHYSICS_EXTRA:
return <WiredExtraMovePhysicsView />;
case WiredActionLayoutCode.UNSEEN_EXTRA:
return <WiredExtraUnseenView />;
case WiredActionLayoutCode.RANDOM_EXTRA:
return <WiredExtraRandomView />;
case WiredActionLayoutCode.SEND_SIGNAL:
return <WiredActionSendSignalView />;
}
@@ -1,5 +1,5 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { WiredFurniType } from '../../../../api';
import { Slider, Text } from '../../../../common';
import { useWired } from '../../../../hooks';
import { WiredExtraBaseView } from './WiredExtraBaseView';
@@ -37,9 +37,7 @@ export const WiredExtraAnimationTimeView: FC<{}> = () =>
return (
<WiredExtraBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save } cardStyle={ { width: 380 } }>
<div className="flex flex-col gap-2">
<Text bold>{ LocalizeText('wiredfurni.params.anim_time.title') }</Text>
<Text>{ LocalizeText('wiredfurni.params.anim_time.description') }</Text>
<Text bold>{ LocalizeText('wiredfurni.params.anim_time.value', [ 'ms' ], [ duration.toString() ]) }</Text>
<Text bold>{ duration } ms</Text>
<Slider min={ MIN_DURATION } max={ MAX_DURATION } step={ STEP_DURATION } value={ duration } onChange={ value => setDuration(normalizeDuration(Array.isArray(value) ? value[0] : Number(value))) } />
</div>
</WiredExtraBaseView>
@@ -1,6 +1,5 @@
import { FC } from 'react';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Text } from '../../../../common';
import { WiredFurniType } from '../../../../api';
import { useWired } from '../../../../hooks';
import { WiredExtraBaseView } from './WiredExtraBaseView';
@@ -14,12 +13,5 @@ export const WiredExtraMoveNoAnimationView: FC<{}> = () =>
setStringParam('');
};
return (
<WiredExtraBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save } cardStyle={ { width: 360 } }>
<div className="flex flex-col gap-1">
<Text bold>{ LocalizeText('wiredfurni.params.mov_no_animation.title') }</Text>
<Text>{ LocalizeText('wiredfurni.params.mov_no_animation.description') }</Text>
</div>
</WiredExtraBaseView>
);
return <WiredExtraBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save } cardStyle={ { width: 320 } } />;
};
@@ -0,0 +1,71 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Slider, Text } from '../../../../common';
import { useWired } from '../../../../hooks';
import { WiredExtraBaseView } from './WiredExtraBaseView';
const MIN_PICK_AMOUNT = 1;
const MIN_SKIP_EXECUTIONS = 0;
const MAX_RANDOM_VALUE = 1000;
const normalizePickAmount = (value: number) =>
{
if(isNaN(value)) return MIN_PICK_AMOUNT;
return Math.max(MIN_PICK_AMOUNT, Math.min(MAX_RANDOM_VALUE, Math.floor(value)));
};
const normalizeSkipExecutions = (value: number) =>
{
if(isNaN(value)) return MIN_SKIP_EXECUTIONS;
return Math.max(MIN_SKIP_EXECUTIONS, Math.min(MAX_RANDOM_VALUE, Math.floor(value)));
};
export const WiredExtraRandomView: FC<{}> = () =>
{
const { trigger = null, setIntParams = null, setStringParam = null } = useWired();
const [ pickAmount, setPickAmount ] = useState(MIN_PICK_AMOUNT);
const [ skipExecutions, setSkipExecutions ] = useState(MIN_SKIP_EXECUTIONS);
useEffect(() =>
{
if(!trigger) return;
setPickAmount(normalizePickAmount((trigger.intData.length > 0) ? trigger.intData[0] : MIN_PICK_AMOUNT));
setSkipExecutions(normalizeSkipExecutions((trigger.intData.length > 1) ? trigger.intData[1] : MIN_SKIP_EXECUTIONS));
}, [ trigger ]);
const save = () =>
{
setIntParams([ normalizePickAmount(pickAmount), normalizeSkipExecutions(skipExecutions) ]);
setStringParam('');
};
return (
<WiredExtraBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save } cardStyle={ { width: 380 } }>
<div className="flex flex-col gap-2">
<div className="flex flex-col gap-1">
<Text>{ LocalizeText('wiredfurni.params.pickamount', [ 'picks' ], [ pickAmount.toString() ]) }</Text>
<Slider
max={ MAX_RANDOM_VALUE }
min={ MIN_PICK_AMOUNT }
step={ 1 }
value={ pickAmount }
onChange={ value => setPickAmount(normalizePickAmount(Array.isArray(value) ? value[0] : Number(value))) } />
<Text small>{ pickAmount }</Text>
</div>
<div className="flex flex-col gap-1">
<Text>{ LocalizeText('wiredfurni.params.skipactions', [ 'skips' ], [ skipExecutions.toString() ]) }</Text>
<Slider
max={ MAX_RANDOM_VALUE }
min={ MIN_SKIP_EXECUTIONS }
step={ 1 }
value={ skipExecutions }
onChange={ value => setSkipExecutions(normalizeSkipExecutions(Array.isArray(value) ? value[0] : Number(value))) } />
<Text small>{ skipExecutions }</Text>
</div>
</div>
</WiredExtraBaseView>
);
};
@@ -0,0 +1,17 @@
import { FC } from 'react';
import { WiredFurniType } from '../../../../api';
import { useWired } from '../../../../hooks';
import { WiredExtraBaseView } from './WiredExtraBaseView';
export const WiredExtraUnseenView: FC<{}> = () =>
{
const { setIntParams = null, setStringParam = null } = useWired();
const save = () =>
{
setIntParams([]);
setStringParam('');
};
return <WiredExtraBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save } cardStyle={ { width: 320 } } />;
};
@@ -16,10 +16,11 @@ export const WiredTriggerAvatarSaysSomethingView: FC<{}> = () =>
const [ hideMessage, setHideMessage ] = useState(false);
const [ ownerOnly, setOwnerOnly ] = useState(false);
const { trigger = null, setStringParam = null, setIntParams = null } = useWired();
const isAnyTextMode = (matchMode === MATCH_ALL);
const save = () =>
{
setStringParam(message);
setStringParam(isAnyTextMode ? '' : message);
setIntParams([
matchMode,
hideMessage ? 1 : 0,
@@ -39,7 +40,11 @@ export const WiredTriggerAvatarSaysSomethingView: FC<{}> = () =>
<WiredTriggerBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
<div className="flex flex-col gap-1">
<Text bold>{ LocalizeText('wiredfurni.params.whatissaid') }</Text>
<NitroInput type="text" value={ message } onChange={ event => setMessage(event.target.value) } />
<NitroInput
disabled={ isAnyTextMode }
type="text"
value={ isAnyTextMode ? '' : message }
onChange={ event => setMessage(event.target.value) } />
</div>
<div className="flex flex-col gap-1">
<div className="flex items-center gap-1">