UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

36 lines (35 loc) 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GridEntityRenderDetection = void 0; const isaac_typescript_definitions_1 = require("isaac-typescript-definitions"); const gridEntities_1 = require("../../../functions/gridEntities"); const Feature_1 = require("../../private/Feature"); class GridEntityRenderDetection extends Feature_1.Feature { postGridEntityRender; postGridEntityCustomRender; customGridEntities; constructor(postGridEntityRender, postGridEntityCustomRender, customGridEntities) { super(); this.callbacksUsed = [ // 2 [isaac_typescript_definitions_1.ModCallback.POST_RENDER, this.postRender], ]; this.postGridEntityRender = postGridEntityRender; this.postGridEntityCustomRender = postGridEntityCustomRender; this.customGridEntities = customGridEntities; } // ModCallback.POST_RENDER (2) postRender = () => { for (const gridEntity of (0, gridEntities_1.getGridEntities)()) { const gridIndex = gridEntity.GetGridIndex(); const gridEntityTypeCustom = this.customGridEntities.getCustomGridEntityType(gridIndex); if (gridEntityTypeCustom === undefined) { this.postGridEntityRender.fire(gridEntity); } else { this.postGridEntityCustomRender.fire(gridEntity, gridEntityTypeCustom); } } }; } exports.GridEntityRenderDetection = GridEntityRenderDetection;