@zerospacegg/iolin
Version:
Pure TypeScript implementation of ZeroSpace game data processing (PKL-free)
55 lines • 1.6 kB
JavaScript
/**
* Turret - Child entity class for defensive turret systems
* Turrets are child entities that attach to buildings/units for defense
*/
import { Child } from "./child.js";
/**
* Turret class for defensive systems that attach to entities
* Extends Child since turrets are child entities, not abilities
*/
export class Turret extends Child {
constructor(props = {}) {
super();
this.name = "";
this.description = "";
this.unlocked = true;
this.type = "turret";
// Turret-specific properties
this.subtype = "turret"; // e.g., "building-turret", "unit-turret"
Object.assign(this, props);
}
/** JSON.stringify() calls this automatically */
toJSON() {
return {
...super.toJSON(),
name: this.name,
description: this.description,
unlocked: this.unlocked,
subtype: this.subtype,
hexiteCost: this.hexiteCost,
fluxCost: this.fluxCost,
buildTime: this.buildTime,
hp: this.hp,
unlocks: this.unlocks,
};
}
}
/**
* Building Turret - Specialized turret for building defense
*/
export class BuildingTurret extends Turret {
constructor(props = {}) {
super(props);
this.subtype = "building-turret";
}
}
/**
* Unit Turret - Specialized turret for unit add-ons (like Dreadnought modules)
*/
export class UnitTurret extends Turret {
constructor(props = {}) {
super(props);
this.subtype = "unit-turret";
}
}
//# sourceMappingURL=turret.js.map