Wired changes

This commit is contained in:
Bill 2023-04-29 19:24:59 -04:00
parent aba4ddf2db
commit 790450edd5
2 changed files with 12 additions and 5 deletions

View File

@ -8,7 +8,7 @@ import { WiredConditionBaseView } from './WiredConditionBaseView';
export const WiredConditionUserCountInRoomView: FC<{}> = props =>
{
const [ min, setMin ] = useState(1);
const [ max, setMax ] = useState(1);
const [ max, setMax ] = useState(0);
const { trigger = null, setIntParams = null } = useWired();
const save = () => setIntParams([ min, max ]);
@ -23,7 +23,7 @@ export const WiredConditionUserCountInRoomView: FC<{}> = props =>
else
{
setMin(1);
setMax(1);
setMax(0);
}
}, [ trigger ]);
@ -42,8 +42,8 @@ export const WiredConditionUserCountInRoomView: FC<{}> = props =>
<Text bold>{ LocalizeText('wiredfurni.params.usercountmax', [ 'value' ], [ max.toString() ]) }</Text>
<ReactSlider
className={ 'nitro-slider' }
min={ 1 }
max={ 50 }
min={ 0 }
max={ 125 }
value={ max }
onChange={ event => setMax(event) } />
</Column>

View File

@ -1,4 +1,4 @@
import { ConditionDefinition, Triggerable, TriggerDefinition, UpdateActionMessageComposer, UpdateConditionMessageComposer, UpdateTriggerMessageComposer, WiredActionDefinition, WiredFurniActionEvent, WiredFurniConditionEvent, WiredFurniTriggerEvent, WiredSaveSuccessEvent } from '@nitrots/nitro-renderer';
import { ConditionDefinition, OpenMessageComposer, Triggerable, TriggerDefinition, UpdateActionMessageComposer, UpdateConditionMessageComposer, UpdateTriggerMessageComposer, WiredActionDefinition, WiredFurniActionEvent, WiredFurniConditionEvent, WiredFurniTriggerEvent, WiredOpenEvent, WiredSaveSuccessEvent } from '@nitrots/nitro-renderer';
import { useEffect, useState } from 'react';
import { useBetween } from 'use-between';
import { IsOwnerOfFloorFurniture, LocalizeText, SendMessageComposer, WiredFurniType, WiredSelectionVisualizer } from '../../api';
@ -80,6 +80,13 @@ const useWiredState = () =>
});
}
useMessageEvent<WiredOpenEvent>(WiredOpenEvent, event =>
{
const parser = event.getParser();
SendMessageComposer(new OpenMessageComposer(parser.stuffId));
});
useMessageEvent<WiredSaveSuccessEvent>(WiredSaveSuccessEvent, event =>
{
const parser = event.getParser();