import { _decorator, Component, Vec3 } from 'cc' import type { InteractableDef } from '../core/types' const { ccclass, property } = _decorator /** * Optional editor-placed zone marker. Runtime proximity uses SimWorld catalog; * this component is for designers to visualize radii in the editor. */ @ccclass('InteractableZone') export class InteractableZone extends Component { @property interactableId = '' @property radius = 1.5 toDef(structureId: string, kind: InteractableDef['kind'], action: string, label: string): InteractableDef { const p = this.node.worldPosition return { id: this.interactableId || this.node.name, kind, structureId, x: p.x, y: p.y, z: p.z, radius: this.radius, label, action, } } distanceTo(world: Vec3): number { return Vec3.distance(this.node.worldPosition, world) } }