UNPKG

arx-level-generator

Version:
94 lines 2.72 kB
import { Entity } from '../../Entity.js'; import { UseMesh } from '../../scripting/commands/UseMesh.js'; import { Variable } from '../../scripting/properties/Variable.js'; export class Door extends Entity { propIsOpen; propIsUnlocked; propLockpickability; constructor(props) { super(props); this.withScript(); this.propIsOpen = new Variable('bool', 'open', props.isOpen ?? false); this.propIsUnlocked = new Variable('bool', 'unlock', !(props.isLocked ?? false)); this.propLockpickability = new Variable('int', 'lockpickability', props.lockpickDifficulty ?? 100); this.script?.properties.push(this.propIsOpen, this.propIsUnlocked, this.propLockpickability); } get isOpen() { return this.propIsOpen.value; } set isOpen(value) { this.propIsOpen.value = value; } get isLocked() { return !this.propIsUnlocked.value; } set isLocked(value) { this.propIsUnlocked.value = !value; } get lockpickDifficulty() { return this.propLockpickability.value; } set lockpickDifficulty(value) { this.propLockpickability.value = value; } } export class Portcullis extends Door { constructor(props = {}) { super({ src: 'fix_inter/porticullis', ...props, }); } } /** * 150 wide / 220 high */ export class LightDoor extends Door { propType; propKey; constructor(props = {}) { super({ src: 'fix_inter/light_door', ...props, }); this.propType = new Variable('string', 'type', 'light_door'); this.propKey = new Variable('string', 'key', 'none'); this.script?.properties.push(this.propType, this.propKey); } setKey(key) { this.propKey.value = key.ref; } removeKey() { this.propKey.value = 'none'; } } /** * 150 wide / 200 high */ export class CatacombHeavyDoor extends LightDoor { constructor(props = {}) { super(props); this.propType.value = 'door_catacomb_heavy'; this.script?.on('load', new UseMesh('door_catacomb_heavy/door_catacomb_heavy.teo')); } } /** * 150 wide / 250 high */ export class YlsideDoor extends LightDoor { constructor(props = {}) { super(props); this.propType.value = 'door_ylsides'; this.script?.on('load', new UseMesh('door_ylsides/door_ylsides.teo')); } } /** * ? wide / ? high */ export class GoblinVeryLightDoor extends LightDoor { constructor(props = {}) { super(props); this.script?.on('load', new UseMesh('door_goblin_light_very/door_goblin_light_very.teo')); } } //# sourceMappingURL=Door.js.map