isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
15 lines (14 loc) • 942 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DICE_FLOOR_TRIGGER_SQUARE_SIZE = void 0;
exports.isCloseEnoughToTriggerDiceFloor = isCloseEnoughToTriggerDiceFloor;
const math_1 = require("./math");
/** For `EntityType.EFFECT` (1000), `EffectVariant.DICE_FLOOR` (76). */
exports.DICE_FLOOR_TRIGGER_SQUARE_SIZE = 75;
/** Helper function to see if a player is close enough to activate a Dice Room floor. */
function isCloseEnoughToTriggerDiceFloor(player, diceFloor) {
// Unlike other entities, the dice floor has a rectangular hit box, not a circular one.
const topLeft = diceFloor.Position.add(Vector(-exports.DICE_FLOOR_TRIGGER_SQUARE_SIZE, -exports.DICE_FLOOR_TRIGGER_SQUARE_SIZE));
const bottomRight = diceFloor.Position.add(Vector(exports.DICE_FLOOR_TRIGGER_SQUARE_SIZE, exports.DICE_FLOOR_TRIGGER_SQUARE_SIZE));
return (0, math_1.inRectangle)(player.Position, topLeft, bottomRight);
}