mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 07:26:19 +00:00
feat(wired): update source-aware furni and signal UI
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType, WiredSelectionVisualizer } from '../../../../api';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Text } from '../../../../common';
|
||||
import { useWired } from '../../../../hooks';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
@@ -30,7 +30,7 @@ export const WiredActionMoveAndRotateFurniView: FC<{}> = props =>
|
||||
{
|
||||
const [ movement, setMovement ] = useState(-1);
|
||||
const [ rotation, setRotation ] = useState(-1);
|
||||
const { trigger = null, furniIds = [], setFurniIds = null, setIntParams = null } = useWired();
|
||||
const { trigger = null, setIntParams = null } = useWired();
|
||||
const [ furniSource, setFurniSource ] = useState<number>(() =>
|
||||
{
|
||||
if(trigger?.intData?.length > 2) return trigger.intData[2];
|
||||
@@ -56,23 +56,9 @@ export const WiredActionMoveAndRotateFurniView: FC<{}> = props =>
|
||||
else setFurniSource((trigger.selectedItems?.length ?? 0) > 0 ? 100 : 0);
|
||||
}, [ trigger ]);
|
||||
|
||||
const onChangeFurniSource = (next: number) =>
|
||||
{
|
||||
if(furniIds.length && setFurniIds)
|
||||
{
|
||||
setFurniIds(prev =>
|
||||
{
|
||||
if(prev && prev.length) WiredSelectionVisualizer.clearSelectionShaderFromFurni(prev);
|
||||
return [];
|
||||
});
|
||||
}
|
||||
const onChangeFurniSource = (next: number) => setFurniSource(next);
|
||||
|
||||
setFurniSource(next);
|
||||
};
|
||||
|
||||
const requiresFurni = (furniSource === 100)
|
||||
? WiredFurniType.STUFF_SELECTION_OPTION_BY_ID_BY_TYPE_OR_FROM_CONTEXT
|
||||
: WiredFurniType.STUFF_SELECTION_OPTION_NONE;
|
||||
const requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_BY_ID_BY_TYPE_OR_FROM_CONTEXT;
|
||||
|
||||
return (
|
||||
<WiredActionBaseView
|
||||
|
||||
Reference in New Issue
Block a user