Add Shift+O fallback tooltips for inspect fields

This commit is contained in:
Jage9
2026-02-21 21:03:18 -05:00
parent e2145a401f
commit 05b68b966e
2 changed files with 21 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
// Maintainer-controlled web client version.
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
window.CHGRID_WEB_VERSION = "2026.02.21 R124";
window.CHGRID_WEB_VERSION = "2026.02.21 R125";
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
window.CHGRID_TIME_ZONE = "America/Detroit";

View File

@@ -754,11 +754,29 @@ function inferItemPropertyValueType(item: WorldItem, key: string): string | unde
return 'text';
}
function getFallbackInspectPropertyTooltip(key: string): string | undefined {
if (key === 'type') return 'The item type identifier.';
if (key === 'x') return 'X coordinate on the grid.';
if (key === 'y') return 'Y coordinate on the grid.';
if (key === 'carrierId') return 'Current carrier user id, or none when on the ground.';
if (key === 'version') return 'Server version for this item, incremented after each update.';
if (key === 'createdBy') return 'User id of who created this item.';
if (key === 'createdAt') return 'Timestamp when this item was created.';
if (key === 'updatedAt') return 'Timestamp when this item was last updated.';
if (key === 'capabilities') return 'Server-declared actions supported by this item.';
if (key === 'useSound') return 'One-shot sound played when use succeeds.';
if (key === 'emitSound') return 'Looping emitted sound source for this item.';
if (key === 'useCooldownMs') return 'Global cooldown in milliseconds between uses.';
if (key === 'directional') return 'Whether emitted audio favors item facing direction.';
return undefined;
}
function describeItemPropertyHelp(item: WorldItem, key: string): string {
const metadata = getItemPropertyMetadata(item.type, key);
const parts: string[] = [];
if (metadata?.tooltip) {
parts.push(metadata.tooltip);
const tooltip = metadata?.tooltip ?? getFallbackInspectPropertyTooltip(key);
if (tooltip) {
parts.push(tooltip);
} else {
parts.push('No tooltip available.');
}