File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/isaacscript-common/src/classes/features/other Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,10 @@ import { CUSTOM_FLOOR_STAGE } from "./customStages/constants";
5959
6060const DEBUG = false as boolean ;
6161
62- /** This also applies to crawl spaces. The value was determined through trial and error. */
62+ /**
63+ * This also applies to crawl spaces. The value was determined through trial and error to match
64+ * vanilla behavior.
65+ */
6366const TRAPDOOR_OPEN_DISTANCE = 60 ;
6467
6568const TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = TRAPDOOR_OPEN_DISTANCE * 2.5 ;
@@ -415,6 +418,15 @@ export class CustomTrapdoors extends Feature {
415418 ) : void {
416419 /** By default, trapdoors will never close if they are already open. */
417420 if ( trapdoorDescription . open ) {
421+ // Sometimes, the `sprite.Play(TrapdoorAnimation.OPEN_ANIMATION, true)` function does not take
422+ // effect. Check for this case.
423+ const sprite = gridEntity . GetSprite ( ) ;
424+ const animation = sprite . GetAnimation ( ) ;
425+ // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
426+ if ( animation === TrapdoorAnimation . CLOSED ) {
427+ // Try it again.
428+ sprite . Play ( TrapdoorAnimation . OPEN_ANIMATION , true ) ;
429+ }
418430 return ;
419431 }
420432
You can’t perform that action at this time.
0 commit comments