UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

26 lines (25 loc) 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isAllPressurePlatesPushed = isAllPressurePlatesPushed; const isaac_typescript_definitions_1 = require("isaac-typescript-definitions"); const cachedClasses_1 = require("../core/cachedClasses"); const gridEntitiesSpecific_1 = require("./gridEntitiesSpecific"); /** * Helper function to check if all of the pressure plates in the room are pushed. * * In this context, "pressure plates" refers to the grid entities that you have to press down in * order for the room to be cleared. This function ignores other types of pressure plates, such as * the ones that you press to get a reward, the ones that you press to start a Greed Mode wave, and * so on. * * Returns true if there are no pressure plates in the room. */ function isAllPressurePlatesPushed() { const room = cachedClasses_1.game.GetRoom(); const hasPressurePlates = room.HasTriggerPressurePlates(); if (!hasPressurePlates) { return true; } const pressurePlates = (0, gridEntitiesSpecific_1.getPressurePlates)(isaac_typescript_definitions_1.PressurePlateVariant.PRESSURE_PLATE); return pressurePlates.every((pressurePlate) => pressurePlate.State === isaac_typescript_definitions_1.PressurePlateState.PRESSURE_PLATE_PRESSED); }