UNPKG

@zerospacegg/iolin

Version:

Pure TypeScript implementation of ZeroSpace game data processing (PKL-free)

33 lines 1.29 kB
/** * Universal - Minimal base class for all game objects * Provides core identity properties that both entities and children need */ export class Universal { constructor() { // Unlock system properties - every entity can participate in unlock relationships this.unlocked = true; // Whether this entity is currently unlocked (default unlocked) this.unlockedBy = []; // What entities this unlocks (what this enables) } /** Runtime class name hierarchy for frontend dynamic imports */ get className() { const hierarchy = []; let currentConstructor = this.constructor; // Walk up the prototype chain until we hit Universal while (currentConstructor) { hierarchy.push(currentConstructor.name); if (currentConstructor.name === "Universal") break; currentConstructor = Object.getPrototypeOf(currentConstructor); } return hierarchy; } /** First class name for backward compatibility */ get firstClassName() { return this.constructor.name; } /** Canonical URL path for this entity on zerospace.gg */ get zsggPath() { return `https://zerospace.gg/library/${this.id}/`; } } //# sourceMappingURL=universal.js.map