mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 07:26:19 +00:00
Merge branch 'main' into catalog-redesign
This commit is contained in:
@@ -51,7 +51,7 @@ export const AvatarEditorFigureSetItemView: FC<{
|
||||
if(!partItem) return null;
|
||||
|
||||
return (
|
||||
<InfiniteGrid.Item itemActive={ isSelected } itemImage={ (partItem.isClear ? undefined : assetUrl) } className={ `avatar-parts mx-auto${ isSelected ? ' part-selected' : '' }` } style={ { backgroundPosition: (setType === AvatarFigurePartType.HEAD) ? 'center -35px' : 'center' } } { ...rest }>
|
||||
<InfiniteGrid.Item itemActive={ isSelected } itemImage={ (partItem.isClear ? undefined : assetUrl) } className={ `avatar-parts mx-auto${ isSelected ? ' part-selected' : '' }` } style={ (setType === AvatarFigurePartType.HEAD) ? { backgroundSize: 'cover', backgroundPosition: 'center' } : { backgroundPosition: 'center' } } { ...rest }>
|
||||
{ !partItem.isClear && isHC && <LayoutCurrencyIcon className="absolute inset-e-1 bottom-1" type="hc" /> }
|
||||
{ partItem.isClear && <AvatarEditorIcon icon="clear" /> }
|
||||
{ !partItem.isClear && partItem.partSet.isSellable && <AvatarEditorIcon className="inset-e-1 bottom-1 absolute" icon="sellable" /> }
|
||||
|
||||
@@ -11,3 +11,12 @@ export const CatalogView: FC<{}> = () =>
|
||||
|
||||
return <CatalogClassicView />;
|
||||
};
|
||||
|
||||
export const CatalogView: FC<{}> = () =>
|
||||
{
|
||||
return (
|
||||
<CatalogAdminProvider>
|
||||
<CatalogViewInner />
|
||||
</CatalogAdminProvider>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -81,9 +81,14 @@ export const WiredActionFurniToFurniView: FC<{}> = () =>
|
||||
if(mode === 'move' && !canEditMove) return;
|
||||
if(mode === 'target' && !canEditTarget) return;
|
||||
|
||||
const nextMoveIds = (selectionMode === 'move') ? [ ...furniIds ] : [ ...moveFurniIds ];
|
||||
const nextTargetIds = (selectionMode === 'target') ? [ ...furniIds ] : [ ...targetFurniIds ];
|
||||
|
||||
setMoveFurniIds(nextMoveIds);
|
||||
setTargetFurniIds(nextTargetIds);
|
||||
setSelectionMode(mode);
|
||||
setFurniIds([ ...(mode === 'move' ? moveFurniIds : targetFurniIds) ]);
|
||||
}, [ moveSource, targetSource, moveFurniIds, targetFurniIds, setFurniIds ]);
|
||||
setFurniIds([ ...(mode === 'move' ? nextMoveIds : nextTargetIds) ]);
|
||||
}, [ selectionMode, furniIds, moveSource, targetSource, moveFurniIds, targetFurniIds, setFurniIds ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@@ -153,10 +158,16 @@ export const WiredActionFurniToFurniView: FC<{}> = () =>
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
const nextMoveIds = (selectionMode === 'move') ? [ ...furniIds ] : [ ...moveFurniIds ];
|
||||
const nextTargetIds = (selectionMode === 'target') ? [ ...furniIds ] : [ ...targetFurniIds ];
|
||||
|
||||
setMoveFurniIds(nextMoveIds);
|
||||
setTargetFurniIds(nextTargetIds);
|
||||
|
||||
if(selectionMode === 'target')
|
||||
{
|
||||
setSelectionMode('move');
|
||||
setFurniIds([ ...moveFurniIds ]);
|
||||
setFurniIds([ ...nextMoveIds ]);
|
||||
}
|
||||
|
||||
setIntParams([
|
||||
@@ -164,8 +175,8 @@ export const WiredActionFurniToFurniView: FC<{}> = () =>
|
||||
targetSource
|
||||
]);
|
||||
|
||||
setStringParam(serializeIds(targetFurniIds));
|
||||
}, [ selectionMode, moveFurniIds, moveSource, targetSource, targetFurniIds, setFurniIds, setIntParams, setStringParam ]);
|
||||
setStringParam(serializeIds(nextTargetIds));
|
||||
}, [ selectionMode, furniIds, moveFurniIds, moveSource, targetSource, targetFurniIds, setFurniIds, setIntParams, setStringParam ]);
|
||||
|
||||
const selectionLimit = trigger?.maximumItemSelectionCount ?? 0;
|
||||
|
||||
|
||||
@@ -52,6 +52,10 @@ import { WiredActionToggleFurniStateView } from './WiredActionToggleFurniStateVi
|
||||
import { WiredActionUnfreezeView } from './WiredActionUnfreezeView';
|
||||
import { WiredExtraFilterFurniView } from '../extras/WiredExtraFilterFurniView';
|
||||
import { WiredExtraFilterUserView } from '../extras/WiredExtraFilterUserView';
|
||||
import { WiredExtraAnimationTimeView } from '../extras/WiredExtraAnimationTimeView';
|
||||
import { WiredExtraMoveCarryUsersView } from '../extras/WiredExtraMoveCarryUsersView';
|
||||
import { WiredExtraMoveNoAnimationView } from '../extras/WiredExtraMoveNoAnimationView';
|
||||
import { WiredExtraMovePhysicsView } from '../extras/WiredExtraMovePhysicsView';
|
||||
|
||||
export const WiredActionLayoutView = (code: number) =>
|
||||
{
|
||||
@@ -165,6 +169,14 @@ export const WiredActionLayoutView = (code: number) =>
|
||||
return <WiredExtraFilterFurniView />;
|
||||
case WiredActionLayoutCode.FILTER_USER_EXTRA:
|
||||
return <WiredExtraFilterUserView />;
|
||||
case WiredActionLayoutCode.MOVE_CARRY_USERS_EXTRA:
|
||||
return <WiredExtraMoveCarryUsersView />;
|
||||
case WiredActionLayoutCode.MOVE_NO_ANIMATION_EXTRA:
|
||||
return <WiredExtraMoveNoAnimationView />;
|
||||
case WiredActionLayoutCode.ANIMATION_TIME_EXTRA:
|
||||
return <WiredExtraAnimationTimeView />;
|
||||
case WiredActionLayoutCode.MOVE_PHYSICS_EXTRA:
|
||||
return <WiredExtraMovePhysicsView />;
|
||||
case WiredActionLayoutCode.SEND_SIGNAL:
|
||||
return <WiredActionSendSignalView />;
|
||||
}
|
||||
|
||||
@@ -115,17 +115,28 @@ export const WiredActionSendSignalView: FC<{}> = () =>
|
||||
if(mode === selectionMode) return;
|
||||
if(mode === 'furni' && furniSource !== SOURCE_SELECTED) return;
|
||||
|
||||
const nextAntennaIds = (selectionMode === 'antenna') ? [ ...furniIds ] : [ ...antennaIds ];
|
||||
const nextForwardFurniIds = (selectionMode === 'furni') ? [ ...furniIds ] : [ ...forwardFurniIds ];
|
||||
|
||||
setAntennaIds(nextAntennaIds);
|
||||
setForwardFurniIds(nextForwardFurniIds);
|
||||
setSelectionMode(mode);
|
||||
if(setFurniIds) setFurniIds([ ...((mode === 'antenna') ? antennaIds : forwardFurniIds) ]);
|
||||
}, [ selectionMode, furniSource, antennaIds, forwardFurniIds, setFurniIds ]);
|
||||
if(setFurniIds) setFurniIds([ ...((mode === 'antenna') ? nextAntennaIds : nextForwardFurniIds) ]);
|
||||
}, [ selectionMode, furniSource, furniIds, antennaIds, forwardFurniIds, setFurniIds ]);
|
||||
|
||||
const onChangeFurniSource = (next: number) =>
|
||||
{
|
||||
if(forwardFurniIds.length) setForwardFurniIds([]);
|
||||
const nextAntennaIds = (selectionMode === 'antenna') ? [ ...furniIds ] : [ ...antennaIds ];
|
||||
|
||||
setAntennaIds(nextAntennaIds);
|
||||
if(forwardFurniIds.length || selectionMode === 'furni')
|
||||
{
|
||||
setForwardFurniIds([]);
|
||||
}
|
||||
|
||||
if(selectionMode === 'furni')
|
||||
{
|
||||
if(setFurniIds) setFurniIds([ ...antennaIds ]);
|
||||
if(setFurniIds) setFurniIds([ ...nextAntennaIds ]);
|
||||
setSelectionMode('antenna');
|
||||
}
|
||||
|
||||
@@ -134,7 +145,19 @@ export const WiredActionSendSignalView: FC<{}> = () =>
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
const antennaSource = (antennaIds && antennaIds.length) ? antennaIds[0] : 0;
|
||||
const nextAntennaIds = (selectionMode === 'antenna') ? [ ...furniIds ] : [ ...antennaIds ];
|
||||
const nextForwardFurniIds = (selectionMode === 'furni') ? [ ...furniIds ] : [ ...forwardFurniIds ];
|
||||
|
||||
setAntennaIds(nextAntennaIds);
|
||||
setForwardFurniIds(nextForwardFurniIds);
|
||||
|
||||
if(selectionMode === 'furni')
|
||||
{
|
||||
setSelectionMode('antenna');
|
||||
if(setFurniIds) setFurniIds([ ...nextAntennaIds ]);
|
||||
}
|
||||
|
||||
const antennaSource = (nextAntennaIds && nextAntennaIds.length) ? nextAntennaIds[0] : 0;
|
||||
|
||||
setIntParams([
|
||||
antennaSource,
|
||||
@@ -145,8 +168,8 @@ export const WiredActionSendSignalView: FC<{}> = () =>
|
||||
0,
|
||||
]);
|
||||
|
||||
setStringParam(serializeForwardIds(forwardFurniIds));
|
||||
}, [ antennaIds, furniSource, userSource, signalPerFurni, signalPerUser, forwardFurniIds, setIntParams, setStringParam ]);
|
||||
setStringParam(serializeForwardIds(nextForwardFurniIds));
|
||||
}, [ selectionMode, furniIds, antennaIds, furniSource, userSource, signalPerFurni, signalPerUser, forwardFurniIds, setFurniIds, setIntParams, setStringParam ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
||||
@@ -85,9 +85,14 @@ export const WiredConditionFurniIsOfTypeView: FC<WiredConditionFurniIsOfTypeView
|
||||
if(mode === 'primary' && !canEditPrimary) return;
|
||||
if(mode === 'secondary' && !canEditSecondary) return;
|
||||
|
||||
const nextPrimaryIds = (selectionMode === 'primary') ? [ ...furniIds ] : [ ...primaryFurniIds ];
|
||||
const nextSecondaryIds = (selectionMode === 'secondary') ? [ ...furniIds ] : [ ...secondaryFurniIds ];
|
||||
|
||||
setPrimaryFurniIds(nextPrimaryIds);
|
||||
setSecondaryFurniIds(nextSecondaryIds);
|
||||
setSelectionMode(mode);
|
||||
setFurniIds([ ...(mode === 'primary' ? primaryFurniIds : secondaryFurniIds) ]);
|
||||
}, [ matchSource, compareSource, primaryFurniIds, secondaryFurniIds, setFurniIds ]);
|
||||
setFurniIds([ ...(mode === 'primary' ? nextPrimaryIds : nextSecondaryIds) ]);
|
||||
}, [ selectionMode, furniIds, matchSource, compareSource, primaryFurniIds, secondaryFurniIds, setFurniIds ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@@ -161,10 +166,16 @@ export const WiredConditionFurniIsOfTypeView: FC<WiredConditionFurniIsOfTypeView
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
const nextPrimaryIds = (selectionMode === 'primary') ? [ ...furniIds ] : [ ...primaryFurniIds ];
|
||||
const nextSecondaryIds = (selectionMode === 'secondary') ? [ ...furniIds ] : [ ...secondaryFurniIds ];
|
||||
|
||||
setPrimaryFurniIds(nextPrimaryIds);
|
||||
setSecondaryFurniIds(nextSecondaryIds);
|
||||
|
||||
if(selectionMode === 'secondary')
|
||||
{
|
||||
setSelectionMode('primary');
|
||||
setFurniIds([ ...primaryFurniIds ]);
|
||||
setFurniIds([ ...nextPrimaryIds ]);
|
||||
}
|
||||
|
||||
setIntParams([
|
||||
@@ -172,8 +183,8 @@ export const WiredConditionFurniIsOfTypeView: FC<WiredConditionFurniIsOfTypeView
|
||||
compareSource,
|
||||
quantifier
|
||||
]);
|
||||
setStringParam(serializeIds(secondaryFurniIds));
|
||||
}, [ selectionMode, primaryFurniIds, matchSource, compareSource, quantifier, secondaryFurniIds, setFurniIds, setIntParams, setStringParam ]);
|
||||
setStringParam(serializeIds(nextSecondaryIds));
|
||||
}, [ selectionMode, furniIds, primaryFurniIds, matchSource, compareSource, quantifier, secondaryFurniIds, setFurniIds, setIntParams, setStringParam ]);
|
||||
|
||||
const selectionLimit = trigger?.maximumItemSelectionCount ?? 0;
|
||||
const quantifierKeyPrefix = negative ? 'wiredfurni.params.quantifier.furni.neg' : 'wiredfurni.params.quantifier.furni';
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
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_DURATION = 50;
|
||||
const MAX_DURATION = 2000;
|
||||
const STEP_DURATION = 50;
|
||||
const DEFAULT_DURATION = 500;
|
||||
|
||||
const normalizeDuration = (value: number) =>
|
||||
{
|
||||
if(isNaN(value)) return DEFAULT_DURATION;
|
||||
|
||||
return Math.max(MIN_DURATION, Math.min(MAX_DURATION, Math.round(value / STEP_DURATION) * STEP_DURATION));
|
||||
};
|
||||
|
||||
export const WiredExtraAnimationTimeView: FC<{}> = () =>
|
||||
{
|
||||
const { trigger = null, setIntParams = null, setStringParam = null } = useWired();
|
||||
const [ duration, setDuration ] = useState(DEFAULT_DURATION);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(!trigger) return;
|
||||
|
||||
setDuration(normalizeDuration((trigger.intData.length > 0) ? trigger.intData[0] : DEFAULT_DURATION));
|
||||
}, [ trigger ]);
|
||||
|
||||
const save = () =>
|
||||
{
|
||||
setIntParams([ normalizeDuration(duration) ]);
|
||||
setStringParam('');
|
||||
};
|
||||
|
||||
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>
|
||||
<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>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Text } from '../../../../common';
|
||||
import { useWired } from '../../../../hooks';
|
||||
import { WiredSourceOption, WiredSourcesSelector } from '../WiredSourcesSelector';
|
||||
import { WiredExtraBaseView } from './WiredExtraBaseView';
|
||||
|
||||
const CARRY_MODE_DIRECT = 0;
|
||||
const CARRY_MODE_SAME_TILE = 1;
|
||||
const SOURCE_ALL_ROOM_USERS = 900;
|
||||
|
||||
const USER_SOURCES: WiredSourceOption[] = [
|
||||
{ value: SOURCE_ALL_ROOM_USERS, label: 'wiredfurni.params.sources.users.900' },
|
||||
{ value: 0, label: 'wiredfurni.params.sources.users.0' },
|
||||
{ value: 200, label: 'wiredfurni.params.sources.users.200' },
|
||||
{ value: 201, label: 'wiredfurni.params.sources.users.201' }
|
||||
];
|
||||
|
||||
const normalizeCarryMode = (value: number) => ((value === CARRY_MODE_SAME_TILE) ? CARRY_MODE_SAME_TILE : CARRY_MODE_DIRECT);
|
||||
const normalizeUserSource = (value: number) => (USER_SOURCES.some(option => option.value === value) ? value : 0);
|
||||
|
||||
export const WiredExtraMoveCarryUsersView: FC<{}> = () =>
|
||||
{
|
||||
const { trigger = null, setIntParams = null, setStringParam = null } = useWired();
|
||||
const [ carryMode, setCarryMode ] = useState(CARRY_MODE_DIRECT);
|
||||
const [ userSource, setUserSource ] = useState(0);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(!trigger) return;
|
||||
|
||||
setCarryMode(normalizeCarryMode((trigger.intData.length > 0) ? trigger.intData[0] : CARRY_MODE_DIRECT));
|
||||
setUserSource(normalizeUserSource((trigger.intData.length > 1) ? trigger.intData[1] : 0));
|
||||
}, [ trigger ]);
|
||||
|
||||
const save = () =>
|
||||
{
|
||||
setIntParams([ normalizeCarryMode(carryMode), normalizeUserSource(userSource) ]);
|
||||
setStringParam('');
|
||||
};
|
||||
|
||||
return (
|
||||
<WiredExtraBaseView
|
||||
hasSpecialInput={ true }
|
||||
requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE }
|
||||
save={ save }
|
||||
cardStyle={ { width: 420 } }
|
||||
footer={ <WiredSourcesSelector showUsers={ true } userSource={ userSource } userSources={ USER_SOURCES } usersTitle="wiredfurni.params.sources.users.title.carry" onChangeUsers={ value => setUserSource(normalizeUserSource(value)) } /> }>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Text bold>{ LocalizeText('wiredfurni.params.carry_mode') }</Text>
|
||||
<label className="flex items-center gap-1 cursor-pointer">
|
||||
<input checked={ (carryMode === CARRY_MODE_DIRECT) } className="form-check-input" name="wiredCarryMode" type="radio" onChange={ () => setCarryMode(CARRY_MODE_DIRECT) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.carry_mode.0') }</Text>
|
||||
</label>
|
||||
<label className="flex items-center gap-1 cursor-pointer">
|
||||
<input checked={ (carryMode === CARRY_MODE_SAME_TILE) } className="form-check-input" name="wiredCarryMode" type="radio" onChange={ () => setCarryMode(CARRY_MODE_SAME_TILE) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.carry_mode.1') }</Text>
|
||||
</label>
|
||||
</div>
|
||||
</WiredExtraBaseView>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
import { FC } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Text } from '../../../../common';
|
||||
import { useWired } from '../../../../hooks';
|
||||
import { WiredExtraBaseView } from './WiredExtraBaseView';
|
||||
|
||||
export const WiredExtraMoveNoAnimationView: 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: 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>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,120 @@
|
||||
import { FC, useEffect, useMemo, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Text } from '../../../../common';
|
||||
import { useWired } from '../../../../hooks';
|
||||
import { WiredSourceOption, WiredSourcesSelector } from '../WiredSourcesSelector';
|
||||
import { WiredExtraBaseView } from './WiredExtraBaseView';
|
||||
|
||||
const SOURCE_ALL_ROOM = 900;
|
||||
const DEFAULT_SOURCE = 0;
|
||||
|
||||
const FURNI_SOURCES: WiredSourceOption[] = [
|
||||
{ value: SOURCE_ALL_ROOM, label: 'wiredfurni.params.sources.furni.900' },
|
||||
{ value: 0, label: 'wiredfurni.params.sources.furni.0' },
|
||||
{ value: 200, label: 'wiredfurni.params.sources.furni.200' },
|
||||
{ value: 201, label: 'wiredfurni.params.sources.furni.201' }
|
||||
];
|
||||
|
||||
const USER_SOURCES: WiredSourceOption[] = [
|
||||
{ value: SOURCE_ALL_ROOM, label: 'wiredfurni.params.sources.users.900' },
|
||||
{ value: 0, label: 'wiredfurni.params.sources.users.0' },
|
||||
{ value: 200, label: 'wiredfurni.params.sources.users.200' },
|
||||
{ value: 201, label: 'wiredfurni.params.sources.users.201' }
|
||||
];
|
||||
|
||||
const normalizeSource = (value: number, options: WiredSourceOption[]) => (options.some(option => option.value === value) ? value : DEFAULT_SOURCE);
|
||||
const getFlag = (value: number) => (value === 1);
|
||||
|
||||
export const WiredExtraMovePhysicsView: FC<{}> = () =>
|
||||
{
|
||||
const { trigger = null, setIntParams = null, setStringParam = null } = useWired();
|
||||
const [ keepAltitude, setKeepAltitude ] = useState(false);
|
||||
const [ moveThroughFurni, setMoveThroughFurni ] = useState(false);
|
||||
const [ moveThroughUsers, setMoveThroughUsers ] = useState(false);
|
||||
const [ blockByFurni, setBlockByFurni ] = useState(false);
|
||||
const [ moveThroughFurniSource, setMoveThroughFurniSource ] = useState(DEFAULT_SOURCE);
|
||||
const [ blockByFurniSource, setBlockByFurniSource ] = useState(DEFAULT_SOURCE);
|
||||
const [ moveThroughUsersSource, setMoveThroughUsersSource ] = useState(DEFAULT_SOURCE);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(!trigger) return;
|
||||
|
||||
setKeepAltitude(getFlag(trigger.intData[0] ?? 0));
|
||||
setMoveThroughFurni(getFlag(trigger.intData[1] ?? 0));
|
||||
setMoveThroughUsers(getFlag(trigger.intData[2] ?? 0));
|
||||
setBlockByFurni(getFlag(trigger.intData[3] ?? 0));
|
||||
setMoveThroughFurniSource(normalizeSource((trigger.intData[4] ?? DEFAULT_SOURCE), FURNI_SOURCES));
|
||||
setBlockByFurniSource(normalizeSource((trigger.intData[5] ?? DEFAULT_SOURCE), FURNI_SOURCES));
|
||||
setMoveThroughUsersSource(normalizeSource((trigger.intData[6] ?? DEFAULT_SOURCE), USER_SOURCES));
|
||||
}, [ trigger ]);
|
||||
|
||||
const save = () =>
|
||||
{
|
||||
setIntParams([
|
||||
keepAltitude ? 1 : 0,
|
||||
moveThroughFurni ? 1 : 0,
|
||||
moveThroughUsers ? 1 : 0,
|
||||
blockByFurni ? 1 : 0,
|
||||
normalizeSource(moveThroughFurniSource, FURNI_SOURCES),
|
||||
normalizeSource(blockByFurniSource, FURNI_SOURCES),
|
||||
normalizeSource(moveThroughUsersSource, USER_SOURCES)
|
||||
]);
|
||||
setStringParam('');
|
||||
};
|
||||
|
||||
const footer = useMemo(() =>
|
||||
{
|
||||
if(!moveThroughFurni && !blockByFurni && !moveThroughUsers) return null;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-3">
|
||||
{ moveThroughFurni &&
|
||||
<WiredSourcesSelector
|
||||
showFurni={ true }
|
||||
furniSource={ moveThroughFurniSource }
|
||||
furniSources={ FURNI_SOURCES }
|
||||
furniTitle="wiredfurni.params.sources.furni.title.physics.0"
|
||||
onChangeFurni={ value => setMoveThroughFurniSource(normalizeSource(value, FURNI_SOURCES)) } /> }
|
||||
{ blockByFurni &&
|
||||
<WiredSourcesSelector
|
||||
showFurni={ true }
|
||||
furniSource={ blockByFurniSource }
|
||||
furniSources={ FURNI_SOURCES }
|
||||
furniTitle="wiredfurni.params.sources.furni.title.physics.1"
|
||||
onChangeFurni={ value => setBlockByFurniSource(normalizeSource(value, FURNI_SOURCES)) } /> }
|
||||
{ moveThroughUsers &&
|
||||
<WiredSourcesSelector
|
||||
showUsers={ true }
|
||||
userSource={ moveThroughUsersSource }
|
||||
userSources={ USER_SOURCES }
|
||||
usersTitle="wiredfurni.params.sources.users.title.physics.0"
|
||||
onChangeUsers={ value => setMoveThroughUsersSource(normalizeSource(value, USER_SOURCES)) } /> }
|
||||
</div>
|
||||
);
|
||||
}, [ blockByFurni, blockByFurniSource, moveThroughFurni, moveThroughFurniSource, moveThroughUsers, moveThroughUsersSource ]);
|
||||
|
||||
return (
|
||||
<WiredExtraBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save } cardStyle={ { width: 430 } } footer={ footer }>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Text bold>{ LocalizeText('wiredfurni.params.select_options') }</Text>
|
||||
<label className="flex items-center gap-2 cursor-pointer">
|
||||
<input checked={ keepAltitude } className="form-check-input" type="checkbox" onChange={ event => setKeepAltitude(event.target.checked) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.movephysics.keep_altitude') }</Text>
|
||||
</label>
|
||||
<label className="flex items-center gap-2 cursor-pointer">
|
||||
<input checked={ moveThroughFurni } className="form-check-input" type="checkbox" onChange={ event => setMoveThroughFurni(event.target.checked) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.movephysics.move_through_furni') }</Text>
|
||||
</label>
|
||||
<label className="flex items-center gap-2 cursor-pointer">
|
||||
<input checked={ moveThroughUsers } className="form-check-input" type="checkbox" onChange={ event => setMoveThroughUsers(event.target.checked) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.movephysics.move_through_users') }</Text>
|
||||
</label>
|
||||
<label className="flex items-center gap-2 cursor-pointer">
|
||||
<input checked={ blockByFurni } className="form-check-input" type="checkbox" onChange={ event => setBlockByFurni(event.target.checked) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.movephysics.block_by_furni') }</Text>
|
||||
</label>
|
||||
</div>
|
||||
</WiredExtraBaseView>
|
||||
);
|
||||
};
|
||||
@@ -12,7 +12,7 @@ export const WiredSelectorFurniByTypeView: FC<{}> = () =>
|
||||
const [ filterExisting, setFilterExisting ] = useState(false);
|
||||
const [ invert, setInvert ] = useState(false);
|
||||
|
||||
const { trigger = null, setIntParams, setSelectByType } = useWired();
|
||||
const { trigger = null, setIntParams } = useWired();
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@@ -24,11 +24,6 @@ export const WiredSelectorFurniByTypeView: FC<{}> = () =>
|
||||
if(p.length >= 4) setInvert(p[3] === 1);
|
||||
}, [ trigger ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
setSelectByType(true);
|
||||
}, [ setSelectByType ]);
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([
|
||||
|
||||
Reference in New Issue
Block a user