From 728eceab65593a559c83c6822868f4c53ddf52f9 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Sat, 13 Jun 2026 16:20:59 +0200 Subject: [PATCH 1/2] fix(wired): @altitude shown 100x too large and round-trip-edited wrong `liveState.altitude` is already z*100, but the @altitude inspector rows multiplied by 100 again (showing z*10000). The edit-commit path parses the field back as `parsed / 100` (expecting z*100), so the displayed value and the edit parser disagreed: tweaking the shown number wrote a wildly wrong altitude (clamped to the 40 ceiling). Display the raw `altitude` so it round-trips with the editor. --- src/components/wired-tools/WiredCreatorToolsView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/wired-tools/WiredCreatorToolsView.tsx b/src/components/wired-tools/WiredCreatorToolsView.tsx index 2bd5cf8..e486d28 100644 --- a/src/components/wired-tools/WiredCreatorToolsView.tsx +++ b/src/components/wired-tools/WiredCreatorToolsView.tsx @@ -1181,7 +1181,7 @@ export const WiredCreatorToolsView: FC<{}> = () => { key: '@position_x', value: String(liveState?.positionX ?? 0), editable: canEditInspection }, { key: '@position_y', value: String(liveState?.positionY ?? 0), editable: canEditInspection }, { key: '@rotation', value: String(liveState?.rotation ?? 0), editable: canEditInspection }, - { key: '@altitude', value: String(Math.round((liveState?.altitude ?? 0) * 100)), editable: canEditInspection }, + { key: '@altitude', value: String(liveState?.altitude ?? 0), editable: canEditInspection }, { key: '@is_invisible', value: '0' }, ...(wallItemOffset ? [ { key: '@wallitem_offset', value: wallItemOffset, editable: canEditInspection } ] : []), { key: '@type', value: `${ selectedFurnitureData?.availableForBuildersClub ? 1 : 0 }${ selectedFurnitureData?.availableForBuildersClub ? ' (BC)' : ' (Normal)' }` }, @@ -1294,7 +1294,7 @@ export const WiredCreatorToolsView: FC<{}> = () => { key: '@position_x', value: String(liveState?.positionX ?? 0), editable: canEditSelectedUser }, { key: '@position_y', value: String(liveState?.positionY ?? 0), editable: canEditSelectedUser }, { key: '@direction', value: String(liveState?.direction ?? 0), editable: canEditSelectedUser }, - { key: '@altitude', value: String(Math.round((liveState?.altitude ?? 0) * 100)) }, + { key: '@altitude', value: String(liveState?.altitude ?? 0) }, ...((Number(selectedUser.favouriteGroupId ?? 0) > 0) ? [ { key: '@favourite_group_id', value: String(selectedUser.favouriteGroupId) } ] : []), From 742f7ee5f71c0d0d89b2ba814b98a34e8b45c9df Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Sat, 13 Jun 2026 16:53:36 +0200 Subject: [PATCH 2/2] fix(wired): date-range condition saved NaN for empty/invalid dates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The save guard `if(startDateInstance && endDateInstance)` is always true — a bad input parses to a truthy *Invalid Date*, so `getTime()/1000` wrote NaN into the int params. A never-configured furni was worse: the read effect only seeded the inputs when `intData.length >= 2`, so the first save sent `new Date('')` → NaN. Guard on `isNaN(getTime())` and seed both inputs to "now" for the empty case. --- .../WiredConditionDateRangeView.tsx | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/components/wired/views/conditions/WiredConditionDateRangeView.tsx b/src/components/wired/views/conditions/WiredConditionDateRangeView.tsx index 8eedbf3..394c931 100644 --- a/src/components/wired/views/conditions/WiredConditionDateRangeView.tsx +++ b/src/components/wired/views/conditions/WiredConditionDateRangeView.tsx @@ -13,35 +13,34 @@ export const WiredConditionDateRangeView: FC<{}> = props => const save = () => { - let startDateMili = 0; - let endDateMili = 0; - const startDateInstance = new Date(startDate); const endDateInstance = new Date(endDate); - if(startDateInstance && endDateInstance) - { - startDateMili = startDateInstance.getTime() / 1000; - endDateMili = endDateInstance.getTime() / 1000; - } + // new Date('garbage') is a truthy *Invalid Date*, not null — the old + // `if(startDateInstance && endDateInstance)` was always true, so an + // unparseable input wrote NaN as the int param. Guard on getTime(). + const startDateMili = isNaN(startDateInstance.getTime()) ? 0 : Math.floor(startDateInstance.getTime() / 1000); + const endDateMili = isNaN(endDateInstance.getTime()) ? 0 : Math.floor(endDateInstance.getTime() / 1000); setIntParams([ startDateMili, endDateMili ]); }; useEffect(() => { + // Seed both inputs (default "now") even for a never-configured furni so + // the first save can't send new Date('') → NaN. + let startDate = new Date(); + let endDate = new Date(); + if(trigger.intData.length >= 2) { - let startDate = new Date(); - let endDate = new Date(); - if(trigger.intData[0] > 0) startDate = new Date((trigger.intData[0] * 1000)); if(trigger.intData[1] > 0) endDate = new Date((trigger.intData[1] * 1000)); - - setStartDate(WiredDateToString(startDate)); - setEndDate(WiredDateToString(endDate)); } + + setStartDate(WiredDateToString(startDate)); + setEndDate(WiredDateToString(endDate)); }, [ trigger ]); return (