/**
 * Prop — a static world object (tree, rock, apple, …). Same Content lineage as
 * creatures, but with no update() so the tick loop leaves it be. The renderer
 * draws it by `kind`. These are the start of the "library of things"; later,
 * any of them is editable/spawnable in-world (mesh + behavior) via author().
 */
'use strict';

class Prop {
  /** @param {{id:string, kind:string, x:number, y:number, z:number, scale?:number, rot?:number, floors?:number, variant?:number}} o */
  constructor(o) {
    this.id = o.id;
    this.kind = o.kind;
    this.x = o.x;
    this.y = o.y;
    this.z = o.z;
    this.scale = o.scale != null ? o.scale : 1;
    this.rot = o.rot != null ? o.rot : 0;
    // Optional, kind-specific decoration (buildings: story count; cars/signs/
    // shopfronts: a palette index) — most kinds never set these.
    if (o.floors != null) this.floors = o.floors;
    if (o.variant != null) this.variant = o.variant;
  }
  // no update() → static (world.step skips entities without one)
  serialize() {
    const s = { id: this.id, kind: this.kind, pose: { x: this.x, y: this.y, z: this.z, rot: this.rot }, scale: this.scale };
    if (this.floors != null) s.floors = this.floors;
    if (this.variant != null) s.variant = this.variant;
    return s;
  }
}

module.exports = { Prop };
